mirror of
https://gitee.com/Lyon1998/pikapython.git
synced 2025-01-29 17:22:56 +08:00
!27 add lvgl package and examples
* support event for lvgl * add example for lvgl * adding const * support core-widget for lvgl * add lvgl package
This commit is contained in:
parent
2c4bbfafad
commit
71364445e0
12
examples/lvgl/lv_arc1.py
Normal file
12
examples/lvgl/lv_arc1.py
Normal file
@ -0,0 +1,12 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
# Create an Arc
|
||||
arc = lv.arc(lv.scr_act())
|
||||
arc.set_end_angle(200)
|
||||
arc.set_size(150, 150)
|
||||
arc.center()
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
12
examples/lvgl/lv_arc2.py
Normal file
12
examples/lvgl/lv_arc2.py
Normal file
@ -0,0 +1,12 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
# Create an Arc
|
||||
arc = lv.arc(lv.scr_act())
|
||||
arc.set_bg_angles(0, 360)
|
||||
arc.set_angles(270, 270)
|
||||
arc.center()
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
11
examples/lvgl/lv_bar1.py
Normal file
11
examples/lvgl/lv_bar1.py
Normal file
@ -0,0 +1,11 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
bar1 = lv.bar(lv.scr_act())
|
||||
bar1.set_size(200, 20)
|
||||
bar1.center()
|
||||
bar1.set_value(70, lv.ANIM.OFF)
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
24
examples/lvgl/lv_btn1.py
Normal file
24
examples/lvgl/lv_btn1.py
Normal file
@ -0,0 +1,24 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
# create a simple button
|
||||
btn1 = lv.btn(lv.scr_act())
|
||||
|
||||
btn1.align(lv.ALIGN.CENTER,0,-40)
|
||||
label=lv.label(btn1)
|
||||
label.set_text("Button")
|
||||
|
||||
# create a toggle button
|
||||
btn2 = lv.btn(lv.scr_act())
|
||||
|
||||
btn2.align(lv.ALIGN.CENTER,0,40)
|
||||
btn2.add_flag(lv.obj.FLAG.CHECKABLE)
|
||||
btn2.set_height(lv.SIZE.CONTENT)
|
||||
|
||||
label=lv.label(btn2)
|
||||
label.set_text("Toggle")
|
||||
label.center()
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
24
examples/lvgl/lv_callback1.py
Normal file
24
examples/lvgl/lv_callback1.py
Normal file
@ -0,0 +1,24 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
|
||||
def event_cb_1(evt):
|
||||
print('in evt1')
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
||||
|
||||
|
||||
def event_cb_2(evt):
|
||||
print('in evt2')
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
||||
|
||||
|
||||
btn1 = lv.btn(lv.scr_act())
|
||||
btn1.align(lv.ALIGN.TOP_MID, 0, 10)
|
||||
btn2 = lv.btn(lv.scr_act())
|
||||
btn2.align(lv.ALIGN.TOP_MID, 0, 50)
|
||||
btn1.add_event_cb(event_cb_1, lv.EVENT.CLICKED, 0)
|
||||
btn2.add_event_cb(event_cb_2, lv.EVENT.CLICKED, 0)
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
25
examples/lvgl/lv_checkbox1.py
Normal file
25
examples/lvgl/lv_checkbox1.py
Normal file
@ -0,0 +1,25 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
cb = lv.checkbox(lv.scr_act())
|
||||
cb.set_text("Apple")
|
||||
cb.align(lv.ALIGN.TOP_LEFT, 0 ,0)
|
||||
|
||||
cb = lv.checkbox(lv.scr_act())
|
||||
cb.set_text("Banana")
|
||||
cb.add_state(lv.STATE.CHECKED)
|
||||
cb.align(lv.ALIGN.TOP_LEFT, 0 ,30)
|
||||
|
||||
cb = lv.checkbox(lv.scr_act())
|
||||
cb.set_text("Lemon")
|
||||
cb.add_state(lv.STATE.DISABLED)
|
||||
cb.align(lv.ALIGN.TOP_LEFT, 0 ,60)
|
||||
|
||||
cb = lv.checkbox(lv.scr_act())
|
||||
cb.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED)
|
||||
cb.set_text("Melon")
|
||||
cb.align(lv.ALIGN.TOP_LEFT, 0 ,90)
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
25
examples/lvgl/lv_label1.py
Normal file
25
examples/lvgl/lv_label1.py
Normal file
@ -0,0 +1,25 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
label1 = lv.label(lv.scr_act())
|
||||
LV_LABEL_LONG_WRAP = 0
|
||||
label1.set_long_mode(LV_LABEL_LONG_WRAP) # Break the long lines*/
|
||||
# Enable re-coloring by commands in the text
|
||||
label1.set_recolor(True)
|
||||
label1.set_text("#0000ff Re-color# #ff00ff words# #ff0000 of a# label, \
|
||||
align the lines to the center and wrap long text automatically.")
|
||||
# Set smaller width to make the lines wrap
|
||||
label1.set_width(150)
|
||||
label1.set_style_text_align(lv.ALIGN.CENTER, 0)
|
||||
label1.align(lv.ALIGN.CENTER, 0, -40)
|
||||
|
||||
LV_LABEL_LONG_SCROLL_CIRCULAR = 3
|
||||
label2 = lv.label(lv.scr_act())
|
||||
label2.set_long_mode(LV_LABEL_LONG_SCROLL_CIRCULAR) # Circular scroll
|
||||
label2.set_width(150)
|
||||
label2.set_text("It is a circularly scrolling text. ")
|
||||
label2.align(lv.ALIGN.CENTER, 0, 40)
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
13
examples/lvgl/lv_list1.py
Normal file
13
examples/lvgl/lv_list1.py
Normal file
@ -0,0 +1,13 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
# Create a normal drop down list
|
||||
dd = lv.dropdown(lv.scr_act())
|
||||
dd.set_options("Apple\nBanana\nOrange\nCherry\nGrape\
|
||||
Raspberry\nMelon\nOrange\nLemon\nNuts")
|
||||
|
||||
dd.align(lv.ALIGN.TOP_MID, 0, 20)
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
13
examples/lvgl/lv_obj1.py
Normal file
13
examples/lvgl/lv_obj1.py
Normal file
@ -0,0 +1,13 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
obj1 = lv.obj(lv.scr_act())
|
||||
obj1.set_size(100, 50)
|
||||
obj1.align(lv.ALIGN.CENTER, -60, -30)
|
||||
|
||||
obj2 = lv.obj(lv.scr_act())
|
||||
obj2.align(lv.ALIGN.CENTER, 60, 30)
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
13
examples/lvgl/lv_obj2.py
Normal file
13
examples/lvgl/lv_obj2.py
Normal file
@ -0,0 +1,13 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
obj = lv.obj(lv.scr_act())
|
||||
obj.set_size(150, 100)
|
||||
|
||||
label = lv.label(obj)
|
||||
label.set_text("test")
|
||||
label.center()
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
15
examples/lvgl/lv_roller1.py
Normal file
15
examples/lvgl/lv_roller1.py
Normal file
@ -0,0 +1,15 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
LV_ROLLER_MODE_INFINITE = 1
|
||||
roller1 = lv.roller(lv.scr_act())
|
||||
roller1.set_options("January\nFebruary\nMarch\nApril\
|
||||
\nMay\nJune\nJuly\nAugust\nSeptember\
|
||||
\nOctober\nNovember\nDecember", LV_ROLLER_MODE_INFINITE)
|
||||
|
||||
roller1.set_visible_row_count(4)
|
||||
roller1.center()
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
16
examples/lvgl/lv_slider1.py
Normal file
16
examples/lvgl/lv_slider1.py
Normal file
@ -0,0 +1,16 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
# Create a slider in the center of the display
|
||||
slider = lv.slider(lv.scr_act())
|
||||
slider.center()
|
||||
|
||||
# Create a label below the slider
|
||||
slider_label = lv.label(lv.scr_act())
|
||||
slider_label.set_text("0%")
|
||||
|
||||
slider_label.align_to(slider, lv.ALIGN.OUT_BOTTOM_MID, 0, 10)
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
21
examples/lvgl/lv_switch1.py
Normal file
21
examples/lvgl/lv_switch1.py
Normal file
@ -0,0 +1,21 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
sw = lv.switch(lv.scr_act())
|
||||
sw.align(lv.ALIGN.TOP_MID, 0, 20)
|
||||
|
||||
sw = lv.switch(lv.scr_act())
|
||||
sw.add_state(lv.STATE.CHECKED)
|
||||
sw.align(lv.ALIGN.TOP_MID, 0, 50)
|
||||
|
||||
sw = lv.switch(lv.scr_act())
|
||||
sw.add_state(lv.STATE.DISABLED)
|
||||
sw.align(lv.ALIGN.TOP_MID, 0, 80)
|
||||
|
||||
sw = lv.switch(lv.scr_act())
|
||||
sw.add_state(lv.STATE.CHECKED | lv.STATE.DISABLED)
|
||||
sw.align(lv.ALIGN.TOP_MID, 0, 110)
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
32
examples/lvgl/lv_table1.py
Normal file
32
examples/lvgl/lv_table1.py
Normal file
@ -0,0 +1,32 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
table = lv.table(lv.scr_act())
|
||||
|
||||
# Fill the first column
|
||||
table.set_cell_value(0, 0, "Name")
|
||||
table.set_cell_value(1, 0, "Apple")
|
||||
table.set_cell_value(2, 0, "Banana")
|
||||
table.set_cell_value(3, 0, "Lemon")
|
||||
table.set_cell_value(4, 0, "Grape")
|
||||
table.set_cell_value(5, 0, "Melon")
|
||||
table.set_cell_value(6, 0, "Peach")
|
||||
table.set_cell_value(7, 0, "Nuts")
|
||||
|
||||
# Fill the second column
|
||||
table.set_cell_value(0, 1, "Price")
|
||||
table.set_cell_value(1, 1, "$7")
|
||||
table.set_cell_value(2, 1, "$4")
|
||||
table.set_cell_value(3, 1, "$6")
|
||||
table.set_cell_value(4, 1, "$2")
|
||||
table.set_cell_value(5, 1, "$5")
|
||||
table.set_cell_value(6, 1, "$1")
|
||||
table.set_cell_value(7, 1, "$9")
|
||||
|
||||
# Set a smaller height to the table. It'll make it scrollable
|
||||
table.set_height(200)
|
||||
table.center()
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
11
examples/lvgl/lv_textarea1.py
Normal file
11
examples/lvgl/lv_textarea1.py
Normal file
@ -0,0 +1,11 @@
|
||||
import pika_lvgl as lv
|
||||
import PikaStdLib
|
||||
mem = PikaStdLib.MemChecker()
|
||||
|
||||
ta = lv.textarea(lv.scr_act())
|
||||
ta.set_one_line(True)
|
||||
ta.align(lv.ALIGN.TOP_MID, 0, 10)
|
||||
ta.add_state(lv.STATE.FOCUSED) # To be sure the cursor is visible
|
||||
|
||||
print('mem used max: %0.2f kB' % (mem.getMax()))
|
||||
print('mem used now: %0.2f kB' % (mem.getNow()))
|
140
package/pika_lvgl/pika_lvgl.c
Normal file
140
package/pika_lvgl/pika_lvgl.c
Normal file
@ -0,0 +1,140 @@
|
||||
#include "pika_lvgl.h"
|
||||
#include "BaseObj.h"
|
||||
#include "lvgl.h"
|
||||
#include "pika_lvgl_arc.h"
|
||||
#include "pika_lvgl_lv_obj.h"
|
||||
|
||||
PikaObj* pika_lv_event_listener_g;
|
||||
|
||||
PikaObj* pika_lvgl_scr_act(PikaObj* self) {
|
||||
PikaObj* new_obj = newNormalObj(New_TinyObj);
|
||||
lv_obj_t* lv_obj = lv_scr_act();
|
||||
obj_setPtr(new_obj, "lv_obj", lv_obj);
|
||||
return new_obj;
|
||||
}
|
||||
|
||||
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");
|
||||
obj_newDirectObj(self, "ALIGN", New_TinyObj);
|
||||
obj_setInt(self, "ALIGN.CENTER", LV_ALIGN_CENTER);
|
||||
obj_setInt(self, "ALIGN.DEFAULT", LV_ALIGN_DEFAULT);
|
||||
obj_setInt(self, "ALIGN.TOP_LEFT", LV_ALIGN_TOP_LEFT);
|
||||
obj_setInt(self, "ALIGN.TOP_MID", LV_ALIGN_TOP_MID);
|
||||
obj_setInt(self, "ALIGN.TOP_RIGHT", LV_ALIGN_TOP_RIGHT);
|
||||
obj_setInt(self, "ALIGN.BOTTOM_LEFT", LV_ALIGN_BOTTOM_LEFT);
|
||||
obj_setInt(self, "ALIGN.BOTTOM_MID", LV_ALIGN_BOTTOM_MID);
|
||||
obj_setInt(self, "ALIGN.BOTTOM_RIGHT", LV_ALIGN_BOTTOM_RIGHT);
|
||||
obj_setInt(self, "ALIGN.LEFT_MID", LV_ALIGN_LEFT_MID);
|
||||
obj_setInt(self, "ALIGN.RIGHT_MID", LV_ALIGN_RIGHT_MID);
|
||||
obj_setInt(self, "ALIGN.OUT_TOP_LEFT", LV_ALIGN_OUT_TOP_LEFT);
|
||||
obj_setInt(self, "ALIGN.OUT_TOP_MID", LV_ALIGN_OUT_TOP_MID);
|
||||
obj_setInt(self, "ALIGN.OUT_TOP_RIGHT", LV_ALIGN_OUT_TOP_RIGHT);
|
||||
obj_setInt(self, "ALIGN.OUT_BOTTOM_LEFT", LV_ALIGN_OUT_BOTTOM_LEFT);
|
||||
obj_setInt(self, "ALIGN.OUT_BOTTOM_MID", LV_ALIGN_OUT_BOTTOM_MID);
|
||||
obj_setInt(self, "ALIGN.OUT_BOTTOM_RIGHT", LV_ALIGN_OUT_BOTTOM_RIGHT);
|
||||
obj_setInt(self, "ALIGN.OUT_LEFT_TOP", LV_ALIGN_OUT_LEFT_TOP);
|
||||
obj_setInt(self, "ALIGN.OUT_LEFT_MID", LV_ALIGN_OUT_LEFT_MID);
|
||||
obj_setInt(self, "ALIGN.OUT_LEFT_BOTTOM", LV_ALIGN_OUT_LEFT_BOTTOM);
|
||||
obj_setInt(self, "ALIGN.OUT_RIGHT_TOP", LV_ALIGN_OUT_RIGHT_TOP);
|
||||
obj_setInt(self, "ALIGN.OUT_RIGHT_MID", LV_ALIGN_OUT_RIGHT_MID);
|
||||
obj_setInt(self, "ALIGN.OUT_RIGHT_BOTTOM", LV_ALIGN_OUT_RIGHT_BOTTOM);
|
||||
|
||||
obj_newDirectObj(self, "PALETTE", New_TinyObj);
|
||||
obj_setInt(self, "PALETTE.RED", LV_PALETTE_RED);
|
||||
obj_setInt(self, "PALETTE.PINK", LV_PALETTE_PINK);
|
||||
obj_setInt(self, "PALETTE.PURPLE", LV_PALETTE_PURPLE);
|
||||
obj_setInt(self, "PALETTE.DEEP_PURPLE", LV_PALETTE_DEEP_PURPLE);
|
||||
obj_setInt(self, "PALETTE.INDIGO", LV_PALETTE_INDIGO);
|
||||
obj_setInt(self, "PALETTE.BLUE", LV_PALETTE_BLUE);
|
||||
obj_setInt(self, "PALETTE.LIGHT_BLUE", LV_PALETTE_LIGHT_BLUE);
|
||||
obj_setInt(self, "PALETTE.CYAN", LV_PALETTE_CYAN);
|
||||
obj_setInt(self, "PALETTE.TEAL", LV_PALETTE_TEAL);
|
||||
obj_setInt(self, "PALETTE.GREEN", LV_PALETTE_GREEN);
|
||||
obj_setInt(self, "PALETTE.LIGHT_GREEN", LV_PALETTE_LIGHT_GREEN);
|
||||
obj_setInt(self, "PALETTE.LIME", LV_PALETTE_LIME);
|
||||
obj_setInt(self, "PALETTE.YELLOW", LV_PALETTE_YELLOW);
|
||||
obj_setInt(self, "PALETTE.AMBER", LV_PALETTE_AMBER);
|
||||
obj_setInt(self, "PALETTE.ORANGE", LV_PALETTE_ORANGE);
|
||||
obj_setInt(self, "PALETTE.DEEP_ORANGE", LV_PALETTE_DEEP_ORANGE);
|
||||
obj_setInt(self, "PALETTE.BROWN", LV_PALETTE_BROWN);
|
||||
obj_setInt(self, "PALETTE.BLUE_GREY", LV_PALETTE_BLUE_GREY);
|
||||
obj_setInt(self, "PALETTE.GREY", LV_PALETTE_GREY);
|
||||
obj_setInt(self, "PALETTE.NONE", LV_PALETTE_NONE);
|
||||
|
||||
obj_newDirectObj(self, "ANIM", New_TinyObj);
|
||||
obj_setInt(self, "ANIM.ON", LV_ANIM_OFF);
|
||||
obj_setInt(self, "ANIM.OFF", LV_ANIM_ON);
|
||||
|
||||
obj_newDirectObj(self, "STATE", New_TinyObj);
|
||||
obj_setInt(self, "STATE.DEFAULT", LV_STATE_DEFAULT);
|
||||
obj_setInt(self, "STATE.CHECKED", LV_STATE_CHECKED);
|
||||
obj_setInt(self, "STATE.FOCUSED", LV_STATE_FOCUSED);
|
||||
obj_setInt(self, "STATE.FOCUS_KEY", LV_STATE_FOCUS_KEY);
|
||||
obj_setInt(self, "STATE.EDITED", LV_STATE_EDITED);
|
||||
obj_setInt(self, "STATE.HOVERED", LV_STATE_HOVERED);
|
||||
obj_setInt(self, "STATE.PRESSED", LV_STATE_PRESSED);
|
||||
obj_setInt(self, "STATE.SCROLLED", LV_STATE_SCROLLED);
|
||||
obj_setInt(self, "STATE.DISABLED", LV_STATE_DISABLED);
|
||||
obj_setInt(self, "STATE.USER_1", LV_STATE_USER_1);
|
||||
obj_setInt(self, "STATE.USER_2", LV_STATE_USER_2);
|
||||
obj_setInt(self, "STATE.USER_3", LV_STATE_USER_3);
|
||||
obj_setInt(self, "STATE.USER_4", LV_STATE_USER_4);
|
||||
obj_setInt(self, "STATE.ANY", LV_STATE_ANY);
|
||||
|
||||
obj_newDirectObj(self, "EVENT", New_TinyObj);
|
||||
obj_setInt(self, "EVENT.ALL", LV_EVENT_ALL);
|
||||
obj_setInt(self, "EVENT.PRESSED", LV_EVENT_PRESSED);
|
||||
obj_setInt(self, "EVENT.PRESSING", LV_EVENT_PRESSING);
|
||||
obj_setInt(self, "EVENT.PRESS_LOST", LV_EVENT_PRESS_LOST);
|
||||
obj_setInt(self, "EVENT.SHORT_CLICKED", LV_EVENT_SHORT_CLICKED);
|
||||
obj_setInt(self, "EVENT.LONG_PRESSED", LV_EVENT_LONG_PRESSED);
|
||||
obj_setInt(self, "EVENT.LONG_PRESSED_REPEAT", LV_EVENT_LONG_PRESSED_REPEAT);
|
||||
obj_setInt(self, "EVENT.CLICKED", LV_EVENT_CLICKED);
|
||||
obj_setInt(self, "EVENT.RELEASED", LV_EVENT_RELEASED);
|
||||
obj_setInt(self, "EVENT.SCROLL_BEGIN", LV_EVENT_SCROLL_BEGIN);
|
||||
obj_setInt(self, "EVENT.SCROLL_END", LV_EVENT_SCROLL_END);
|
||||
obj_setInt(self, "EVENT.SCROLL", LV_EVENT_SCROLL);
|
||||
obj_setInt(self, "EVENT.GESTURE", LV_EVENT_GESTURE);
|
||||
obj_setInt(self, "EVENT.KEY", LV_EVENT_KEY);
|
||||
obj_setInt(self, "EVENT.FOCUSED", LV_EVENT_FOCUSED);
|
||||
obj_setInt(self, "EVENT.DEFOCUSED", LV_EVENT_DEFOCUSED);
|
||||
obj_setInt(self, "EVENT.LEAVE", LV_EVENT_LEAVE);
|
||||
obj_setInt(self, "EVENT.HIT_TEST", LV_EVENT_HIT_TEST);
|
||||
obj_setInt(self, "EVENT.COVER_CHECK", LV_EVENT_COVER_CHECK);
|
||||
obj_setInt(self, "EVENT.REFR_EXT_DRAW_SIZE", LV_EVENT_REFR_EXT_DRAW_SIZE);
|
||||
obj_setInt(self, "EVENT.DRAW_MAIN_BEGIN", LV_EVENT_DRAW_MAIN_BEGIN);
|
||||
obj_setInt(self, "EVENT.DRAW_MAIN", LV_EVENT_DRAW_MAIN);
|
||||
obj_setInt(self, "EVENT.DRAW_MAIN_END", LV_EVENT_DRAW_MAIN_END);
|
||||
obj_setInt(self, "EVENT.DRAW_POST_BEGIN", LV_EVENT_DRAW_POST_BEGIN);
|
||||
obj_setInt(self, "EVENT.DRAW_POST", LV_EVENT_DRAW_POST);
|
||||
obj_setInt(self, "EVENT.DRAW_POST_END", LV_EVENT_DRAW_POST_END);
|
||||
obj_setInt(self, "EVENT.DRAW_PART_BEGIN", LV_EVENT_DRAW_PART_BEGIN);
|
||||
obj_setInt(self, "EVENT.DRAW_PART_END", LV_EVENT_DRAW_PART_END);
|
||||
obj_setInt(self, "EVENT.VALUE_CHANGED", LV_EVENT_VALUE_CHANGED);
|
||||
obj_setInt(self, "EVENT.INSERT", LV_EVENT_INSERT);
|
||||
obj_setInt(self, "EVENT.REFRESH", LV_EVENT_REFRESH);
|
||||
obj_setInt(self, "EVENT.READY", LV_EVENT_READY);
|
||||
obj_setInt(self, "EVENT.CANCEL", LV_EVENT_CANCEL);
|
||||
obj_setInt(self, "EVENT.DELETE", LV_EVENT_DELETE);
|
||||
obj_setInt(self, "EVENT.CHILD_CHANGED", LV_EVENT_CHILD_CHANGED);
|
||||
obj_setInt(self, "EVENT.CHILD_CREATED", LV_EVENT_CHILD_CREATED);
|
||||
obj_setInt(self, "EVENT.CHILD_DELETED", LV_EVENT_CHILD_DELETED);
|
||||
obj_setInt(self, "EVENT.SCREEN_UNLOAD_START", LV_EVENT_SCREEN_UNLOAD_START);
|
||||
obj_setInt(self, "EVENT.SCREEN_LOAD_START", LV_EVENT_SCREEN_LOAD_START);
|
||||
obj_setInt(self, "EVENT.SCREEN_LOADED", LV_EVENT_SCREEN_LOADED);
|
||||
obj_setInt(self, "EVENT.SCREEN_UNLOADED", LV_EVENT_SCREEN_UNLOADED);
|
||||
obj_setInt(self, "EVENT.SIZE_CHANGED", LV_EVENT_SIZE_CHANGED);
|
||||
obj_setInt(self, "EVENT.STYLE_CHANGED", LV_EVENT_STYLE_CHANGED);
|
||||
obj_setInt(self, "EVENT.LAYOUT_CHANGED", LV_EVENT_LAYOUT_CHANGED);
|
||||
obj_setInt(self, "EVENT.GET_SELF_SIZE", LV_EVENT_GET_SELF_SIZE);
|
||||
obj_setInt(self, "EVENT.PREPROCESS", LV_EVENT_PREPROCESS);
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
185
package/pika_lvgl/pika_lvgl.pyi
Normal file
185
package/pika_lvgl/pika_lvgl.pyi
Normal file
@ -0,0 +1,185 @@
|
||||
from PikaObj import *
|
||||
|
||||
|
||||
def __init__(): ...
|
||||
|
||||
|
||||
class EVENT:
|
||||
ALL: int
|
||||
PRESSED: int
|
||||
PRESSING: int
|
||||
PRESS_LOST: int
|
||||
SHORT_CLICKED: int
|
||||
LONG_PRESSED: int
|
||||
LONG_PRESSED_REPEAT: int
|
||||
CLICKED: int
|
||||
RELEASED: int
|
||||
SCROLL_BEGIN: int
|
||||
SCROLL_END: int
|
||||
SCROLL: int
|
||||
GESTURE: int
|
||||
KEY: int
|
||||
FOCUSED: int
|
||||
DEFOCUSED: int
|
||||
LEAVE: int
|
||||
HIT_TEST: int
|
||||
COVER_CHECK: int
|
||||
REFR_EXT_DRAW_SIZE: int
|
||||
DRAW_MAIN_BEGIN: int
|
||||
DRAW_MAIN: int
|
||||
DRAW_MAIN_END: int
|
||||
DRAW_POST_BEGIN: int
|
||||
DRAW_POST: int
|
||||
DRAW_POST_END: int
|
||||
DRAW_PART_BEGIN: int
|
||||
DRAW_PART_END: int
|
||||
VALUE_CHANGED: int
|
||||
INSERT: int
|
||||
REFRESH: int
|
||||
READY: int
|
||||
CANCEL: int
|
||||
DELETE: int
|
||||
CHILD_CHANGED: int
|
||||
CHILD_CREATED: int
|
||||
CHILD_DELETED: int
|
||||
SCREEN_UNLOAD_START: int
|
||||
SCREEN_LOAD_START: int
|
||||
SCREEN_LOADED: int
|
||||
SCREEN_UNLOADED: int
|
||||
SIZE_CHANGED: int
|
||||
STYLE_CHANGED: int
|
||||
LAYOUT_CHANGED: int
|
||||
GET_SELF_SIZE: int
|
||||
PREPROCESS: int
|
||||
|
||||
|
||||
class ALIGN:
|
||||
DEFAULT: int
|
||||
TOP_LEFT: int
|
||||
TOP_MID: int
|
||||
TOP_RIGHT: int
|
||||
BOTTOM_LEFT: int
|
||||
BOTTOM_MID: int
|
||||
BOTTOM_RIGHT: int
|
||||
LEFT_MID: int
|
||||
RIGHT_MID: int
|
||||
CENTER: int
|
||||
OUT_TOP_LEFT: int
|
||||
OUT_TOP_MID: int
|
||||
OUT_TOP_RIGHT: int
|
||||
OUT_BOTTOM_LEFT: int
|
||||
OUT_BOTTOM_MID: int
|
||||
OUT_BOTTOM_RIGHT: int
|
||||
OUT_LEFT_TOP: int
|
||||
OUT_LEFT_MID: int
|
||||
OUT_LEFT_BOTTOM: int
|
||||
OUT_RIGHT_TOP: int
|
||||
OUT_RIGHT_MID: int
|
||||
OUT_RIGHT_BOTTOM: int
|
||||
|
||||
|
||||
class PALETTE:
|
||||
RED: int
|
||||
PINK: int
|
||||
PURPLE: int
|
||||
DEEP_PURPLE: int
|
||||
INDIGO: int
|
||||
BLUE: int
|
||||
LIGHT_BLUE: int
|
||||
CYAN: int
|
||||
TEAL: int
|
||||
GREEN: int
|
||||
LIGHT_GREEN: int
|
||||
LIME: int
|
||||
YELLOW: int
|
||||
AMBER: int
|
||||
ORANGE: int
|
||||
DEEP_ORANGE: int
|
||||
BROWN: int
|
||||
BLUE_GREY: int
|
||||
GREY: int
|
||||
NONE: int
|
||||
|
||||
|
||||
class ANIM:
|
||||
OFF: int
|
||||
ON: int
|
||||
|
||||
|
||||
class lv_event(TinyObj):
|
||||
def get_code(self) -> int: ...
|
||||
|
||||
|
||||
class lv_obj(TinyObj):
|
||||
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 update_layout(self): ...
|
||||
def set_width(self, w: int): ...
|
||||
def add_state(self, state: int): ...
|
||||
def add_event_cb(self, event_cb: any, filter: int, user_data: pointer): ...
|
||||
|
||||
|
||||
def obj(parent: lv_obj) -> lv_obj: ...
|
||||
|
||||
|
||||
class arc(lv_obj):
|
||||
def __init__(self, parent: lv_obj): ...
|
||||
def set_end_angle(self, angle: int): ...
|
||||
def set_bg_angles(self, start: int, end: int): ...
|
||||
def set_angles(self, start: int, end: int): ...
|
||||
|
||||
|
||||
class bar(lv_obj):
|
||||
def __init__(self, parent: lv_obj): ...
|
||||
def set_value(self, value: int, anim: 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): ...
|
||||
|
||||
|
||||
class dropdown(lv_obj):
|
||||
def __init__(self, parent: lv_obj): ...
|
||||
def set_options(self, options: str): ...
|
||||
|
||||
|
||||
class label(lv_obj):
|
||||
def __init__(self, parent: lv_obj): ...
|
||||
def set_text(self, txt: str): ...
|
||||
def set_long_mode(self, mode: int): ...
|
||||
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: ...
|
26
package/pika_lvgl/pika_lvgl_arc.c
Normal file
26
package/pika_lvgl/pika_lvgl_arc.c
Normal file
@ -0,0 +1,26 @@
|
||||
#include "pika_lvgl_arc.h"
|
||||
#include "BaseObj.h"
|
||||
#include "lvgl.h"
|
||||
#include "pika_lvgl.h"
|
||||
#include "pika_lvgl_lv_obj.h"
|
||||
|
||||
void pika_lvgl_arc___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
|
||||
lv_obj_t* lv_obj = lv_arc_create(lv_parent);
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_arc_set_end_angle(PikaObj* self, int angle) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_arc_set_end_angle(lv_obj, angle);
|
||||
}
|
||||
|
||||
void pika_lvgl_arc_set_bg_angles(PikaObj* self, int end, int start) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_arc_set_bg_angles(lv_obj, start, end);
|
||||
}
|
||||
|
||||
void pika_lvgl_arc_set_angles(PikaObj* self, int end, int start) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_arc_set_angles(lv_obj, start, end);
|
||||
}
|
13
package/pika_lvgl/pika_lvgl_bar.c
Normal file
13
package/pika_lvgl/pika_lvgl_bar.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include "pika_lvgl_bar.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
void pika_lvgl_bar___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
|
||||
lv_obj_t* lv_obj = lv_bar_create(lv_parent);
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_bar_set_value(PikaObj* self, int anim, int value) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_bar_set_value(lv_obj, value, value);
|
||||
}
|
8
package/pika_lvgl/pika_lvgl_btn.c
Normal file
8
package/pika_lvgl/pika_lvgl_btn.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include "pika_lvgl_btn.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
void pika_lvgl_btn___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
|
||||
lv_obj_t* lv_obj = lv_btn_create(lv_parent);
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
13
package/pika_lvgl/pika_lvgl_checkbox.c
Normal file
13
package/pika_lvgl/pika_lvgl_checkbox.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include "pika_lvgl_checkbox.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
void pika_lvgl_checkbox___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
|
||||
lv_obj_t* lv_obj = lv_checkbox_create(lv_parent);
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_checkbox_set_text(PikaObj *self, char* txt){
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_checkbox_set_text(lv_obj, txt);
|
||||
}
|
13
package/pika_lvgl/pika_lvgl_dropdown.c
Normal file
13
package/pika_lvgl/pika_lvgl_dropdown.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include "pika_lvgl_dropdown.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
void pika_lvgl_dropdown___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
|
||||
lv_obj_t* lv_obj = lv_dropdown_create(lv_parent);
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_dropdown_set_options(PikaObj* self, char* options) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_dropdown_set_options(lv_obj, options);
|
||||
}
|
30
package/pika_lvgl/pika_lvgl_label.c
Normal file
30
package/pika_lvgl/pika_lvgl_label.c
Normal file
@ -0,0 +1,30 @@
|
||||
#include "pika_lvgl_label.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
void pika_lvgl_label___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
|
||||
lv_obj_t* lv_obj = lv_label_create(lv_parent);
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_label_set_long_mode(PikaObj* self, int mode) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_label_set_long_mode(lv_obj, mode);
|
||||
}
|
||||
|
||||
void pika_lvgl_label_set_recolor(PikaObj* self, int en) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_label_set_recolor(lv_obj, en);
|
||||
}
|
||||
|
||||
void pika_lvgl_label_set_text(PikaObj* self, char* txt) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_label_set_text(lv_obj, txt);
|
||||
}
|
||||
|
||||
void pika_lvgl_label_set_style_text_align(PikaObj* self,
|
||||
int selector,
|
||||
int value) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_obj_set_style_text_align(lv_obj, value, selector);
|
||||
}
|
8
package/pika_lvgl/pika_lvgl_lv_event.c
Normal file
8
package/pika_lvgl/pika_lvgl_lv_event.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include "lvgl.h"
|
||||
#include "pika_lvgl_lv_event.h"
|
||||
|
||||
int pika_lvgl_lv_event_get_code(PikaObj *self){
|
||||
lv_event_t *lv_event = obj_getPtr(self, "lv_event");
|
||||
return lv_event_get_code(lv_event);
|
||||
}
|
||||
|
93
package/pika_lvgl/pika_lvgl_lv_obj.c
Normal file
93
package/pika_lvgl/pika_lvgl_lv_obj.c
Normal file
@ -0,0 +1,93 @@
|
||||
#include "pika_lvgl_lv_obj.h"
|
||||
#include "BaseObj.h"
|
||||
#include "dataStrs.h"
|
||||
#include "lvgl.h"
|
||||
#include "pika_lvgl.h"
|
||||
#include "pika_lvgl_arc.h"
|
||||
#include "pika_lvgl_lv_event.h"
|
||||
|
||||
extern PikaObj* pika_lv_event_listener_g;
|
||||
|
||||
void pika_lvgl_lv_obj_center(PikaObj* self) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_obj_center(lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_lv_obj_set_size(PikaObj* self, int size_x, int size_y) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_obj_set_size(lv_obj, size_x, size_y);
|
||||
}
|
||||
|
||||
void pika_lvgl_lv_obj_align(PikaObj* self, int align, int x_ofs, int y_ofs) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_obj_align(lv_obj, align, x_ofs, y_ofs);
|
||||
}
|
||||
|
||||
void pika_lvgl_lv_obj_set_hight(PikaObj* self, int h) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_obj_set_height(lv_obj, h);
|
||||
}
|
||||
|
||||
void pika_lvgl_lv_obj_update_layout(PikaObj* self) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_obj_update_layout(lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_lv_obj_set_width(PikaObj* self, int w) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_obj_set_width(lv_obj, w);
|
||||
}
|
||||
|
||||
void pika_lvgl_lv_obj_add_state(PikaObj* self, int state) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_obj_add_state(lv_obj, state);
|
||||
}
|
||||
|
||||
PikaObj* eventLisener_getHandler(PikaObj* self, uintptr_t event_id) {
|
||||
Args buffs = {0};
|
||||
char* event_name =
|
||||
strsFormat(&buffs, PIKA_SPRINTF_BUFF_SIZE, "%d", event_id);
|
||||
PikaObj* event_item = obj_getObj(self, event_name);
|
||||
PikaObj* event_handler = obj_getPtr(event_item, "handler");
|
||||
strsDeinit(&buffs);
|
||||
return event_handler;
|
||||
}
|
||||
|
||||
extern PikaObj* __pikaMain;
|
||||
static void __pika_event_cb(lv_event_t* e) {
|
||||
lv_obj_t* target = lv_event_get_target(e);
|
||||
PikaObj* event_handler =
|
||||
eventLisener_getHandler(pika_lv_event_listener_g, (uintptr_t)target);
|
||||
PikaObj* evt = obj_getObj(event_handler, "_event_evt");
|
||||
obj_setPtr(evt, "lv_event", e);
|
||||
obj_setArg(__pikaMain, "_event_cb", obj_getArg(event_handler, "_event_cb"));
|
||||
obj_setArg(__pikaMain, "_event_evt",
|
||||
obj_getArg(event_handler, "_event_evt"));
|
||||
obj_run(__pikaMain, "_event_cb(_event_evt)");
|
||||
obj_removeArg(__pikaMain, "_event_cb");
|
||||
obj_removeArg(__pikaMain, "_event_evt");
|
||||
}
|
||||
|
||||
void eventLicener_registEvent(PikaObj* self,
|
||||
uintptr_t event_id,
|
||||
PikaObj* event_handler) {
|
||||
Args buffs = {0};
|
||||
char* event_name =
|
||||
strsFormat(&buffs, PIKA_SPRINTF_BUFF_SIZE, "%d", event_id);
|
||||
obj_newDirectObj(self, event_name, New_TinyObj);
|
||||
PikaObj* event_item = obj_getObj(self, event_name);
|
||||
obj_setRef(event_item, "handler", event_handler);
|
||||
strsDeinit(&buffs);
|
||||
}
|
||||
|
||||
void pika_lvgl_lv_obj_add_event_cb(PikaObj* self,
|
||||
Arg* event_cb,
|
||||
int filter,
|
||||
void* user_data) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_obj_add_event_cb(lv_obj, __pika_event_cb, filter, NULL);
|
||||
obj_setArg(self, "_event_cb", event_cb);
|
||||
obj_setPtr(self, "_event_user_data", user_data);
|
||||
obj_newDirectObj(self, "_event_evt", New_pika_lvgl_lv_event);
|
||||
eventLicener_registEvent(pika_lv_event_listener_g, (uintptr_t)lv_obj, self);
|
||||
}
|
18
package/pika_lvgl/pika_lvgl_roller.c
Normal file
18
package/pika_lvgl/pika_lvgl_roller.c
Normal file
@ -0,0 +1,18 @@
|
||||
#include "pika_lvgl_roller.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
void pika_lvgl_roller___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
|
||||
lv_obj_t* lv_obj = lv_roller_create(lv_parent);
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_roller_set_options(PikaObj* self, int mode, char* options) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_roller_set_options(lv_obj, options, mode);
|
||||
}
|
||||
|
||||
void pika_lvgl_roller_set_visible_row_count(PikaObj* self, int row_cnt) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_roller_set_visible_row_count(lv_obj, row_cnt);
|
||||
}
|
8
package/pika_lvgl/pika_lvgl_slider.c
Normal file
8
package/pika_lvgl/pika_lvgl_slider.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include "pika_lvgl_slider.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
void pika_lvgl_slider___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
|
||||
lv_obj_t* lv_obj = lv_slider_create(lv_parent);
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
8
package/pika_lvgl/pika_lvgl_switch.c
Normal file
8
package/pika_lvgl/pika_lvgl_switch.c
Normal file
@ -0,0 +1,8 @@
|
||||
#include "pika_lvgl_switch.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
void pika_lvgl_switch___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
|
||||
lv_obj_t* lv_obj = lv_switch_create(lv_parent);
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
16
package/pika_lvgl/pika_lvgl_table.c
Normal file
16
package/pika_lvgl/pika_lvgl_table.c
Normal file
@ -0,0 +1,16 @@
|
||||
#include "pika_lvgl_table.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
void pika_lvgl_table___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
|
||||
lv_obj_t* lv_obj = lv_table_create(lv_parent);
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_table_set_cell_value(PikaObj* self,
|
||||
int col,
|
||||
int row,
|
||||
char* txt) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_table_set_cell_value(lv_obj, row, col, txt);
|
||||
}
|
13
package/pika_lvgl/pika_lvgl_textarea.c
Normal file
13
package/pika_lvgl/pika_lvgl_textarea.c
Normal file
@ -0,0 +1,13 @@
|
||||
#include "pika_lvgl_textarea.h"
|
||||
#include "lvgl.h"
|
||||
|
||||
void pika_lvgl_textarea___init__(PikaObj* self, PikaObj* parent) {
|
||||
lv_obj_t* lv_parent = obj_getPtr(parent, "lv_obj");
|
||||
lv_obj_t* lv_obj = lv_textarea_create(lv_parent);
|
||||
obj_setPtr(self, "lv_obj", lv_obj);
|
||||
}
|
||||
|
||||
void pika_lvgl_textarea_set_one_line(PikaObj* self, int en) {
|
||||
lv_obj_t* lv_obj = obj_getPtr(self, "lv_obj");
|
||||
lv_textarea_set_one_line(lv_obj, en);
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user