Apply clang-format for more source files (#795)

Apply clang-format for C source files in folder core/app-mgr,
core/app-framework, and test-tools.
And rename folder component_test to component-test, update
zephyr build document.

Signed-off-by: Wenyong Huang <wenyong.huang@intel.com>
This commit is contained in:
Wenyong Huang
2021-10-21 13:58:34 +08:00
committed by GitHub
parent 225f5d0a64
commit 32242988ed
143 changed files with 5377 additions and 4627 deletions

View File

@ -7,12 +7,13 @@
#include "bh_platform.h"
#include "gui_api.h"
#define ARGC sizeof(argv)/sizeof(uint32)
#define ARGC sizeof(argv) / sizeof(uint32)
#define CALL_BTN_NATIVE_FUNC(id) wasm_btn_native_call(id, argv, ARGC)
lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
lv_obj_t *
lv_btn_create(lv_obj_t *par, const lv_obj_t *copy)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)par;
argv[1] = (uint32)copy;
@ -20,100 +21,113 @@ lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
return (lv_obj_t *)argv[0];
}
void lv_btn_set_toggle(lv_obj_t * btn, bool tgl)
void
lv_btn_set_toggle(lv_obj_t *btn, bool tgl)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)btn;
argv[1] = tgl;
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_SET_TOGGLE);
}
void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state)
void
lv_btn_set_state(lv_obj_t *btn, lv_btn_state_t state)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)btn;
argv[1] = state;
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_SET_STATE);
}
void lv_btn_toggle(lv_obj_t * btn)
void
lv_btn_toggle(lv_obj_t *btn)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)btn;
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_TOGGLE);
}
void lv_btn_set_ink_in_time(lv_obj_t * btn, uint16_t time)
void
lv_btn_set_ink_in_time(lv_obj_t *btn, uint16_t time)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)btn;
argv[1] = time;
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_SET_INK_IN_TIME);
}
void lv_btn_set_ink_wait_time(lv_obj_t * btn, uint16_t time)
void
lv_btn_set_ink_wait_time(lv_obj_t *btn, uint16_t time)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)btn;
argv[1] = time;
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_SET_INK_WAIT_TIME);
}
void lv_btn_set_ink_out_time(lv_obj_t * btn, uint16_t time)
void
lv_btn_set_ink_out_time(lv_obj_t *btn, uint16_t time)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)btn;
argv[1] = time;
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_SET_INK_OUT_TIME);
}
//void wgl_btn_set_style(wgl_obj_t btn, wgl_btn_style_t type, const wgl_style_t * style)
// void wgl_btn_set_style(wgl_obj_t btn, wgl_btn_style_t type,
// const wgl_style_t *style)
//{
// //TODO: pack style
// //wasm_btn_set_style(btn, type, style);
//}
//
lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn)
lv_btn_state_t
lv_btn_get_state(const lv_obj_t *btn)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)btn;
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_GET_STATE);
return (lv_btn_state_t)argv[0];
}
bool lv_btn_get_toggle(const lv_obj_t * btn)
bool
lv_btn_get_toggle(const lv_obj_t *btn)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)btn;
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_GET_TOGGLE);
return (bool)argv[0];
}
uint16_t lv_btn_get_ink_in_time(const lv_obj_t * btn)
uint16_t
lv_btn_get_ink_in_time(const lv_obj_t *btn)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)btn;
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_GET_INK_IN_TIME);
return (uint16_t)argv[0];
}
uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn)
uint16_t
lv_btn_get_ink_wait_time(const lv_obj_t *btn)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)btn;
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_GET_INK_WAIT_TIME);
return (uint16_t)argv[0];
}
uint16_t lv_btn_get_ink_out_time(const lv_obj_t * btn)
uint16_t
lv_btn_get_ink_out_time(const lv_obj_t *btn)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)btn;
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_GET_INK_OUT_TIME);
return (uint16_t)argv[0];
}
//
//const wgl_style_t * wgl_btn_get_style(const wgl_obj_t btn, wgl_btn_style_t type)
// const wgl_style_t * wgl_btn_get_style(const wgl_obj_t btn,
// wgl_btn_style_t type)
//{
// //TODO: pack style
// //wasm_btn_get_style(btn, type);

View File

@ -3,18 +3,18 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include "wa-inc/lvgl/lvgl.h"
#include "gui_api.h"
#include <string.h>
#define ARGC sizeof(argv)/sizeof(uint32)
#define ARGC sizeof(argv) / sizeof(uint32)
#define CALL_CB_NATIVE_FUNC(id) wasm_cb_native_call(id, argv, ARGC)
lv_obj_t * lv_cb_create(lv_obj_t * par, const lv_obj_t * copy)
lv_obj_t *
lv_cb_create(lv_obj_t *par, const lv_obj_t *copy)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)par;
argv[1] = (uint32)copy;
@ -22,41 +22,46 @@ lv_obj_t * lv_cb_create(lv_obj_t * par, const lv_obj_t * copy)
return (lv_obj_t *)argv[0];
}
void lv_cb_set_text(lv_obj_t * cb, const char * txt)
void
lv_cb_set_text(lv_obj_t *cb, const char *txt)
{
uint32 argv[3] = {0};
uint32 argv[3] = { 0 };
argv[0] = (uint32)cb;
argv[1] = (uint32)txt;
argv[2] = strlen(txt) + 1;
CALL_CB_NATIVE_FUNC(CB_FUNC_ID_SET_TEXT);
}
void lv_cb_set_static_text(lv_obj_t * cb, const char * txt)
void
lv_cb_set_static_text(lv_obj_t *cb, const char *txt)
{
uint32 argv[3] = {0};
uint32 argv[3] = { 0 };
argv[0] = (uint32)cb;
argv[1] = (uint32)txt;
argv[2] = strlen(txt) + 1;
CALL_CB_NATIVE_FUNC(CB_FUNC_ID_SET_STATIC_TEXT);
}
//void wgl_cb_set_style(wgl_obj_t cb, wgl_cb_style_t type, const wgl_style_t * style)
// void wgl_cb_set_style(wgl_obj_t cb, wgl_cb_style_t type,
// const wgl_style_t *style)
//{
// //TODO:
//}
//
static unsigned int wgl_cb_get_text_length(lv_obj_t * cb)
static unsigned int
wgl_cb_get_text_length(lv_obj_t *cb)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)cb;
CALL_CB_NATIVE_FUNC(CB_FUNC_ID_GET_TEXT_LENGTH);
return argv[0];
}
static char *wgl_cb_get_text(lv_obj_t * cb, char *buffer, int buffer_len)
static char *
wgl_cb_get_text(lv_obj_t *cb, char *buffer, int buffer_len)
{
uint32 argv[3] = {0};
uint32 argv[3] = { 0 };
argv[0] = (uint32)cb;
argv[1] = (uint32)buffer;
argv[2] = buffer_len;
@ -65,18 +70,17 @@ static char *wgl_cb_get_text(lv_obj_t * cb, char *buffer, int buffer_len)
}
// TODO: need to use a global data buffer for the returned text
const char * lv_cb_get_text(const lv_obj_t * cb)
const char *
lv_cb_get_text(const lv_obj_t *cb)
{
return NULL;
}
//const wgl_style_t * wgl_cb_get_style(const wgl_obj_t cb, wgl_cb_style_t type)
// const wgl_style_t * wgl_cb_get_style(const wgl_obj_t cb,
// wgl_cb_style_t type)
//{
// //TODO
// return NULL;
//}
//

View File

@ -3,19 +3,17 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include "wa-inc/lvgl/lvgl.h"
#include "gui_api.h"
#include <string.h>
#define ARGC sizeof(argv)/sizeof(uint32)
#define ARGC sizeof(argv) / sizeof(uint32)
#define CALL_LABEL_NATIVE_FUNC(id) wasm_label_native_call(id, argv, ARGC)
lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
lv_obj_t *
lv_label_create(lv_obj_t *par, const lv_obj_t *copy)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)par;
argv[1] = (uint32)copy;
@ -23,109 +21,112 @@ lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
return (lv_obj_t *)argv[0];
}
void lv_label_set_text(lv_obj_t * label, const char * text)
void
lv_label_set_text(lv_obj_t *label, const char *text)
{
uint32 argv[3] = {0};
uint32 argv[3] = { 0 };
argv[0] = (uint32)label;
argv[1] = (uint32)text;
argv[2] = strlen(text) + 1;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_SET_TEXT);
}
void lv_label_set_array_text(lv_obj_t * label, const char * array, uint16_t size)
void
lv_label_set_array_text(lv_obj_t *label, const char *array, uint16_t size)
{
uint32 argv[3] = {0};
uint32 argv[3] = { 0 };
argv[0] = (uint32)label;
argv[1] = (uint32)array;
argv[2] = size;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_SET_ARRAY_TEXT);
}
void lv_label_set_static_text(lv_obj_t * label, const char * text)
void
lv_label_set_static_text(lv_obj_t *label, const char *text)
{
uint32 argv[3] = {0};
uint32 argv[3] = { 0 };
argv[0] = (uint32)label;
argv[1] = (uint32)text;
argv[2] = strlen(text) + 1;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_SET_STATIC_TEXT);
}
void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode)
void
lv_label_set_long_mode(lv_obj_t *label, lv_label_long_mode_t long_mode)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)label;
argv[1] = long_mode;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_SET_LONG_MODE);
}
void lv_label_set_align(lv_obj_t * label, lv_label_align_t align)
void
lv_label_set_align(lv_obj_t *label, lv_label_align_t align)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)label;
argv[1] = align;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_SET_ALIGN);
}
void lv_label_set_recolor(lv_obj_t * label, bool en)
void
lv_label_set_recolor(lv_obj_t *label, bool en)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)label;
argv[1] = en;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_SET_RECOLOR);
}
void lv_label_set_body_draw(lv_obj_t * label, bool en)
void
lv_label_set_body_draw(lv_obj_t *label, bool en)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)label;
argv[1] = en;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_SET_BODY_DRAW);
}
void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed)
void
lv_label_set_anim_speed(lv_obj_t *label, uint16_t anim_speed)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)label;
argv[1] = anim_speed;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_SET_ANIM_SPEED);
}
void lv_label_set_text_sel_start(lv_obj_t * label, uint16_t index)
void
lv_label_set_text_sel_start(lv_obj_t *label, uint16_t index)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)label;
argv[1] = index;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_SET_TEXT_SEL_START);
}
void lv_label_set_text_sel_end(lv_obj_t * label, uint16_t index)
void
lv_label_set_text_sel_end(lv_obj_t *label, uint16_t index)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)label;
argv[1] = index;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_SET_TEXT_SEL_END);
}
unsigned int wgl_label_get_text_length(lv_obj_t * label)
unsigned int
wgl_label_get_text_length(lv_obj_t *label)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)label;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_GET_TEXT_LENGTH);
return argv[0];
}
char * wgl_label_get_text(lv_obj_t * label, char *buffer, int buffer_len)
char *
wgl_label_get_text(lv_obj_t *label, char *buffer, int buffer_len)
{
uint32 argv[3] = {0};
uint32 argv[3] = { 0 };
argv[0] = (uint32)label;
argv[1] = (uint32)buffer;
argv[2] = buffer_len;
@ -133,63 +134,63 @@ char * wgl_label_get_text(lv_obj_t * label, char *buffer, int buffer_len)
return (char *)argv[0];
}
// TODO:
char * lv_label_get_text(const lv_obj_t * label)
// TODO:
char *
lv_label_get_text(const lv_obj_t *label)
{
return NULL;
}
lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * label)
lv_label_long_mode_t
lv_label_get_long_mode(const lv_obj_t *label)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)label;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_GET_LONG_MODE);
return (lv_label_long_mode_t)argv[0];
}
lv_label_align_t lv_label_get_align(const lv_obj_t * label)
lv_label_align_t
lv_label_get_align(const lv_obj_t *label)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)label;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_GET_ALIGN);
return (lv_label_align_t)argv[0];
}
bool lv_label_get_recolor(const lv_obj_t * label)
bool
lv_label_get_recolor(const lv_obj_t *label)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)label;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_GET_RECOLOR);
return (bool)argv[0];
}
bool lv_label_get_body_draw(const lv_obj_t * label)
bool
lv_label_get_body_draw(const lv_obj_t *label)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)label;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_GET_BODY_DRAW);
return (bool)argv[0];
}
uint16_t lv_label_get_anim_speed(const lv_obj_t * label)
uint16_t
lv_label_get_anim_speed(const lv_obj_t *label)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)label;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_GET_ANIM_SPEED);
return (uint16_t)argv[0];
}
void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t index, lv_point_t * pos)
void
lv_label_get_letter_pos(const lv_obj_t *label, uint16_t index, lv_point_t *pos)
{
uint32 argv[4] = {0};
uint32 argv[4] = { 0 };
argv[0] = (uint32)label;
argv[1] = index;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_GET_LETTER_POS);
@ -197,10 +198,10 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t index, lv_point_t
pos->y = argv[3];
}
uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
uint16_t
lv_label_get_letter_on(const lv_obj_t *label, lv_point_t *pos)
{
uint32 argv[3] = {0};
uint32 argv[3] = { 0 };
argv[0] = (uint32)label;
argv[1] = pos->x;
argv[2] = pos->y;
@ -208,10 +209,10 @@ uint16_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
return (uint16_t)argv[0];
}
bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos)
bool
lv_label_is_char_under_pos(const lv_obj_t *label, lv_point_t *pos)
{
uint32 argv[3] = {0};
uint32 argv[3] = { 0 };
argv[0] = (uint32)label;
argv[1] = pos->x;
argv[2] = pos->y;
@ -219,28 +220,28 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos)
return (bool)argv[0];
}
uint16_t lv_label_get_text_sel_start(const lv_obj_t * label)
uint16_t
lv_label_get_text_sel_start(const lv_obj_t *label)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)label;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_GET_TEXT_SEL_START);
return (uint16_t)argv[0];
}
uint16_t lv_label_get_text_sel_end(const lv_obj_t * label)
uint16_t
lv_label_get_text_sel_end(const lv_obj_t *label)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)label;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_GET_TEXT_SEL_END);
return (uint16_t)argv[0];
}
void lv_label_ins_text(lv_obj_t * label, uint32_t pos, const char * txt)
void
lv_label_ins_text(lv_obj_t *label, uint32_t pos, const char *txt)
{
uint32 argv[4] = {0};
uint32 argv[4] = { 0 };
argv[0] = (uint32)label;
argv[1] = pos;
argv[2] = (uint32)txt;
@ -248,14 +249,12 @@ void lv_label_ins_text(lv_obj_t * label, uint32_t pos, const char * txt)
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_INS_TEXT);
}
void lv_label_cut_text(lv_obj_t * label, uint32_t pos, uint32_t cnt)
void
lv_label_cut_text(lv_obj_t *label, uint32_t pos, uint32_t cnt)
{
uint32 argv[3] = {0};
uint32 argv[3] = { 0 };
argv[0] = (uint32)label;
argv[1] = pos;
argv[2] = cnt;
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_CUT_TEXT);
}

View File

@ -3,19 +3,18 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include "wa-inc/lvgl/lvgl.h"
#include "gui_api.h"
#include <string.h>
#define ARGC sizeof(argv)/sizeof(uint32)
#define ARGC sizeof(argv) / sizeof(uint32)
#define CALL_LIST_NATIVE_FUNC(id) wasm_list_native_call(id, argv, ARGC)
lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
lv_obj_t *
lv_list_create(lv_obj_t *par, const lv_obj_t *copy)
{
uint32 argv[2] = {0};
uint32 argv[2] = { 0 };
argv[0] = (uint32)par;
argv[1] = (uint32)copy;
@ -25,15 +24,16 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
}
//
//
//void wgl_list_clean(wgl_obj_t obj)
// void wgl_list_clean(wgl_obj_t obj)
//{
// wasm_list_clean(obj);
//}
//
lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * txt)
lv_obj_t *
lv_list_add_btn(lv_obj_t *list, const void *img_src, const char *txt)
{
uint32 argv[3] = {0};
uint32 argv[3] = { 0 };
(void)img_src; /* doesn't support img src currently */
@ -45,13 +45,13 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t
}
//
//
//bool wgl_list_remove(const wgl_obj_t list, uint16_t index)
// bool wgl_list_remove(const wgl_obj_t list, uint16_t index)
//{
// return wasm_list_remove(list, index);
//}
//
//
//void wgl_list_set_single_mode(wgl_obj_t list, bool mode)
// void wgl_list_set_single_mode(wgl_obj_t list, bool mode)
//{
// wasm_list_set_single_mode(list, mode);
//}
@ -59,68 +59,69 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t
//#if LV_USE_GROUP
//
//
//void wgl_list_set_btn_selected(wgl_obj_t list, wgl_obj_t btn)
// void wgl_list_set_btn_selected(wgl_obj_t list, wgl_obj_t btn)
//{
// wasm_list_set_btn_selected(list, btn);
//}
//#endif
//
//
//void wgl_list_set_style(wgl_obj_t list, wgl_list_style_t type, const wgl_style_t * style)
// void wgl_list_set_style(wgl_obj_t list, wgl_list_style_t type,
// const wgl_style_t * style)
//{
// //TODO
//}
//
//
//bool wgl_list_get_single_mode(wgl_obj_t list)
// bool wgl_list_get_single_mode(wgl_obj_t list)
//{
// return wasm_list_get_single_mode(list);
//}
//
//
//const char * wgl_list_get_btn_text(const wgl_obj_t btn)
// const char * wgl_list_get_btn_text(const wgl_obj_t btn)
//{
// return wasm_list_get_btn_text(btn);
//}
//
//wgl_obj_t wgl_list_get_btn_label(const wgl_obj_t btn)
// wgl_obj_t wgl_list_get_btn_label(const wgl_obj_t btn)
//{
// return wasm_list_get_btn_label(btn);
//}
//
//
//wgl_obj_t wgl_list_get_btn_img(const wgl_obj_t btn)
// wgl_obj_t wgl_list_get_btn_img(const wgl_obj_t btn)
//{
// return wasm_list_get_btn_img(btn);
//}
//
//
//wgl_obj_t wgl_list_get_prev_btn(const wgl_obj_t list, wgl_obj_t prev_btn)
// wgl_obj_t wgl_list_get_prev_btn(const wgl_obj_t list, wgl_obj_t prev_btn)
//{
// return wasm_list_get_prev_btn(list, prev_btn);
//}
//
//
//wgl_obj_t wgl_list_get_next_btn(const wgl_obj_t list, wgl_obj_t prev_btn)
// wgl_obj_t wgl_list_get_next_btn(const wgl_obj_t list, wgl_obj_t prev_btn)
//{
// return wasm_list_get_next_btn(list, prev_btn);
//}
//
//
//int32_t wgl_list_get_btn_index(const wgl_obj_t list, const wgl_obj_t btn)
// int32_t wgl_list_get_btn_index(const wgl_obj_t list, const wgl_obj_t btn)
//{
// return wasm_list_get_btn_index(list, btn);
//}
//
//
//uint16_t wgl_list_get_size(const wgl_obj_t list)
// uint16_t wgl_list_get_size(const wgl_obj_t list)
//{
// return wasm_list_get_size(list);
//}
//
//#if LV_USE_GROUP
//
//wgl_obj_t wgl_list_get_btn_selected(const wgl_obj_t list)
// wgl_obj_t wgl_list_get_btn_selected(const wgl_obj_t list)
//{
// return wasm_list_get_btn_selected(list);
//}
@ -128,28 +129,27 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t
//
//
//
//const wgl_style_t * wgl_list_get_style(const wgl_obj_t list, wgl_list_style_t type)
// const wgl_style_t * wgl_list_get_style(const wgl_obj_t list,
// wgl_list_style_t type)
//{
// //TODO
// return NULL;
//}
//
//
//void wgl_list_up(const wgl_obj_t list)
// void wgl_list_up(const wgl_obj_t list)
//{
// wasm_list_up(list);
//}
//
//void wgl_list_down(const wgl_obj_t list)
// void wgl_list_down(const wgl_obj_t list)
//{
// wasm_list_down(list);
//}
//
//
//void wgl_list_focus(const wgl_obj_t btn, wgl_anim_enable_t anim)
// void wgl_list_focus(const wgl_obj_t btn, wgl_anim_enable_t anim)
//{
// wasm_list_focus(btn, anim);
//}
//

View File

@ -3,19 +3,18 @@
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
*/
#include "wa-inc/lvgl/lvgl.h"
#include "gui_api.h"
#include <stdlib.h>
#include <string.h>
#define ARGC sizeof(argv)/sizeof(uint32)
#define ARGC sizeof(argv) / sizeof(uint32)
#define CALL_OBJ_NATIVE_FUNC(id) wasm_obj_native_call(id, argv, ARGC)
typedef struct _obj_evt_cb {
struct _obj_evt_cb *next;
lv_obj_t * obj;
lv_obj_t *obj;
lv_event_cb_t event_cb;
} obj_evt_cb_t;
@ -24,31 +23,36 @@ static obj_evt_cb_t *g_obj_evt_cb_list = NULL;
/* For lvgl compatible */
char g_widget_text[100];
lv_res_t lv_obj_del(lv_obj_t * obj)
lv_res_t
lv_obj_del(lv_obj_t *obj)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)obj;
CALL_OBJ_NATIVE_FUNC(OBJ_FUNC_ID_DEL);
return (lv_res_t)argv[0];
}
void lv_obj_del_async(struct _lv_obj_t *obj)
void
lv_obj_del_async(struct _lv_obj_t *obj)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)obj;
CALL_OBJ_NATIVE_FUNC(OBJ_FUNC_ID_DEL_ASYNC);
}
void lv_obj_clean(lv_obj_t * obj)
void
lv_obj_clean(lv_obj_t *obj)
{
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
argv[0] = (uint32)obj;
CALL_OBJ_NATIVE_FUNC(OBJ_FUNC_ID_CLEAN);
}
void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_mod, lv_coord_t y_mod)
void
lv_obj_align(lv_obj_t *obj, const lv_obj_t *base, lv_align_t align,
lv_coord_t x_mod, lv_coord_t y_mod)
{
uint32 argv[5] = {0};
uint32 argv[5] = { 0 };
argv[0] = (uint32)obj;
argv[1] = (uint32)base;
argv[2] = align;
@ -57,7 +61,8 @@ void lv_obj_align(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_co
CALL_OBJ_NATIVE_FUNC(OBJ_FUNC_ID_ALIGN);
}
lv_event_cb_t lv_obj_get_event_cb(const lv_obj_t * obj)
lv_event_cb_t
lv_obj_get_event_cb(const lv_obj_t *obj)
{
obj_evt_cb_t *obj_evt_cb = g_obj_evt_cb_list;
while (obj_evt_cb != NULL) {
@ -70,10 +75,11 @@ lv_event_cb_t lv_obj_get_event_cb(const lv_obj_t * obj)
return NULL;
}
void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb)
void
lv_obj_set_event_cb(lv_obj_t *obj, lv_event_cb_t event_cb)
{
obj_evt_cb_t *obj_evt_cb;
uint32 argv[1] = {0};
uint32 argv[1] = { 0 };
obj_evt_cb = g_obj_evt_cb_list;
while (obj_evt_cb) {
@ -94,7 +100,8 @@ void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb)
if (g_obj_evt_cb_list != NULL) {
obj_evt_cb->next = g_obj_evt_cb_list;
g_obj_evt_cb_list = obj_evt_cb;
} else {
}
else {
g_obj_evt_cb_list = obj_evt_cb;
}
@ -102,7 +109,8 @@ void lv_obj_set_event_cb(lv_obj_t * obj, lv_event_cb_t event_cb)
CALL_OBJ_NATIVE_FUNC(OBJ_FUNC_ID_SET_EVT_CB);
}
void on_widget_event(lv_obj_t * obj, lv_event_t event)
void
on_widget_event(lv_obj_t *obj, lv_event_t event)
{
obj_evt_cb_t *obj_evt_cb = g_obj_evt_cb_list;