Skip to content

Commit 4c1558a

Browse files
committed
build and test pass
1 parent 66d6a39 commit 4c1558a

File tree

22 files changed

+181
-670
lines changed

22 files changed

+181
-670
lines changed

core/app-framework/app-native-shared/bi-inc/wgl_shared_utils.h

Lines changed: 0 additions & 232 deletions
Original file line numberDiff line numberDiff line change
@@ -15,238 +15,6 @@ extern "C" {
1515

1616
#include <stdbool.h>
1717

18-
#include "lv_conf.h"
19-
20-
typedef lv_coord_t wgl_coord_t; /* lv_coord_t is defined in lv_conf.h */
21-
typedef void * wgl_font_user_data_t;
22-
23-
/**
24-
* Represents a point on the screen.
25-
*/
26-
typedef struct
27-
{
28-
lv_coord_t x;
29-
lv_coord_t y;
30-
} wgl_point_t;
31-
32-
/** Represents an area of the screen. */
33-
typedef struct
34-
{
35-
lv_coord_t x1;
36-
lv_coord_t y1;
37-
lv_coord_t x2;
38-
lv_coord_t y2;
39-
} wgl_area_t;
40-
41-
42-
/** Describes the properties of a glyph. */
43-
typedef struct
44-
{
45-
uint16_t adv_w; /**< The glyph needs this space. Draw the next glyph after this width. 8 bit integer, 4 bit fractional */
46-
uint8_t box_w; /**< Width of the glyph's bounding box*/
47-
uint8_t box_h; /**< Height of the glyph's bounding box*/
48-
int8_t ofs_x; /**< x offset of the bounding box*/
49-
int8_t ofs_y; /**< y offset of the bounding box*/
50-
uint8_t bpp; /**< Bit-per-pixel: 1, 2, 4, 8*/
51-
}wgl_font_glyph_dsc_t;
52-
53-
/*Describe the properties of a font*/
54-
typedef struct _wgl_font_struct
55-
{
56-
/** Get a glyph's descriptor from a font*/
57-
bool (*get_glyph_dsc)(const struct _wgl_font_struct *, wgl_font_glyph_dsc_t *, uint32_t letter, uint32_t letter_next);
58-
59-
/** Get a glyph's bitmap from a font*/
60-
const uint8_t * (*get_glyph_bitmap)(const struct _wgl_font_struct *, uint32_t);
61-
62-
/*Pointer to the font in a font pack (must have the same line height)*/
63-
uint8_t line_height; /**< The real line height where any text fits*/
64-
uint8_t base_line; /**< Base line measured from the top of the line_height*/
65-
void * dsc; /**< Store implementation specific data here*/
66-
#if LV_USE_USER_DATA
67-
wgl_font_user_data_t user_data; /**< Custom user data for font. */
68-
#endif
69-
} wgl_font_t;
70-
71-
#if LV_COLOR_DEPTH == 1
72-
#define LV_COLOR_SIZE 8
73-
#elif LV_COLOR_DEPTH == 8
74-
#define LV_COLOR_SIZE 8
75-
#elif LV_COLOR_DEPTH == 16
76-
#define LV_COLOR_SIZE 16
77-
#elif LV_COLOR_DEPTH == 32
78-
#define LV_COLOR_SIZE 32
79-
#else
80-
#error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!"
81-
#endif
82-
83-
/**********************
84-
* TYPEDEFS
85-
**********************/
86-
87-
typedef union
88-
{
89-
uint8_t blue : 1;
90-
uint8_t green : 1;
91-
uint8_t red : 1;
92-
uint8_t full : 1;
93-
} wgl_color1_t;
94-
95-
typedef union
96-
{
97-
struct
98-
{
99-
uint8_t blue : 2;
100-
uint8_t green : 3;
101-
uint8_t red : 3;
102-
} ch;
103-
uint8_t full;
104-
} wgl_color8_t;
105-
106-
typedef union
107-
{
108-
struct
109-
{
110-
#if LV_COLOR_16_SWAP == 0
111-
uint16_t blue : 5;
112-
uint16_t green : 6;
113-
uint16_t red : 5;
114-
#else
115-
uint16_t green_h : 3;
116-
uint16_t red : 5;
117-
uint16_t blue : 5;
118-
uint16_t green_l : 3;
119-
#endif
120-
} ch;
121-
uint16_t full;
122-
} wgl_color16_t;
123-
124-
typedef union
125-
{
126-
struct
127-
{
128-
uint8_t blue;
129-
uint8_t green;
130-
uint8_t red;
131-
uint8_t alpha;
132-
} ch;
133-
uint32_t full;
134-
} wgl_color32_t;
135-
136-
#if LV_COLOR_DEPTH == 1
137-
typedef uint8_t wgl_color_int_t;
138-
typedef wgl_color1_t wgl_color_t;
139-
#elif LV_COLOR_DEPTH == 8
140-
typedef uint8_t wgl_color_int_t;
141-
typedef wgl_color8_t wgl_color_t;
142-
#elif LV_COLOR_DEPTH == 16
143-
typedef uint16_t wgl_color_int_t;
144-
typedef wgl_color16_t wgl_color_t;
145-
#elif LV_COLOR_DEPTH == 32
146-
typedef uint32_t wgl_color_int_t;
147-
typedef wgl_color32_t wgl_color_t;
148-
#else
149-
#error "Invalid LV_COLOR_DEPTH in lv_conf.h! Set it to 1, 8, 16 or 32!"
150-
#endif
151-
152-
typedef uint8_t wgl_opa_t;
153-
154-
155-
156-
/*Border types (Use 'OR'ed values)*/
157-
enum {
158-
WGL_BORDER_NONE = 0x00,
159-
WGL_BORDER_BOTTOM = 0x01,
160-
WGL_BORDER_TOP = 0x02,
161-
WGL_BORDER_LEFT = 0x04,
162-
WGL_BORDER_RIGHT = 0x08,
163-
WGL_BORDER_FULL = 0x0F,
164-
WGL_BORDER_INTERNAL = 0x10, /**< FOR matrix-like objects (e.g. Button matrix)*/
165-
};
166-
typedef uint8_t wgl_border_part_t;
167-
168-
/*Shadow types*/
169-
enum {
170-
WGL_SHADOW_BOTTOM = 0, /**< Only draw bottom shadow */
171-
WGL_SHADOW_FULL, /**< Draw shadow on all sides */
172-
};
173-
typedef uint8_t wgl_shadow_type_t;
174-
175-
/**
176-
* Objects in LittlevGL can be assigned a style - which holds information about
177-
* how the object should be drawn.
178-
*
179-
* This allows for easy customization without having to modify the object's design
180-
* function.
181-
*/
182-
typedef struct
183-
{
184-
uint8_t glass : 1; /**< 1: Do not inherit this style*/
185-
186-
/** Object background. */
187-
struct
188-
{
189-
wgl_color_t main_color; /**< Object's main background color. */
190-
wgl_color_t grad_color; /**< Second color. If not equal to `main_color` a gradient will be drawn for the background. */
191-
wgl_coord_t radius; /**< Object's corner radius. You can use #WGL_RADIUS_CIRCLE if you want to draw a circle. */
192-
wgl_opa_t opa; /**< Object's opacity (0-255). */
193-
194-
struct
195-
{
196-
wgl_color_t color; /**< Border color */
197-
wgl_coord_t width; /**< Border width */
198-
wgl_border_part_t part; /**< Which borders to draw */
199-
wgl_opa_t opa; /**< Border opacity. */
200-
} border;
201-
202-
203-
struct
204-
{
205-
wgl_color_t color;
206-
wgl_coord_t width;
207-
wgl_shadow_type_t type; /**< Which parts of the shadow to draw */
208-
} shadow;
209-
210-
struct
211-
{
212-
wgl_coord_t top;
213-
wgl_coord_t bottom;
214-
wgl_coord_t left;
215-
wgl_coord_t right;
216-
wgl_coord_t inner;
217-
} padding;
218-
} body;
219-
220-
/** Style for text drawn by this object. */
221-
struct
222-
{
223-
wgl_color_t color; /**< Text color */
224-
wgl_color_t sel_color; /**< Text selection background color. */
225-
const wgl_font_t * font;
226-
wgl_coord_t letter_space; /**< Space between letters */
227-
wgl_coord_t line_space; /**< Space between lines (vertical) */
228-
wgl_opa_t opa; /**< Text opacity */
229-
} text;
230-
231-
/**< Style of images. */
232-
struct
233-
{
234-
wgl_color_t color; /**< Color to recolor the image with */
235-
wgl_opa_t intense; /**< Opacity of recoloring (0 means no recoloring) */
236-
wgl_opa_t opa; /**< Opacity of whole image */
237-
} image;
238-
239-
/**< Style of lines (not borders). */
240-
struct
241-
{
242-
wgl_color_t color;
243-
wgl_coord_t width;
244-
wgl_opa_t opa;
245-
uint8_t rounded : 1; /**< 1: rounded line endings*/
246-
} line;
247-
} wgl_style_t;
248-
249-
25018

25119
/* Object native function IDs */
25220
enum {

core/app-framework/wgl/app/gui_api.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#define _GUI_API_H_
88

99
#include "bh_platform.h"
10+
#include "bi-inc/wgl_shared_utils.h"
1011

1112
#ifdef __cplusplus
1213
extern "C" {

core/app-framework/wgl/app/src/wgl_btn.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -10,56 +10,56 @@
1010
#define ARGC sizeof(argv)/sizeof(uint32)
1111
#define CALL_BTN_NATIVE_FUNC(id) wasm_btn_native_call(id, argv, ARGC)
1212

13-
lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy);
13+
lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
1414
{
1515
uint32 argv[2] = {0};
1616

1717
argv[0] = (uint32)par;
1818
argv[1] = (uint32)copy;
1919
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_CREATE);
20-
return (wgl_obj_t)argv[0];
20+
return (lv_obj_t *)argv[0];
2121
}
2222

23-
void lv_btn_set_toggle(lv_obj_t * btn, bool tgl);
23+
void lv_btn_set_toggle(lv_obj_t * btn, bool tgl)
2424
{
2525
uint32 argv[2] = {0};
2626
argv[0] = (uint32)btn;
2727
argv[1] = tgl;
2828
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_SET_TOGGLE);
2929
}
3030

31-
void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state);
31+
void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state)
3232
{
3333
uint32 argv[2] = {0};
3434
argv[0] = (uint32)btn;
3535
argv[1] = state;
3636
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_SET_STATE);
3737
}
3838

39-
void lv_btn_toggle(lv_obj_t * btn);
39+
void lv_btn_toggle(lv_obj_t * btn)
4040
{
4141
uint32 argv[1] = {0};
4242
argv[0] = (uint32)btn;
4343
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_TOGGLE);
4444
}
4545

46-
void lv_btn_set_ink_in_time(lv_obj_t * btn, uint16_t time);
46+
void lv_btn_set_ink_in_time(lv_obj_t * btn, uint16_t time)
4747
{
4848
uint32 argv[2] = {0};
4949
argv[0] = (uint32)btn;
5050
argv[1] = time;
5151
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_SET_INK_IN_TIME);
5252
}
5353

54-
void lv_btn_set_ink_wait_time(lv_obj_t * btn, uint16_t time);
54+
void lv_btn_set_ink_wait_time(lv_obj_t * btn, uint16_t time)
5555
{
5656
uint32 argv[2] = {0};
5757
argv[0] = (uint32)btn;
5858
argv[1] = time;
5959
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_SET_INK_WAIT_TIME);
6060
}
6161

62-
void lv_btn_set_ink_out_time(lv_obj_t * btn, uint16_t time);
62+
void lv_btn_set_ink_out_time(lv_obj_t * btn, uint16_t time)
6363
{
6464
uint32 argv[2] = {0};
6565
argv[0] = (uint32)btn;
@@ -73,39 +73,39 @@ void lv_btn_set_ink_out_time(lv_obj_t * btn, uint16_t time);
7373
// //wasm_btn_set_style(btn, type, style);
7474
//}
7575
//
76-
lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn);
76+
lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn)
7777
{
7878
uint32 argv[1] = {0};
7979
argv[0] = (uint32)btn;
8080
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_GET_STATE);
81-
return (wgl_btn_state_t)argv[0];
81+
return (lv_btn_state_t)argv[0];
8282
}
8383

84-
bool lv_btn_get_toggle(const lv_obj_t * btn);
84+
bool lv_btn_get_toggle(const lv_obj_t * btn)
8585
{
8686
uint32 argv[1] = {0};
8787
argv[0] = (uint32)btn;
8888
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_GET_TOGGLE);
8989
return (bool)argv[0];
9090
}
9191

92-
uint16_t lv_btn_get_ink_in_time(const lv_obj_t * btn);
92+
uint16_t lv_btn_get_ink_in_time(const lv_obj_t * btn)
9393
{
9494
uint32 argv[1] = {0};
9595
argv[0] = (uint32)btn;
9696
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_GET_INK_IN_TIME);
9797
return (uint16_t)argv[0];
9898
}
9999

100-
uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn);
100+
uint16_t lv_btn_get_ink_wait_time(const lv_obj_t * btn)
101101
{
102102
uint32 argv[1] = {0};
103103
argv[0] = (uint32)btn;
104104
CALL_BTN_NATIVE_FUNC(BTN_FUNC_ID_GET_INK_WAIT_TIME);
105105
return (uint16_t)argv[0];
106106
}
107107

108-
uint16_t lv_btn_get_ink_out_time(const lv_obj_t * btn);
108+
uint16_t lv_btn_get_ink_out_time(const lv_obj_t * btn)
109109
{
110110
uint32 argv[1] = {0};
111111
argv[0] = (uint32)btn;

0 commit comments

Comments
 (0)