mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-15 17:02:53 +08:00
support keyboard wegit for lvgl
This commit is contained in:
parent
c52e180975
commit
bf917e356a
@ -435,4 +435,98 @@ PikaObj* pika_lvgl_color_white(PikaObj* self) {
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
/*
|
||||
class PART:
|
||||
MAIN: int
|
||||
SCROLLBAR: int
|
||||
INDICATOR: int
|
||||
KNOB: int
|
||||
SELECTED: int
|
||||
ITEMS: int
|
||||
TICKS: int
|
||||
CURSOR: int
|
||||
CUSTOM_FIRST: int
|
||||
ANY: int
|
||||
def __init__(self): ...
|
||||
*/
|
||||
|
||||
void pika_lvgl_PART___init__(PikaObj* self) {
|
||||
obj_setInt(self, "MAIN", LV_PART_MAIN);
|
||||
obj_setInt(self, "SCROLLBAR", LV_PART_SCROLLBAR);
|
||||
obj_setInt(self, "INDICATOR", LV_PART_INDICATOR);
|
||||
obj_setInt(self, "KNOB", LV_PART_KNOB);
|
||||
obj_setInt(self, "SELECTED", LV_PART_SELECTED);
|
||||
obj_setInt(self, "ITEMS", LV_PART_ITEMS);
|
||||
obj_setInt(self, "TICKS", LV_PART_TICKS);
|
||||
obj_setInt(self, "CURSOR", LV_PART_CURSOR);
|
||||
obj_setInt(self, "CUSTOM_FIRST", LV_PART_CUSTOM_FIRST);
|
||||
obj_setInt(self, "ANY", LV_PART_ANY);
|
||||
}
|
||||
|
||||
/*
|
||||
class CHART_TYPE:
|
||||
NONE: int
|
||||
LINE: int
|
||||
BAR: int
|
||||
SCATTER: int
|
||||
def __init__(self): ...
|
||||
*/
|
||||
|
||||
void pika_lvgl_CHART_TYPE___init__(PikaObj* self) {
|
||||
obj_setInt(self, "NONE", LV_CHART_TYPE_NONE);
|
||||
obj_setInt(self, "LINE", LV_CHART_TYPE_LINE);
|
||||
obj_setInt(self, "BAR", LV_CHART_TYPE_BAR);
|
||||
obj_setInt(self, "SCATTER", LV_CHART_TYPE_SCATTER);
|
||||
}
|
||||
|
||||
/*
|
||||
class CHART_AXIS:
|
||||
PRIMARY_Y: int
|
||||
SECONDARY_Y: int
|
||||
PRIMARY_X: int
|
||||
SECONDARY_X: int
|
||||
def __init__(self): ...
|
||||
*/
|
||||
|
||||
void pika_lvgl_CHART_AXIS___init__(PikaObj* self) {
|
||||
obj_setInt(self, "PRIMARY_Y", LV_CHART_AXIS_PRIMARY_Y);
|
||||
obj_setInt(self, "SECONDARY_Y", LV_CHART_AXIS_SECONDARY_Y);
|
||||
obj_setInt(self, "PRIMARY_X", LV_CHART_AXIS_PRIMARY_X);
|
||||
obj_setInt(self, "SECONDARY_X", LV_CHART_AXIS_SECONDARY_X);
|
||||
}
|
||||
|
||||
/*
|
||||
class CHART_UPDATE_MODE:
|
||||
SHIFT: int
|
||||
CIRCULAR: int
|
||||
def __init__(self): ...
|
||||
*/
|
||||
|
||||
void pika_lvgl_CHART_UPDATE_MODE___init__(PikaObj* self) {
|
||||
obj_setInt(self, "SHIFT", LV_CHART_UPDATE_MODE_SHIFT);
|
||||
obj_setInt(self, "CIRCULAR", LV_CHART_UPDATE_MODE_CIRCULAR);
|
||||
}
|
||||
|
||||
/*
|
||||
class CHART_DRAW_PART:
|
||||
DIV_LINE_INIT: int
|
||||
DIV_LINE_HOR: int
|
||||
DIV_LINE_VER: int
|
||||
LINE_AND_POINT: int
|
||||
BAR: int
|
||||
CURSOR: int
|
||||
TICK_LABEL: int
|
||||
def __init__(self): ...
|
||||
*/
|
||||
|
||||
void pika_lvgl_CHART_DRAW_PART___init__(PikaObj* self) {
|
||||
obj_setInt(self, "DIV_LINE_INIT", LV_CHART_DRAW_PART_DIV_LINE_INIT);
|
||||
obj_setInt(self, "DIV_LINE_HOR", LV_CHART_DRAW_PART_DIV_LINE_HOR);
|
||||
obj_setInt(self, "DIV_LINE_VER", LV_CHART_DRAW_PART_DIV_LINE_VER);
|
||||
obj_setInt(self, "LINE_AND_POINT", LV_CHART_DRAW_PART_LINE_AND_POINT);
|
||||
obj_setInt(self, "BAR", LV_CHART_DRAW_PART_BAR);
|
||||
obj_setInt(self, "CURSOR", LV_CHART_DRAW_PART_CURSOR);
|
||||
obj_setInt(self, "TICK_LABEL", LV_CHART_DRAW_PART_TICK_LABEL);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -641,10 +641,53 @@ class lv_obj:
|
||||
# def get_scroll_end(self) -> point_t: ...
|
||||
# def set_scroll_propagation(self, en: int): ...
|
||||
# def get_scroll_propagation(self) -> int: ...
|
||||
def remove_style_all(self): ...
|
||||
def move_foreground(self): ...
|
||||
def move_background(self): ...
|
||||
|
||||
|
||||
"""
|
||||
void lv_indev_read_timer_cb(lv_timer_t * timer);
|
||||
void lv_indev_enable(lv_indev_t * indev, bool en);
|
||||
lv_indev_t * lv_indev_get_act(void);
|
||||
lv_indev_type_t lv_indev_get_type(const lv_indev_t * indev);
|
||||
void lv_indev_reset(lv_indev_t * indev, lv_obj_t * obj);
|
||||
void lv_indev_reset_long_press(lv_indev_t * indev);
|
||||
void lv_indev_set_cursor(lv_indev_t * indev, lv_obj_t * cur_obj);
|
||||
void lv_indev_set_group(lv_indev_t * indev, lv_group_t * group);
|
||||
void lv_indev_set_button_points(lv_indev_t * indev, const lv_point_t points[]);
|
||||
void lv_indev_get_point(const lv_indev_t * indev, lv_point_t * point);
|
||||
lv_dir_t lv_indev_get_gesture_dir(const lv_indev_t * indev);
|
||||
uint32_t lv_indev_get_key(const lv_indev_t * indev);
|
||||
lv_dir_t lv_indev_get_scroll_dir(const lv_indev_t * indev);
|
||||
lv_obj_t * lv_indev_get_scroll_obj(const lv_indev_t * indev);
|
||||
void lv_indev_get_vect(const lv_indev_t * indev, lv_point_t * point);
|
||||
void lv_indev_wait_release(lv_indev_t * indev);
|
||||
lv_obj_t * lv_indev_get_obj_act(void);
|
||||
lv_timer_t * lv_indev_get_read_timer(lv_disp_t * indev);
|
||||
lv_obj_t * lv_indev_search_obj(lv_obj_t * obj, lv_point_t * point);
|
||||
"""
|
||||
|
||||
|
||||
class indev_t:
|
||||
def __init__(self): ...
|
||||
def enable(self, en: int): ...
|
||||
def get_type(self) -> int: ...
|
||||
def reset(self, obj: lv_obj): ...
|
||||
def reset_long_press(self): ...
|
||||
def set_cursor(self, cur_obj: lv_obj): ...
|
||||
# def set_group(self, group: lv_group): ...
|
||||
def set_button_points(self, points: point_t): ...
|
||||
def get_point(self)->point_t: ...
|
||||
def get_gesture_dir(self) -> int: ...
|
||||
def get_key(self) -> int: ...
|
||||
def get_scroll_dir(self) -> int: ...
|
||||
def get_scroll_obj(self) -> lv_obj: ...
|
||||
def get_vect(self, point: point_t): ...
|
||||
def wait_release(self): ...
|
||||
def get_obj_act(self) -> lv_obj: ...
|
||||
# def get_read_timer(self) -> lv_timer: ...
|
||||
def search_obj(self, obj: lv_obj, point: point_t) -> lv_obj: ...
|
||||
|
||||
|
||||
class FLEX_ALIGN:
|
||||
@ -657,6 +700,20 @@ class FLEX_ALIGN:
|
||||
def __init__(self): ...
|
||||
|
||||
|
||||
class PART:
|
||||
MAIN: int
|
||||
SCROLLBAR: int
|
||||
INDICATOR: int
|
||||
KNOB: int
|
||||
SELECTED: int
|
||||
ITEMS: int
|
||||
TICKS: int
|
||||
CURSOR: int
|
||||
CUSTOM_FIRST: int
|
||||
ANY: int
|
||||
def __init__(self): ...
|
||||
|
||||
|
||||
class obj(lv_obj):
|
||||
FLAG: flag_t
|
||||
def __init__(self, *parent): ...
|
||||
@ -666,6 +723,8 @@ def indev_get_act() -> indev_t: ...
|
||||
|
||||
|
||||
class point_t:
|
||||
x: int
|
||||
y: int
|
||||
def __init__(self): ...
|
||||
|
||||
|
||||
@ -853,16 +912,184 @@ class chart_series_t:
|
||||
...
|
||||
|
||||
|
||||
"""
|
||||
enum {
|
||||
LV_CHART_TYPE_NONE, /**< Don't draw the series*/
|
||||
LV_CHART_TYPE_LINE, /**< Connect the points with lines*/
|
||||
LV_CHART_TYPE_BAR, /**< Draw columns*/
|
||||
LV_CHART_TYPE_SCATTER, /**< Draw points and lines in 2D (x,y coordinates)*/
|
||||
};
|
||||
typedef uint8_t lv_chart_type_t;
|
||||
"""
|
||||
|
||||
|
||||
class CHART_TYPE:
|
||||
NONE: int
|
||||
LINE: int
|
||||
BAR: int
|
||||
SCATTER: int
|
||||
def __init__(self): ...
|
||||
|
||||
|
||||
"""
|
||||
enum {
|
||||
LV_CHART_AXIS_PRIMARY_Y = 0x00,
|
||||
LV_CHART_AXIS_SECONDARY_Y = 0x01,
|
||||
LV_CHART_AXIS_PRIMARY_X = 0x02,
|
||||
LV_CHART_AXIS_SECONDARY_X = 0x04,
|
||||
_LV_CHART_AXIS_LAST
|
||||
};
|
||||
typedef uint8_t lv_chart_axis_t;
|
||||
"""
|
||||
|
||||
|
||||
class CHART_AXIS:
|
||||
PRIMARY_Y: int
|
||||
SECONDARY_Y: int
|
||||
PRIMARY_X: int
|
||||
SECONDARY_X: int
|
||||
def __init__(self): ...
|
||||
|
||||
|
||||
"""
|
||||
enum {
|
||||
LV_CHART_UPDATE_MODE_SHIFT, /**< Shift old data to the left and add the new one the right*/
|
||||
LV_CHART_UPDATE_MODE_CIRCULAR, /**< Add the new data in a circular way*/
|
||||
};
|
||||
typedef uint8_t lv_chart_update_mode_t;
|
||||
"""
|
||||
|
||||
|
||||
class CHART_UPDATE_MODE:
|
||||
SHIFT: int
|
||||
CIRCULAR: int
|
||||
def __init__(self): ...
|
||||
|
||||
"""
|
||||
typedef enum {
|
||||
LV_CHART_DRAW_PART_DIV_LINE_INIT, /**< Used before/after drawn the div lines*/
|
||||
LV_CHART_DRAW_PART_DIV_LINE_HOR, /**< Used for each horizontal division lines*/
|
||||
LV_CHART_DRAW_PART_DIV_LINE_VER, /**< Used for each vertical division lines*/
|
||||
LV_CHART_DRAW_PART_LINE_AND_POINT, /**< Used on line and scatter charts for lines and points*/
|
||||
LV_CHART_DRAW_PART_BAR, /**< Used on bar charts for the rectangles*/
|
||||
LV_CHART_DRAW_PART_CURSOR, /**< Used on cursor lines and points*/
|
||||
LV_CHART_DRAW_PART_TICK_LABEL, /**< Used on tick lines and labels*/
|
||||
} lv_chart_draw_part_type_t;
|
||||
"""
|
||||
|
||||
|
||||
class CHART_DRAW_PART:
|
||||
DIV_LINE_INIT: int
|
||||
DIV_LINE_HOR: int
|
||||
DIV_LINE_VER: int
|
||||
LINE_AND_POINT: int
|
||||
BAR: int
|
||||
CURSOR: int
|
||||
TICK_LABEL: int
|
||||
def __init__(self): ...
|
||||
|
||||
|
||||
"""
|
||||
lv_obj_t * lv_chart_create(lv_obj_t * parent);
|
||||
void lv_chart_set_type(lv_obj_t * obj, lv_chart_type_t type);
|
||||
void lv_chart_set_point_count(lv_obj_t * obj, uint16_t cnt);
|
||||
void lv_chart_set_range(lv_obj_t * obj, lv_chart_axis_t axis, lv_coord_t min, lv_coord_t max);
|
||||
void lv_chart_set_update_mode(lv_obj_t * obj, lv_chart_update_mode_t update_mode);
|
||||
void lv_chart_set_div_line_count(lv_obj_t * obj, uint8_t hdiv, uint8_t vdiv);
|
||||
void lv_chart_set_zoom_x(lv_obj_t * obj, uint16_t zoom_x);
|
||||
void lv_chart_set_zoom_y(lv_obj_t * obj, uint16_t zoom_y);
|
||||
uint16_t lv_chart_get_zoom_x(const lv_obj_t * obj);
|
||||
uint16_t lv_chart_get_zoom_y(const lv_obj_t * obj);
|
||||
void lv_chart_set_axis_tick(lv_obj_t * obj, lv_chart_axis_t axis, lv_coord_t major_len, lv_coord_t minor_len,
|
||||
lv_coord_t major_cnt, lv_coord_t minor_cnt, bool label_en, lv_coord_t draw_size);
|
||||
lv_chart_type_t lv_chart_get_type(const lv_obj_t * obj);
|
||||
uint16_t lv_chart_get_point_count(const lv_obj_t * obj);
|
||||
uint16_t lv_chart_get_x_start_point(const lv_obj_t * obj, lv_chart_series_t * ser);
|
||||
void lv_chart_get_point_pos_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id, lv_point_t * p_out);
|
||||
void lv_chart_refresh(lv_obj_t * obj);
|
||||
lv_chart_series_t * lv_chart_add_series(lv_obj_t * obj, lv_color_t color, lv_chart_axis_t axis);
|
||||
void lv_chart_remove_series(lv_obj_t * obj, lv_chart_series_t * series);
|
||||
void lv_chart_hide_series(lv_obj_t * chart, lv_chart_series_t * series, bool hide);
|
||||
void lv_chart_set_series_color(lv_obj_t * chart, lv_chart_series_t * series, lv_color_t color);
|
||||
void lv_chart_set_x_start_point(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id);
|
||||
lv_chart_series_t * lv_chart_get_series_next(const lv_obj_t * chart, const lv_chart_series_t * ser);
|
||||
lv_chart_cursor_t * lv_chart_add_cursor(lv_obj_t * obj, lv_color_t color, lv_dir_t dir);
|
||||
void lv_chart_set_cursor_pos(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_point_t * pos);
|
||||
void lv_chart_set_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor, lv_chart_series_t * ser,
|
||||
uint16_t point_id);
|
||||
lv_point_t lv_chart_get_cursor_point(lv_obj_t * chart, lv_chart_cursor_t * cursor);
|
||||
void lv_chart_set_all_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t value);
|
||||
void lv_chart_set_next_value(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t value);
|
||||
void lv_chart_set_next_value2(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t x_value, lv_coord_t y_value);
|
||||
void lv_chart_set_value_by_id(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id, lv_coord_t value);
|
||||
void lv_chart_set_value_by_id2(lv_obj_t * obj, lv_chart_series_t * ser, uint16_t id, lv_coord_t x_value,
|
||||
lv_coord_t y_value);
|
||||
void lv_chart_set_ext_y_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t array[]);
|
||||
void lv_chart_set_ext_x_array(lv_obj_t * obj, lv_chart_series_t * ser, lv_coord_t array[]);
|
||||
lv_coord_t * lv_chart_get_y_array(const lv_obj_t * obj, lv_chart_series_t * ser);
|
||||
lv_coord_t * lv_chart_get_x_array(const lv_obj_t * obj, lv_chart_series_t * ser);
|
||||
uint32_t lv_chart_get_pressed_point(const lv_obj_t * obj);
|
||||
"""
|
||||
|
||||
|
||||
class chart_cursor_t:
|
||||
...
|
||||
|
||||
|
||||
class coord_t:
|
||||
...
|
||||
|
||||
|
||||
class chart(lv_obj):
|
||||
TYPE: CHART_TYPE
|
||||
AXIS: CHART_AXIS
|
||||
UPDATE_MODE: CHART_UPDATE_MODE
|
||||
DRAW_PART: CHART_DRAW_PART
|
||||
def __init__(self, parent: lv_obj): ...
|
||||
def set_point_count(self, cnt: int): ...
|
||||
def set_range(self, axis: int, min: int, max: int): ...
|
||||
def set_zoom_x(self, zoom_x: int): ...
|
||||
def set_zoom_y(self, zoom_y: int): ...
|
||||
def add_series(self, color: lv_color_t, axis: int) -> chart_series_t: ...
|
||||
def get_series_next(self, ser: chart_series_t) -> chart_series_t: ...
|
||||
def set_ext_y_array(self, ser: chart_series_t, array: any): ...
|
||||
def remove_series(self, series: chart_series_t): ...
|
||||
def hide_series(self, series: chart_series_t, hide: int): ...
|
||||
def set_series_color(self, series: chart_series_t, color: lv_color_t): ...
|
||||
def refresh(self): ...
|
||||
def set_type(self, type: int): ...
|
||||
def set_update_mode(self, update_mode: int): ...
|
||||
def set_div_line_count(self, hdiv: int, vdiv: int): ...
|
||||
def set_axis_tick(self, axis: int, major_len: int, minor_len: int,
|
||||
major_cnt: int, minor_cnt: int, label_en: int, draw_size: int): ...
|
||||
|
||||
def get_type(self) -> int: ...
|
||||
def get_point_count(self) -> int: ...
|
||||
def get_x_start_point(self, ser: chart_series_t) -> int: ...
|
||||
def get_point_pos_by_id(self, ser: chart_series_t, id: int) -> point_t: ...
|
||||
def get_zoom_x(self) -> int: ...
|
||||
def get_zoom_y(self) -> int: ...
|
||||
def get_series_next(self, ser: chart_series_t) -> chart_series_t: ...
|
||||
def set_x_start_point(self, ser: chart_series_t, id: int): ...
|
||||
def add_cursor(self, color: lv_color_t, dir: int) -> chart_cursor_t: ...
|
||||
def set_cursor_pos(self, cursor: chart_cursor_t, pos: point_t): ...
|
||||
def set_cursor_point(
|
||||
self, cursor: chart_cursor_t, ser: chart_series_t, point_id: int): ...
|
||||
|
||||
def get_cursor_point(self, cursor: chart_cursor_t) -> point_t: ...
|
||||
def set_all_value(self, ser: chart_series_t, value: int): ...
|
||||
def set_next_value(self, ser: chart_series_t, value: int): ...
|
||||
def set_next_value2(self, ser: chart_series_t,
|
||||
x_value: int, y_value: int): ...
|
||||
|
||||
def set_value_by_id(self, ser: chart_series_t, id: int, value: int): ...
|
||||
def set_value_by_id2(self, ser: chart_series_t, id: int,
|
||||
x_value: int, y_value: int): ...
|
||||
|
||||
def set_ext_x_array(self, ser: chart_series_t, array: any): ...
|
||||
def set_ext_y_array(self, ser: chart_series_t, array: any): ...
|
||||
def get_y_array(self, ser: chart_series_t) -> any: ...
|
||||
def get_x_array(self, ser: chart_series_t) -> any: ...
|
||||
def get_pressed_point(self) -> int: ...
|
||||
|
||||
|
||||
"""
|
||||
typedef struct {
|
||||
@ -976,12 +1203,78 @@ class meter(lv_obj):
|
||||
def set_indicator_end_value(
|
||||
self, indic: meter_indicator_t, value: int): ...
|
||||
|
||||
"""
|
||||
enum {
|
||||
LV_KEYBOARD_MODE_TEXT_LOWER,
|
||||
LV_KEYBOARD_MODE_TEXT_UPPER,
|
||||
LV_KEYBOARD_MODE_SPECIAL,
|
||||
LV_KEYBOARD_MODE_NUMBER,
|
||||
LV_KEYBOARD_MODE_USER_1,
|
||||
LV_KEYBOARD_MODE_USER_2,
|
||||
LV_KEYBOARD_MODE_USER_3,
|
||||
LV_KEYBOARD_MODE_USER_4,
|
||||
};
|
||||
typedef uint8_t lv_keyboard_mode_t;
|
||||
|
||||
typedef struct {
|
||||
lv_btnmatrix_t btnm;
|
||||
lv_obj_t * ta;
|
||||
lv_keyboard_mode_t mode;
|
||||
uint8_t popovers : 1;
|
||||
} lv_keyboard_t;
|
||||
|
||||
extern const lv_obj_class_t lv_keyboard_class;
|
||||
|
||||
lv_obj_t * lv_keyboard_create(lv_obj_t * parent);
|
||||
|
||||
void lv_keyboard_set_textarea(lv_obj_t * kb, lv_obj_t * ta);
|
||||
void lv_keyboard_set_mode(lv_obj_t * kb, lv_keyboard_mode_t mode);
|
||||
void lv_keyboard_set_popovers(lv_obj_t * kb, bool en);
|
||||
void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * map[],
|
||||
const lv_btnmatrix_ctrl_t ctrl_map[]);
|
||||
|
||||
lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * kb);
|
||||
lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * kb);
|
||||
bool lv_btnmatrix_get_popovers(const lv_obj_t * obj);
|
||||
static inline const char ** lv_keyboard_get_map_array(const lv_obj_t * kb);
|
||||
static inline uint16_t lv_keyboard_get_selected_btn(const lv_obj_t * obj);
|
||||
static inline const char * lv_keyboard_get_btn_text(const lv_obj_t * obj, uint16_t btn_id);
|
||||
|
||||
void lv_keyboard_def_event_cb(lv_event_t * e);
|
||||
"""
|
||||
|
||||
|
||||
class KEYBOARD_MODE:
|
||||
TEXT_LOWER: int
|
||||
TEXT_UPPER: int
|
||||
SPECIAL: int
|
||||
NUMBER: int
|
||||
USER_1: int
|
||||
USER_2: int
|
||||
USER_3: int
|
||||
USER_4: int
|
||||
def __init__(self): ...
|
||||
|
||||
|
||||
class keyboard(lv_obj):
|
||||
MODE: KEYBOARD_MODE
|
||||
def __init__(self, parent: lv_obj): ...
|
||||
def set_textarea(self, ta: lv_obj): ...
|
||||
def set_mode(self, mode: int): ...
|
||||
def set_popovers(self, en: int): ...
|
||||
# def set_map(self, mode: int, map: any, ctrl_map: any): ...
|
||||
def get_textarea(self) -> lv_obj: ...
|
||||
def get_mode(self) -> int: ...
|
||||
# def get_popovers(self) -> int: ...
|
||||
# def get_map_array(self) -> any: ...
|
||||
def get_selected_btn(self) -> int: ...
|
||||
def get_btn_text(self, btn_id: int) -> str: ...
|
||||
|
||||
|
||||
def scr_act() -> lv_obj: ...
|
||||
def pct(x: int) -> int: ...
|
||||
def timer_create_basic() -> lv_timer_t: ...
|
||||
|
||||
|
||||
def color_black() -> lv_color_t: ...
|
||||
def color_white() -> lv_color_t: ...
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
|
||||
#if defined(LV_LVGL_H_INCLUDE_SIMPLE)
|
||||
#include "lvgl.h"
|
||||
#else
|
||||
#include "../../lvgl.h"
|
||||
@ -7,6 +7,101 @@
|
||||
#ifdef PIKASCRIPT
|
||||
|
||||
#include "pika_lvgl_indev_t.h"
|
||||
#include "pika_lvgl_lv_obj.h"
|
||||
#include "pika_lvgl_point_t.h"
|
||||
|
||||
/*
|
||||
class indev_t:
|
||||
def __init__(self): ...
|
||||
def enable(self, en: int): ...
|
||||
def get_type(self) -> int: ...
|
||||
def reset(self, obj: lv_obj): ...
|
||||
def reset_long_press(self): ...
|
||||
def set_cursor(self, cur_obj: lv_obj): ...
|
||||
# def set_group(self, group: lv_group): ...
|
||||
def set_button_points(self, points: point_t): ...
|
||||
def get_point(self, point: point_t): ...
|
||||
def get_gesture_dir(self) -> int: ...
|
||||
def get_key(self) -> int: ...
|
||||
def get_scroll_dir(self) -> int: ...
|
||||
def get_scroll_obj(self) -> lv_obj: ...
|
||||
def get_vect(self, point: point_t): ...
|
||||
def wait_release(self): ...
|
||||
def get_obj_act(self) -> lv_obj: ...
|
||||
# def get_read_timer(self) -> lv_timer: ...
|
||||
def search_obj(self, obj: lv_obj, point: point_t) -> lv_obj: ...
|
||||
*/
|
||||
|
||||
void pika_lvgl_indev_t___init__(PikaObj* self) {
|
||||
lv_indev_t* lv_indev = lv_indev_get_act();
|
||||
obj_setPtr(self, "lv_indev", lv_indev);
|
||||
}
|
||||
|
||||
void pika_lvgl_indev_t_enable(PikaObj* self, int en) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
lv_indev_enable(lv_indev, en);
|
||||
}
|
||||
|
||||
int pika_lvgl_indev_t_get_type(PikaObj* self) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
return lv_indev_get_type(lv_indev);
|
||||
}
|
||||
|
||||
void pika_lvgl_indev_t_reset(PikaObj* self, PikaObj* obj) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
lv_obj_t* lv_obj = obj_getPtr(obj, "lv_obj");
|
||||
lv_indev_reset(lv_indev, lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_indev_t_reset_long_press(PikaObj* self) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
lv_indev_reset_long_press(lv_indev);
|
||||
}
|
||||
|
||||
void pika_lvgl_indev_t_set_cursor(PikaObj* self, PikaObj* cur_obj) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
lv_obj_t* lv_cur_obj = obj_getPtr(cur_obj, "lv_obj");
|
||||
lv_indev_set_cursor(lv_indev, lv_cur_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_indev_t_set_button_points(PikaObj* self, PikaObj* points) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
lv_point_t* lv_points = obj_getPtr(points, "lv_point");
|
||||
lv_indev_set_button_points(lv_indev, lv_points);
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_indev_t_get_point(PikaObj* self) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
PikaObj* new_obj = newNormalObj(New_pika_lvgl_point_t);
|
||||
lv_point_t lv_point = {0};
|
||||
lv_indev_get_point(lv_indev, &lv_point);
|
||||
obj_setInt(new_obj, "x", lv_point.x);
|
||||
obj_setInt(new_obj, "y", lv_point.y);
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
int pika_lvgl_indev_t_get_gesture_dir(PikaObj* self) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
return lv_indev_get_gesture_dir(lv_indev);
|
||||
}
|
||||
|
||||
int pika_lvgl_indev_t_get_key(PikaObj* self) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
return lv_indev_get_key(lv_indev);
|
||||
}
|
||||
|
||||
int pika_lvgl_indev_t_get_scroll_dir(PikaObj* self) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
return lv_indev_get_scroll_dir(lv_indev);
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_indev_t_get_scroll_obj(PikaObj* self) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
lv_obj_t* lv_obj = lv_indev_get_scroll_obj(lv_indev);
|
||||
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_obj);
|
||||
obj_setPtr(new_obj, "lv_obj", lv_obj);
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
void pika_lvgl_indev_t_get_vect(PikaObj* self, PikaObj* point) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
@ -15,4 +110,27 @@ void pika_lvgl_indev_t_get_vect(PikaObj* self, PikaObj* point) {
|
||||
obj_setInt(point, "x", lv_point->x);
|
||||
obj_setInt(point, "y", lv_point->y);
|
||||
}
|
||||
|
||||
void pika_lvgl_indev_t_wait_release(PikaObj* self) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
lv_indev_wait_release(lv_indev);
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_indev_t_get_obj_act(PikaObj* self, PikaObj* obj) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
lv_obj_t* lv_obj = lv_indev_get_obj_act(lv_indev);
|
||||
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_obj);
|
||||
obj_setPtr(new_obj, "lv_obj", lv_obj);
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_indev_t_search_obj(PikaObj* self, PikaObj* point) {
|
||||
lv_indev_t* lv_indev = obj_getPtr(self, "lv_indev");
|
||||
lv_point_t* lv_point = obj_getPtr(point, "lv_point");
|
||||
lv_obj_t* lv_obj = lv_indev_search_obj(lv_indev, lv_point);
|
||||
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_obj);
|
||||
obj_setPtr(new_obj, "lv_obj", lv_obj);
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1329,4 +1329,21 @@ int pika_lvgl_lv_obj_get_scroll_right(PikaObj* self) {
|
||||
// return lv_obj_get_scroll_propagation(obj_getPtr(self, "lv_obj"));
|
||||
// }
|
||||
|
||||
void pika_lvgl_lv_obj_remove_style_all(PikaObj* self) {
|
||||
lv_obj_remove_style_all(obj_getPtr(self, "lv_obj"));
|
||||
}
|
||||
|
||||
/*
|
||||
def move_foreground(self): ...
|
||||
def move_background(self): ...
|
||||
*/
|
||||
|
||||
void pika_lvgl_lv_obj_move_foreground(PikaObj* self) {
|
||||
lv_obj_move_foreground(obj_getPtr(self, "lv_obj"));
|
||||
}
|
||||
|
||||
void pika_lvgl_lv_obj_move_background(PikaObj* self) {
|
||||
lv_obj_move_background(obj_getPtr(self, "lv_obj"));
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -10,7 +10,7 @@
|
||||
|
||||
void pika_lvgl_point_t___init__(PikaObj* self) {
|
||||
lv_point_t lv_point = {0};
|
||||
args_setStruct(self->list, "lv_point_struct", lv_point);
|
||||
obj_setPtr(self, "lv_point", args_getStruct(self->list, "lv_point_struct"));
|
||||
obj_setStruct(self, "lv_point_struct", lv_point);
|
||||
obj_setPtr(self, "lv_point", obj_getStruct(self, "lv_point_struct"));
|
||||
}
|
||||
#endif
|
||||
|
@ -8,21 +8,29 @@
|
||||
#include "BaseObj.h"
|
||||
#include "PikaStdData_Dict.h"
|
||||
#include "pika_lvgl.h"
|
||||
#include "pika_lvgl_CHART_AXIS.h"
|
||||
#include "pika_lvgl_CHART_DRAW_PART.h"
|
||||
#include "pika_lvgl_CHART_TYPE.h"
|
||||
#include "pika_lvgl_CHART_UPDATE_MODE.h"
|
||||
#include "pika_lvgl_KEYBOARD_MODE.h"
|
||||
#include "pika_lvgl_arc.h"
|
||||
#include "pika_lvgl_bar.h"
|
||||
#include "pika_lvgl_btn.h"
|
||||
#include "pika_lvgl_cf_t.h"
|
||||
#include "pika_lvgl_chart.h"
|
||||
#include "pika_lvgl_chart_cursor_t.h"
|
||||
#include "pika_lvgl_chart_series_t.h"
|
||||
#include "pika_lvgl_checkbox.h"
|
||||
#include "pika_lvgl_coord_t.h"
|
||||
#include "pika_lvgl_dropdown.h"
|
||||
#include "pika_lvgl_img.h"
|
||||
#include "pika_lvgl_img_dsc_t.h"
|
||||
#include "pika_lvgl_label.h"
|
||||
#include "pika_lvgl_meter_indicator_t.h"
|
||||
#include "pika_lvgl_meter_scale_t.h"
|
||||
#include "pika_lvgl_lv_obj.h"
|
||||
#include "pika_lvgl_meter.h"
|
||||
#include "pika_lvgl_meter_indicator_t.h"
|
||||
#include "pika_lvgl_meter_scale_t.h"
|
||||
#include "pika_lvgl_point_t.h"
|
||||
#include "pika_lvgl_roller.h"
|
||||
#include "pika_lvgl_slider.h"
|
||||
#include "pika_lvgl_switch.h"
|
||||
@ -501,9 +509,72 @@ void pika_lvgl_img_set_zoom(PikaObj* self, int zoom) {
|
||||
lv_img_set_zoom(lv_obj, zoom);
|
||||
}
|
||||
|
||||
/*
|
||||
class chart(lv_obj):
|
||||
TYPE: CHART_TYPE
|
||||
AXIS: CHART_AXIS
|
||||
UPDATE_MODE: CHART_UPDATE_MODE
|
||||
DRAW_PART: CHART_DRAW_PART
|
||||
def __init__(self, parent: lv_obj): ...
|
||||
def set_point_count(self, cnt: int): ...
|
||||
def set_range(self, axis: int, min: int, max: int): ...
|
||||
def set_zoom_x(self, zoom_x: int): ...
|
||||
def set_zoom_y(self, zoom_y: int): ...
|
||||
def add_series(self, color: lv_color_t, axis: int) -> chart_series_t: ...
|
||||
def remove_series(self, series: chart_series_t): ...
|
||||
def hide_series(self, series: chart_series_t, hide: int): ...
|
||||
def set_series_color(self, series: chart_series_t, color: lv_color_t): ...
|
||||
def refresh(self): ...
|
||||
def set_type(self, type: int): ...
|
||||
def set_update_mode(self, update_mode: int): ...
|
||||
def set_div_line_count(self, hdiv: int, vdiv: int): ...
|
||||
def set_axis_tick(self, axis: int, major_len: int, minor_len: int,
|
||||
major_cnt: int, minor_cnt: int, label_en: int, draw_size:
|
||||
int): ...
|
||||
|
||||
def get_type(self) -> int: ...
|
||||
def get_point_count(self) -> int: ...
|
||||
def get_x_start_point(self, ser: chart_series_t) -> int: ...
|
||||
def get_point_pos_by_id(self, ser: chart_series_t, id: int) -> point_t: ...
|
||||
def get_zoom_x(self) -> int: ...
|
||||
def get_zoom_y(self) -> int: ...
|
||||
def get_series_next(self, ser: chart_series_t) -> chart_series_t: ...
|
||||
def set_x_start_point(self, ser: chart_series_t, id: int): ...
|
||||
def add_cursor(self, color: lv_color_t, dir: int): ...
|
||||
def set_cursor_pos(self, cursor: chart_cursor_t, pos: point_t): ...
|
||||
def set_cursor_point(
|
||||
self, cursor: chart_cursor_t, ser: chart_series_t, point_id: int): ...
|
||||
|
||||
def get_cursor_point(self, cursor: chart_cursor_t) -> point_t: ...
|
||||
def set_all_value(self, ser: chart_series_t, value: int): ...
|
||||
def set_next_value(self, ser: chart_series_t, value: int): ...
|
||||
def set_next_value2(self, ser: chart_series_t,
|
||||
x_value: int, y_value: int): ...
|
||||
|
||||
def set_value_by_id(self, ser: chart_series_t, id: int, value: int): ...
|
||||
def set_value_by_id2(self, ser: chart_series_t, id: int,
|
||||
x_value: int, y_value: int): ...
|
||||
|
||||
def set_ext_x_array(self, ser: chart_series_t, array: any): ...
|
||||
def set_ext_y_array(self, ser: chart_series_t, array: any): ...
|
||||
def get_y_array(self, ser: chart_series_t) -> any: ...
|
||||
def get_x_array(self, ser: chart_series_t) -> any: ...
|
||||
def get_pressed_point(self) -> int: ...
|
||||
*/
|
||||
|
||||
void pika_lvgl_chart___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_obj = lv_chart_create(obj_getPtr(parent, "lv_obj"));
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
if (NULL != parent) {
|
||||
lv_obj_t* lv_obj = lv_chart_create(obj_getPtr(parent, "lv_obj"));
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
||||
obj_newDirectObj(self, "TYPE", New_pika_lvgl_CHART_TYPE);
|
||||
obj_newDirectObj(self, "AXIS", New_pika_lvgl_CHART_AXIS);
|
||||
obj_newDirectObj(self, "UPDATE_MODE", New_pika_lvgl_CHART_UPDATE_MODE);
|
||||
obj_newDirectObj(self, "DRAW_PART", New_pika_lvgl_CHART_DRAW_PART);
|
||||
obj_runMethod0(obj_getObj(self, "TYPE"), "__init__");
|
||||
obj_runMethod0(obj_getObj(self, "AXIS"), "__init__");
|
||||
obj_runMethod0(obj_getObj(self, "UPDATE_MODE"), "__init__");
|
||||
obj_runMethod0(obj_getObj(self, "DRAW_PART"), "__init__");
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_chart_add_series(PikaObj* self, PikaObj* color, int axis) {
|
||||
@ -515,6 +586,27 @@ PikaObj* pika_lvgl_chart_add_series(PikaObj* self, PikaObj* color, int axis) {
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_remove_series(PikaObj* self, PikaObj* ser) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* series = obj_getPtr(ser, "lv_chart_series_t");
|
||||
lv_chart_remove_series(lv_obj, series);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_hide_series(PikaObj* self, PikaObj* ser, int hide) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* series = obj_getPtr(ser, "lv_chart_series_t");
|
||||
lv_chart_hide_series(lv_obj, series, hide);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_series_color(PikaObj* self,
|
||||
PikaObj* ser,
|
||||
PikaObj* color) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* series = obj_getPtr(ser, "lv_chart_series_t");
|
||||
lv_color_t* lv_color = obj_getPtr(color, "lv_color");
|
||||
lv_chart_set_series_color(lv_obj, series, *lv_color);
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_chart_get_series_next(PikaObj* self, PikaObj* ser) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* series = obj_getPtr(ser, "lv_chart_series_t");
|
||||
@ -524,16 +616,6 @@ PikaObj* pika_lvgl_chart_get_series_next(PikaObj* self, PikaObj* ser) {
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_ext_y_array(PikaObj* self, PikaObj* ser, Arg* array) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* series = obj_getPtr(ser, "series");
|
||||
if (arg_getType(array) == ARG_TYPE_INT) {
|
||||
lv_coord_t* arr = (lv_coord_t*)arg_getInt(array);
|
||||
lv_chart_set_ext_y_array(lv_obj, series, arr);
|
||||
pika_debug("set ext y array, arr: %p", arr);
|
||||
}
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_refresh(PikaObj* self) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_refresh(lv_obj);
|
||||
@ -559,6 +641,196 @@ void pika_lvgl_chart_set_zoom_y(PikaObj* self, int zoom_y) {
|
||||
lv_chart_set_zoom_y(lv_obj, zoom_y);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_type(PikaObj* self, int type) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_set_type(lv_obj, type);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_update_mode(PikaObj* self, int update_mode) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_set_update_mode(lv_obj, update_mode);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_div_line_count(PikaObj* self, int hdiv, int vdiv) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_set_div_line_count(lv_obj, hdiv, vdiv);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_axis_tick(PikaObj* self,
|
||||
int axis,
|
||||
int major_len,
|
||||
int minor_len,
|
||||
int major_cnt,
|
||||
int minor_cnt,
|
||||
int label_en,
|
||||
int draw_size) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_set_axis_tick(lv_obj, axis, major_len, minor_len, major_cnt,
|
||||
minor_cnt, label_en, draw_size);
|
||||
}
|
||||
|
||||
int pika_lvgl_chart_get_type(PikaObj* self) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
return lv_chart_get_type(lv_obj);
|
||||
}
|
||||
|
||||
int pika_lvgl_chart_get_point_count(PikaObj* self) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
return lv_chart_get_point_count(lv_obj);
|
||||
}
|
||||
|
||||
int pika_lvgl_chart_get_x_start_point(PikaObj* self, PikaObj* ser) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* series = obj_getPtr(ser, "series");
|
||||
return lv_chart_get_x_start_point(lv_obj, series);
|
||||
}
|
||||
|
||||
int pika_lvgl_chart_get_zoom_x(PikaObj* self) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
return lv_chart_get_zoom_x(lv_obj);
|
||||
}
|
||||
|
||||
int pika_lvgl_chart_get_zoom_y(PikaObj* self) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
return lv_chart_get_zoom_y(lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_x_start_point(PikaObj* self, PikaObj* ser, int id) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* series = obj_getPtr(ser, "series");
|
||||
lv_chart_set_x_start_point(lv_obj, series, id);
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_chart_add_cursor(PikaObj* self, PikaObj* color, int dir) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_color_t* lv_color = obj_getPtr(color, "lv_color");
|
||||
lv_chart_cursor_t* cursor = lv_chart_add_cursor(lv_obj, *lv_color, dir);
|
||||
PikaObj* new_obj = newNormalObj(New_pika_lvgl_chart_cursor_t);
|
||||
obj_setPtr(new_obj, "cursor", cursor);
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_cursor_pos(PikaObj* self,
|
||||
PikaObj* cursor,
|
||||
PikaObj* pos) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_cursor_t* lv_cursor = obj_getPtr(cursor, "cursor");
|
||||
lv_point_t* lv_pos = obj_getPtr(pos, "lv_point");
|
||||
lv_chart_set_cursor_pos(lv_obj, lv_cursor, lv_pos);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_cursor_point(PikaObj* self,
|
||||
PikaObj* cursor,
|
||||
PikaObj* ser,
|
||||
int point_id) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_cursor_t* lv_cursor = obj_getPtr(cursor, "cursor");
|
||||
lv_chart_series_t* lv_ser = obj_getPtr(ser, "series");
|
||||
lv_chart_set_cursor_point(lv_obj, lv_cursor, lv_ser, point_id);
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_chart_get_cursor_point(PikaObj* self, PikaObj* cursor) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_cursor_t* lv_cursor = obj_getPtr(cursor, "cursor");
|
||||
lv_point_t lv_pos = lv_chart_get_cursor_point(lv_obj, lv_cursor);
|
||||
PikaObj* new_obj = newNormalObj(New_pika_lvgl_point_t);
|
||||
obj_setStruct(new_obj, "lv_point_struct", lv_pos);
|
||||
obj_setPtr(self, "lv_point", obj_getStruct(new_obj, "lv_point_struct"));
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_chart_get_point_pos_by_id(PikaObj* self,
|
||||
PikaObj* ser,
|
||||
int id) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* lv_ser = obj_getPtr(ser, "series");
|
||||
lv_point_t lv_pos = {0};
|
||||
lv_chart_get_point_pos_by_id(lv_obj, lv_ser, id, &lv_pos);
|
||||
PikaObj* new_obj = newNormalObj(New_pika_lvgl_point_t);
|
||||
obj_setStruct(new_obj, "lv_point_struct", lv_pos);
|
||||
obj_setPtr(self, "lv_point", obj_getStruct(new_obj, "lv_point_struct"));
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_all_value(PikaObj* self, PikaObj* ser, int value) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* lv_ser = obj_getPtr(ser, "series");
|
||||
lv_chart_set_all_value(lv_obj, lv_ser, value);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_next_value(PikaObj* self, PikaObj* ser, int value) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* lv_ser = obj_getPtr(ser, "series");
|
||||
lv_chart_set_next_value(lv_obj, lv_ser, value);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_next_value2(PikaObj* self,
|
||||
PikaObj* ser,
|
||||
int x_value,
|
||||
int y_value) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* lv_ser = obj_getPtr(ser, "series");
|
||||
lv_chart_set_next_value2(lv_obj, lv_ser, x_value, y_value);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_value_by_id(PikaObj* self,
|
||||
PikaObj* ser,
|
||||
int id,
|
||||
int value) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* lv_ser = obj_getPtr(ser, "series");
|
||||
lv_chart_set_value_by_id(lv_obj, lv_ser, id, value);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_value_by_id2(PikaObj* self,
|
||||
PikaObj* ser,
|
||||
int id,
|
||||
int x_value,
|
||||
int y_value) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* lv_ser = obj_getPtr(ser, "series");
|
||||
lv_chart_set_value_by_id2(lv_obj, lv_ser, id, x_value, y_value);
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_ext_x_array(PikaObj* self, PikaObj* ser, Arg* array) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* lv_ser = obj_getPtr(ser, "series");
|
||||
if (arg_getType(array) == ARG_TYPE_INT) {
|
||||
lv_coord_t* arr = (lv_coord_t*)arg_getInt(array);
|
||||
lv_chart_set_ext_x_array(lv_obj, lv_ser, arr);
|
||||
pika_debug("set ext x array, arr: %p", arr);
|
||||
}
|
||||
}
|
||||
|
||||
void pika_lvgl_chart_set_ext_y_array(PikaObj* self, PikaObj* ser, Arg* array) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* series = obj_getPtr(ser, "series");
|
||||
if (arg_getType(array) == ARG_TYPE_INT) {
|
||||
lv_coord_t* arr = (lv_coord_t*)arg_getInt(array);
|
||||
lv_chart_set_ext_y_array(lv_obj, series, arr);
|
||||
pika_debug("set ext y array, arr: %p", arr);
|
||||
}
|
||||
}
|
||||
|
||||
Arg* pika_lvgl_chart_get_y_array(PikaObj* self, PikaObj* ser) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* lv_ser = obj_getPtr(ser, "series");
|
||||
lv_coord_t* arr = lv_chart_get_y_array(lv_obj, lv_ser);
|
||||
return arg_newInt((uintptr_t)arr);
|
||||
}
|
||||
|
||||
Arg* pika_lvgl_chart_get_x_array(PikaObj* self, PikaObj* ser) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_chart_series_t* lv_ser = obj_getPtr(ser, "series");
|
||||
lv_coord_t* arr = lv_chart_get_x_array(lv_obj, lv_ser);
|
||||
return arg_newInt((uintptr_t)arr);
|
||||
}
|
||||
|
||||
int pika_lvgl_chart_get_pressed_point(PikaObj* self) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
return lv_chart_get_pressed_point(lv_obj);
|
||||
}
|
||||
|
||||
/*
|
||||
typedef struct {
|
||||
lv_obj_t obj;
|
||||
@ -846,4 +1118,91 @@ void pika_lvgl_meter_set_indicator_end_value(PikaObj* self,
|
||||
lv_meter_set_indicator_end_value(lv_obj, lv_indic, value);
|
||||
}
|
||||
|
||||
/*
|
||||
class KEYBOARD_MODE:
|
||||
TEXT_LOWER: int
|
||||
TEXT_UPPER: int
|
||||
SPECIAL: int
|
||||
NUMBER: int
|
||||
USER_1: int
|
||||
USER_2: int
|
||||
USER_3: int
|
||||
USER_4: int
|
||||
def __init__(self): ...
|
||||
*/
|
||||
|
||||
void pika_lvgl_KEYBOARD_MODE___init__(PikaObj* self) {
|
||||
obj_setInt(self, "TEXT_LOWER", LV_KEYBOARD_MODE_TEXT_LOWER);
|
||||
obj_setInt(self, "TEXT_UPPER", LV_KEYBOARD_MODE_TEXT_UPPER);
|
||||
obj_setInt(self, "SPECIAL", LV_KEYBOARD_MODE_SPECIAL);
|
||||
obj_setInt(self, "NUMBER", LV_KEYBOARD_MODE_NUMBER);
|
||||
obj_setInt(self, "USER_1", LV_KEYBOARD_MODE_USER_1);
|
||||
obj_setInt(self, "USER_2", LV_KEYBOARD_MODE_USER_2);
|
||||
obj_setInt(self, "USER_3", LV_KEYBOARD_MODE_USER_3);
|
||||
obj_setInt(self, "USER_4", LV_KEYBOARD_MODE_USER_4);
|
||||
}
|
||||
|
||||
/*
|
||||
class keyboard(lv_obj):
|
||||
def __init__(self, parent: lv_obj): ...
|
||||
def set_textarea(self, ta: lv_obj): ...
|
||||
def set_mode(self, mode: int): ...
|
||||
def set_popovers(self, en: int): ...
|
||||
# def set_map(self, mode: int, map: any, ctrl_map: any): ...
|
||||
def get_textarea(self) -> lv_obj: ...
|
||||
def get_mode(self) -> int: ...
|
||||
# def get_popovers(self) -> int: ...
|
||||
# def get_map_array(self) -> any: ...
|
||||
def get_selected_btn(self) -> int: ...
|
||||
def get_btn_text(self, btn_id: int) -> str: ...
|
||||
*/
|
||||
|
||||
void pika_lvgl_keyboard___init__(PikaObj* self, PikaObj* parent) {
|
||||
if (NULL != parent) {
|
||||
lv_obj_t* lv_obj = lv_keyboard_create(obj_getPtr(parent, "lv_obj"));
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
||||
obj_newDirectObj(self, "MODE", New_pika_lvgl_KEYBOARD_MODE);
|
||||
obj_runMethod0(obj_getObj(self, "MODE"), "__init__");
|
||||
}
|
||||
|
||||
void pika_lvgl_keyboard_set_textarea(PikaObj* self, PikaObj* ta) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_obj_t* lv_ta = obj_getPtr(ta, "lv_obj");
|
||||
lv_keyboard_set_textarea(lv_obj, lv_ta);
|
||||
}
|
||||
|
||||
void pika_lvgl_keyboard_set_mode(PikaObj* self, int mode) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_keyboard_set_mode(lv_obj, mode);
|
||||
}
|
||||
|
||||
void pika_lvgl_keyboard_set_popovers(PikaObj* self, int en) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_keyboard_set_popovers(lv_obj, en);
|
||||
}
|
||||
|
||||
PikaObj* pika_lvgl_keyboard_get_textarea(PikaObj* self) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_obj_t* lv_ta = lv_keyboard_get_textarea(lv_obj);
|
||||
PikaObj* new_obj = newNormalObj(New_pika_lvgl_lv_obj);
|
||||
obj_setPtr(new_obj, "lv_obj", lv_ta);
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
int pika_lvgl_keyboard_get_mode(PikaObj* self) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
return lv_keyboard_get_mode(lv_obj);
|
||||
}
|
||||
|
||||
int pika_lvgl_keyboard_get_selected_btn(PikaObj* self) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
return lv_keyboard_get_selected_btn(lv_obj);
|
||||
}
|
||||
|
||||
char* pika_lvgl_keyboard_get_btn_text(PikaObj* self, int btn_id) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
return lv_keyboard_get_btn_text(lv_obj, btn_id);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
Loading…
x
Reference in New Issue
Block a user