VSF Documented
vsf_tgui_v_type.h
Go to the documentation of this file.
1/*****************************************************************************
2 * Copyright(C)2009-2022 by VSF Team *
3 * *
4 * Licensed under the Apache License, Version 2.0 (the "License"); *
5 * you may not use this file except in compliance with the License. *
6 * You may obtain a copy of the License at *
7 * *
8 * http://www.apache.org/licenses/LICENSE-2.0 *
9 * *
10 * Unless required by applicable law or agreed to in writing, software *
11 * distributed under the License is distributed on an "AS IS" BASIS, *
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
13 * See the License for the specific language governing permissions and *
14 * limitations under the License. *
15 * *
16 ****************************************************************************/
17
18#ifndef __VSF_TINY_GUI_V_TMPLATE_TYPE_H__
19#define __VSF_TINY_GUI_V_TMPLATE_TYPE_H__
20
21/*============================ INCLUDES ======================================*/
22#include "../../vsf_tgui_cfg.h"
23
24#if VSF_USE_TINY_GUI == ENABLED \
25 && VSF_TGUI_CFG_RENDERING_TEMPLATE_SEL == VSF_TGUI_V_TEMPLATE_SIMPLE_VIEW
26
27#include "./vsf_tgui_sv_color.h"
28
29/*============================ MACROS ========================================*/
30#ifndef VSF_TGUI_CFG_SV_SUPPORT_FLUXIBLE_BACKGROUND_COLOR
31# define VSF_TGUI_CFG_SV_SUPPORT_FLUXIBLE_BACKGROUND_COLOR ENABLED
32#endif
33
34#if VSF_TGUI_CFG_SV_SUPPORT_FLUXIBLE_BACKGROUND_COLOR == DISLABED
35#ifndef VSF_TGUI_CFG_SV_SUPPORT_FIXED_BACKGROUND_COLOR
36# define VSF_TGUI_CFG_SV_SUPPORT_FIXED_BACKGROUND_COLOR ENABLED
37#endif
38#endif
39
40#ifndef VSF_TGUI_CFG_SV_SUPPORT_TILE_TRANSPARENCY
41# define VSF_TGUI_CFG_SV_SUPPORT_TILE_TRANSPARENCY ENABLED
42#endif
43
44#ifndef VSF_TGUI_CFG_SV_SUPPORT_CORNER_TILE
45# define VSF_TGUI_CFG_SV_SUPPORT_CORNER_TILE ENABLED
46#endif
47
48#ifndef VSF_TGUI_CFG_SV_LABLE_SUPPORT_TEXT_COLOR
49# define VSF_TGUI_CFG_SV_LABLE_SUPPORT_TEXT_COLOR ENABLED
50#endif
51
52#ifndef VSF_TGUI_CFG_SV_CONTROL_BACKGROUND_COLOR
53# define VSF_TGUI_CFG_SV_CONTROL_BACKGROUND_COLOR VSF_TGUI_COLOR_RGB(0xB4, 0xC7, 0xE7)
54#endif
55
56#ifndef VSF_TGUI_CFG_SV_LABEL_BACKGROUND_COLOR
57# define VSF_TGUI_CFG_SV_LABEL_BACKGROUND_COLOR VSF_TGUI_COLOR_RGB(0xB4, 0xC7, 0xE7)
58#endif
59
60#ifndef VSF_TGUI_CFG_SV_LABEL_TEXT_COLOR
61# define VSF_TGUI_CFG_SV_LABEL_TEXT_COLOR VSF_TGUI_COLOR_BLACK
62#endif
63
64#ifndef VSF_TGUI_CFG_SV_BUTTON_BACKGROUND_COLOR
65# define VSF_TGUI_CFG_SV_BUTTON_BACKGROUND_COLOR VSF_TGUI_COLOR_RGB(0xB4, 0xC7, 0xE7)
66#endif
67
68#ifndef VSF_TGUI_CFG_SV_BUTTON_CLICKED_BACKGROUND_COLOR
69# define VSF_TGUI_CFG_SV_BUTTON_CLICKED_BACKGROUND_COLOR VSF_TGUI_COLOR_BLUE
70#endif
71
72#ifndef VSF_TGUI_CFG_SV_BUTTON_CLICKED_MIX_COLOR
73# define VSF_TGUI_CFG_SV_BUTTON_CLICKED_MIX_COLOR VSF_TGUI_COLOR_BLUE
74#endif
75
76#ifndef VSF_TGUI_CFG_SV_BUTTON_CLICKED_MIX_VALUE
77# define VSF_TGUI_CFG_SV_BUTTON_CLICKED_MIX_VALUE 128
78#endif
79
80#ifndef VSF_TGUI_CFG_SV_BUTTON_TEXT_COLOR
81# define VSF_TGUI_CFG_SV_BUTTON_TEXT_COLOR VSF_TGUI_COLOR_BLACK
82#endif
83
84#ifndef VSF_TGUI_CFG_SV_CONTAINER_BACKGROUND_COLOR
85# define VSF_TGUI_CFG_SV_CONTAINER_BACKGROUND_COLOR VSF_TGUI_COLOR_RGB(0x44, 0x72, 0xC4)
86#endif
87
88#ifndef VSF_TGUI_CFG_SV_PANEL_BACKGROUND_COLOR
89# define VSF_TGUI_CFG_SV_PANEL_BACKGROUND_COLOR VSF_TGUI_COLOR_RGB(0x44, 0x72, 0xC4)
90#endif
91
92#ifndef VSF_TGUI_CFG_SV_LIST_BACKGROUND_COLOR
93# define VSF_TGUI_CFG_SV_LIST_BACKGROUND_COLOR VSF_TGUI_COLOR_RGBA(0xB4, 0xC7, 0xE7, 0x00)
94#endif
95
96#ifndef VSF_TGUI_CFG_SV_TEXT_LIST_BACKGROUND_COLOR
97# define VSF_TGUI_CFG_SV_TEXT_LIST_BACKGROUND_COLOR VSF_TGUI_COLOR_RGB(0xB4, 0xC7, 0xE7)
98#endif
99
100#ifndef VSF_TGUI_CFG_SV_TEXT_LIST_INDICATOR_COLOR
101# define VSF_TGUI_CFG_SV_TEXT_LIST_INDICATOR_COLOR VSF_TGUI_COLOR_RGB(0x44, 0x72, 0xC4)
102#endif
103
104#if VSF_TGUI_CFG_SV_SUPPORT_FLUXIBLE_BACKGROUND_COLOR == ENABLED
105# define __SV_BACKGROUND_COLOR(__COLOR) .background_color = __COLOR,
106#else
107# define __SV_BACKGROUND_COLOR(__COLOR)
108#endif
109
110#if VSF_TGUI_CFG_SV_SUPPORT_TILE_TRANSPARENCY == ENABLED
111# define __SV_TILE_TRANS_RATE(__COLOR) .tile_trans_rate = __COLOR,
112#else
113# define __SV_TILE_TRANS_RATE(__COLOR)
114#endif
115
116#if VSF_TGUI_CFG_SV_SUPPORT_CORNER_TILE == ENABLED
117# define __SV_SHOW_CORNER_TILE(__VALUE) .show_corner_tile = __VALUE,
118#else
119# define __SV_SHOW_CORNER_TILE(__VALUE)
120#endif
121
122#if VSF_TGUI_CFG_SV_LABLE_SUPPORT_TEXT_COLOR == ENABLED
123# define __SV_TEXT_COLOR(__COLOR) .font_color = __COLOR,
124#else
125# define __SV_TEXT_COLOR(__COLOR)
126#endif
127
128#define VSF_TGUI_V_CONTROL_STATIC_INIT_DEFAULT \
129 __SV_SHOW_CORNER_TILE(false) \
130 __SV_TILE_TRANS_RATE(0xFF) \
131 __SV_BACKGROUND_COLOR(VSF_TGUI_CFG_SV_CONTROL_BACKGROUND_COLOR) \
132
133#define VSF_TGUI_V_LABEL_STATIC_INIT_DEFAULT \
134 __SV_SHOW_CORNER_TILE(true) \
135 __SV_TILE_TRANS_RATE(0xFF) \
136 __SV_BACKGROUND_COLOR(VSF_TGUI_CFG_SV_LABEL_BACKGROUND_COLOR) \
137 __SV_TEXT_COLOR(VSF_TGUI_CFG_SV_LABEL_TEXT_COLOR)
138
139#define VSF_TGUI_V_BUTTON_STATIC_INIT_DEFAULT \
140 __SV_SHOW_CORNER_TILE(true) \
141 __SV_TILE_TRANS_RATE(0xFF) \
142 __SV_BACKGROUND_COLOR(VSF_TGUI_CFG_SV_BUTTON_BACKGROUND_COLOR) \
143 __SV_TEXT_COLOR(VSF_TGUI_CFG_SV_BUTTON_TEXT_COLOR)
144
145#define VSF_TGUI_V_CONTAINER_STATIC_INIT_DEFAULT \
146 __SV_SHOW_CORNER_TILE(false) \
147 __SV_TILE_TRANS_RATE(0xFF) \
148 __SV_BACKGROUND_COLOR(VSF_TGUI_CFG_SV_CONTAINER_BACKGROUND_COLOR) \
149
150#define VSF_TGUI_V_TEXT_LIST_STATIC_INIT_DEFAULT \
151 __SV_SHOW_CORNER_TILE(false) \
152 __SV_TILE_TRANS_RATE(0xFF) \
153 __SV_BACKGROUND_COLOR(VSF_TGUI_CFG_SV_TEXT_LIST_BACKGROUND_COLOR)
154
155#define VSF_TGUI_V_LIST_STATIC_INIT_DEFAULT \
156 __SV_SHOW_CORNER_TILE(false) \
157 __SV_TILE_TRANS_RATE(0xFF) \
158
159
160#define VSF_TGUI_V_PANEL_STATIC_INIT_DEFAULT \
161 __SV_SHOW_CORNER_TILE(true) \
162 __SV_TILE_TRANS_RATE(0xFF)
163
164#define VSF_TGUI_V_CONTROL_STATIC_INIT_OVERRIDE
165#define VSF_TGUI_V_LABEL_STATIC_INIT_OVERRIDE
166#define VSF_TGUI_V_BUTTON_STATIC_INIT_OVERRIDE
167#define VSF_TGUI_V_CONTAINER_STATIC_INIT_OVERRIDE
168#define VSF_TGUI_V_LIST_STATIC_INIT_OVERRIDE
169
170#if VSF_TGUI_CFG_SV_SUPPORT_FLUXIBLE_BACKGROUND_COLOR == ENABLED
171#define VSF_TGUI_V_TEXT_LIST_STATIC_INIT_BACKGROUND_CLOLOR_OVERRIDE \
172 .tList.background_color = VSF_TGUI_COLOR_RGBA(0x00, 0x00, 0x00, 0x00),
173#else
174#define VSF_TGUI_V_TEXT_LIST_STATIC_INIT_BACKGROUND_CLOLOR_OVERRIDE
175#endif
176
177#if VSF_TGUI_CFG_SV_SUPPORT_CORNER_TILE == ENABLED
178#define VSF_TGUI_V_TEXT_LIST_STATIC_INIT_TILE_OVERRIDE \
179 .show_corner_tile = true,
180#else
181#define VSF_TGUI_V_TEXT_LIST_STATIC_INIT_TILE_OVERRIDE
182#endif
183
184#define VSF_TGUI_V_TEXT_LIST_STATIC_INIT_OVERRIDE \
185 VSF_TGUI_V_TEXT_LIST_STATIC_INIT_BACKGROUND_CLOLOR_OVERRIDE
186
187#if VSF_TGUI_CFG_SV_SUPPORT_FLUXIBLE_BACKGROUND_COLOR == ENABLED
188# define VSF_TGUI_V_TEXT_LIST_CONTENT_INIT_OVERRIDE \
189 .background_color = VSF_TGUI_COLOR_RGBA(0x00, 0x00, 0x00, 0x00), \
190 VSF_TGUI_V_TEXT_LIST_STATIC_INIT_TILE_OVERRIDE
191#else
192# define VSF_TGUI_V_TEXT_LIST_CONTENT_INIT_OVERRIDE
193#endif
194
195#define VSF_TGUI_V_TEXT_LIST_CONTENT_INIT_DEFAULT
196
197#define VSF_TGUI_V_PANEL_STATIC_INIT_OVERRIDE
198
199#define tgui_sv_font(...) \
200 __tgui_attribute(font_index, __VA_ARGS__)
201
202#if VSF_TGUI_CFG_SV_SUPPORT_CORNER_TILE == ENABLED
203#define tgui_sv_tile_show_corner(...) \
204 __tgui_attribute(show_corner_tile, __VA_ARGS__)
205#else
206#define tgui_sv_tile_show_corner(...)
207#endif
208
209#if VSF_TGUI_CFG_SV_SUPPORT_TILE_TRANSPARENCY == ENABLED
210#define tgui_sv_tile_trans_rate(...) \
211 __tgui_attribute(tile_trans_rate, __VA_ARGS__)
212#else
213#define tgui_sv_tile_trans_rate(...)
214#endif
215
216#if VSF_TGUI_CFG_SV_SUPPORT_FLUXIBLE_BACKGROUND_COLOR == ENABLED
217#define tgui_sv_background_color(...) \
218 __tgui_attribute(background_color, __VA_ARGS__)
219#else
220#define tgui_sv_background_color(...)
221#endif
222
223#if VSF_TGUI_CFG_SV_LABLE_SUPPORT_TEXT_COLOR == ENABLED
224#define tgui_sv_font_color(...) \
225 __tgui_attribute(font_color, __VA_ARGS__)
226#else
227#define tgui_sv_font_color(...)
228#endif
229
230/*============================ MACROFIED FUNCTIONS ===========================*/
231/*============================ TYPES =========================================*/
232
233declare_structure(vsf_tgui_v_control_t)
234
235def_structure(vsf_tgui_v_control_t)
236 uint8_t font_index : 7;
237
238#if VSF_TGUI_CFG_SV_SUPPORT_CORNER_TILE == ENABLED
240#endif
241
242#if VSF_TGUI_CFG_SV_SUPPORT_TILE_TRANSPARENCY == ENABLED
244#endif
245
246#if VSF_TGUI_CFG_SV_SUPPORT_FLUXIBLE_BACKGROUND_COLOR == ENABLED
248#endif
249
250end_def_structure(vsf_tgui_v_control_t)
251
252declare_structure(vsf_tgui_v_container_t)
253
254def_structure(vsf_tgui_v_container_t)
255#if __IS_COMPILER_IAR__ || (!defined( __STDC_VERSION__ ) || __STDC_VERSION__ < 199901L)
256 //please remove this if your structure is not emplty
258#endif
259end_def_structure(vsf_tgui_v_container_t)
260
261declare_structure(vsf_tgui_v_label_t)
262def_structure(vsf_tgui_v_label_t)
263#if VSF_TGUI_CFG_SV_LABLE_SUPPORT_TEXT_COLOR == ENABLED
264 vsf_tgui_sv_color_t font_color;
265#endif
266end_def_structure(vsf_tgui_v_label_t)
267
268declare_structure(vsf_tgui_v_button_t)
269def_structure(vsf_tgui_v_button_t)
270#if __IS_COMPILER_IAR__ || (!defined( __STDC_VERSION__ ) || __STDC_VERSION__ < 199901L)
271 //please remove this if your structure is not emplty
273#endif
274end_def_structure(vsf_tgui_v_button_t)
275
276declare_structure(vsf_tgui_v_panel_t)
277def_structure(vsf_tgui_v_panel_t)
278#if __IS_COMPILER_IAR__ || (!defined( __STDC_VERSION__ ) || __STDC_VERSION__ < 199901L)
279 //please remove this if your structure is not emplty
281#endif
282end_def_structure(vsf_tgui_v_panel_t)
283
284declare_structure(vsf_tgui_v_list_t)
285def_structure(vsf_tgui_v_list_t)
286#if __IS_COMPILER_IAR__ || (!defined( __STDC_VERSION__ ) || __STDC_VERSION__ < 199901L)
287 //please remove this if your structure is not emplty
289#endif
290end_def_structure(vsf_tgui_v_list_t)
291
292declare_structure(vsf_tgui_v_text_list_t)
293def_structure(vsf_tgui_v_text_list_t)
294#if __IS_COMPILER_IAR__ || (!defined( __STDC_VERSION__ ) || __STDC_VERSION__ < 199901L)
295 //please remove this if your structure is not emplty
297#endif
298end_def_structure(vsf_tgui_v_text_list_t)
299
300/*============================ GLOBAL VARIABLES ==============================*/
301/*============================ PROTOTYPES ====================================*/
302
303#endif
304
305#endif
306/* EOF */
#define REG_RSVD_U8
Definition i_io_systick.h:136
declare_structure(vsf_tgui_v_control_t) def_structure(vsf_tgui_v_control_t) uint8_t font_index uint8_t show_corner_tile
Definition vsf_tgui_v_type.h:233
end_def_structure(vsf_tgui_v_control_t) declare_structure(vsf_tgui_v_container_t) def_structure(vsf_tgui_v_container_t) REG_RSVD_U8 end_def_structure(vsf_tgui_v_container_t) declare_structure(vsf_tgui_v_label_t) def_structure(vsf_tgui_v_label_t) vsf_tgui_sv_color_t font_color
vsf_tgui_sv_color_t background_color
Definition vsf_tgui_v_type.h:247
uint8_t tile_trans_rate
Definition vsf_tgui_v_type.h:243
unsigned char uint8_t
Definition stdint.h:5
Definition vsf_tgui_sv_color.h:84
vsf_tgui_evt_t declare_structure(__vk_tgui_focus_t) def_structure(__vk_tgui_focus_t) const vsf_tgui_control_t *current_ptr
def_structure(vsf_tgui_v_button_t) end_def_structure(vsf_tgui_v_button_t) extern fsm_rt_t vsf_tgui_button_v_init(vsf_tgui_button_t *ptButton)