35#ifndef __VSF_TINY_GUI_COMMON_H__
36#define __VSF_TINY_GUI_COMMON_H__
40#if VSF_USE_TINY_GUI == ENABLED
43#define VSF_TGUI_COLORSIZE_1BIT 0
44#define VSF_TGUI_COLORSIZE_4BIT 2
45#define VSF_TGUI_COLORSIZE_8BIT 3
46#define VSF_TGUI_COLORSIZE_16BIT 4
47#define VSF_TGUI_COLORSIZE_24IT 6
48#define VSF_TGUI_COLORSIZE_32IT 5
53# define tgui_contains(...) __VA_ARGS__
55# define tgui_null_parent(__type) ((__type *)0)
57# define __tgui_attribute(__NAME, ...) .__NAME = __VA_ARGS__
58# define tgui_attribute(__NAME, ...) __tgui_attribute(__NAME, __VA_ARGS__)
60# if VSF_TGUI_CFG_SUPPORT_CONTROL_LAYOUT_ALIGN == ENABLED
61# define tgui_alignto(...) __tgui_attribute(tAlign, {__VA_ARGS__})
64# if VSF_TGUI_CFG_SUPPORT_CONTROL_LAYOUT_ANCHOR == ENABLED
65# define tgui_anchor(...) __tgui_attribute(tAnchor, __VA_ARGS__)
68# if VSF_TGUI_CFG_SUPPORT_CONTROL_LAYOUT_DOCK == ENABLED
69# define tgui_dock(...) __tgui_attribute(tDock, __VA_ARGS__)
72# if VSF_TGUI_CFG_SUPPORT_CONTROL_LAYOUT_MARGIN == ENABLED
73# define tgui_margin(...) __tgui_attribute(tMargin, {__VA_ARGS__})
75# define tgui_margin(...) .dummy_bits = 0
77# if VSF_TGUI_CFG_SUPPORT_CONTROL_LAYOUT_PADDING == ENABLED
78# define tgui_padding(...) \
79 __tgui_attribute(tContainerPadding, {__VA_ARGS__})
81# define tgui_padding(...) .dummy_bits = 0
84# if VSF_TGUI_CFG_SUPPORT_MULTI_LANGUAGE_EXTERNSION == ENABLED
85# define __tgui_text(__NAME, __ID, ...) \
86 .__NAME.tString.tID = (__ID), \
87 .__NAME.bIsChanged = true, \
88 .__NAME.bIsAutoSize = false, \
89 .__NAME.u4Align = (0, ##__VA_ARGS__)
92# if VSF_TGUI_CFG_SAFE_STRING_MODE == ENABLED
93# define __tgui_text(__NAME, __TEXT, __AUTOSIZE, ...) \
94 .__NAME.tString.pstrText = __TEXT, \
95 .__NAME.tString.s16_size = sizeof(__TEXT) - 1, \
96 .__NAME.bIsChanged = true, \
97 .__NAME.bIsAutoSize = (__AUTOSIZE), \
98 .__NAME.u4Align = (0, ##__VA_ARGS__)
100# define __tgui_text(__NAME, __TEXT, __AUTOSIZE, ...) \
101 .__NAME.tString.pstrText = __TEXT, \
102 .__NAME.bIsChanged = true, \
103 .__NAME.bIsAutoSize = (__AUTOSIZE), \
104 .__NAME.u4Align = (0, ##__VA_ARGS__)
108# define __tgui_container_type(__TYPE, ...) \
109 .ContainerAttribute.u5Type = (__TYPE), \
110 .ContainerAttribute.bIsAutoSize = (true, ##__VA_ARGS__)
112# define __tgui_line_space(__NAME, __PIX) \
113 .__NAME.chInterLineSpace = (__PIX)
115# define tgui_size(...) \
116 __tgui_attribute(tSize, {__VA_ARGS__})
117# define tgui_location(...) \
118 __tgui_attribute(tLocation, {__VA_ARGS__})
119# define tgui_region(...) \
120 __tgui_attribute(tRegion, {__VA_ARGS__})
121# define tgui_background(...) \
122 __tgui_attribute(tBackground, {__VA_ARGS__})
123# define tgui_text(__NAME, __TEXT, __AUTOSIZE, ...) \
124 __tgui_text(__NAME, __TEXT, __AUTOSIZE, ##__VA_ARGS__)
125# define tgui_line_space(__NAME, __PIX) \
126 __tgui_line_space(__NAME, (__PIX))
128# if VSF_TGUI_CFG_SUPPORT_TIMER == ENABLED
129# define tgui_timer(__NAME, __INTERVAL, __REPEATE, ...) \
130 __tgui_attribute(__NAME, {.u29Interval = (__INTERVAL), \
131 .bIsRepeat = (__REPEATE), \
132 .bEnabled = (true, ##__VA_ARGS__), \
136# define tgui_handler(...) \
137 __tgui_attribute(msg_handler, {__VA_ARGS__})
138# define tgui_container_type(__TYPE, ...) \
139 __tgui_container_type(__TYPE, ##__VA_ARGS__)
142#define __tgui_handlers(...) \
144 .ptItems = ((const vsf_tgui_user_evt_handler *)({ \
145 static const vsf_tgui_user_evt_handler \
146 VSF_MACRO_SAFE_NAME(MessageMap)[] = {__VA_ARGS__}; \
147 VSF_MACRO_SAFE_NAME(MessageMap);})), \
148 .chCount = sizeof((const vsf_tgui_user_evt_handler []) { \
150 }) / sizeof(vsf_tgui_user_evt_handler), \
154#define __tgui_msgmap(...) \
156 .ptItems = (const vsf_tgui_user_evt_handler []) { \
159 .chCount = dimof(((const vsf_tgui_user_evt_handler []) { \
164#if VSF_TGUI_CFG_SUPPORT_NAME_STRING == ENABLED
166# define __tgui_msg_handler(__MSG, __FUNC, ...) \
169 .u2Type = VSF_MSGT_NODE_HANDLER_TYPE_CALLBACK, \
170 .FSM = (vsf_tgui_controal_fsm_t *)&__FUNC, \
171 .u10EvtMask = ((uint16_t)-1, ##__VA_ARGS__), \
172 .handler_name_ptr = #__FUNC, \
175# define __tgui_msg_mux(__MSG, __FUNC, ...) \
178 .u2Type = VSF_MSGT_NODE_HANDLER_TYPE_CALLBACK, \
179 .FSM = (vsf_tgui_controal_fsm_t *)&__FUNC, \
180 .u10EvtMask = (0, ##__VA_ARGS__), \
181 .handler_name_ptr = #__FUNC, \
186# define __tgui_msg_handler(__MSG, __FUNC, ...) \
189 .u2Type = VSF_MSGT_NODE_HANDLER_TYPE_CALLBACK, \
190 .FSM = (vsf_tgui_controal_fsm_t *)&__FUNC, \
191 .u10EvtMask = ((uint16_t)-1, ##__VA_ARGS__), \
194# define __tgui_msg_mux(__MSG, __FUNC, ...) \
197 .u2Type = VSF_MSGT_NODE_HANDLER_TYPE_CALLBACK, \
198 .FSM = (vsf_tgui_controal_fsm_t *)&__FUNC, \
199 .u10EvtMask = (0, ##__VA_ARGS__), \
203#define tgui_handlers(...) __tgui_handlers(__VA_ARGS__)
205#define tgui_msgmap(...) __tgui_msgmap(__VA_ARGS__)
207#define tgui_msg_handler(__MSG, __FUNC, ...) \
208 __tgui_msg_handler(__MSG, __FUNC, ##__VA_ARGS__)
212#define tgui_msg_mux(__MSG, __FUNC, ...) \
213 __tgui_msg_mux((__MSG), __FUNC, ##__VA_ARGS__)
215#define tgui_initalize_top_container(__DESCRIPTOR_NAME, __PTR) \
217 *(__PTR) = __DESCRIPTOR_NAME; \
218 vsf_msgt_offset_tree_init((const vsf_msgt_container_t*)(__PTR));\
300#if VSF_TGUI_CFG_SUPPORT_MULTI_LANGUAGE_EXTERNSION == ENABLED
301# if !defined(VSF_TGUI_CFG_LANGUAGE_ID_TYPE)
302# define VSF_TGUI_CFG_LANGUAGE_ID_TYPE uint8_t
313#if !defined(VSF_TGUI_CFG_STRING_TYPE)
314# define VSF_TGUI_CFG_STRING_TYPE const char
318 VSF_TGUI_CFG_STRING_TYPE *pstrText;
319#if VSF_TGUI_CFG_SAFE_STRING_MODE == ENABLED
333# if VSF_TGUI_CFG_TEXT_SIZE_INFO_CACHING == ENABLED
347#ifndef VSF_TGUI_CFG_DRAM_POINTER_TYPE
348# define VSF_TGUI_CFG_DRAM_POINTER_TYPE uintptr_t
362#if VSF_TGUI_CFG_SUPPORT_NAME_STRING == ENABLED
424#define VSF_TGUI_MSG_MSK (0x1F0)
425#define VSF_TGUI_EVT_MSK (0x00F)
#define VSF_BIT(__N)
Definition __type.h:188
@ fsm_rt_user
Definition __type.h:83
unsigned short uint16_t
Definition stdint.h:7
short int16_t
Definition stdint.h:6
unsigned char uint8_t
Definition stdint.h:5
signed char int8_t
Definition stdint.h:4
Definition vsf_tgui_common.h:525
Definition vsf_tgui_common.h:534
Definition vsf_tgui_common.h:226
int16_t iX
Definition vsf_tgui_common.h:227
int16_t iY
Definition vsf_tgui_common.h:228
Definition vsf_tgui_common.h:509
Definition vsf_tgui_common.h:519
Definition vsf_tgui_common.h:514
Definition vsf_tgui_common.h:236
implement_ex(vsf_tgui_location_t, tLocation) implement_ex(vsf_tgui_size_t
Definition vsf_tgui_common.h:231
int16_t iWidth
Definition vsf_tgui_common.h:232
int16_t iHeight
Definition vsf_tgui_common.h:233
Definition vsf_tgui_common.h:307
vsf_tgui_text_id_t tID
Definition vsf_tgui_common.h:308
Definition vsf_tgui_common.h:326
uint8_t bIsChanged
Definition vsf_tgui_common.h:330
int8_t chInterLineSpace
Definition vsf_tgui_common.h:332
vsf_tgui_size_t tStringSize
Definition vsf_tgui_common.h:335
uint8_t chCharHeight
Definition vsf_tgui_common.h:337
vsf_tgui_string_t tString
Definition vsf_tgui_common.h:327
uint16_t hwLines
Definition vsf_tgui_common.h:336
struct vsf_tgui_text_info_t::@169 tInfoCache
uint8_t u4Align
Definition vsf_tgui_common.h:328
uint8_t bIsAutoSize
Definition vsf_tgui_common.h:331
Definition vsf_tgui_common.h:372
vsf_tgui_tile_core_t implement_ex(vsf_tgui_size_t, tSize) vsf_tgui_disp_ram_uintptr_t ptBitmap
Definition vsf_tgui_common.h:379
implement_ex(vsf_tgui_size_t, tSize) vsf_tgui_tile_core_t *parent_ptr
Definition vsf_tgui_common.h:353
struct vsf_tgui_tile_core_t::@171 Attribute
uint8_t u2RootTileType
Definition vsf_tgui_common.h:355
uint8_t bIsRootTile
Definition vsf_tgui_common.h:358
uint8_t u2ColorType
Definition vsf_tgui_common.h:356
uint8_t u3ColorSize
Definition vsf_tgui_common.h:357
const char * name_ptr
Definition vsf_tgui_common.h:363
Definition vsf_tgui_common.h:367
uint8_t chIndex
Definition vsf_tgui_common.h:368
Definition vsf_tgui_common.h:539
Definition vsf_tgui_common.h:395
vsf_tgui_tile_child_t tChild
Definition vsf_tgui_common.h:405
implement_ex(struct { uint8_t :8;vsf_tgui_tile_core_t tCore;}, _) vsf_tgui_tile_idx_root_t tIndexRoot
vsf_tgui_tile_buf_root_t tBufRoot
Definition vsf_tgui_common.h:404
@ fsm_rt_err
fsm error, error code can be get from other interface
Definition vsf_fsm.h:316
@ fsm_rt_cpl
fsm complete
Definition vsf_fsm.h:317
vsf_msgt_msg_t
Definition vsf_msg_tree.h:79
vsf_msgt_container_t * parent_ptr
parent node
Definition vsf_msg_tree.h:187
bool vsf_tgui_tile_is_root(const vsf_tgui_tile_t *ptTile)
Definition vsf_tgui_common.c:99
void vsf_tgui_text_set(vsf_tgui_text_info_t *ptTextInfo, const vsf_tgui_string_t *pstrNew)
Definition vsf_tgui_common.c:106
vsf_tgui_tile_t * vsf_tgui_tile_get_root(const vsf_tgui_tile_t *ptTile, vsf_tgui_region_t *region_ptr)
Definition vsf_tgui_common.c:71
vsf_tgui_size_t vsf_tgui_root_tile_get_size(const vsf_tgui_tile_t *ptTile)
Definition vsf_tgui_common.c:58
@ VSF_TGUI_EVT_POINTER_ENTER
not all device support this
Definition vsf_tgui_common.h:455
@ VSF_TGUI_EVT_ON_LOAD
Definition vsf_tgui_common.h:435
@ VSF_TGUI_EVT_POINTER_LEFT
not all device support this
Definition vsf_tgui_common.h:458
@ VSF_TGUI_EVT_LIST_SLIDING_STOPPED
Definition vsf_tgui_common.h:496
@ VSF_TGUI_EVT_POINTER_HOLD
not all device support this
Definition vsf_tgui_common.h:449
@ VSF_TGUI_EVT_KEY_UP
Definition vsf_tgui_common.h:475
@ VSF_TGUI_EVT_UPDATE_TREE
Definition vsf_tgui_common.h:438
@ VSF_TGUI_EVT_KEY_DOWN
Definition vsf_tgui_common.h:473
@ VSF_TGUI_EVT_ON_SET_TOP_CONTAINER
Definition vsf_tgui_common.h:434
@ VSF_TGUI_MSG_AVAILABLE
Definition vsf_tgui_common.h:428
@ VSF_TGUI_EVT_UPDATE
Definition vsf_tgui_common.h:437
@ VSF_TGUI_MSG_GESTURE_EVT
gesture events
Definition vsf_tgui_common.h:481
@ VSF_TGUI_EVT_GESTURE_ZOOM_OUT
not all device support this
Definition vsf_tgui_common.h:486
@ VSF_TGUI_EVT_GESTURE_WHEEL
not all device support this
Definition vsf_tgui_common.h:484
@ VSF_TGUI_EVT_GESTURE_ROTATE_ANTICLOCKWISE
not all device support this
Definition vsf_tgui_common.h:488
@ VSF_TGUI_EVT_GET_ACTIVE
Definition vsf_tgui_common.h:441
@ VSF_TGUI_EVT_POST_REFRESH
Definition vsf_tgui_common.h:440
@ VSF_TGUI_EVT_POINTER_DOUBLE_CLICK
Definition vsf_tgui_common.h:452
@ VSF_TGUI_EVT_ON_TIME
Definition vsf_tgui_common.h:443
@ VSF_TGUI_MSG_CONTROL_EVT
control events
Definition vsf_tgui_common.h:433
@ VSF_TGUI_EVT_POINTER_CLICK
Definition vsf_tgui_common.h:451
@ VSF_TGUI_EVT_REFRESH
Definition vsf_tgui_common.h:439
@ VSF_TGUI_EVT_ON_DEPOSE
Definition vsf_tgui_common.h:436
@ VSF_TGUI_EVT_KEY_PRESSED
Definition vsf_tgui_common.h:476
@ VSF_TGUI_EVT_POINTER_HOVER
not all device support this
Definition vsf_tgui_common.h:467
@ VSF_TGUI_MSG_KEY_EVT
key events
Definition vsf_tgui_common.h:472
@ VSF_TGUI_EVT_POINTER_MOVE
not all device support this
Definition vsf_tgui_common.h:469
@ VSF_TGUI_EVT_GESTURE_ROTATE_CLOCKWISE
not all device support this
Definition vsf_tgui_common.h:487
@ VSF_TGUI_EVT_KEY_DOUBLE_CLICK
not all device support this
Definition vsf_tgui_common.h:478
@ VSF_TGUI_EVT_KEY_REPEATE
not all device support this
Definition vsf_tgui_common.h:474
@ VSF_TGUI_MSG_LOW_LEVEL_READY_TO_REFRESH
Definition vsf_tgui_common.h:429
@ VSF_TGUI_MSG_LIST_EVT
Definition vsf_tgui_common.h:493
@ VSF_TGUI_MSG_POINTER_EVT
pointer events
Definition vsf_tgui_common.h:446
@ VSF_TGUI_EVT_KEY_LONG_PRESSED
not all device support this
Definition vsf_tgui_common.h:477
@ VSF_TGUI_EVT_LOST_ACTIVE
Definition vsf_tgui_common.h:442
@ VSF_TGUI_EVT_GESTURE_ZOOM_IN
not all device support this
Definition vsf_tgui_common.h:485
@ VSF_TGUI_EVT_POINTER_DOWN
Definition vsf_tgui_common.h:448
@ VSF_TGUI_EVT_POINTER_UP
Definition vsf_tgui_common.h:450
@ VSF_TGUI_MSG_CONTROL_SPECIFIC_EVT
All control specific events share the same code region.
Definition vsf_tgui_common.h:491
@ VSF_TGUI_EVT_LIST_SLIDING_STARTED
Definition vsf_tgui_common.h:495
@ VSF_TGUI_EVT_LIST_SELECTION_CHANGED
Definition vsf_tgui_common.h:494
@ VSF_TGUI_MSG
Definition vsf_tgui_common.h:430
@ VSF_TGUI_EVT_GESTURE_SLIDE
Definition vsf_tgui_common.h:483
#define VSF_TGUI_CFG_DRAM_POINTER_TYPE
Definition vsf_tgui_common.h:348
vsf_tgui_align_mode_t
Definition vsf_tgui_common.h:242
@ VSF_TGUI_ALIGN_FILL
Definition vsf_tgui_common.h:248
@ VSF_TGUI_ALIGN_MID_BOTTOM
Definition vsf_tgui_common.h:255
@ VSF_TGUI_ALIGN_BOTTOM
Definition vsf_tgui_common.h:247
@ VSF_TGUI_ALIGN_BOTTOM_RIGHT
Definition vsf_tgui_common.h:270
@ VSF_TGUI_ALIGN_CENTER
Definition vsf_tgui_common.h:243
@ VSF_TGUI_ALIGN_LEFT
Definition vsf_tgui_common.h:244
@ VSF_TGUI_ALIGN_TOP_RIGHT
Definition vsf_tgui_common.h:264
@ VSF_TGUI_ALIGN_MID_TOP
Definition vsf_tgui_common.h:253
@ VSF_TGUI_ALIGN_TOP
Definition vsf_tgui_common.h:246
@ VSF_TGUI_ALIGN_BOTTOM_LEFT
Definition vsf_tgui_common.h:267
@ VSF_TGUI_ALIGN_MID_LEFT
Definition vsf_tgui_common.h:257
@ VSF_TGUI_ALIGN_TOP_LEFT
Definition vsf_tgui_common.h:261
@ VSF_TGUI_ALIGN_RIGHT
Definition vsf_tgui_common.h:245
@ VSF_TGUI_ALIGN_MID_RIGHT
Definition vsf_tgui_common.h:259
vsf_tgui_anchor_mode_t
Definition vsf_tgui_common.h:287
@ VSF_TGUI_ANCHOR_TOP
Definition vsf_tgui_common.h:291
@ VSF_TGUI_ANCHOR_BOTTOM
Definition vsf_tgui_common.h:292
@ VSF_TGUI_ANCHOR_NONE
Definition vsf_tgui_common.h:288
@ VSF_TGUI_ANCHOR_LEFT
Definition vsf_tgui_common.h:289
@ VSF_TGUI_ANCHOR_RIGHT
Definition vsf_tgui_common.h:290
vsf_tgui_dock_mode_t
Definition vsf_tgui_common.h:275
@ VSF_TGUI_DOCK_BOTTOM
Definition vsf_tgui_common.h:280
@ VSF_TGUI_DOCK_TOP
Definition vsf_tgui_common.h:279
@ VSF_TGUI_DOCK_NONE
Definition vsf_tgui_common.h:276
@ VSF_TGUI_DOCK_RIGHT
Definition vsf_tgui_common.h:278
@ VSF_TGUI_DOCK_FILL
Definition vsf_tgui_common.h:281
@ VSF_TGUI_DOCK_LEFT
Definition vsf_tgui_common.h:277
#define VSF_TGUI_CFG_LANGUAGE_ID_TYPE
Definition vsf_tgui_common.h:302
vsf_tgui_container_type_t
Definition vsf_tgui_common.h:412
@ VSF_TGUI_CONTAINER_TYPE_LINE_STREAM_VERTICAL
Definition vsf_tgui_common.h:417
@ VSF_TGUI_CONTAINER_TYPE_STREAM_HORIZONTAL
Definition vsf_tgui_common.h:414
@ VSF_TGUI_CONTAINER_TYPE_LINE_STREAM_HORIZONTAL
Definition vsf_tgui_common.h:416
@ VSF_TGUI_CONTAINER_TYPE_STREAM_VERTICAL
Definition vsf_tgui_common.h:415
@ VSF_TGUI_CONTAINER_TYPE_PLANE
Definition vsf_tgui_common.h:413
struct vsf_tgui_control_t vsf_tgui_control_t
Definition vsf_tgui_common.h:506
VSF_TGUI_CFG_DRAM_POINTER_TYPE vsf_tgui_disp_ram_uintptr_t
Definition vsf_tgui_common.h:351
@ VSF_TGUI_MSG_RT_UNHANDLED
Definition vsf_tgui_common.h:500
@ VSF_TGUI_MSG_RT_REFRESH_PARENT
Definition vsf_tgui_common.h:503
@ VSF_TGUI_MSG_RT_REFRESH
Definition vsf_tgui_common.h:502
@ VSF_TGUI_MSG_RT_DONE
Definition vsf_tgui_common.h:501
struct vsf_tgui_root_container_t vsf_tgui_root_container_t
Definition vsf_tgui_common.h:507
VSF_TGUI_CFG_LANGUAGE_ID_TYPE vsf_tgui_text_id_t
Definition vsf_tgui_common.h:305