add_files

This commit is contained in:
lyon 2022-09-25 17:37:15 +08:00
parent 7ac02f7f91
commit 90f979ae0b
4 changed files with 68 additions and 19 deletions

View File

@ -9,7 +9,6 @@
#include "pika_lvgl_lv_timer_t.h"
PikaEventListener* g_pika_lv_timer_event_listener;
void __pika_timer_cb(lv_timer_t* timer) {
PikaObj* eventHandleObj = pks_eventLisener_getEventHandleObj(
g_pika_lv_timer_event_listener, (uint32_t)timer);

View File

@ -5,8 +5,8 @@
#endif
#ifdef PIKASCRIPT
#include "pika_lvgl.h"
#include "BaseObj.h"
#include "pika_lvgl.h"
#include "pika_lvgl_ALIGN.h"
#include "pika_lvgl_ANIM.h"
#include "pika_lvgl_EVENT.h"
@ -14,9 +14,9 @@
#include "pika_lvgl_PALETTE.h"
#include "pika_lvgl_STATE.h"
#include "pika_lvgl_arc.h"
#include "pika_lvgl_indev_t.h"
#include "pika_lvgl_lv_color_t.h"
#include "pika_lvgl_lv_obj.h"
#include "pika_lvgl_indev_t.h"
#include "pika_lvgl_lv_timer_t.h"
PikaObj* pika_lv_event_listener_g;
@ -165,7 +165,8 @@ PikaObj* pika_lvgl_obj(PikaObj* self, PikaObj* parent) {
return new_obj;
}
PikaObj* pika_lvgl_palette_lighten(PikaObj *self, int p, int lvl){
PikaObj* pika_lvgl_palette_lighten(PikaObj* self, int p, int lvl) {
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_color_t);
lv_color_t lv_color = lv_palette_lighten(p, lvl);
args_setStruct(new_obj->list, "lv_color_struct", lv_color);
@ -174,6 +175,15 @@ PikaObj* pika_lvgl_palette_lighten(PikaObj *self, int p, int lvl){
return new_obj;
}
PikaObj* pika_lvgl_lv_color_hex(PikaObj* self, int64_t hex) {
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_color_t);
lv_color_t lv_color = lv_color_hex(hex);
args_setStruct(new_obj->list, "lv_color_struct", lv_color);
lv_color_t* plv_color = args_getStruct(new_obj->list, "lv_color_struct");
obj_setPtr(new_obj, "lv_color", plv_color);
return new_obj;
}
PikaObj* pika_lvgl_palette_main(PikaObj* self, int p) {
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_color_t);
lv_color_t lv_color = lv_palette_main(p);
@ -183,17 +193,17 @@ PikaObj* pika_lvgl_palette_main(PikaObj* self, int p) {
return new_obj;
}
PikaObj* pika_lvgl_indev_get_act(PikaObj *self){
PikaObj* pika_lvgl_indev_get_act(PikaObj* self) {
PikaObj* new_obj = newNormalObj(New_pika_lvgl_indev_t);
lv_indev_t *lv_indev = lv_indev_get_act();
obj_setPtr(new_obj,"lv_indev", lv_indev);
lv_indev_t* lv_indev = lv_indev_get_act();
obj_setPtr(new_obj, "lv_indev", lv_indev);
return new_obj;
}
PikaObj* pika_lvgl_timer_create_basic(PikaObj *self){
PikaObj* pika_lvgl_timer_create_basic(PikaObj* self) {
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_timer_t);
lv_timer_t *lv_timer = lv_timer_create_basic();
obj_setPtr(new_obj,"lv_timer", lv_timer);
lv_timer_t* lv_timer = lv_timer_create_basic();
obj_setPtr(new_obj, "lv_timer", lv_timer);
return new_obj;
}
#endif

View File

@ -1,7 +1,9 @@
from PikaObj import *
def __init__(): ...
class EVENT:
ALL: int
PRESSED: int
@ -51,6 +53,7 @@ class EVENT:
PREPROCESS: int
def __init__(self): ...
class ALIGN:
DEFAULT: int
TOP_LEFT: int
@ -76,6 +79,7 @@ class ALIGN:
OUT_RIGHT_BOTTOM: int
def __init__(self): ...
class PALETTE:
RED: int
PINK: int
@ -99,33 +103,45 @@ class PALETTE:
NONE: int
def __init__(self): ...
class OPA:
TRANSP: int
COVER: int
def __init__(self): ...
class ANIM:
OFF: int
ON: int
def __init__(self): ...
class STATE:
def __init__(self): ...
class lv_event:
def get_code(self) -> int: ...
def get_target(self) -> lv_obj: ...
class lv_color_t: ...
class lv_color_t:
...
def lv_color_hex(hex: int64) -> lv_color_t: ...
class lv_timer_t:
def set_period(period: int): ...
def set_cb(cb: any): ...
def _del(self): ...
def palette_lighten(p: int, lvl: int) -> lv_color_t: ...
def palette_main(p: int) -> lv_color_t: ...
class style_t:
def __init__(self): ...
def init(self): ...
@ -139,11 +155,13 @@ class style_t:
def set_shadow_spread(self, s: int): ...
def set_shadow_color(self, color: lv_color_t): ...
class lv_obj:
def __init__(self, parent: lv_obj): ...
def center(self): ...
def set_size(self, size_x: int, size_y: int): ...
def align(self, align: int, x_ofs: int, y_ofs: int): ...
def set_hight(self, h: int): ...
def set_height(self, h: int): ...
def update_layout(self): ...
def set_width(self, w: int): ...
def add_state(self, state: int): ...
@ -153,15 +171,19 @@ class lv_obj:
def get_y(self) -> int: ...
def set_pos(self, x: int, y: int): ...
class indev_t:
def get_vect(self, point: point_t): ...
def obj(parent: lv_obj) -> lv_obj: ...
def indev_get_act() -> indev_t: ...
class point_t:
def __init__(self): ...
class arc(lv_obj):
MODE_NORMAL: int
MODE_SYMMETRICAL: int
@ -188,6 +210,7 @@ class arc(lv_obj):
def get_mode(self) -> int: ...
# def get_rotation(self) -> int: ...
class bar(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_value(self, value: int, anim: int): ...
@ -200,20 +223,23 @@ class bar(lv_obj):
def get_max_value(self) -> int: ...
def get_mode(self) -> int: ...
class btn(lv_obj):
def __init__(self, parent: lv_obj): ...
class checkbox(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_text(self, txt: str): ...
def set_text_static(self, txt: str): ...
def get_text(self) -> str: ...
class dropdown(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_text(self, txt: str): ...
def set_options(self, options: str): ...
def add_option(self, option: str, pos:int): ...
def add_option(self, option: str, pos: int): ...
def clear_options(self): ...
def set_selected(self, sel_opt: int): ...
def set_dir(self, dir: int): ...
@ -233,6 +259,7 @@ class dropdown(lv_obj):
def close(self): ...
def is_open(self) -> int: ...
class label(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_text(self, txt: str): ...
@ -240,24 +267,30 @@ class label(lv_obj):
def set_recolor(self, en: int): ...
def set_style_text_align(self, value: int, selector: int): ...
class roller(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_options(self, options: str, mode: int): ...
def set_visible_row_count(self, row_cnt: int): ...
class slider(lv_obj):
def __init__(self, parent: lv_obj): ...
class switch(lv_obj):
def __init__(self, parent: lv_obj): ...
class table(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_cell_value(self, row: int, col: int, txt: str): ...
class textarea(lv_obj):
def __init__(self, parent: lv_obj): ...
def set_one_line(en: int): ...
def scr_act() -> lv_obj: ...
def timer_create_basic() -> lv_timer_t: ...

View File

@ -6,15 +6,21 @@
#ifdef PIKASCRIPT
#include "pika_lvgl_lv_obj.h"
#include "BaseObj.h"
#include "dataStrs.h"
#include "pika_lvgl.h"
#include "pika_lvgl_arc.h"
#include "pika_lvgl_lv_event.h"
#include "pika_lvgl_lv_obj.h"
extern PikaObj* pika_lv_event_listener_g;
void pika_lvgl_lv_obj___init__(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_obj_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
}
void pika_lvgl_lv_obj_center(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_center(lv_obj);
@ -30,7 +36,7 @@ void pika_lvgl_lv_obj_align(PikaObj* self, int align, int x_ofs, int y_ofs) {
lv_obj_align(lv_obj, align, x_ofs, y_ofs);
}
void pika_lvgl_lv_obj_set_hight(PikaObj* self, int h) {
void pika_lvgl_lv_obj_set_height(PikaObj* self, int h) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_set_height(lv_obj, h);
}
@ -93,24 +99,25 @@ void pika_lvgl_lv_obj_add_event_cb(PikaObj* self,
eventLicener_registEvent(pika_lv_event_listener_g, (uintptr_t)lv_obj, self);
}
void pika_lvgl_lv_obj_add_style(PikaObj *self, PikaObj* style, int selector){
void pika_lvgl_lv_obj_add_style(PikaObj* self, PikaObj* style, int selector) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_style_t* lv_style = obj_getPtr(style, "lv_style");
lv_obj_add_style(lv_obj, lv_style, selector);
}
int pika_lvgl_lv_obj_get_x(PikaObj *self){
int pika_lvgl_lv_obj_get_x(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_obj_get_x(lv_obj);
}
int pika_lvgl_lv_obj_get_y(PikaObj *self){
int pika_lvgl_lv_obj_get_y(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
return lv_obj_get_y(lv_obj);
}
void pika_lvgl_lv_obj_set_pos(PikaObj *self, int x, int y){
void pika_lvgl_lv_obj_set_pos(PikaObj* self, int x, int y) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_set_pos(lv_obj, x, y);
}
#endif