add_files

This commit is contained in:
lyon 2022-09-30 14:11:10 +08:00
parent ccacb8ffe0
commit 556b3cd6eb
4 changed files with 227 additions and 12 deletions

View File

@ -10,17 +10,23 @@
#include "pika_lvgl_ALIGN.h"
#include "pika_lvgl_ANIM.h"
#include "pika_lvgl_EVENT.h"
#include "pika_lvgl_FLEX_ALIGN.h"
#include "pika_lvgl_FLEX_FLOW.h"
#include "pika_lvgl_LAYOUT_FLEX.h"
#include "pika_lvgl_SIZE.h"
#include "pika_lvgl_OPA.h"
#include "pika_lvgl_PALETTE.h"
#include "pika_lvgl_STATE.h"
#include "pika_lvgl_TEXT_DECOR.h"
#include "pika_lvgl_arc.h"
#include "pika_lvgl_flag_t.h"
#include "pika_lvgl_indev_t.h"
#include "pika_lvgl_lv_color_t.h"
#include "pika_lvgl_lv_obj.h"
#include "pika_lvgl_lv_timer_t.h"
#include "pika_lvgl_TEXT_DECOR.h"
PikaObj* pika_lv_event_listener_g;
Args* pika_lv_id_register_g;
void pika_lvgl_STATE___init__(PikaObj* self) {
obj_setInt(self, "DEFAULT", LV_STATE_DEFAULT);
@ -39,7 +45,39 @@ void pika_lvgl_STATE___init__(PikaObj* self) {
obj_setInt(self, "ANY", LV_STATE_ANY);
}
void pika_lvgl_TEXT_DECOR___init__(PikaObj *self){
void pika_lvgl_flag_t___init__(PikaObj* self) {
obj_setInt(self, "HIDDEN", LV_OBJ_FLAG_HIDDEN);
obj_setInt(self, "CLICKABLE", LV_OBJ_FLAG_CLICKABLE);
obj_setInt(self, "CLICK_FOCUSABLE", LV_OBJ_FLAG_CLICK_FOCUSABLE);
obj_setInt(self, "CHECKABLE", LV_OBJ_FLAG_CHECKABLE);
obj_setInt(self, "SCROLLABLE", LV_OBJ_FLAG_SCROLLABLE);
obj_setInt(self, "SCROLL_ELASTIC", LV_OBJ_FLAG_SCROLL_ELASTIC);
obj_setInt(self, "SCROLL_MOMENTUM", LV_OBJ_FLAG_SCROLL_MOMENTUM);
obj_setInt(self, "SCROLL_ONE", LV_OBJ_FLAG_SCROLL_ONE);
obj_setInt(self, "SCROLL_CHAIN_HOR", LV_OBJ_FLAG_SCROLL_CHAIN_HOR);
obj_setInt(self, "SCROLL_CHAIN_VER", LV_OBJ_FLAG_SCROLL_CHAIN_VER);
obj_setInt(self, "SCROLL_CHAIN", LV_OBJ_FLAG_SCROLL_CHAIN);
obj_setInt(self, "SCROLL_ON_FOCUS", LV_OBJ_FLAG_SCROLL_ON_FOCUS);
obj_setInt(self, "SCROLL_WITH_ARROW", LV_OBJ_FLAG_SCROLL_WITH_ARROW);
obj_setInt(self, "SNAPPABLE", LV_OBJ_FLAG_SNAPPABLE);
obj_setInt(self, "PRESS_LOCK", LV_OBJ_FLAG_PRESS_LOCK);
obj_setInt(self, "EVENT_BUBBLE", LV_OBJ_FLAG_EVENT_BUBBLE);
obj_setInt(self, "GESTURE_BUBBLE", LV_OBJ_FLAG_GESTURE_BUBBLE);
obj_setInt(self, "ADV_HITTEST", LV_OBJ_FLAG_ADV_HITTEST);
obj_setInt(self, "IGNORE_LAYOUT", LV_OBJ_FLAG_IGNORE_LAYOUT);
obj_setInt(self, "FLOATING", LV_OBJ_FLAG_FLOATING);
obj_setInt(self, "OVERFLOW_VISIBLE", LV_OBJ_FLAG_OVERFLOW_VISIBLE);
obj_setInt(self, "LAYOUT_1", LV_OBJ_FLAG_LAYOUT_1);
obj_setInt(self, "LAYOUT_2", LV_OBJ_FLAG_LAYOUT_2);
obj_setInt(self, "WIDGET_1", LV_OBJ_FLAG_WIDGET_1);
obj_setInt(self, "WIDGET_2", LV_OBJ_FLAG_WIDGET_2);
obj_setInt(self, "USER_1", LV_OBJ_FLAG_USER_1);
obj_setInt(self, "USER_2", LV_OBJ_FLAG_USER_2);
obj_setInt(self, "USER_3", LV_OBJ_FLAG_USER_3);
obj_setInt(self, "USER_4", LV_OBJ_FLAG_USER_4);
}
void pika_lvgl_TEXT_DECOR___init__(PikaObj* self) {
obj_setInt(self, "NONE", LV_TEXT_DECOR_NONE);
obj_setInt(self, "UNDERLINE", LV_TEXT_DECOR_UNDERLINE);
obj_setInt(self, "STRIKETHROUGH", LV_TEXT_DECOR_STRIKETHROUGH);
@ -162,17 +200,25 @@ PikaObj* pika_lvgl_scr_act(PikaObj* self) {
void pika_lvgl___init__(PikaObj* self) {
obj_newDirectObj(self, "lv_event_listener", New_TinyObj);
pika_lv_event_listener_g = obj_getObj(self, "lv_event_listener");
pika_lv_id_register_g = New_args(NULL);
}
PikaObj* pika_lvgl_obj(PikaObj* self, PikaObj* parent) {
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
lv_obj_t* lv_obj = lv_obj_create(lv_parent);
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_obj);
obj_setPtr(new_obj, "lv_obj", lv_obj);
return new_obj;
void pika_lvgl_obj___init__(PikaObj* self, PikaTuple* parent) {
PikaObj* parent_obj = NULL;
if (NULL == parent) {
void pika_lvgl_flag_tMethod(PikaObj * self, Args * args);
class_defineConstructor(self, "FLAG()", pika_lvgl_flag_tMethod);
return;
}
if (tuple_getSize(parent) == 1) {
parent_obj = tuple_getPtr(parent, 0);
lv_obj_t* lv_parent = obj_getPtr(parent_obj, "lv_obj");
lv_obj_t* lv_obj = lv_obj_create(lv_parent);
obj_setPtr(self, "lv_obj", lv_obj);
return;
}
}
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);
@ -213,4 +259,33 @@ PikaObj* pika_lvgl_timer_create_basic(PikaObj* self) {
obj_setPtr(new_obj, "lv_timer", lv_timer);
return new_obj;
}
void pika_lvgl_FLEX_FLOW___init__(PikaObj* self) {
obj_setInt(self, "ROW", LV_FLEX_FLOW_ROW);
obj_setInt(self, "COLUMN", LV_FLEX_FLOW_COLUMN);
obj_setInt(self, "ROW_WRAP", LV_FLEX_FLOW_ROW_WRAP);
obj_setInt(self, "ROW_REVERSE", LV_FLEX_FLOW_ROW_REVERSE);
obj_setInt(self, "ROW_WRAP_REVERSE", LV_FLEX_FLOW_ROW_WRAP_REVERSE);
obj_setInt(self, "COLUMN_WRAP", LV_FLEX_FLOW_COLUMN_WRAP);
obj_setInt(self, "COLUMN_REVERSE", LV_FLEX_FLOW_COLUMN_REVERSE);
obj_setInt(self, "COLUMN_WRAP_REVERSE", LV_FLEX_FLOW_COLUMN_WRAP_REVERSE);
}
void pika_lvgl_FLEX_ALIGN___init__(PikaObj* self) {
obj_setInt(self, "START", LV_FLEX_ALIGN_START);
obj_setInt(self, "END", LV_FLEX_ALIGN_END);
obj_setInt(self, "CENTER", LV_FLEX_ALIGN_CENTER);
obj_setInt(self, "SPACE_EVENLY", LV_FLEX_ALIGN_SPACE_EVENLY);
obj_setInt(self, "SPACE_AROUND", LV_FLEX_ALIGN_SPACE_AROUND);
obj_setInt(self, "SPACE_BETWEEN", LV_FLEX_ALIGN_SPACE_BETWEEN);
}
void pika_lvgl_LAYOUT_FLEX___init__(PikaObj* self) {
obj_setInt(self, "value", LV_LAYOUT_FLEX);
}
void pika_lvgl_SIZE___init__(PikaObj *self){
obj_setInt(self, "CONTENT", LV_SIZE_CONTENT);
}
#endif

View File

@ -1,4 +1,5 @@
from PikaObj import *
from tkinter import HIDDEN
from PikaObj import *
def __init__(): ...
@ -266,11 +267,69 @@ class style_t:
def set_pad_ver(self, value: int): ...
def set_pad_gap(self, value: int): ...
def prop_has_flag(self, prop: int, flag: int) -> int: ...
def set_flex_flow(self, value: int): ...
def set_flex_main_place(self, value: int): ...
def set_flex_cross_place(self, value: int): ...
def set_flex_track_place(self, value: int): ...
def set_flex_grow(self, value: int): ...
class LAYOUT_FLEX:
value: int
def __init__(self): ...
class SIZE:
CONTENT:int
def __init__(self): ...
class flag_t:
HIDDEN: int
CLICKABLE: int
CLICK_FOCUSABLE: int
CHECKABLE: int
SCROLLABLE: int
SCROLL_ELASTIC: int
SCROLL_MOMENTUM: int
SCROLL_ONE: int
SCROLL_CHAIN_HOR: int
SCROLL_CHAIN_VER: int
SCROLL_CHAIN: int
SCROLL_ON_FOCUS: int
SCROLL_WITH_ARROW: int
SNAPPABLE: int
PRESS_LOCK: int
EVENT_BUBBLE: int
GESTURE_BUBBLE: int
ADV_HITTEST: int
IGNORE_LAYOUT: int
FLOATING: int
OVERFLOW_VISIBLE: int
LAYOUT_1: int
LAYOUT_2: int
WIDGET_1: int
WIDGET_2: int
USER_1: int
USER_2: int
USER_3: int
USER_4: int
def __init__(self): ...
class FLEX_FLOW:
ROW: int
COLUMN: int
ROW_WRAP: int
ROW_REVERSE: int
ROW_WRAP_REVERSE: int
COLUMN_WRAP: int
COLUMN_REVERSE: int
COLUMN_WRAP_REVERSE: int
def __init__(self): ...
class lv_obj:
def __init__(self, parent: lv_obj): ...
def add_state(self, state: int): ...
def add_flag(self, flag:int): ...
def clear_flag(self, flag:int): ...
def add_event_cb(self, event_cb: any, filter: int, user_data: pointer): ...
def add_style(self, style: style_t, selector: int): ...
def set_pos(self, x: int, y: int): ...
@ -318,13 +377,27 @@ class lv_obj:
def set_ext_click_area(self, size: int): ...
# def get_click_area(self, area: lv_area_t): ...
def hit_test(self, point: point_t) -> int: ...
def set_flex_flow(self, flow: int): ...
def set_flex_align(self, main_place: int, cross_place: int, align: int): ...
def set_id(self, id: str): ...
def get_id(self) -> str: ...
class indev_t:
def get_vect(self, point: point_t): ...
class FLEX_ALIGN:
START: int
END: int
CENTER: int
SPACE_EVENLY: int
SPACE_AROUND: int
SPACE_BETWEEN: int
def __init__(self): ...
class obj(lv_obj):
FLAG:flag_t
def __init__(self, *parent) : ...
def obj(parent: lv_obj) -> lv_obj: ...
def indev_get_act() -> indev_t: ...

View File

@ -281,4 +281,46 @@ void pika_lvgl_lv_obj_transform_point(PikaObj* self,
lv_obj_transform_point(lv_obj, lv_point, recursive, inv);
}
void pika_lvgl_lv_obj_add_flag(PikaObj* self, int flag) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_add_flag(lv_obj, flag);
}
void pika_lvgl_lv_obj_clear_flag(PikaObj* self, int flag) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_clear_flag(lv_obj, flag);
}
void pika_lvgl_lv_obj_set_flex_align(PikaObj* self,
int main_place,
int cross_place,
int align) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_set_flex_align(lv_obj, main_place, cross_place, align);
}
void pika_lvgl_lv_obj_set_flex_flow(PikaObj* self, int flow) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
lv_obj_set_flex_flow(lv_obj, flow);
}
extern Args* pika_lv_id_register_g;
void pika_lvgl_lv_obj_set_id(PikaObj* self, char* id) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
uintptr_t id_key = (uintptr_t)lv_obj;
Arg* id_arg = arg_newStr(id);
id_arg->name_hash = (Hash)id_key;
args_setArg(pika_lv_id_register_g, id_arg);
}
char* pika_lvgl_lv_obj_get_id(PikaObj* self) {
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
uintptr_t id_key = (uintptr_t)lv_obj;
Arg* id_arg = args_getArg_hash(pika_lv_id_register_g, (Hash)id_key);
if (NULL == id_arg) {
return NULL;
}
return arg_getStr(id_arg);
}
#endif

View File

@ -472,4 +472,29 @@ void pika_lvgl_style_t_set_size(PikaObj* self, int value) {
lv_style_set_size(lv_style, value);
}
void pika_lvgl_style_t_set_flex_cross_place(PikaObj* self, int value) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_set_flex_cross_place(lv_style, value);
}
void pika_lvgl_style_t_set_flex_flow(PikaObj* self, int value) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_set_flex_flow(lv_style, value);
}
void pika_lvgl_style_t_set_flex_grow(PikaObj* self, int value) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_set_flex_grow(lv_style, value);
}
void pika_lvgl_style_t_set_flex_main_place(PikaObj* self, int value) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_set_flex_main_place(lv_style, value);
}
void pika_lvgl_style_t_set_flex_track_place(PikaObj* self, int value) {
lv_style_t* lv_style = obj_getPtr(self, "lv_style");
lv_style_set_flex_track_place(lv_style, value);
}
#endif