mirror of
https://github.com/zlgopen/awtk.git
synced 2025-05-08 19:44:45 +08:00
support load ui from xml/bin ui description
This commit is contained in:
parent
998ce389b1
commit
9a0590ba59
@ -27,7 +27,7 @@ elif os.name == 'nt':
|
||||
os.environ['LFTK_ROOT'] = LFTK_ROOT;
|
||||
os.environ['GTEST_ROOT'] = GTEST_ROOT;
|
||||
|
||||
DefaultEnvironment(CCFLAGS = OS_FLAGS + ' -DLFTK_ROOT=\\\"'+LFTK_ROOT+'\\\"',
|
||||
DefaultEnvironment(CCFLAGS = OS_FLAGS + ' -DLFTK_ROOT=\\\"'+LFTK_ROOT+'\\\" -DHAS_STD_MALLOC',
|
||||
CPPPATH = [LFTK_ROOT, LFTK_SRC, LFTK_3RD_ROOT, LFTK_TOOLS_ROOT,
|
||||
] + OS_CPPPATH,
|
||||
LIBS=['lftk_base', 'main_loop', 'lcd', 'platform', 'SDL2'] + OS_LIBS,
|
||||
@ -59,12 +59,12 @@ SConscript([
|
||||
'src/font/SConscript',
|
||||
'src/ui_loader/SConscript',
|
||||
'src/image_loader/SConscript',
|
||||
'demos/SConscript',
|
||||
'tools/common/SConscript',
|
||||
'tools/theme_gen/SConscript',
|
||||
'tools/font_gen/SConscript',
|
||||
'tools/image_gen/SConscript',
|
||||
'tools/ui_gen/SConscript',
|
||||
'demos/SConscript',
|
||||
'tests/SConscript',
|
||||
'3rd/lua/SConscript',
|
||||
'lua/SConscript'
|
||||
|
@ -76,7 +76,8 @@ static ret_t on_cancel(void* ctx, event_t* e) {
|
||||
|
||||
static ret_t on_show_dialog(void* ctx, event_t* e) {
|
||||
uint32_t code = 0;
|
||||
widget_t* win = window_open("dialog1");
|
||||
const char* name = (const char*)ctx;
|
||||
widget_t* win = window_open(name);
|
||||
|
||||
widget_child_on(win, "ok", EVT_CLICK, on_ok, win);
|
||||
widget_child_on(win, "cancel", EVT_CLICK, on_cancel, win);
|
||||
@ -95,7 +96,8 @@ ret_t application_init() {
|
||||
widget_t* progress_bar = widget_lookup(win, "bar1", TRUE);
|
||||
widget_child_on(win, "inc", EVT_CLICK, on_inc, progress_bar);
|
||||
widget_child_on(win, "dec", EVT_CLICK, on_dec, progress_bar);
|
||||
widget_child_on(win, "dialog", EVT_CLICK, on_show_dialog, NULL);
|
||||
widget_child_on(win, "dialog", EVT_CLICK, on_show_dialog, "dialog1");
|
||||
widget_child_on(win, "dialog2", EVT_CLICK, on_show_dialog, "dialog2");
|
||||
timer_add(on_timer, widget_lookup(win, "bar2", TRUE), 500);
|
||||
|
||||
return RET_OK;
|
||||
|
@ -1,12 +1,13 @@
|
||||
const unsigned char ui_dialog1[] = {
|
||||
0x07,0x00,0x00,0x00,0xba,0x00,0x00,0x00,0x64,0x69,0x61,0x6c,0x6f,0x67,0x31,0x00,0x64,0x61,0x74,0x61,
|
||||
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x04,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x78,0x00,0x00,0x00,
|
||||
0x2c,0x01,0x00,0x00,0xf0,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x00,0x69,0x63,0x6f,0x6e,0x00,0x69,
|
||||
0x6e,0x66,0x6f,0x00,0x74,0x65,0x78,0x74,0x00,0x44,0x69,0x61,0x6c,0x6f,0x67,0x00,0x00,0x0a,0x00,0x00,
|
||||
0x00,0x3c,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,
|
||||
0x65,0x00,0x6f,0x6b,0x00,0x74,0x65,0x78,0x74,0x00,0x47,0x6f,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0xc8,
|
||||
0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,
|
||||
0x63,0x61,0x6e,0x63,0x65,0x6c,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x61,0x6e,0x63,0x65,0x6c,0x00,0x00,
|
||||
0x00,0x09,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x1e,0x00,0x00,
|
||||
0x00,0x6e,0x61,0x6d,0x65,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x41,0x72,0x65,0x20,0x79,0x6f,0x75,0x20,
|
||||
0x72,0x65,0x61,0x64,0x79,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
|
||||
0x07,0x00,0x00,0x00,0xca,0x00,0x00,0x00,0x64,0x69,0x61,0x6c,0x6f,0x67,0x31,0x00,0x64,0x61,0x74,0x61,
|
||||
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x01,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,
|
||||
0x78,0x00,0x00,0x00,0x2c,0x01,0x00,0x00,0xf0,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x00,0x69,0x63,
|
||||
0x6f,0x6e,0x00,0x69,0x6e,0x66,0x6f,0x00,0x74,0x65,0x78,0x74,0x00,0x44,0x69,0x61,0x6c,0x6f,0x67,0x00,
|
||||
0x00,0x01,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0x3c,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0x50,0x00,0x00,
|
||||
0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6f,0x6b,0x00,0x74,0x65,0x78,0x74,0x00,0x47,0x6f,
|
||||
0x00,0x00,0x00,0x01,0x00,0x0a,0x00,0x00,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0xa0,0x00,0x00,0x00,0x50,
|
||||
0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x61,0x6e,0x63,0x65,0x6c,0x00,0x74,
|
||||
0x65,0x78,0x74,0x00,0x43,0x61,0x6e,0x63,0x65,0x6c,0x00,0x00,0x00,0x01,0x00,0x09,0x00,0x00,0x00,0x00,
|
||||
0x00,0x0a,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,
|
||||
0x65,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x41,0x72,0x65,0x20,0x79,0x6f,0x75,0x20,0x72,0x65,0x61,0x64,
|
||||
0x79,0x21,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
|
||||
|
13
demos/res/ui/dialog2.data
Normal file
13
demos/res/ui/dialog2.data
Normal file
@ -0,0 +1,13 @@
|
||||
const unsigned char ui_dialog2[] = {
|
||||
0x07,0x00,0x00,0x00,0xc9,0x00,0x00,0x00,0x64,0x69,0x61,0x6c,0x6f,0x67,0x32,0x00,0x64,0x61,0x74,0x61,
|
||||
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x01,0x00,0x04,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,
|
||||
0x78,0x00,0x00,0x00,0x2c,0x01,0x00,0x00,0xf0,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x00,0x69,0x63,
|
||||
0x6f,0x6e,0x00,0x69,0x6e,0x66,0x6f,0x00,0x74,0x65,0x78,0x74,0x00,0x44,0x69,0x61,0x6c,0x6f,0x67,0x00,
|
||||
0x00,0x01,0x00,0x09,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0xc8,0x00,0x00,
|
||||
0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x4c,0x46,0x54,0x4b,
|
||||
0x20,0x69,0x73,0x20,0x63,0x6f,0x6f,0x6c,0x21,0x00,0x00,0x00,0x01,0x00,0x0a,0x00,0x00,0x03,0x01,0x00,
|
||||
0x0a,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,
|
||||
0x00,0x6f,0x6b,0x00,0x74,0x65,0x78,0x74,0x00,0x47,0x6f,0x00,0x00,0x00,0x01,0x00,0x0a,0x00,0x03,0x03,
|
||||
0x01,0x00,0x0a,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,
|
||||
0x6d,0x65,0x00,0x63,0x61,0x6e,0x63,0x65,0x6c,0x00,0x74,0x65,0x78,0x74,0x00,0x43,0x61,0x6e,0x63,0x65,
|
||||
0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
|
@ -1,32 +1,38 @@
|
||||
const unsigned char ui_window1[] = {
|
||||
0x07,0x00,0x00,0x00,0x4e,0x02,0x00,0x00,0x77,0x69,0x6e,0x64,0x6f,0x77,0x31,0x00,0x64,0x61,0x74,0x61,
|
||||
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x40,0x01,0x00,0x00,0xe0,0x01,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6d,0x61,0x69,0x6e,0x00,0x00,0x0a,
|
||||
0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,
|
||||
0x61,0x6d,0x65,0x00,0x69,0x6e,0x63,0x00,0x74,0x65,0x78,0x74,0x00,0x49,0x6e,0x63,0x00,0x00,0x00,0x0a,
|
||||
0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,
|
||||
0x61,0x6d,0x65,0x00,0x64,0x65,0x63,0x00,0x74,0x65,0x78,0x74,0x00,0x44,0x65,0x63,0x00,0x00,0x00,0x0a,
|
||||
0x00,0x00,0x00,0xbe,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,
|
||||
0x61,0x6d,0x65,0x00,0x64,0x69,0x61,0x6c,0x6f,0x67,0x00,0x74,0x65,0x78,0x74,0x00,0x44,0x69,0x61,0x6c,
|
||||
0x6f,0x67,0x00,0x00,0x00,0x0b,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0xe6,0x00,0x00,0x00,0x64,0x00,0x00,
|
||||
0x00,0x64,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x69,0x6d,0x67,0x00,0x00,0x00,0x09,0x00,0x00,0x00,
|
||||
0x0a,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,
|
||||
0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x4c,0x65,0x66,0x74,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0x64,0x00,
|
||||
0x00,0x00,0x28,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x00,
|
||||
0x74,0x65,0x78,0x74,0x00,0x43,0x65,0x6e,0x74,0x65,0x72,0x00,0x00,0x00,0x09,0x00,0x00,0x00,0xc8,0x00,
|
||||
0x00,0x00,0x28,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x00,
|
||||
0x74,0x65,0x78,0x74,0x00,0x52,0x69,0x67,0x68,0x74,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x0a,0x00,0x00,
|
||||
0x00,0x50,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x62,0x61,
|
||||
0x72,0x31,0x00,0x00,0x00,0x0d,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,
|
||||
0x00,0x76,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x62,0x61,0x72,0x32,0x00,0x76,0x65,0x72,0x74,0x69,
|
||||
0x63,0x61,0x6c,0x00,0x74,0x72,0x75,0x65,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x96,
|
||||
0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x31,0x00,0x74,
|
||||
0x65,0x78,0x74,0x00,0x42,0x6f,0x6f,0x6b,0x00,0x00,0x00,0x0f,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x96,
|
||||
0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x32,0x00,0x74,
|
||||
0x65,0x78,0x74,0x00,0x46,0x6f,0x6f,0x64,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0xc8,
|
||||
0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x72,0x31,0x00,0x74,
|
||||
0x65,0x78,0x74,0x00,0x42,0x6f,0x6f,0x6b,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0xc8,
|
||||
0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x72,0x32,0x00,0x74,
|
||||
0x65,0x78,0x74,0x00,0x46,0x6f,0x6f,0x64,0x00,0x00,0x00,0x10,0x00,0x00,0x00,0xbe,0x00,0x00,0x00,0xc8,
|
||||
0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x72,0x33,0x00,0x74,
|
||||
0x65,0x78,0x74,0x00,0x50,0x65,0x6e,0x63,0x69,0x6c,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
|
||||
0x07,0x00,0x00,0x00,0xbe,0x02,0x00,0x00,0x77,0x69,0x6e,0x64,0x6f,0x77,0x31,0x00,0x64,0x61,0x74,0x61,
|
||||
0x00,0x00,0x00,0x00,0x12,0x12,0x22,0x11,0x01,0x00,0x02,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
|
||||
0x00,0x00,0x00,0x00,0x40,0x01,0x00,0x00,0xe0,0x01,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x6d,0x61,0x69,
|
||||
0x6e,0x00,0x00,0x01,0x00,0x0a,0x00,0x00,0x00,0x01,0x00,0x0a,0x00,0x00,0x00,0x05,0x00,0x00,0x00,0x28,
|
||||
0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x69,0x6e,0x63,0x00,0x74,0x65,0x78,0x74,
|
||||
0x00,0x49,0x6e,0x63,0x00,0x00,0x00,0x01,0x00,0x0a,0x00,0x03,0x00,0x01,0x00,0x0a,0x00,0x00,0x00,0x05,
|
||||
0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x64,0x65,0x63,0x00,
|
||||
0x74,0x65,0x78,0x74,0x00,0x44,0x65,0x63,0x00,0x00,0x00,0x01,0x00,0x0b,0x00,0x00,0x00,0x00,0x00,0x0a,
|
||||
0x00,0x00,0x00,0xe6,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,
|
||||
0x69,0x6d,0x67,0x00,0x00,0x00,0x01,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x28,0x00,
|
||||
0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x00,0x74,0x65,0x78,0x74,
|
||||
0x00,0x4c,0x65,0x66,0x74,0x00,0x00,0x00,0x01,0x00,0x09,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,
|
||||
0x28,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x00,0x74,0x65,
|
||||
0x78,0x74,0x00,0x43,0x65,0x6e,0x74,0x65,0x72,0x00,0x00,0x00,0x01,0x00,0x09,0x00,0x00,0x00,0x00,0x00,
|
||||
0xc8,0x00,0x00,0x00,0x28,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,
|
||||
0x00,0x00,0x74,0x65,0x78,0x74,0x00,0x52,0x69,0x67,0x68,0x74,0x00,0x00,0x00,0x01,0x00,0x0d,0x00,0x00,
|
||||
0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0xa8,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,
|
||||
0x61,0x6d,0x65,0x00,0x62,0x61,0x72,0x31,0x00,0x00,0x00,0x01,0x00,0x0d,0x00,0x00,0x00,0x00,0x00,0x04,
|
||||
0x01,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x76,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,
|
||||
0x62,0x61,0x72,0x32,0x00,0x76,0x65,0x72,0x74,0x69,0x63,0x61,0x6c,0x00,0x74,0x72,0x75,0x65,0x00,0x00,
|
||||
0x00,0x01,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,0x00,0x96,0x00,0x00,0x00,0x50,0x00,0x00,
|
||||
0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x31,0x00,0x74,0x65,0x78,0x74,0x00,0x42,0x6f,
|
||||
0x6f,0x6b,0x00,0x00,0x00,0x01,0x00,0x0f,0x00,0x00,0x00,0x00,0x00,0x64,0x00,0x00,0x00,0x96,0x00,0x00,
|
||||
0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x63,0x32,0x00,0x74,0x65,0x78,
|
||||
0x74,0x00,0x46,0x6f,0x6f,0x64,0x00,0x00,0x00,0x01,0x00,0x10,0x00,0x00,0x00,0x00,0x00,0x0a,0x00,0x00,
|
||||
0x00,0xc8,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x72,0x31,
|
||||
0x00,0x74,0x65,0x78,0x74,0x00,0x42,0x6f,0x6f,0x6b,0x00,0x00,0x00,0x01,0x00,0x10,0x00,0x00,0x00,0x00,
|
||||
0x00,0x64,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,
|
||||
0x65,0x00,0x72,0x32,0x00,0x74,0x65,0x78,0x74,0x00,0x46,0x6f,0x6f,0x64,0x00,0x00,0x00,0x01,0x00,0x10,
|
||||
0x00,0x00,0x00,0x00,0x00,0xbe,0x00,0x00,0x00,0xc8,0x00,0x00,0x00,0x50,0x00,0x00,0x00,0x1e,0x00,0x00,
|
||||
0x00,0x6e,0x61,0x6d,0x65,0x00,0x72,0x33,0x00,0x74,0x65,0x78,0x74,0x00,0x50,0x65,0x6e,0x63,0x69,0x6c,
|
||||
0x00,0x00,0x00,0x01,0x00,0x0a,0x00,0x00,0x00,0x01,0x00,0x0a,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x28,
|
||||
0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,0x65,0x00,0x64,0x69,0x61,0x6c,0x6f,0x67,0x00,0x74,
|
||||
0x65,0x78,0x74,0x00,0x44,0x69,0x61,0x6c,0x6f,0x67,0x00,0x00,0x00,0x01,0x00,0x0a,0x00,0x03,0x00,0x01,
|
||||
0x00,0x0a,0x00,0x00,0x00,0x04,0x01,0x00,0x00,0x28,0x00,0x00,0x00,0x1e,0x00,0x00,0x00,0x6e,0x61,0x6d,
|
||||
0x65,0x00,0x64,0x69,0x61,0x6c,0x6f,0x67,0x32,0x00,0x74,0x65,0x78,0x74,0x00,0x44,0x69,0x61,0x6c,0x6f,
|
||||
0x67,0x32,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,};
|
||||
|
@ -29,6 +29,7 @@
|
||||
#include "res/theme/theme.data"
|
||||
#include "res/ui/window1.data"
|
||||
#include "res/ui/dialog1.data"
|
||||
#include "res/ui/dialog2.data"
|
||||
|
||||
#include "base/theme.h"
|
||||
#include "font/font_bitmap.h"
|
||||
@ -44,6 +45,7 @@ ret_t resource_init() {
|
||||
font_manager_add(default_fm(), font_bitmap_create(font_font20));
|
||||
|
||||
resource_manager_add((const resource_info_t*)ui_dialog1);
|
||||
resource_manager_add((const resource_info_t*)ui_dialog2);
|
||||
resource_manager_add((const resource_info_t*)ui_window1);
|
||||
image_loader_bitmap_add(bitmap_loader, earth);
|
||||
image_loader_bitmap_add(bitmap_loader, info);
|
||||
|
@ -19,9 +19,9 @@ function application_init()
|
||||
end
|
||||
return Ret.REPEAT
|
||||
end, 500)
|
||||
|
||||
win.dialog:on(EventType.CLICK, function(evt)
|
||||
local dlg = Dialog.open("dialog1");
|
||||
|
||||
function show_dialog(name)
|
||||
local dlg = Dialog.open(name)
|
||||
|
||||
dlg.client.ok:on(EventType.CLICK, function(evt)
|
||||
dlg:quit(0)
|
||||
@ -33,6 +33,14 @@ function application_init()
|
||||
|
||||
dlg:modal()
|
||||
dlg:destroy()
|
||||
end
|
||||
|
||||
win.dialog:on(EventType.CLICK, function(evt)
|
||||
show_dialog("dialog1");
|
||||
end);
|
||||
|
||||
win.dialog2:on(EventType.CLICK, function(evt)
|
||||
show_dialog("dialog2");
|
||||
end);
|
||||
end
|
||||
|
||||
|
@ -109,10 +109,18 @@ static ret_t button_on_event(widget_t* widget, event_t* e) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t button_destroy(widget_t* widget) {
|
||||
button_t* button = BUTTON(widget);
|
||||
wstr_reset(&(button->text));
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static const widget_vtable_t s_button_vtable = {.on_event = button_on_event,
|
||||
.on_paint_self = button_on_paint_self,
|
||||
.get_prop = button_get_prop,
|
||||
.set_prop = button_set_prop};
|
||||
.set_prop = button_set_prop,
|
||||
.destroy = button_destroy};
|
||||
|
||||
widget_t* button_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
widget_t* widget = NULL;
|
||||
|
@ -159,10 +159,18 @@ static ret_t check_button_set_prop(widget_t* widget, const char* name, const val
|
||||
return RET_NOT_FOUND;
|
||||
}
|
||||
|
||||
static ret_t check_button_destroy(widget_t* widget) {
|
||||
check_button_t* check_button = CHECK_BUTTON(widget);
|
||||
wstr_reset(&(check_button->text));
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static const widget_vtable_t s_check_button_vtable = {.on_event = check_button_on_event,
|
||||
.on_paint_self = check_button_on_paint_self,
|
||||
.get_prop = check_button_get_prop,
|
||||
.set_prop = check_button_set_prop};
|
||||
.set_prop = check_button_set_prop,
|
||||
.destroy = check_button_destroy};
|
||||
|
||||
widget_t* check_button_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
widget_t* widget = NULL;
|
||||
|
@ -69,7 +69,18 @@ font_t* font_manager_find(font_manager_t* fm, const char* name, uint16_t size) {
|
||||
}
|
||||
|
||||
ret_t font_manager_deinit(font_manager_t* fm) {
|
||||
uint32_t i = 0;
|
||||
uint32_t nr = 0;
|
||||
font_t** fonts = NULL;
|
||||
return_value_if_fail(fm != NULL, RET_BAD_PARAMS);
|
||||
|
||||
nr = fm->fonts.size;
|
||||
fonts = (font_t**)fm->fonts.elms;
|
||||
for (i = 0; i < nr; i++) {
|
||||
font_t* iter = fonts[i];
|
||||
font_destroy(iter);
|
||||
}
|
||||
|
||||
array_deinit(&(fm->fonts));
|
||||
|
||||
return RET_OK;
|
||||
|
@ -115,7 +115,20 @@ ret_t image_manager_add_image(image_manager_t* im, const char* name, bitmap_t* b
|
||||
}
|
||||
|
||||
ret_t image_manager_deinit(image_manager_t* im) {
|
||||
uint32_t i = 0;
|
||||
uint32_t nr = 0;
|
||||
image_item_t* item= NULL;
|
||||
image_item_t** elms = NULL;
|
||||
return_value_if_fail(im != NULL, RET_BAD_PARAMS);
|
||||
nr = im->images.size;
|
||||
elms = (image_item_t**)(im->images.elms);
|
||||
for (i = 0; i < nr; i++) {
|
||||
item = elms[i];
|
||||
MEM_FREE(item);
|
||||
}
|
||||
|
||||
array_deinit(&(im->images));
|
||||
array_deinit(&(im->loaders));
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
@ -147,8 +147,17 @@ static ret_t label_set_prop(widget_t* widget, const char* name, const value_t* v
|
||||
return RET_NOT_FOUND;
|
||||
}
|
||||
|
||||
static const widget_vtable_t s_label_vtable = {
|
||||
.on_paint_self = label_on_paint_self, .get_prop = label_get_prop, .set_prop = label_set_prop};
|
||||
static ret_t label_destroy(widget_t* widget) {
|
||||
label_t* label = LABEL(widget);
|
||||
wstr_reset(&(label->text));
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static const widget_vtable_t s_label_vtable = {.on_paint_self = label_on_paint_self,
|
||||
.get_prop = label_get_prop,
|
||||
.set_prop = label_set_prop,
|
||||
.destroy = label_destroy};
|
||||
|
||||
widget_t* label_create(widget_t* parent, xy_t x, xy_t y, wh_t w, wh_t h) {
|
||||
widget_t* widget = NULL;
|
||||
|
179
src/base/layout.c
Normal file
179
src/base/layout.c
Normal file
@ -0,0 +1,179 @@
|
||||
/**
|
||||
* File: layout.c
|
||||
* Author: Li XianJing <xianjimli@hotmail.com>
|
||||
* Brief: layout
|
||||
*
|
||||
* Copyright (c) 2018 - 2018 Li XianJing <xianjimli@hotmail.com>
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* License file for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* History:
|
||||
* ================================================================
|
||||
* 2018-03-10 Li XianJing <xianjimli@hotmail.com> created
|
||||
*
|
||||
*/
|
||||
|
||||
#include "base/layout.h"
|
||||
|
||||
widget_layout_t* widget_layout_parse(widget_layout_t* layout, const char* x, const char* y,
|
||||
const char* w, const char* h) {
|
||||
return_value_if_fail(layout != NULL, NULL);
|
||||
|
||||
memset(layout, 0x00, sizeof(*layout));
|
||||
if (x != NULL) {
|
||||
if (strstr(x, "center") != NULL) {
|
||||
if (x[6] == ':') {
|
||||
layout->x = atoi(x + 7);
|
||||
}
|
||||
layout->x_attr = X_ATTR_CENTER;
|
||||
} else if (strstr(x, "right") != NULL) {
|
||||
if (x[5] == ':') {
|
||||
layout->x = atoi(x + 6);
|
||||
}
|
||||
layout->x_attr = X_ATTR_RIGHT;
|
||||
} else if (strstr(x, "%") != NULL) {
|
||||
layout->x = atoi(x);
|
||||
layout->x_attr = X_ATTR_PERCENT;
|
||||
} else {
|
||||
layout->x = atoi(x);
|
||||
layout->x_attr = X_ATTR_DEFAULT;
|
||||
}
|
||||
} else {
|
||||
layout->x_attr = X_ATTR_DEFAULT;
|
||||
}
|
||||
|
||||
if (y != NULL) {
|
||||
if (strstr(y, "middle") != NULL) {
|
||||
if (y[6] == ':') {
|
||||
layout->y = atoi(y + 7);
|
||||
}
|
||||
layout->y_attr = Y_ATTR_MIDDLE;
|
||||
} else if (strstr(y, "bottom") != NULL) {
|
||||
if (y[6] == ':') {
|
||||
layout->y = atoi(y + 7);
|
||||
}
|
||||
layout->y_attr = Y_ATTR_BOTTOM;
|
||||
} else if (strstr(y, "%") != NULL) {
|
||||
layout->y = atoi(y);
|
||||
layout->y_attr = Y_ATTR_PERCENT;
|
||||
} else {
|
||||
layout->y = atoi(y);
|
||||
layout->y_attr = Y_ATTR_DEFAULT;
|
||||
}
|
||||
} else {
|
||||
layout->y_attr = Y_ATTR_DEFAULT;
|
||||
}
|
||||
|
||||
if (w != NULL) {
|
||||
layout->w = atoi(w);
|
||||
if (w != NULL && strchr(w, '%') != NULL) {
|
||||
layout->w_attr = W_ATTR_PERCENT;
|
||||
} else {
|
||||
layout->w_attr = W_ATTR_PIXEL;
|
||||
}
|
||||
} else {
|
||||
layout->h_attr = H_ATTR_PIXEL;
|
||||
}
|
||||
|
||||
if (h != NULL) {
|
||||
layout->h = atoi(h);
|
||||
if (strchr(h, '%') != NULL) {
|
||||
layout->h_attr = H_ATTR_PERCENT;
|
||||
} else {
|
||||
layout->h_attr = H_ATTR_PIXEL;
|
||||
}
|
||||
} else {
|
||||
layout->h_attr = H_ATTR_PIXEL;
|
||||
}
|
||||
|
||||
return layout;
|
||||
}
|
||||
|
||||
ret_t widget_layout_calc(const widget_layout_t* layout, rect_t* r, wh_t parent_w, wh_t parent_h) {
|
||||
xy_t x = layout->x;
|
||||
xy_t y = layout->y;
|
||||
wh_t w = layout->w;
|
||||
wh_t h = layout->h;
|
||||
uint8_t x_attr = layout->x_attr;
|
||||
uint8_t y_attr = layout->y_attr;
|
||||
uint8_t w_attr = layout->w_attr;
|
||||
uint8_t h_attr = layout->h_attr;
|
||||
|
||||
if (parent_w > 0 && parent_h > 0) {
|
||||
if (w_attr == W_ATTR_PERCENT) {
|
||||
w = (parent_w * layout->w) / 100;
|
||||
}
|
||||
|
||||
if (h_attr == H_ATTR_PERCENT) {
|
||||
h = (parent_h * layout->h) / 100;
|
||||
}
|
||||
|
||||
switch (x_attr) {
|
||||
case X_ATTR_CENTER:
|
||||
x = (parent_w - w) / 2 + x;
|
||||
break;
|
||||
case X_ATTR_RIGHT:
|
||||
x = (parent_w - w) - x;
|
||||
break;
|
||||
case X_ATTR_PERCENT:
|
||||
x = parent_w * x / 100;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
switch (y_attr) {
|
||||
case Y_ATTR_MIDDLE:
|
||||
y = (parent_h - h) / 2 + y;
|
||||
break;
|
||||
case Y_ATTR_BOTTOM:
|
||||
y = (parent_h - h) - y;
|
||||
break;
|
||||
case Y_ATTR_PERCENT:
|
||||
y = parent_h * y / 100;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
r->x = x;
|
||||
r->y = y;
|
||||
r->w = w;
|
||||
r->h = h;
|
||||
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t widget_set_self_layout_params(widget_t* widget, const widget_layout_t* layout) {
|
||||
/*TODO*/
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t widget_set_children_layout_params(widget_t* widget, uint8_t rows, uint8_t cols,
|
||||
uint8_t margin, uint8_t cell_h_margin,
|
||||
uint8_t cell_v_margin) {
|
||||
/*TODO*/
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t widget_layout(widget_t* widget) {
|
||||
/*TODO*/
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t widget_layout_self(widget_t* widget) {
|
||||
/*TODO*/
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
ret_t widget_layout_children(widget_t* widget) {
|
||||
/*TODO*/
|
||||
return RET_OK;
|
||||
}
|
91
src/base/layout.h
Executable file
91
src/base/layout.h
Executable file
@ -0,0 +1,91 @@
|
||||
/**
|
||||
* File: layout.h
|
||||
* Author: Li XianJing <xianjimli@hotmail.com>
|
||||
* Brief: layout
|
||||
*
|
||||
* Copyright (c) 2018 - 2018 Li XianJing <xianjimli@hotmail.com>
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* License file for more details.
|
||||
*
|
||||
*/
|
||||
|
||||
/**
|
||||
* History:
|
||||
* ================================================================
|
||||
* 2018-03-10 Li XianJing <xianjimli@hotmail.com> created
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef LFTK_LAYOUT_H
|
||||
#define LFTK_LAYOUT_H
|
||||
|
||||
#include "base/widget.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
|
||||
typedef enum _x_attr_t {
|
||||
X_ATTR_DEFAULT = 0,
|
||||
X_ATTR_PERCENT,
|
||||
X_ATTR_CENTER,
|
||||
X_ATTR_RIGHT
|
||||
}x_attr_t;
|
||||
|
||||
typedef enum _y_attr_t {
|
||||
Y_ATTR_DEFAULT = 0,
|
||||
Y_ATTR_PERCENT,
|
||||
Y_ATTR_MIDDLE,
|
||||
Y_ATTR_BOTTOM
|
||||
}y_attr_t;
|
||||
|
||||
typedef enum _w_attr_t {
|
||||
W_ATTR_PIXEL = 0,
|
||||
W_ATTR_PERCENT
|
||||
}w_attr_t;
|
||||
|
||||
typedef enum _h_attr_t {
|
||||
H_ATTR_PIXEL = 0,
|
||||
H_ATTR_PERCENT
|
||||
}h_attr_t;
|
||||
|
||||
typedef struct _widget_layout_t {
|
||||
uint8_t x_attr;
|
||||
uint8_t y_attr;
|
||||
uint8_t w_attr;
|
||||
uint8_t h_attr;
|
||||
xy_t x;
|
||||
xy_t y;
|
||||
wh_t w;
|
||||
wh_t h;
|
||||
}widget_layout_t;
|
||||
|
||||
typedef struct _children_layout_t {
|
||||
uint8_t rows;
|
||||
uint8_t cols;
|
||||
uint8_t margin;
|
||||
uint8_t cell_h_margin;
|
||||
uint8_t cell_v_margin;
|
||||
}children_layout_t;
|
||||
|
||||
typedef struct _layout_params_t {
|
||||
widget_layout_t self;
|
||||
children_layout_t children;
|
||||
}layout_params_t;
|
||||
|
||||
ret_t widget_layout_calc(const widget_layout_t* layout, rect_t* r, wh_t parent_w, wh_t parent_h);
|
||||
widget_layout_t* widget_layout_parse(widget_layout_t* layout, const char* x, const char* y, const char* w, const char* h);
|
||||
|
||||
ret_t widget_set_self_layout_params(widget_t* widget, const widget_layout_t* layout);
|
||||
ret_t widget_set_children_layout_params(widget_t* widget, uint8_t rows, uint8_t cols, uint8_t margin, uint8_t cell_h_margin, uint8_t cell_v_margin);
|
||||
|
||||
ret_t widget_layout(widget_t* widget);
|
||||
ret_t widget_layout_self(widget_t* widget);
|
||||
ret_t widget_layout_children(widget_t* widget);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#endif/*LFTK_LAYOUT_H*/
|
||||
|
@ -21,6 +21,21 @@
|
||||
|
||||
#include "base/mem.h"
|
||||
|
||||
#ifdef HAS_STD_MALLOC
|
||||
ret_t mem_init(void* buffer, uint32_t length) {
|
||||
(void)buffer;
|
||||
(void)length;
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
mem_stat_t mem_stat(void) {
|
||||
mem_stat_t stat;
|
||||
return stat;
|
||||
}
|
||||
|
||||
void mem_info_dump(void) {}
|
||||
|
||||
#else
|
||||
typedef struct _free_node_t {
|
||||
uint32_t length;
|
||||
struct _free_node_t* next;
|
||||
@ -254,3 +269,4 @@ mem_stat_t mem_stat() {
|
||||
|
||||
return st;
|
||||
}
|
||||
#endif
|
||||
|
@ -40,18 +40,25 @@ mem_stat_t mem_stat(void);
|
||||
|
||||
void mem_info_dump(void);
|
||||
|
||||
#ifdef HAS_STD_MALLOC
|
||||
#define MEM_ALLOC(size) malloc(size)
|
||||
#define MEM_ZALLOC(type) (type*)calloc(1, sizeof(type))
|
||||
#define MEM_ZALLOCN(type, n) (type*)calloc(n, sizeof(type))
|
||||
#define MEM_REALLOC(type, p, n) (type*)realloc(p, (n) * sizeof(type))
|
||||
#define MEM_FREE(p) free(p)
|
||||
#else
|
||||
void* lftk_calloc(uint32_t nmemb, uint32_t size);
|
||||
void* lftk_realloc(void* ptr, uint32_t size);
|
||||
void lftk_free(void* ptr);
|
||||
void* lftk_alloc(uint32_t size);
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
#define MEM_ALLOC(size) lftk_alloc(size)
|
||||
#define MEM_ZALLOC(type) (type*)lftk_calloc(1, sizeof(type))
|
||||
#define MEM_ZALLOCN(type, n) (type*)lftk_calloc(n, sizeof(type))
|
||||
#define MEM_REALLOC(type, p, n) (type*)lftk_realloc(p, (n) * sizeof(type))
|
||||
#define MEM_FREE(p) lftk_free(p)
|
||||
#endif
|
||||
|
||||
END_C_DECLS
|
||||
#endif/*LFTK_MEM_MANAGER_H*/
|
||||
|
||||
|
@ -4,6 +4,7 @@
|
||||
uint32_t heap[1024];
|
||||
|
||||
int main() {
|
||||
#ifndef HAS_STD_MALLOC
|
||||
char* str = NULL;
|
||||
char* p[32];
|
||||
uint32_t i = 0;
|
||||
@ -33,6 +34,6 @@ int main() {
|
||||
}
|
||||
|
||||
mem_info_dump();
|
||||
|
||||
#endif
|
||||
return 0;
|
||||
}
|
||||
|
@ -55,3 +55,9 @@ ret_t resource_manager_add(const resource_info_t* info) {
|
||||
|
||||
return array_push(&s_resources, (void*)info) ? RET_OK : RET_FAIL;
|
||||
}
|
||||
|
||||
ret_t resource_manager_deinit() {
|
||||
array_deinit(&(s_resources));
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
|
@ -51,6 +51,7 @@ ret_t resource_manager_add(const resource_info_t* info);
|
||||
const resource_info_t* resource_manager_ref(resource_type_t type, const char* name);
|
||||
ret_t resource_manager_unref(const resource_info_t* info);
|
||||
|
||||
ret_t resource_manager_deinit();
|
||||
|
||||
END_C_DECLS
|
||||
|
||||
|
@ -74,12 +74,18 @@ static int compare_timer(const void* a, const void* b) {
|
||||
|
||||
ret_t timer_remove(uint32_t timer_id) {
|
||||
timer_info_t timer;
|
||||
timer_info_t* ret = NULL;
|
||||
return_value_if_fail(timer_id > 0, RET_BAD_PARAMS);
|
||||
return_value_if_fail(s_get_time != NULL && ensure_timer_manager() == RET_OK, RET_BAD_PARAMS);
|
||||
|
||||
timer.id = timer_id;
|
||||
ret = (timer_info_t*)array_find(s_timer_manager, compare_timer, &timer);
|
||||
return_value_if_fail(ret != NULL, RET_NOT_FOUND);
|
||||
if (array_remove(s_timer_manager, compare_timer, &timer)) {
|
||||
MEM_FREE(ret);
|
||||
}
|
||||
|
||||
return array_remove(s_timer_manager, compare_timer, &timer) ? RET_OK : RET_FAIL;
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
const timer_info_t* timer_find(uint32_t timer_id) {
|
||||
@ -122,6 +128,8 @@ ret_t timer_check() {
|
||||
timer_info_t* iter = timers[i];
|
||||
if (iter->repeat) {
|
||||
timers[k++] = timers[i];
|
||||
} else {
|
||||
MEM_FREE(timers[i]);
|
||||
}
|
||||
}
|
||||
s_timer_manager->size = k;
|
||||
|
@ -21,10 +21,10 @@
|
||||
|
||||
#include "ui_loader/ui_builder.h"
|
||||
|
||||
ret_t ui_builder_on_widget_start(ui_builder_t* b, uint16_t type, xy_t x, xy_t y, xy_t w, xy_t h) {
|
||||
return_value_if_fail(b != NULL && b->on_widget_start != NULL, RET_BAD_PARAMS);
|
||||
ret_t ui_builder_on_widget_start(ui_builder_t* b, const widget_desc_t* desc) {
|
||||
return_value_if_fail(b != NULL && b->on_widget_start != NULL && desc != NULL, RET_BAD_PARAMS);
|
||||
|
||||
return b->on_widget_start(b, type, x, y, w, h);
|
||||
return b->on_widget_start(b, desc);
|
||||
}
|
||||
|
||||
ret_t ui_builder_on_widget_prop(ui_builder_t* b, const char* name, const char* value) {
|
||||
|
@ -23,13 +23,20 @@
|
||||
#define LFTK_UI_BUILDER_H
|
||||
|
||||
#include "base/widget.h"
|
||||
#include "base/layout.h"
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
struct _ui_builder_t;
|
||||
typedef struct _ui_builder_t ui_builder_t;
|
||||
|
||||
typedef ret_t (*ui_builder_on_widget_start_t)(ui_builder_t* b, uint16_t type, xy_t x, xy_t y, xy_t w, xy_t h);
|
||||
typedef struct _widget_desc_t {
|
||||
uint16_t version;
|
||||
uint16_t type;
|
||||
widget_layout_t layout;
|
||||
}widget_desc_t;
|
||||
|
||||
typedef ret_t (*ui_builder_on_widget_start_t)(ui_builder_t* b, const widget_desc_t* desc);
|
||||
typedef ret_t (*ui_builder_on_widget_prop_t)(ui_builder_t* b, const char* name, const char* value);
|
||||
typedef ret_t (*ui_builder_on_widget_prop_end_t)(ui_builder_t* b);
|
||||
typedef ret_t (*ui_builder_on_widget_end_t)(ui_builder_t* b);
|
||||
@ -43,7 +50,7 @@ struct _ui_builder_t {
|
||||
widget_t* widget;
|
||||
};
|
||||
|
||||
ret_t ui_builder_on_widget_start(ui_builder_t* b, uint16_t type, xy_t x, xy_t y, xy_t w, xy_t h);
|
||||
ret_t ui_builder_on_widget_start(ui_builder_t* b, const widget_desc_t* desc);
|
||||
ret_t ui_builder_on_widget_prop(ui_builder_t* b, const char* name, const char* value);
|
||||
ret_t ui_builder_on_widget_prop_end(ui_builder_t* b);
|
||||
ret_t ui_builder_on_widget_end(ui_builder_t* b);
|
||||
|
@ -34,11 +34,24 @@
|
||||
#include "ui_loader/ui_loader_default.h"
|
||||
#include "base/resource_manager.h"
|
||||
|
||||
static ret_t ui_builder_default_on_widget_start(ui_builder_t* b, uint16_t type, xy_t x, xy_t y,
|
||||
xy_t w, xy_t h) {
|
||||
static ret_t ui_builder_default_on_widget_start(ui_builder_t* b, const widget_desc_t* desc) {
|
||||
rect_t r;
|
||||
xy_t x = desc->layout.x;
|
||||
xy_t y = desc->layout.y;
|
||||
wh_t w = desc->layout.w;
|
||||
wh_t h = desc->layout.h;
|
||||
widget_t* widget = NULL;
|
||||
uint16_t type = desc->type;
|
||||
widget_t* parent = b->widget;
|
||||
|
||||
if (parent != NULL) {
|
||||
widget_layout_calc(&desc->layout, &r, parent->w, parent->h);
|
||||
x = r.x;
|
||||
y = r.y;
|
||||
w = r.w;
|
||||
h = r.h;
|
||||
}
|
||||
|
||||
if (parent && parent->type == WIDGET_DIALOG) {
|
||||
dialog_t* dlg = DIALOG(parent);
|
||||
parent = dlg->client;
|
||||
|
@ -31,19 +31,9 @@ typedef struct _ui_builder_writer_t {
|
||||
wbuffer_t* wbuffer;
|
||||
} ui_builder_writer_t;
|
||||
|
||||
static ret_t ui_builder_writer_on_widget_start(ui_builder_t* b, uint16_t type, xy_t x, xy_t y,
|
||||
xy_t w, xy_t h) {
|
||||
widget_desc_t desc;
|
||||
static ret_t ui_builder_writer_on_widget_start(ui_builder_t* b, const widget_desc_t* desc) {
|
||||
ui_builder_writer_t* writer = (ui_builder_writer_t*)b;
|
||||
|
||||
desc.x = x;
|
||||
desc.y = y;
|
||||
desc.w = w;
|
||||
desc.h = h;
|
||||
desc.type = type;
|
||||
desc.reserve = 0;
|
||||
|
||||
return wbuffer_write_binary(writer->wbuffer, &desc, sizeof(desc));
|
||||
return wbuffer_write_binary(writer->wbuffer, desc, sizeof(*desc));
|
||||
}
|
||||
|
||||
static ret_t ui_builder_writer_on_widget_prop(ui_builder_t* b, const char* name,
|
||||
|
@ -40,7 +40,7 @@ ret_t ui_loader_load_default(ui_loader_t* loader, const uint8_t* data, uint32_t
|
||||
const char* value = NULL;
|
||||
return_value_if_fail(rbuffer_read_binary(&rbuffer, &desc, sizeof(desc)) == RET_OK,
|
||||
RET_BAD_PARAMS);
|
||||
ui_builder_on_widget_start(b, desc.type, desc.x, desc.y, desc.w, desc.h);
|
||||
ui_builder_on_widget_start(b, &desc);
|
||||
|
||||
return_value_if_fail(rbuffer_read_string(&rbuffer, &key) == RET_OK, RET_BAD_PARAMS);
|
||||
while (*key) {
|
||||
|
@ -26,15 +26,6 @@
|
||||
|
||||
BEGIN_C_DECLS
|
||||
|
||||
typedef struct _widget_desc_t {
|
||||
uint16_t type;
|
||||
uint16_t reserve;
|
||||
xy_t x;
|
||||
xy_t y;
|
||||
wh_t w;
|
||||
wh_t h;
|
||||
}widget_desc_t;
|
||||
|
||||
ui_loader_t* default_ui_loader();
|
||||
|
||||
END_C_DECLS
|
||||
|
@ -19,10 +19,11 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "ui_loader/ui_loader_xml.h"
|
||||
#include "base/enums.h"
|
||||
#include "base/mem.h"
|
||||
#include "base/layout.h"
|
||||
#include "xml/xml_parser.h"
|
||||
#include "ui_loader/ui_loader_xml.h"
|
||||
|
||||
typedef struct _xml_builder_t {
|
||||
XmlBuilder builder;
|
||||
@ -30,18 +31,22 @@ typedef struct _xml_builder_t {
|
||||
} xml_builder_t;
|
||||
|
||||
static void xml_loader_on_start(XmlBuilder* thiz, const char* tag, const char** attrs) {
|
||||
xy_t x = 0;
|
||||
xy_t y = 0;
|
||||
wh_t w = 0;
|
||||
wh_t h = 0;
|
||||
char c = '\0';
|
||||
uint32_t i = 0;
|
||||
const char* x = "0";
|
||||
const char* y = "0";
|
||||
const char* w = "100";
|
||||
const char* h = "30";
|
||||
widget_desc_t desc;
|
||||
const char* key = NULL;
|
||||
const char* value = NULL;
|
||||
xml_builder_t* b = (xml_builder_t*)thiz;
|
||||
const key_type_value_t* widget_item = widget_name_find(tag);
|
||||
return_if_fail(widget_item != NULL);
|
||||
|
||||
memset(&desc, 0x00, sizeof(desc));
|
||||
|
||||
desc.version = 0x01;
|
||||
while (attrs[i] != NULL) {
|
||||
key = attrs[i];
|
||||
value = attrs[i + 1];
|
||||
@ -49,20 +54,22 @@ static void xml_loader_on_start(XmlBuilder* thiz, const char* tag, const char**
|
||||
c = key[0];
|
||||
if (key[1] == '\0') {
|
||||
if (c == 'x') {
|
||||
x = atoi(value);
|
||||
x = (value);
|
||||
} else if (c == 'y') {
|
||||
y = atoi(value);
|
||||
y = (value);
|
||||
} else if (c == 'w') {
|
||||
w = atoi(value);
|
||||
w = (value);
|
||||
} else if (c == 'h') {
|
||||
h = atoi(value);
|
||||
h = (value);
|
||||
}
|
||||
}
|
||||
|
||||
i += 2;
|
||||
}
|
||||
|
||||
ui_builder_on_widget_start(b->ui_builder, widget_item->value, x, y, w, h);
|
||||
desc.type = widget_item->value;
|
||||
widget_layout_parse(&(desc.layout), x, y, w, h);
|
||||
ui_builder_on_widget_start(b->ui_builder, &desc);
|
||||
|
||||
i = 0;
|
||||
while (attrs[i] != NULL) {
|
||||
|
@ -14,7 +14,7 @@ INCLUDE_PATH = [LFTK_ROOT,
|
||||
os.path.join(GTEST_ROOT, 'make')]
|
||||
|
||||
env['CPPPATH'] = INCLUDE_PATH
|
||||
env['LIBS'] = ['theme_gen', 'font_gen', 'ui_loader', 'fontstb', 'fontbitmap', 'xml', 'common', 'lftk_base'] + env['LIBS']
|
||||
env['LIBS'] = ['resource', 'imageloaderbitmap', 'theme_gen', 'font_gen', 'ui_loader', 'fontstb', 'fontbitmap', 'xml', 'common', 'lftk_base'] + env['LIBS']
|
||||
|
||||
SOURCES = [
|
||||
os.path.join(GTEST_ROOT, 'src/gtest-all.cc'),
|
||||
|
@ -46,6 +46,8 @@ TEST(Canvas, draw_hline) {
|
||||
ASSERT_EQ(lcd_log_get_commands(lcd), "dhl(290,110,10);");
|
||||
|
||||
canvas_end_frame(&c);
|
||||
font_manager_deinit(&font_manager);
|
||||
lcd_destroy(lcd);
|
||||
}
|
||||
|
||||
TEST(Canvas, draw_vline) {
|
||||
@ -88,6 +90,8 @@ TEST(Canvas, draw_vline) {
|
||||
ASSERT_EQ(lcd_log_get_commands(lcd), "dvl(110,290,10);");
|
||||
|
||||
canvas_end_frame(&c);
|
||||
font_manager_deinit(&font_manager);
|
||||
lcd_destroy(lcd);
|
||||
}
|
||||
|
||||
TEST(Canvas, fill_rect) {
|
||||
@ -162,6 +166,8 @@ TEST(Canvas, fill_rect) {
|
||||
ASSERT_EQ(lcd_log_get_commands(lcd), "fr(100,120,30,40);");
|
||||
|
||||
canvas_end_frame(&c);
|
||||
font_manager_deinit(&font_manager);
|
||||
lcd_destroy(lcd);
|
||||
}
|
||||
|
||||
TEST(Canvas, draw_points) {
|
||||
@ -204,6 +210,8 @@ TEST(Canvas, draw_points) {
|
||||
ASSERT_EQ(lcd_log_get_commands(lcd), "dps((100,100)(200,200)(300,300));");
|
||||
|
||||
canvas_end_frame(&c);
|
||||
font_manager_deinit(&font_manager);
|
||||
lcd_destroy(lcd);
|
||||
}
|
||||
|
||||
TEST(Canvas, draw_glyph) {
|
||||
@ -258,6 +266,8 @@ TEST(Canvas, draw_glyph) {
|
||||
ASSERT_EQ(lcd_log_get_commands(lcd), "dg(5,0,5,5,100,295);");
|
||||
|
||||
canvas_end_frame(&c);
|
||||
font_manager_deinit(&font_manager);
|
||||
lcd_destroy(lcd);
|
||||
}
|
||||
|
||||
TEST(Canvas, draw_image) {
|
||||
@ -267,6 +277,7 @@ TEST(Canvas, draw_image) {
|
||||
canvas_t c;
|
||||
bitmap_t img;
|
||||
font_manager_t font_manager;
|
||||
font_manager_init(&font_manager);
|
||||
lcd_t* lcd = lcd_log_init(800, 600);
|
||||
canvas_init(&c, lcd, &font_manager);
|
||||
|
||||
@ -328,4 +339,7 @@ TEST(Canvas, draw_image) {
|
||||
canvas_draw_image(&c, &img, &s, &d);
|
||||
ASSERT_EQ(lcd_log_get_commands(lcd), "dg(10,10,10,10,290,290,10,10);");
|
||||
canvas_end_frame(&c);
|
||||
font_manager_deinit(&font_manager);
|
||||
lcd_destroy(lcd);
|
||||
}
|
||||
|
||||
|
@ -25,4 +25,6 @@ TEST(FontManager, basic) {
|
||||
|
||||
ASSERT_EQ(font_manager_find(&font_manager, NULL, 20) != NULL, true);
|
||||
ASSERT_EQ(font_manager_find(&font_manager, "demo0", 20) != NULL, true);
|
||||
|
||||
font_manager_deinit(&font_manager);
|
||||
}
|
||||
|
106
tests/layout_test.cc
Normal file
106
tests/layout_test.cc
Normal file
@ -0,0 +1,106 @@
|
||||
#include "base/layout.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
TEST(Layuout, basic) {
|
||||
rect_t r;
|
||||
widget_layout_t layout;
|
||||
ASSERT_EQ(widget_layout_parse(&layout, "1", "2", "3", "4"), &layout);
|
||||
ASSERT_EQ(layout.x, 1);
|
||||
ASSERT_EQ(layout.y, 2);
|
||||
ASSERT_EQ(layout.w, 3);
|
||||
ASSERT_EQ(layout.h, 4);
|
||||
ASSERT_EQ(layout.x_attr, X_ATTR_DEFAULT);
|
||||
ASSERT_EQ(layout.y_attr, Y_ATTR_DEFAULT);
|
||||
ASSERT_EQ(layout.w_attr, W_ATTR_PIXEL);
|
||||
ASSERT_EQ(layout.h_attr, H_ATTR_PIXEL);
|
||||
|
||||
widget_layout_calc(&layout, &r, 100, 200);
|
||||
ASSERT_EQ(r.x, 1);
|
||||
ASSERT_EQ(r.y, 2);
|
||||
ASSERT_EQ(r.w, 3);
|
||||
ASSERT_EQ(r.h, 4);
|
||||
}
|
||||
|
||||
TEST(Layuout, percent) {
|
||||
rect_t r;
|
||||
widget_layout_t layout;
|
||||
ASSERT_EQ(widget_layout_parse(&layout, "1%", "2%", "3%", "4%"), &layout);
|
||||
ASSERT_EQ(layout.x, 1);
|
||||
ASSERT_EQ(layout.y, 2);
|
||||
ASSERT_EQ(layout.w, 3);
|
||||
ASSERT_EQ(layout.h, 4);
|
||||
ASSERT_EQ(layout.x_attr, X_ATTR_PERCENT);
|
||||
ASSERT_EQ(layout.y_attr, Y_ATTR_PERCENT);
|
||||
ASSERT_EQ(layout.w_attr, W_ATTR_PERCENT);
|
||||
ASSERT_EQ(layout.h_attr, H_ATTR_PERCENT);
|
||||
|
||||
widget_layout_calc(&layout, &r, 100, 200);
|
||||
ASSERT_EQ(r.x, 1);
|
||||
ASSERT_EQ(r.y, 4);
|
||||
ASSERT_EQ(r.w, 3);
|
||||
ASSERT_EQ(r.h, 8);
|
||||
}
|
||||
|
||||
TEST(Layuout, center_middle) {
|
||||
rect_t r;
|
||||
widget_layout_t layout;
|
||||
ASSERT_EQ(widget_layout_parse(&layout, "center", "middle", "30%", "40%"), &layout);
|
||||
ASSERT_EQ(layout.x, 0);
|
||||
ASSERT_EQ(layout.y, 0);
|
||||
ASSERT_EQ(layout.x_attr, X_ATTR_CENTER);
|
||||
ASSERT_EQ(layout.y_attr, Y_ATTR_MIDDLE);
|
||||
|
||||
widget_layout_calc(&layout, &r, 100, 200);
|
||||
ASSERT_EQ(r.x, 35);
|
||||
ASSERT_EQ(r.y, 60);
|
||||
ASSERT_EQ(r.w, 30);
|
||||
ASSERT_EQ(r.h, 80);
|
||||
}
|
||||
|
||||
TEST(Layuout, center_middle1) {
|
||||
rect_t r;
|
||||
widget_layout_t layout;
|
||||
ASSERT_EQ(widget_layout_parse(&layout, "center:1", "middle:2", "30%", "40%"), &layout);
|
||||
ASSERT_EQ(layout.x, 1);
|
||||
ASSERT_EQ(layout.y, 2);
|
||||
ASSERT_EQ(layout.x_attr, X_ATTR_CENTER);
|
||||
ASSERT_EQ(layout.y_attr, Y_ATTR_MIDDLE);
|
||||
|
||||
widget_layout_calc(&layout, &r, 100, 200);
|
||||
ASSERT_EQ(r.x, 36);
|
||||
ASSERT_EQ(r.y, 62);
|
||||
ASSERT_EQ(r.w, 30);
|
||||
ASSERT_EQ(r.h, 80);
|
||||
}
|
||||
|
||||
TEST(Layuout, right_bottom) {
|
||||
rect_t r;
|
||||
widget_layout_t layout;
|
||||
ASSERT_EQ(widget_layout_parse(&layout, "right", "bottom", "30%", "40%"), &layout);
|
||||
ASSERT_EQ(layout.x, 0);
|
||||
ASSERT_EQ(layout.y, 0);
|
||||
ASSERT_EQ(layout.x_attr, X_ATTR_RIGHT);
|
||||
ASSERT_EQ(layout.y_attr, Y_ATTR_BOTTOM);
|
||||
|
||||
widget_layout_calc(&layout, &r, 100, 200);
|
||||
ASSERT_EQ(r.x, 70);
|
||||
ASSERT_EQ(r.y, 120);
|
||||
ASSERT_EQ(r.w, 30);
|
||||
ASSERT_EQ(r.h, 80);
|
||||
}
|
||||
|
||||
TEST(Layuout, right_bottom1) {
|
||||
rect_t r;
|
||||
widget_layout_t layout;
|
||||
ASSERT_EQ(widget_layout_parse(&layout, "right:1", "bottom:2", "30%", "40%"), &layout);
|
||||
ASSERT_EQ(layout.x, 1);
|
||||
ASSERT_EQ(layout.y, 2);
|
||||
ASSERT_EQ(layout.x_attr, X_ATTR_RIGHT);
|
||||
ASSERT_EQ(layout.y_attr, Y_ATTR_BOTTOM);
|
||||
|
||||
widget_layout_calc(&layout, &r, 100, 200);
|
||||
ASSERT_EQ(r.x, 69);
|
||||
ASSERT_EQ(r.y, 118);
|
||||
ASSERT_EQ(r.w, 30);
|
||||
ASSERT_EQ(r.h, 80);
|
||||
}
|
@ -104,13 +104,17 @@ static ret_t lcd_log_end_frame(lcd_t* lcd) {
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
static ret_t lcd_log_destroy(lcd_t* lcd) { return RET_OK; }
|
||||
static ret_t lcd_log_destroy(lcd_t* lcd) {
|
||||
lcd_log_t* log = (lcd_log_t*)lcd;
|
||||
delete log;
|
||||
return RET_OK;
|
||||
}
|
||||
|
||||
lcd_t* lcd_log_init(wh_t w, wh_t h) {
|
||||
static lcd_log_t lcd;
|
||||
lcd_t* base = &(lcd.base);
|
||||
lcd_log_t* lcd = new lcd_log_t();
|
||||
lcd_t* base = &(lcd->base);
|
||||
|
||||
memset(&lcd, 0x00, sizeof(lcd_log_t));
|
||||
memset(lcd, 0x00, sizeof(lcd_log_t));
|
||||
|
||||
base->begin_frame = lcd_log_begin_frame;
|
||||
base->draw_vline = lcd_log_draw_vline;
|
||||
|
@ -30,12 +30,22 @@
|
||||
#include "base/mem.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <stdio.h>
|
||||
#include "demos/resource.h"
|
||||
#include "base/font_manager.h"
|
||||
#include "base/resource_manager.h"
|
||||
|
||||
static uint32_t s_heap_mem[1024 * 1024];
|
||||
static uint32_t s_heap_mem[4 * 1024 * 1024];
|
||||
|
||||
GTEST_API_ int main(int argc, char** argv) {
|
||||
printf("Running main() from gtest_main.cc\n");
|
||||
testing::InitGoogleTest(&argc, argv);
|
||||
mem_init(s_heap_mem, sizeof(s_heap_mem));
|
||||
return RUN_ALL_TESTS();
|
||||
resource_init();
|
||||
|
||||
RUN_ALL_TESTS();
|
||||
|
||||
font_manager_destroy(default_fm());
|
||||
resource_manager_deinit();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -8,7 +8,6 @@ TEST(ResourceManager, basic) {
|
||||
resource_info_t ui1 = {RESOURCE_TYPE_UI, 102, "ui1"};
|
||||
resource_info_t ui2 = {RESOURCE_TYPE_UI, 103, "ui2"};
|
||||
|
||||
ASSERT_EQ(resource_manager_init(10), RET_OK);
|
||||
ASSERT_EQ(resource_manager_add(&img1), RET_OK);
|
||||
ASSERT_EQ(resource_manager_add(&img2), RET_OK);
|
||||
ASSERT_EQ(resource_manager_add(&ui1), RET_OK);
|
||||
|
@ -4,32 +4,45 @@
|
||||
#include "ui_loader/ui_loader_default.h"
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
#define INIT_DESC(tt, xx, yy, ww, hh) \
|
||||
desc.version = 1; \
|
||||
desc.layout.x = xx; \
|
||||
desc.layout.y = yy; \
|
||||
desc.layout.w = ww; \
|
||||
desc.layout.h = hh; \
|
||||
desc.type = tt
|
||||
|
||||
TEST(UILoader, basic) {
|
||||
uint8_t data[1024];
|
||||
wbuffer_t wbuffer;
|
||||
widget_t* ok = NULL;
|
||||
widget_t* cancel = NULL;
|
||||
widget_desc_t desc;
|
||||
ui_loader_t* loader = default_ui_loader();
|
||||
ui_builder_t* builder = ui_builder_default();
|
||||
ui_builder_t* writer = ui_builder_writer(wbuffer_init(&wbuffer, data, sizeof(data)));
|
||||
|
||||
ASSERT_EQ(ui_builder_on_widget_start(writer, WIDGET_DIALOG, 0, 0, 400, 300), RET_OK);
|
||||
memset(&desc, 0x00, sizeof(desc));
|
||||
INIT_DESC(WIDGET_DIALOG, 0, 0, 400, 300);
|
||||
ASSERT_EQ(ui_builder_on_widget_start(writer, &desc), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop_end(writer), RET_OK);
|
||||
|
||||
ASSERT_EQ(ui_builder_on_widget_start(writer, WIDGET_BUTTON, 0, 0, 80, 30), RET_OK);
|
||||
INIT_DESC(WIDGET_BUTTON, 0, 0, 80, 30);
|
||||
ASSERT_EQ(ui_builder_on_widget_start(writer, &desc), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop(writer, "text", "ok"), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop(writer, "name", "ok"), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop_end(writer), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_end(writer), RET_OK);
|
||||
|
||||
ASSERT_EQ(ui_builder_on_widget_start(writer, WIDGET_LABEL, 128, 0, 80, 30), RET_OK);
|
||||
INIT_DESC(WIDGET_LABEL, 128, 0, 80, 30);
|
||||
ASSERT_EQ(ui_builder_on_widget_start(writer, &desc), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop(writer, "text", "cancel"), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop(writer, "name", "cancel"), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop_end(writer), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_end(writer), RET_OK);
|
||||
|
||||
ASSERT_EQ(ui_builder_on_widget_end(writer), RET_OK);
|
||||
ASSERT_EQ(wbuffer.cursor, 110);
|
||||
ASSERT_EQ(wbuffer.cursor, 122);
|
||||
|
||||
ASSERT_EQ(ui_loader_load(loader, wbuffer.data, wbuffer.cursor, builder), RET_OK);
|
||||
ASSERT_EQ(builder->root->type == WIDGET_DIALOG, TRUE);
|
||||
@ -50,3 +63,68 @@ TEST(UILoader, basic) {
|
||||
|
||||
widget_destroy(builder->root);
|
||||
}
|
||||
|
||||
TEST(UILoader, ext) {
|
||||
uint8_t data[1024];
|
||||
wbuffer_t wbuffer;
|
||||
widget_t* ok = NULL;
|
||||
widget_t* cancel = NULL;
|
||||
widget_desc_t desc;
|
||||
ui_loader_t* loader = default_ui_loader();
|
||||
ui_builder_t* builder = ui_builder_default();
|
||||
ui_builder_t* writer = ui_builder_writer(wbuffer_init(&wbuffer, data, sizeof(data)));
|
||||
|
||||
memset(&desc, 0x00, sizeof(desc));
|
||||
INIT_DESC(WIDGET_GROUP_BOX, 0, 0, 100, 200);
|
||||
ASSERT_EQ(ui_builder_on_widget_start(writer, &desc), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop_end(writer), RET_OK);
|
||||
|
||||
INIT_DESC(WIDGET_BUTTON, 10, 20, 30, 40);
|
||||
desc.layout.x_attr = X_ATTR_PERCENT;
|
||||
desc.layout.y_attr = Y_ATTR_PERCENT;
|
||||
desc.layout.w_attr = W_ATTR_PERCENT;
|
||||
desc.layout.h_attr = H_ATTR_PERCENT;
|
||||
ASSERT_EQ(ui_builder_on_widget_start(writer, &desc), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop(writer, "text", "ok"), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop(writer, "name", "ok"), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop_end(writer), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_end(writer), RET_OK);
|
||||
|
||||
INIT_DESC(WIDGET_LABEL, 1, 2, 30, 40);
|
||||
desc.layout.x_attr = X_ATTR_CENTER;
|
||||
desc.layout.y_attr = Y_ATTR_MIDDLE;
|
||||
desc.layout.w_attr = W_ATTR_PIXEL;
|
||||
desc.layout.h_attr = H_ATTR_PIXEL;
|
||||
ASSERT_EQ(ui_builder_on_widget_start(writer, &desc), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop(writer, "text", "cancel"), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop(writer, "name", "cancel"), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_prop_end(writer), RET_OK);
|
||||
ASSERT_EQ(ui_builder_on_widget_end(writer), RET_OK);
|
||||
|
||||
ASSERT_EQ(ui_builder_on_widget_end(writer), RET_OK);
|
||||
ASSERT_EQ(wbuffer.cursor, 122);
|
||||
|
||||
ASSERT_EQ(ui_loader_load(loader, wbuffer.data, wbuffer.cursor, builder), RET_OK);
|
||||
ASSERT_EQ(builder->root->type == WIDGET_GROUP_BOX, TRUE);
|
||||
ASSERT_EQ(widget_count_children(builder->root), 2);
|
||||
|
||||
ok = widget_lookup(builder->root, "ok", TRUE);
|
||||
cancel = widget_lookup(builder->root, "cancel", TRUE);
|
||||
|
||||
ASSERT_EQ(ok != NULL, true);
|
||||
ASSERT_EQ(ok->type == WIDGET_BUTTON, true);
|
||||
ASSERT_EQ(cancel != NULL, true);
|
||||
ASSERT_EQ(cancel->type == WIDGET_LABEL, true);
|
||||
|
||||
ASSERT_EQ(ok->x, 10);
|
||||
ASSERT_EQ(ok->y, 40);
|
||||
ASSERT_EQ(ok->w, 30);
|
||||
ASSERT_EQ(ok->h, 80);
|
||||
|
||||
ASSERT_EQ(cancel->w, 30);
|
||||
ASSERT_EQ(cancel->h, 40);
|
||||
ASSERT_EQ(cancel->x, 36);
|
||||
ASSERT_EQ(cancel->y, 82);
|
||||
|
||||
widget_destroy(builder->root);
|
||||
}
|
||||
|
@ -35,3 +35,54 @@ TEST(UILoaderXML, basic) {
|
||||
|
||||
widget_destroy(builder->root);
|
||||
}
|
||||
|
||||
TEST(UILoaderXML, attr) {
|
||||
widget_t* b1 = NULL;
|
||||
widget_t* b2 = NULL;
|
||||
widget_t* b3 = NULL;
|
||||
widget_t* b4 = NULL;
|
||||
ui_loader_t* loader = xml_ui_loader();
|
||||
ui_builder_t* builder = ui_builder_default();
|
||||
const char* str =
|
||||
"<dialog x=\"0\" y=\"0\" w=\"400\" h=\"300\">\
|
||||
<button name=\"b1\" x=\"10\" y=\"10\" w=\"80\" h=\"20\" />\
|
||||
<button name=\"b2\" x=\"10%\" y=\"10%\" w=\"80%\" h=\"20%\" />\
|
||||
<button name=\"b3\" x=\"center\" y=\"middle\" w=\"80\" h=\"20\" />\
|
||||
<button name=\"b4\" x=\"right\" y=\"bottom\" w=\"80\" h=\"20\" />\
|
||||
</dialog>";
|
||||
|
||||
ASSERT_EQ(ui_loader_load(loader, (const uint8_t*)str, strlen(str), builder), RET_OK);
|
||||
|
||||
ASSERT_EQ(builder->root != NULL, true);
|
||||
b1 = widget_lookup(builder->root, "b1", TRUE);
|
||||
ASSERT_EQ(b1 != NULL, true);
|
||||
ASSERT_EQ(b1->x, 10);
|
||||
ASSERT_EQ(b1->y, 10);
|
||||
ASSERT_EQ(b1->w, 80);
|
||||
ASSERT_EQ(b1->h, 20);
|
||||
wh_t parent_w = b1->parent->w;
|
||||
wh_t parent_h = b1->parent->h;
|
||||
|
||||
b2 = widget_lookup(builder->root, "b2", TRUE);
|
||||
ASSERT_EQ(b2 != NULL, true);
|
||||
ASSERT_EQ(b2->x, 40);
|
||||
ASSERT_EQ(b2->y, parent_h * 10 / 100);
|
||||
ASSERT_EQ(b2->w, 320);
|
||||
ASSERT_EQ(b2->h, parent_h * 20 / 100);
|
||||
|
||||
b3 = widget_lookup(builder->root, "b3", TRUE);
|
||||
ASSERT_EQ(b3 != NULL, true);
|
||||
ASSERT_EQ(b3->x, 160);
|
||||
ASSERT_EQ(b3->y, (parent_h - b3->h) / 2);
|
||||
ASSERT_EQ(b3->w, 80);
|
||||
ASSERT_EQ(b3->h, 20);
|
||||
|
||||
b4 = widget_lookup(builder->root, "b4", TRUE);
|
||||
ASSERT_EQ(b4 != NULL, true);
|
||||
ASSERT_EQ(b4->x, parent_w - b4->w);
|
||||
ASSERT_EQ(b4->y, parent_h - b4->h);
|
||||
ASSERT_EQ(b4->w, 80);
|
||||
ASSERT_EQ(b4->h, 20);
|
||||
|
||||
widget_destroy(builder->root);
|
||||
}
|
||||
|
@ -1,144 +1,126 @@
|
||||
|
||||
#include "base/canvas.h"
|
||||
#include "base/widget.h"
|
||||
#include "base/button.h"
|
||||
#include "base/group_box.h"
|
||||
#include "base/window.h"
|
||||
#include "font_dummy.h"
|
||||
#include "lcd_log.h"
|
||||
#include "gtest/gtest.h"
|
||||
#include <stdlib.h>
|
||||
#include "gtest/gtest.h"
|
||||
|
||||
TEST(Widget, moveresize) {
|
||||
widget_t w;
|
||||
memset(&w, 0x00, sizeof(w));
|
||||
widget_t* w = window_create(NULL, 0, 0, 400, 300);
|
||||
|
||||
ASSERT_EQ(widget_init(&w, NULL, WIDGET_NORMAL_WINDOW), &w);
|
||||
ASSERT_EQ(widget_move(&w, 100, 200), RET_OK);
|
||||
ASSERT_EQ(w.x, 100);
|
||||
ASSERT_EQ(w.y, 200);
|
||||
ASSERT_EQ(w->x, 0);
|
||||
ASSERT_EQ(w->y, 0);
|
||||
ASSERT_EQ(widget_move(w, 100, 200), RET_OK);
|
||||
ASSERT_EQ(w->x, 100);
|
||||
ASSERT_EQ(w->y, 200);
|
||||
|
||||
ASSERT_EQ(widget_init(&w, NULL, WIDGET_NORMAL_WINDOW), &w);
|
||||
ASSERT_EQ(widget_resize(&w, 300, 400), RET_OK);
|
||||
ASSERT_EQ(w.w, 300);
|
||||
ASSERT_EQ(w.h, 400);
|
||||
ASSERT_EQ(widget_resize(w, 300, 400), RET_OK);
|
||||
ASSERT_EQ(w->w, 300);
|
||||
ASSERT_EQ(w->h, 400);
|
||||
|
||||
ASSERT_EQ(widget_set_state(&w, WIDGET_STATE_PRESSED), RET_OK);
|
||||
ASSERT_EQ(w.state, WIDGET_STATE_PRESSED);
|
||||
ASSERT_EQ(widget_set_state(w, WIDGET_STATE_PRESSED), RET_OK);
|
||||
ASSERT_EQ(w->state, WIDGET_STATE_PRESSED);
|
||||
|
||||
ASSERT_EQ(widget_set_enable(&w, TRUE), RET_OK);
|
||||
ASSERT_EQ(w.enable, TRUE);
|
||||
ASSERT_EQ(widget_set_enable(w, TRUE), RET_OK);
|
||||
ASSERT_EQ(w->enable, TRUE);
|
||||
|
||||
ASSERT_EQ(widget_set_enable(&w, FALSE), RET_OK);
|
||||
ASSERT_EQ(w.enable, FALSE);
|
||||
ASSERT_EQ(widget_set_enable(w, FALSE), RET_OK);
|
||||
ASSERT_EQ(w->enable, FALSE);
|
||||
|
||||
ASSERT_EQ(widget_set_visible(&w, TRUE, TRUE), RET_OK);
|
||||
ASSERT_EQ(w.visible, TRUE);
|
||||
ASSERT_EQ(widget_set_visible(w, TRUE, TRUE), RET_OK);
|
||||
ASSERT_EQ(w->visible, TRUE);
|
||||
|
||||
ASSERT_EQ(widget_set_visible(&w, FALSE, TRUE), RET_OK);
|
||||
ASSERT_EQ(w.visible, FALSE);
|
||||
ASSERT_EQ(widget_set_visible(w, FALSE, TRUE), RET_OK);
|
||||
ASSERT_EQ(w->visible, FALSE);
|
||||
|
||||
ASSERT_EQ(widget_set_focused(&w, FALSE), RET_OK);
|
||||
ASSERT_EQ(w.focused, FALSE);
|
||||
ASSERT_EQ(widget_set_focused(w, FALSE), RET_OK);
|
||||
ASSERT_EQ(w->focused, FALSE);
|
||||
|
||||
widget_destroy(w);
|
||||
}
|
||||
|
||||
TEST(Widget, props) {
|
||||
widget_t w;
|
||||
value_t v1;
|
||||
value_t v2;
|
||||
memset(&w, 0x00, sizeof(w));
|
||||
widget_t* w = window_create(NULL, 0, 0, 400, 300);
|
||||
|
||||
ASSERT_EQ(widget_init(&w, NULL, WIDGET_NORMAL_WINDOW), &w);
|
||||
value_set_str(&v1, "window");
|
||||
ASSERT_EQ(widget_set_prop(&w, "name", &v1), RET_OK);
|
||||
ASSERT_EQ(widget_get_prop(&w, "name", &v2), RET_OK);
|
||||
ASSERT_EQ(widget_set_prop(w, "name", &v1), RET_OK);
|
||||
ASSERT_EQ(widget_get_prop(w, "name", &v2), RET_OK);
|
||||
ASSERT_EQ(v1.type, v2.type);
|
||||
ASSERT_EQ(strcmp(v1.value.str, v2.value.str), 0);
|
||||
|
||||
value_set_int(&v1, 1);
|
||||
ASSERT_EQ(widget_set_prop(&w, "x", &v1), RET_OK);
|
||||
ASSERT_EQ(widget_get_prop(&w, "x", &v2), RET_OK);
|
||||
ASSERT_EQ(widget_set_prop(w, "x", &v1), RET_OK);
|
||||
ASSERT_EQ(widget_get_prop(w, "x", &v2), RET_OK);
|
||||
ASSERT_EQ(v1.type, v2.type);
|
||||
ASSERT_EQ(value_int(&v1), value_int(&v2));
|
||||
|
||||
value_set_int(&v1, 2);
|
||||
ASSERT_EQ(widget_set_prop(&w, "y", &v1), RET_OK);
|
||||
ASSERT_EQ(widget_get_prop(&w, "y", &v2), RET_OK);
|
||||
ASSERT_EQ(widget_set_prop(w, "y", &v1), RET_OK);
|
||||
ASSERT_EQ(widget_get_prop(w, "y", &v2), RET_OK);
|
||||
ASSERT_EQ(v1.type, v2.type);
|
||||
ASSERT_EQ(value_int(&v1), value_int(&v2));
|
||||
|
||||
value_set_int(&v1, 3);
|
||||
ASSERT_EQ(widget_set_prop(&w, "w", &v1), RET_OK);
|
||||
ASSERT_EQ(widget_get_prop(&w, "w", &v2), RET_OK);
|
||||
ASSERT_EQ(widget_set_prop(w, "w", &v1), RET_OK);
|
||||
ASSERT_EQ(widget_get_prop(w, "w", &v2), RET_OK);
|
||||
ASSERT_EQ(v1.type, v2.type);
|
||||
ASSERT_EQ(value_int(&v1), value_int(&v2));
|
||||
|
||||
value_set_int(&v1, 4);
|
||||
ASSERT_EQ(widget_set_prop(&w, "h", &v1), RET_OK);
|
||||
ASSERT_EQ(widget_get_prop(&w, "h", &v2), RET_OK);
|
||||
ASSERT_EQ(widget_set_prop(w, "h", &v1), RET_OK);
|
||||
ASSERT_EQ(widget_get_prop(w, "h", &v2), RET_OK);
|
||||
ASSERT_EQ(v1.type, v2.type);
|
||||
ASSERT_EQ(value_int(&v1), value_int(&v2));
|
||||
|
||||
ASSERT_EQ(widget_set_prop(&w, "hh", &v1), RET_NOT_FOUND);
|
||||
ASSERT_EQ(widget_get_prop(&w, "hh", &v2), RET_NOT_FOUND);
|
||||
ASSERT_EQ(widget_set_prop(w, "hh", &v1), RET_NOT_FOUND);
|
||||
ASSERT_EQ(widget_get_prop(w, "hh", &v2), RET_NOT_FOUND);
|
||||
widget_destroy(w);
|
||||
}
|
||||
|
||||
TEST(Widget, children) {
|
||||
widget_t c1;
|
||||
widget_t c2;
|
||||
widget_t c3;
|
||||
widget_t c4;
|
||||
widget_t c5;
|
||||
widget_t c6;
|
||||
widget_t group;
|
||||
widget_t w;
|
||||
uint32_t size = sizeof(c1);
|
||||
printf("widget size=%d\n", size);
|
||||
memset(&w, 0x00, size);
|
||||
memset(&c1, 0x00, size);
|
||||
memset(&c2, 0x00, size);
|
||||
memset(&c3, 0x00, size);
|
||||
memset(&c4, 0x00, size);
|
||||
memset(&c5, 0x00, size);
|
||||
memset(&c6, 0x00, size);
|
||||
memset(&group, 0x00, size);
|
||||
widget_t* w = window_create(NULL, 0, 0, 400, 300);
|
||||
widget_t* c1 = button_create(w, 0, 0, 10, 10);
|
||||
widget_t* c2 = button_create(w, 0, 0, 10, 10);
|
||||
widget_t* c3 = button_create(w, 0, 0, 10, 10);
|
||||
widget_t* c4 = button_create(w, 0, 0, 10, 10);
|
||||
widget_t* c5 = button_create(w, 0, 0, 10, 10);
|
||||
widget_t* c6 = button_create(w, 0, 0, 10, 10);
|
||||
widget_t* group = group_box_create(w, 0, 0, 10, 10);
|
||||
|
||||
ASSERT_EQ(widget_init(&w, NULL, WIDGET_NORMAL_WINDOW), &w);
|
||||
ASSERT_EQ(widget_init(&c1, &w, WIDGET_BUTTON), &c1);
|
||||
ASSERT_EQ(widget_init(&c2, &w, WIDGET_BUTTON), &c2);
|
||||
ASSERT_EQ(widget_init(&c3, &w, WIDGET_BUTTON), &c3);
|
||||
ASSERT_EQ(widget_init(&group, &w, WIDGET_BUTTON), &group);
|
||||
ASSERT_EQ(widget_set_name(c1, "c1"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(c2, "c2"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(c3, "c3"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(c4, "c4"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(c5, "c5"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(c6, "c6"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(group, "group"), RET_OK);
|
||||
|
||||
ASSERT_EQ(widget_init(&c4, &group, WIDGET_BUTTON), &c4);
|
||||
ASSERT_EQ(widget_init(&c5, &group, WIDGET_BUTTON), &c5);
|
||||
ASSERT_EQ(widget_init(&c6, &group, WIDGET_BUTTON), &c6);
|
||||
ASSERT_EQ(widget_lookup(w, "c1", FALSE), c1);
|
||||
ASSERT_EQ(widget_lookup(w, "c2", FALSE), c2);
|
||||
ASSERT_EQ(widget_lookup(w, "c3", FALSE), c3);
|
||||
|
||||
ASSERT_EQ(widget_set_name(&c1, "c1"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(&c2, "c2"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(&c3, "c3"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(&c4, "c4"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(&c5, "c5"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(&c6, "c6"), RET_OK);
|
||||
ASSERT_EQ(widget_set_name(&group, "group"), RET_OK);
|
||||
ASSERT_EQ(widget_lookup(w, "c1", TRUE), c1);
|
||||
ASSERT_EQ(widget_lookup(w, "c2", TRUE), c2);
|
||||
ASSERT_EQ(widget_lookup(w, "c3", TRUE), c3);
|
||||
|
||||
ASSERT_EQ(widget_lookup(&w, "c1", FALSE), &c1);
|
||||
ASSERT_EQ(widget_lookup(&w, "c2", FALSE), &c2);
|
||||
ASSERT_EQ(widget_lookup(&w, "c3", FALSE), &c3);
|
||||
ASSERT_EQ(widget_lookup(w, "c4", TRUE), c4);
|
||||
ASSERT_EQ(widget_lookup(w, "c5", TRUE), c5);
|
||||
ASSERT_EQ(widget_lookup(w, "c6", TRUE), c6);
|
||||
|
||||
ASSERT_EQ(widget_lookup(&w, "c1", TRUE), &c1);
|
||||
ASSERT_EQ(widget_lookup(&w, "c2", TRUE), &c2);
|
||||
ASSERT_EQ(widget_lookup(&w, "c3", TRUE), &c3);
|
||||
widget_move_resize(c1, 10, 10, 20, 20);
|
||||
ASSERT_EQ(widget_find_target(w, 11, 11), c1);
|
||||
|
||||
ASSERT_EQ(widget_lookup(&w, "c4", TRUE), &c4);
|
||||
ASSERT_EQ(widget_lookup(&w, "c5", TRUE), &c5);
|
||||
ASSERT_EQ(widget_lookup(&w, "c6", TRUE), &c6);
|
||||
widget_move_resize(c2, 150, 10, 20, 20);
|
||||
ASSERT_EQ(widget_find_target(w, 151, 11), c2);
|
||||
|
||||
widget_move_resize(&c1, 10, 10, 20, 20);
|
||||
ASSERT_EQ(widget_find_target(&w, 11, 11), &c1);
|
||||
widget_move_resize(c3, 150, 100, 20, 20);
|
||||
ASSERT_EQ(widget_find_target(w, 151, 100), c3);
|
||||
|
||||
widget_move_resize(&c2, 150, 10, 20, 20);
|
||||
ASSERT_EQ(widget_find_target(&w, 151, 11), &c2);
|
||||
|
||||
widget_move_resize(&c3, 150, 100, 20, 20);
|
||||
ASSERT_EQ(widget_find_target(&w, 151, 100), &c3);
|
||||
|
||||
ASSERT_EQ(widget_remove_child(&w, &c3), RET_OK);
|
||||
ASSERT_EQ(widget_remove_child(&w, &c3), RET_NOT_FOUND);
|
||||
widget_destroy(w);
|
||||
}
|
||||
|
@ -10,4 +10,5 @@ TEST(WStr, basic) {
|
||||
ASSERT_EQ(wstr_set(&str, cstr), RET_OK);
|
||||
ASSERT_EQ(str.size, wcslen(cstr));
|
||||
ASSERT_EQ(wcscmp(str.str, cstr), 0);
|
||||
ASSERT_EQ(wstr_reset(&str), RET_OK);
|
||||
}
|
||||
|
@ -53,7 +53,8 @@ uint8_t* Style::Output(uint8_t* buff, uint32_t max_size) {
|
||||
|
||||
size = this->int_values.size();
|
||||
save_uint32(p, size);
|
||||
printf(" size=%d type=%d subtype=%d state=%d\n", size, this->type, this->subtype, this->state);
|
||||
// printf(" size=%d type=%d subtype=%d state=%d\n", size, this->type, this->subtype,
|
||||
// this->state);
|
||||
for (vector<NameIntValue>::iterator i = this->int_values.begin(); i != this->int_values.end();
|
||||
i++) {
|
||||
uint32_t name = i->name;
|
||||
|
5
tools/ui_gen/dialog2.xml
Normal file
5
tools/ui_gen/dialog2.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<dialog name="" icon="info" x="10" y="120" w="300" h="240" text="Dialog">
|
||||
<label name="" x="center" y="80" w="200" h="30" text="LFTK is cool!"/>
|
||||
<button name="ok" x="10" y="bottom:10" w="40%" h="30" text="Go"/>
|
||||
<button name="cancel" x="right:10" y="bottom:10" w="40%" h="30" text="Cancel"/>
|
||||
</dialog>
|
@ -1,4 +1,11 @@
|
||||
./xml_to_ui window1.xml window1.data
|
||||
./xml_to_ui dialog1.xml dialog1.data
|
||||
|
||||
for f in *.xml;
|
||||
do
|
||||
echo ./xml_to_ui $f ${f/xml/data}
|
||||
./xml_to_ui $f ${f/xml/data}
|
||||
done
|
||||
|
||||
mv -v *.data ../../demos/res/ui/
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
<window name="main" x="0" y="0" w="320" h="480">
|
||||
<button name="inc" x="10" y="5" w="80" h="30" text="Inc"/>
|
||||
<button name="dec" x="100" y="5" w="80" h="30" text="Dec"/>
|
||||
<button name="dialog" x="190" y="5" w="80" h="30" text="Dialog"/>
|
||||
<button name="inc" x="10" y="5" w="40%" h="30" text="Inc"/>
|
||||
<button name="dec" x="right:10" y="5" w="40%" h="30" text="Dec"/>
|
||||
<image name="img" x="10" y="230" w="100" h="100"/>
|
||||
<label name="" x="10" y="40" w="80" h="30" text="Left"/>
|
||||
<label name="" x="100" y="40" w="80" h="30" text="Center"/>
|
||||
@ -13,4 +12,7 @@
|
||||
<radio_button name="r1" x="10" y="200" w="80" h="30" text="Book"/>
|
||||
<radio_button name="r2" x="100" y="200" w="80" h="30" text="Food"/>
|
||||
<radio_button name="r3" x="190" y="200" w="80" h="30" text="Pencil"/>
|
||||
|
||||
<button name="dialog" x="10" y="260" w="40%" h="30" text="Dialog"/>
|
||||
<button name="dialog2" x="right:10" y="260" w="40%" h="30" text="Dialog2"/>
|
||||
</window>
|
||||
|
Loading…
x
Reference in New Issue
Block a user