build and test pass
This commit is contained in:
@ -15,238 +15,6 @@ extern "C" {
|
||||
|
||||
#include <stdbool.h>
|
||||
|
||||
#include "lv_conf.h"
|
||||
|
||||
typedef lv_coord_t wgl_coord_t; /* lv_coord_t is defined in lv_conf.h */
|
||||
typedef void * wgl_font_user_data_t;
|
||||
|
||||
/**
|
||||
* Represents a point on the screen.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
lv_coord_t x;
|
||||
lv_coord_t y;
|
||||
} wgl_point_t;
|
||||
|
||||
/** Represents an area of the screen. */
|
||||
typedef struct
|
||||
{
|
||||
lv_coord_t x1;
|
||||
lv_coord_t y1;
|
||||
lv_coord_t x2;
|
||||
lv_coord_t y2;
|
||||
} wgl_area_t;
|
||||
|
||||
|
||||
/** Describes the properties of a glyph. */
|
||||
typedef struct
|
||||
{
|
||||
uint16_t adv_w; /**< The glyph needs this space. Draw the next glyph after this width. 8 bit integer, 4 bit fractional */
|
||||
uint8_t box_w; /**< Width of the glyph's bounding box*/
|
||||
uint8_t box_h; /**< Height of the glyph's bounding box*/
|
||||
int8_t ofs_x; /**< x offset of the bounding box*/
|
||||
int8_t ofs_y; /**< y offset of the bounding box*/
|
||||
uint8_t bpp; /**< Bit-per-pixel: 1, 2, 4, 8*/
|
||||
}wgl_font_glyph_dsc_t;
|
||||
|
||||
/*Describe the properties of a font*/
|
||||
typedef struct _wgl_font_struct
|
||||
{
|
||||
/** Get a glyph's descriptor from a font*/
|
||||
bool (*get_glyph_dsc)(const struct _wgl_font_struct *, wgl_font_glyph_dsc_t *, uint32_t letter, uint32_t letter_next);
|
||||
|
||||
/** Get a glyph's bitmap from a font*/
|
||||
const uint8_t * (*get_glyph_bitmap)(const struct _wgl_font_struct *, uint32_t);
|
||||
|
||||
/*Pointer to the font in a font pack (must have the same line height)*/
|
||||
uint8_t line_height; /**< The real line height where any text fits*/
|
||||
uint8_t base_line; /**< Base line measured from the top of the line_height*/
|
||||
void * dsc; /**< Store implementation specific data here*/
|
||||
#if LV_USE_USER_DATA
|
||||
wgl_font_user_data_t user_data; /**< Custom user data for font. */
|
||||
#endif
|
||||
} wgl_font_t;
|
||||
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
#define LV_COLOR_SIZE 8
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
#define LV_COLOR_SIZE 8
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
#define LV_COLOR_SIZE 16
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
#define LV_COLOR_SIZE 32
|
||||
#else
|
||||
#error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!"
|
||||
#endif
|
||||
|
||||
/**********************
|
||||
* TYPEDEFS
|
||||
**********************/
|
||||
|
||||
typedef union
|
||||
{
|
||||
uint8_t blue : 1;
|
||||
uint8_t green : 1;
|
||||
uint8_t red : 1;
|
||||
uint8_t full : 1;
|
||||
} wgl_color1_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t blue : 2;
|
||||
uint8_t green : 3;
|
||||
uint8_t red : 3;
|
||||
} ch;
|
||||
uint8_t full;
|
||||
} wgl_color8_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct
|
||||
{
|
||||
#if LV_COLOR_16_SWAP == 0
|
||||
uint16_t blue : 5;
|
||||
uint16_t green : 6;
|
||||
uint16_t red : 5;
|
||||
#else
|
||||
uint16_t green_h : 3;
|
||||
uint16_t red : 5;
|
||||
uint16_t blue : 5;
|
||||
uint16_t green_l : 3;
|
||||
#endif
|
||||
} ch;
|
||||
uint16_t full;
|
||||
} wgl_color16_t;
|
||||
|
||||
typedef union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t blue;
|
||||
uint8_t green;
|
||||
uint8_t red;
|
||||
uint8_t alpha;
|
||||
} ch;
|
||||
uint32_t full;
|
||||
} wgl_color32_t;
|
||||
|
||||
#if LV_COLOR_DEPTH == 1
|
||||
typedef uint8_t wgl_color_int_t;
|
||||
typedef wgl_color1_t wgl_color_t;
|
||||
#elif LV_COLOR_DEPTH == 8
|
||||
typedef uint8_t wgl_color_int_t;
|
||||
typedef wgl_color8_t wgl_color_t;
|
||||
#elif LV_COLOR_DEPTH == 16
|
||||
typedef uint16_t wgl_color_int_t;
|
||||
typedef wgl_color16_t wgl_color_t;
|
||||
#elif LV_COLOR_DEPTH == 32
|
||||
typedef uint32_t wgl_color_int_t;
|
||||
typedef wgl_color32_t wgl_color_t;
|
||||
#else
|
||||
#error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!"
|
||||
#endif
|
||||
|
||||
typedef uint8_t wgl_opa_t;
|
||||
|
||||
|
||||
|
||||
/*Border types (Use 'OR'ed values)*/
|
||||
enum {
|
||||
WGL_BORDER_NONE = 0x00,
|
||||
WGL_BORDER_BOTTOM = 0x01,
|
||||
WGL_BORDER_TOP = 0x02,
|
||||
WGL_BORDER_LEFT = 0x04,
|
||||
WGL_BORDER_RIGHT = 0x08,
|
||||
WGL_BORDER_FULL = 0x0F,
|
||||
WGL_BORDER_INTERNAL = 0x10, /**< FOR matrix-like objects (e.g. Button matrix)*/
|
||||
};
|
||||
typedef uint8_t wgl_border_part_t;
|
||||
|
||||
/*Shadow types*/
|
||||
enum {
|
||||
WGL_SHADOW_BOTTOM = 0, /**< Only draw bottom shadow */
|
||||
WGL_SHADOW_FULL, /**< Draw shadow on all sides */
|
||||
};
|
||||
typedef uint8_t wgl_shadow_type_t;
|
||||
|
||||
/**
|
||||
* Objects in LittlevGL can be assigned a style - which holds information about
|
||||
* how the object should be drawn.
|
||||
*
|
||||
* This allows for easy customization without having to modify the object's design
|
||||
* function.
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
uint8_t glass : 1; /**< 1: Do not inherit this style*/
|
||||
|
||||
/** Object background. */
|
||||
struct
|
||||
{
|
||||
wgl_color_t main_color; /**< Object's main background color. */
|
||||
wgl_color_t grad_color; /**< Second color. If not equal to `main_color` a gradient will be drawn for the background. */
|
||||
wgl_coord_t radius; /**< Object's corner radius. You can use #WGL_RADIUS_CIRCLE if you want to draw a circle. */
|
||||
wgl_opa_t opa; /**< Object's opacity (0-255). */
|
||||
|
||||
struct
|
||||
{
|
||||
wgl_color_t color; /**< Border color */
|
||||
wgl_coord_t width; /**< Border width */
|
||||
wgl_border_part_t part; /**< Which borders to draw */
|
||||
wgl_opa_t opa; /**< Border opacity. */
|
||||
} border;
|
||||
|
||||
|
||||
struct
|
||||
{
|
||||
wgl_color_t color;
|
||||
wgl_coord_t width;
|
||||
wgl_shadow_type_t type; /**< Which parts of the shadow to draw */
|
||||
} shadow;
|
||||
|
||||
struct
|
||||
{
|
||||
wgl_coord_t top;
|
||||
wgl_coord_t bottom;
|
||||
wgl_coord_t left;
|
||||
wgl_coord_t right;
|
||||
wgl_coord_t inner;
|
||||
} padding;
|
||||
} body;
|
||||
|
||||
/** Style for text drawn by this object. */
|
||||
struct
|
||||
{
|
||||
wgl_color_t color; /**< Text color */
|
||||
wgl_color_t sel_color; /**< Text selection background color. */
|
||||
const wgl_font_t * font;
|
||||
wgl_coord_t letter_space; /**< Space between letters */
|
||||
wgl_coord_t line_space; /**< Space between lines (vertical) */
|
||||
wgl_opa_t opa; /**< Text opacity */
|
||||
} text;
|
||||
|
||||
/**< Style of images. */
|
||||
struct
|
||||
{
|
||||
wgl_color_t color; /**< Color to recolor the image with */
|
||||
wgl_opa_t intense; /**< Opacity of recoloring (0 means no recoloring) */
|
||||
wgl_opa_t opa; /**< Opacity of whole image */
|
||||
} image;
|
||||
|
||||
/**< Style of lines (not borders). */
|
||||
struct
|
||||
{
|
||||
wgl_color_t color;
|
||||
wgl_coord_t width;
|
||||
wgl_opa_t opa;
|
||||
uint8_t rounded : 1; /**< 1: rounded line endings*/
|
||||
} line;
|
||||
} wgl_style_t;
|
||||
|
||||
|
||||
|
||||
/* Object native function IDs */
|
||||
enum {
|
||||
|
||||
@ -7,6 +7,7 @@
|
||||
#define _GUI_API_H_
|
||||
|
||||
#include "bh_platform.h"
|
||||
#include "bi-inc/wgl_shared_utils.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
|
||||
@ -10,17 +10,17 @@
|
||||
#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};
|
||||
|
||||
argv[0] = (uint32)par;
|
||||
argv[1] = (uint32)copy;
|
||||
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_CREATE);
|
||||
return (wgl_obj_t)argv[0];
|
||||
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};
|
||||
argv[0] = (uint32)btn;
|
||||
@ -28,7 +28,7 @@ void lv_btn_set_toggle(lv_obj_t * btn, bool 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};
|
||||
argv[0] = (uint32)btn;
|
||||
@ -36,14 +36,14 @@ void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t 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};
|
||||
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};
|
||||
argv[0] = (uint32)btn;
|
||||
@ -51,7 +51,7 @@ void lv_btn_set_ink_in_time(lv_obj_t * btn, uint16_t 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};
|
||||
argv[0] = (uint32)btn;
|
||||
@ -59,7 +59,7 @@ void lv_btn_set_ink_wait_time(lv_obj_t * btn, uint16_t 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};
|
||||
argv[0] = (uint32)btn;
|
||||
@ -73,15 +73,15 @@ void lv_btn_set_ink_out_time(lv_obj_t * btn, uint16_t time);
|
||||
// //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};
|
||||
argv[0] = (uint32)btn;
|
||||
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_GET_STATE);
|
||||
return (wgl_btn_state_t)argv[0];
|
||||
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};
|
||||
argv[0] = (uint32)btn;
|
||||
@ -89,7 +89,7 @@ bool lv_btn_get_toggle(const lv_obj_t * btn);
|
||||
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};
|
||||
argv[0] = (uint32)btn;
|
||||
@ -97,7 +97,7 @@ uint16_t lv_btn_get_ink_in_time(const lv_obj_t * btn);
|
||||
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};
|
||||
argv[0] = (uint32)btn;
|
||||
@ -105,7 +105,7 @@ uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn);
|
||||
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};
|
||||
argv[0] = (uint32)btn;
|
||||
|
||||
@ -12,17 +12,17 @@
|
||||
#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};
|
||||
|
||||
argv[0] = (uint32)par;
|
||||
argv[1] = (uint32)copy;
|
||||
CALL_CB_NATIVE_FUNC(CB_FUNC_ID_CREATE);
|
||||
return (wgl_obj_t)argv[0];
|
||||
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};
|
||||
argv[0] = (uint32)cb;
|
||||
@ -31,7 +31,7 @@ void lv_cb_set_text(lv_obj_t * cb, const char * txt);
|
||||
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};
|
||||
argv[0] = (uint32)cb;
|
||||
@ -46,7 +46,7 @@ void lv_cb_set_static_text(lv_obj_t * cb, const char * txt);
|
||||
//}
|
||||
//
|
||||
|
||||
static unsigned int wgl_cb_get_text_length(wgl_obj_t cb)
|
||||
static unsigned int wgl_cb_get_text_length(lv_obj_t * cb)
|
||||
{
|
||||
uint32 argv[1] = {0};
|
||||
argv[0] = (uint32)cb;
|
||||
@ -54,7 +54,7 @@ static unsigned int wgl_cb_get_text_length(wgl_obj_t cb)
|
||||
return argv[0];
|
||||
}
|
||||
|
||||
static char *wgl_cb_get_text(wgl_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};
|
||||
argv[0] = (uint32)cb;
|
||||
|
||||
@ -13,17 +13,17 @@
|
||||
#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};
|
||||
|
||||
argv[0] = (uint32)par;
|
||||
argv[1] = (uint32)copy;
|
||||
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_CREATE);
|
||||
return (wgl_obj_t)argv[0];
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -33,7 +33,7 @@ void lv_label_set_text(lv_obj_t * label, const char * 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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -43,7 +43,7 @@ void lv_label_set_array_text(lv_obj_t * label, const char * array, uint16_t size
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -53,7 +53,7 @@ void lv_label_set_static_text(lv_obj_t * label, const char * 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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -62,7 +62,7 @@ void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t 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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -71,7 +71,7 @@ void lv_label_set_align(lv_obj_t * label, lv_label_align_t 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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -80,7 +80,7 @@ void lv_label_set_recolor(lv_obj_t * label, bool en);
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -89,7 +89,7 @@ void lv_label_set_body_draw(lv_obj_t * label, bool en);
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -98,7 +98,7 @@ void lv_label_set_anim_speed(lv_obj_t * label, uint16_t 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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -107,7 +107,7 @@ void lv_label_set_text_sel_start(lv_obj_t * label, uint16_t index);
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -115,7 +115,7 @@ void lv_label_set_text_sel_end(lv_obj_t * label, uint16_t index);
|
||||
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_SET_TEXT_SEL_END);
|
||||
}
|
||||
|
||||
unsigned int wgl_label_get_text_length(wgl_obj_t label)
|
||||
unsigned int wgl_label_get_text_length(lv_obj_t * label)
|
||||
{
|
||||
uint32 argv[1] = {0};
|
||||
argv[0] = (uint32)label;
|
||||
@ -123,7 +123,7 @@ unsigned int wgl_label_get_text_length(wgl_obj_t label)
|
||||
return argv[0];
|
||||
}
|
||||
|
||||
char * wgl_label_get_text(wgl_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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -137,28 +137,30 @@ char * wgl_label_get_text(wgl_obj_t label, char *buffer, int buffer_len)
|
||||
char * lv_label_get_text(const lv_obj_t * label)
|
||||
{
|
||||
|
||||
return NULL;
|
||||
|
||||
}
|
||||
|
||||
|
||||
wgl_label_long_mode_t wgl_label_get_long_mode(const wgl_obj_t label)
|
||||
lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * label)
|
||||
{
|
||||
uint32 argv[1] = {0};
|
||||
argv[0] = (uint32)label;
|
||||
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_GET_LONG_MODE);
|
||||
return (wgl_label_long_mode_t)argv[0];
|
||||
return (lv_label_long_mode_t)argv[0];
|
||||
}
|
||||
|
||||
|
||||
lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * label);
|
||||
lv_label_align_t lv_label_get_align(const lv_obj_t * label)
|
||||
{
|
||||
uint32 argv[1] = {0};
|
||||
argv[0] = (uint32)label;
|
||||
CALL_LABEL_NATIVE_FUNC(LABEL_FUNC_ID_GET_ALIGN);
|
||||
return (wgl_label_align_t)argv[0];
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -167,7 +169,7 @@ bool lv_label_get_recolor(const lv_obj_t * label);
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -176,7 +178,7 @@ bool lv_label_get_body_draw(const lv_obj_t * label);
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -185,7 +187,7 @@ uint16_t lv_label_get_anim_speed(const lv_obj_t * label);
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -196,7 +198,7 @@ void lv_label_get_letter_pos(const lv_obj_t * label, uint16_t index, lv_point_t
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -207,7 +209,7 @@ uint16_t lv_label_get_letter_on(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);
|
||||
bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos)
|
||||
{
|
||||
uint32 argv[3] = {0};
|
||||
argv[0] = (uint32)label;
|
||||
@ -218,7 +220,7 @@ bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos);
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -227,7 +229,7 @@ uint16_t lv_label_get_text_sel_start(const lv_obj_t * label);
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -236,7 +238,7 @@ uint16_t lv_label_get_text_sel_end(const lv_obj_t * label);
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
@ -247,7 +249,7 @@ void lv_label_ins_text(lv_obj_t * label, uint32_t pos, const char * txt);
|
||||
}
|
||||
|
||||
|
||||
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};
|
||||
argv[0] = (uint32)label;
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
#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};
|
||||
|
||||
@ -21,7 +21,7 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy);
|
||||
argv[1] = (uint32)copy;
|
||||
|
||||
CALL_LIST_NATIVE_FUNC(LIST_FUNC_ID_CREATE);
|
||||
return (wgl_obj_t)argv[0];
|
||||
return (lv_obj_t *)argv[0];
|
||||
}
|
||||
//
|
||||
//
|
||||
@ -31,7 +31,7 @@ lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy);
|
||||
//}
|
||||
//
|
||||
|
||||
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};
|
||||
|
||||
@ -41,7 +41,7 @@ lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * t
|
||||
argv[1] = (uint32)txt;
|
||||
argv[2] = strlen(txt) + 1;
|
||||
CALL_LIST_NATIVE_FUNC(LIST_FUNC_ID_ADD_BTN);
|
||||
return (wgl_obj_t)argv[0];
|
||||
return (lv_obj_t *)argv[0];
|
||||
}
|
||||
//
|
||||
//
|
||||
|
||||
@ -15,9 +15,8 @@
|
||||
typedef struct _obj_evt_cb {
|
||||
struct _obj_evt_cb *next;
|
||||
|
||||
wgl_obj_t obj;
|
||||
|
||||
wgl_event_cb_t event_cb;
|
||||
lv_obj_t * obj;
|
||||
lv_event_cb_t event_cb;
|
||||
} obj_evt_cb_t;
|
||||
|
||||
static obj_evt_cb_t *g_obj_evt_cb_list = NULL;
|
||||
@ -25,29 +24,29 @@ 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};
|
||||
argv[0] = (uint32)obj;
|
||||
CALL_OBJ_NATIVE_FUNC(OBJ_FUNC_ID_DEL);
|
||||
return (wgl_res_t)argv[0];
|
||||
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};
|
||||
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};
|
||||
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};
|
||||
argv[0] = (uint32)obj;
|
||||
@ -58,7 +57,7 @@ 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) {
|
||||
@ -71,7 +70,7 @@ 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};
|
||||
@ -103,7 +102,7 @@ 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(wgl_obj_t obj, wgl_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;
|
||||
|
||||
|
||||
8
core/app-framework/wgl/app/wa-inc/lvgl/LICENCE.txt
Normal file
8
core/app-framework/wgl/app/wa-inc/lvgl/LICENCE.txt
Normal file
@ -0,0 +1,8 @@
|
||||
MIT licence
|
||||
Copyright (c) 2016 Gábor Kiss-Vámosi
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
@ -30,9 +30,24 @@ Firstly we have to redefine some data types such as lv_obj_t in the APIs exposed
|
||||
typedef void lv_obj_t;
|
||||
'''
|
||||
|
||||
Secondly, as the littlevgl source code is no longer compiled and linked with the WASM app source codes, the compilation won't be successfully while including the original littvgl header files.
|
||||
|
||||
|
||||
|
||||
|
||||
# Prepare the lvgl header files for WASM applicaitons
|
||||
|
||||
Run the below script to setup the lvgl header files for the wasm appliation.
|
||||
|
||||
```
|
||||
core/app-framework/wgl/app/prepare_headers.sh
|
||||
```
|
||||
|
||||
The script is also automatically executed after downloading the lvgl repo in the wamr-sdk building process.
|
||||
|
||||
|
||||
|
||||
# How to extend a little vgl wideget
|
||||
Currently the wgl has exported the API for a few common used widgets such as button, label etc.
|
||||
|
||||
Refer to the implementation of these widgets for extending other widgets.
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user