VSF Documented
vsf_tgui.h
Go to the documentation of this file.
1/****************************************************************************
2* Copyright 2020 by Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) *
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/*****************************************************************************
19 * Copyright(C)2009-2022 by VSF Team *
20 * *
21 * Licensed under the Apache License, Version 2.0 (the "License"); *
22 * you may not use this file except in compliance with the License. *
23 * You may obtain a copy of the License at *
24 * *
25 * http://www.apache.org/licenses/LICENSE-2.0 *
26 * *
27 * Unless required by applicable law or agreed to in writing, software *
28 * distributed under the License is distributed on an "AS IS" BASIS, *
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. *
30 * See the License for the specific language governing permissions and *
31 * limitations under the License. *
32 * *
33 ****************************************************************************/
34
35#ifndef __VSF_TINY_GUI_H__
36#define __VSF_TINY_GUI_H__
37
38/*============================ INCLUDES ======================================*/
39
40#include "./vsf_tgui_cfg.h"
41
42#if VSF_USE_TINY_GUI == ENABLED
43
44#ifndef VSF_TGUI_V_TEMPLATE_TYPE_HEADER_FILE
45#if VSF_TGUI_CFG_RENDERING_TEMPLATE_SEL == VSF_TGUI_V_TEMPLATE_SIMPLE_VIEW
46# define VSF_TGUI_V_TEMPLATE_TYPE_HEADER_FILE "./view/simple_view/vsf_tgui_v_type.h"
47#elif VSF_TGUI_CFG_RENDERING_TEMPLATE_SEL == VSF_TGUI_V_TEMPLATE_SCGUI_VIEW
48# define VSF_TGUI_V_TEMPLATE_TYPE_HEADER_FILE "./view/scgui_view/vsf_tgui_v_type.h"
49#else
50# undef VSF_TGUI_CFG_RENDERING_TEMPLATE_SEL
51# define VSF_TGUI_CFG_RENDERING_TEMPLATE_SEL VSF_TGUI_V_TEMPLATE_EXAMPLE
52# define VSF_TGUI_V_TEMPLATE_TYPE_HEADER_FILE "./view/template/vsf_tgui_v_type.h"
53#endif
54#include VSF_TGUI_V_TEMPLATE_TYPE_HEADER_FILE
55#endif
56
58
63#if defined(__VSF_TGUI_CLASS_IMPLEMENT)
64# define __PLOOC_CLASS_IMPLEMENT__
65
66#elif defined(__VSF_TGUI_CLASS_INHERIT)
67# define __PLOOC_CLASS_INHERIT__
68
69#endif
70
71#include "utilities/ooc_class.h"
72
73#ifdef __cplusplus
74extern "C" {
75#endif
76
77/*============================ MACROS ========================================*/
78/*============================ MACROFIED FUNCTIONS ===========================*/
79/*============================ TYPES =========================================*/
80
81declare_vsf_rng_buf(__vsf_tgui_evt_queue_t)
82
83def_vsf_rng_buf(__vsf_tgui_evt_queue_t, vsf_tgui_evt_t)
84
85declare_structure(__vk_tgui_focus_t)
86
87def_structure(__vk_tgui_focus_t)
88 const vsf_tgui_control_t* current_ptr;
90end_def_structure(__vk_tgui_focus_t)
91
92declare_vsf_pt(__vsf_tgui_evt_shooter_t)
93
94def_vsf_pt(__vsf_tgui_evt_shooter_t,
96 __vsf_tgui_evt_queue_t* queue_ptr;
97 vsf_msgt_t* msg_tree_ptr;
98 const vsf_tgui_root_container_t * root_node_ptr;
99 const vsf_msgt_node_t* node_ptr;
100 vsf_tgui_evt_t event;
101 const vsf_tgui_region_t* region_ptr;
102 vsf_tgui_region_t temp_region;
103
104 __vk_tgui_focus_t Activated;
105
106#if VSF_TGUI_CFG_SUPPORT_MOUSE_LIKE_EVENTS == ENABLED
107 __vk_tgui_focus_t pointer_above;
108#endif
109
110 struct {
111 //uint8_t bIsActivatedControlChanged : 1;
112 uint8_t is_queue_drain : 1;
113#if VSF_TGUI_CFG_SUPPORT_DIRTY_REGION == ENABLED \
114 && VSF_TGUI_CFG_SUPPORT_TRANSPARENT_CONTROL == ENABLED
115 uint8_t is_dirty_region_include_transparent_area : 1;
116#endif
117 } Attribute;
118
119 ))
120end_def_vsf_pt(__vsf_tgui_evt_shooter_t)
121
122
123declare_class(vsf_tgui_t)
124
125def_class(vsf_tgui_t,
126 private_member(
127 implement(vsf_msgt_t)
128 implement_ex(__vsf_tgui_evt_shooter_t, consumer)
129 __vsf_tgui_evt_queue_t msg_queue;
130
131 struct {
133 union {
134 struct {
137 uint8_t : 6;
139 };
141 }finger;
143 }input;
145 protected_member(
146 implement(vsf_tgui_v_port_t)
147 )
148)
149end_def_class(vsf_tgui_t)
150
151typedef struct vsf_tgui_cfg_t {
152 vsf_mem_t evt_queue;
153
154#if VSF_TGUI_CFG_REFRESH_SCHEME == VSF_TGUI_REFRESH_SCHEME_BREADTH_FIRST_TRAVERSAL
155 vsf_mem_t bfs_queue;
156#endif
157
158 const vsf_tgui_root_container_t* root_node_ptr;
159 vsf_prio_t priority;
160 bool is_ignore_first_refresh;
161
163
164/*============================ GLOBAL VARIABLES ==============================*/
165/*============================ PROTOTYPES ====================================*/
166
167
168extern
169vsf_err_t vk_tgui_init(vsf_tgui_t* gui_ptr, const vsf_tgui_cfg_t *cfg_ptr);
170
171extern
172vsf_err_t vk_tgui_set_root_container(vsf_tgui_t* gui_ptr,
173 vsf_tgui_root_container_t *root_node_ptr,
174 bool req_first_refresh);
175
176extern
177vsf_err_t vk_tgui_close_root_container(vsf_tgui_t* gui_ptr);
178
179extern
180bool vk_tgui_send_message(vsf_tgui_t *gui_ptr, vsf_tgui_evt_t event);
181
182extern
183bool vk_tgui_update(vsf_tgui_t *gui_ptr,
184 const vsf_tgui_control_t *target_ptr);
185
186extern
187bool vk_tgui_update_tree(vsf_tgui_t* gui_ptr,
188 const vsf_tgui_control_t* target_ptr);
189
190extern
191bool vk_tgui_send_timer_event( vsf_tgui_t* gui_ptr,
192 const vsf_tgui_control_t* target_ptr);
193
194extern
195const vsf_tgui_control_t *vsf_tgui_actived_control_get(vsf_tgui_t *gui_ptr);
196
197#if VSF_TGUI_CFG_SUPPORT_MOUSE_LIKE_EVENTS == ENABLED
198extern
199const vsf_tgui_control_t *vsf_tgui_pointed_control_get(vsf_tgui_t *gui_ptr);
200#endif
201
202#if VSF_TGUI_CFG_REFRESH_SCHEME != VSF_TGUI_REFRESH_SCHEME_NONE
203extern
204bool vk_tgui_refresh(vsf_tgui_t *gui_ptr);
205
206// region_ptr is relative region to target_ptr
207extern
208bool vk_tgui_refresh_ex( vsf_tgui_t *gui_ptr,
209 const vsf_tgui_control_t *target_ptr,
210 const vsf_tgui_region_t *region_ptr);
211
212extern
213bool vk_tgui_refresh_dirty( vsf_tgui_t* gui_ptr,
214 vsf_tgui_control_t* target_ptr);
215
216
227extern
229 vsf_tgui_t* gui_ptr,
230 const vsf_tgui_region_t* ptPlannedRefreshRegion);
231
237extern
238bool vsf_tgui_v_refresh_loop_end(vsf_tgui_t* gui_ptr);
239
240extern
241void vsf_tgui_low_level_refresh_ready(vsf_tgui_t *gui_ptr);
242
243/*----------------------------------------------------------------------------*
244 * Input related APIs *
245 *----------------------------------------------------------------------------*/
246extern
247vsf_err_t vsf_tgui_send_touch_evt( vsf_tgui_t *tgui_ptr,
248 uint_fast8_t finger_idx,
250 bool is_down,
252extern
253const vsf_tgui_location_t *vsf_tgui_get_pointer_location(vsf_tgui_t *gui_ptr,
254 int_fast8_t idx);
255
256extern
257bool vsf_tgui_set_pointer_location( vsf_tgui_t *gui_ptr,
258 int_fast8_t idx,
259 vsf_tgui_location_t *location_ptr);
260
261#ifdef __VSF_TGUI_CLASS_IMPLEMENT
262extern
263bool __vk_tgui_send_touch_evt( vsf_tgui_t *tgui_ptr,
264 uint_fast8_t finger_idx,
265 vsf_evt_t msg,
267
268extern
269bool __vk_tgui_send_gesture_evt(vsf_tgui_t *tgui_ptr,
270 uint_fast8_t finger_idx,
271 vsf_evt_t msg,
274#endif
275
276#ifdef __cplusplus
277}
278#endif
279
280/*============================ INCLUDES ======================================*/
281
283#include "./view/vsf_tgui_v.h"
284
286
287#include "./port/vsf_tgui_port.h"
288
289#endif
290#endif
291
292#undef __VSF_TGUI_CLASS_IMPLEMENT
293#undef __VSF_TGUI_CLASS_INHERIT
294#endif
295/* EOF */
vsf_err_t
Definition __type.h:42
declare_class(vsf_tgui_t)
Definition __vk_tgui_slider.c:41
u8 position[WLAN_USER_POSITION_LEN]
Definition ieee80211.h:144
__le16 duration
Definition ieee80211.h:1
signed int int32_t
Definition lvgl.h:44
unsigned char uint8_t
Definition lvgl.h:40
signed char int8_t
Definition lvgl.h:38
unsigned char uint_fast8_t
Definition stdint.h:23
char int_fast8_t
Definition stdint.h:22
Definition vsf_utilities.h:51
Definition vsf_tgui_common.h:271
Definition vsf_tgui_common.h:281
Definition vsf_tgui_common.h:591
int16_t vsf_evt_t
Definition vsf_eda.h:654
#define def_params(...)
Definition vsf_fsm.h:76
vsf_prio_t
Definition vsf_kernel_common.h:37
union @747 Attribute
def_class(vsf_stream_fifo_t, which(vsf_stream_tx_t TX;vsf_stream_rx_t RX;), private:vsf_slist_queue_t union { vsf_stream_fifo_cfg_t cfg;struct { vsf_stream_dat_rdy_evt_t tDataReadyEventHandling;vsf_stream_dat_drn_evt_t tDataDrainEventHandling;vsf_stream_status_t Status;#if !defined(VSF_PBUF_QUEUE_CFG_ATOM_ACCESS) vsf_protect_region_t *pregion;#endif };};) end_def_class(vsf_stream_fifo_t) extern vsf_err_t vsf_stream_fifo_init(vsf_stream_fifo_t *obj_ptr
#define declare_vsf_pt(__name)
Definition vsf_pt.h:207
#define end_def_vsf_pt(...)
Definition vsf_pt.h:191
#define def_vsf_pt(__name,...)
Definition vsf_pt.h:190
#define declare_vsf_rng_buf(__name)
Definition vsf_queue.h:175
#define def_vsf_rng_buf(__name, __type)
Definition vsf_queue.h:242
bool vsf_tgui_set_pointer_location(vsf_tgui_t *gui_ptr, int_fast8_t idx, vsf_tgui_location_t *location_ptr)
Definition vsf_tgui.c:507
void vsf_tgui_low_level_refresh_ready(vsf_tgui_t *gui_ptr)
Definition vsf_tgui.c:542
const vsf_tgui_location_t * vsf_tgui_get_pointer_location(vsf_tgui_t *gui_ptr, int_fast8_t idx)
Definition vsf_tgui.c:528
bool vk_tgui_update_tree(vsf_tgui_t *gui_ptr, const vsf_tgui_control_t *target_ptr)
Definition vsf_tgui.c:267
bool vk_tgui_update(vsf_tgui_t *gui_ptr, const vsf_tgui_control_t *target_ptr)
Definition vsf_tgui.c:231
uint8_t is_finger1_down
Definition vsf_tgui.h:144
bool vk_tgui_send_message(vsf_tgui_t *gui_ptr, vsf_tgui_evt_t event)
tgui msg queue producer
Definition vsf_tgui.c:201
vsf_tgui_location_t current[2]
Definition vsf_tgui.h:144
union @157::@158 finger
const vsf_tgui_control_t * vsf_tgui_actived_control_get(vsf_tgui_t *gui_ptr)
Definition vsf_tgui.c:493
uint8_t is_finger0_down
Definition vsf_tgui.h:144
vsf_err_t vk_tgui_init(vsf_tgui_t *gui_ptr, const vsf_tgui_cfg_t *cfg_ptr)
bool vk_tgui_send_timer_event(vsf_tgui_t *gui_ptr, const vsf_tgui_control_t *target_ptr)
Definition vsf_tgui.c:249
end_def_structure(__vk_tgui_focus_t) declare_vsf_pt(__vsf_tgui_evt_shooter_t) def_vsf_pt(__vsf_tgui_evt_shooter_t
vsf_err_t vk_tgui_set_root_container(vsf_tgui_t *gui_ptr, vsf_tgui_root_container_t *root_node_ptr, bool req_first_refresh)
Definition vsf_tgui.c:150
const vsf_tgui_control_t * vsf_tgui_pointed_control_get(vsf_tgui_t *gui_ptr)
Definition vsf_tgui.c:500
vsf_tgui_v_port_t end_def_class(vsf_tgui_t) typedef struct vsf_tgui_cfg_t
Definition vsf_tgui.h:149
vsf_tgui_evt_t declare_structure(__vk_tgui_focus_t) def_structure(__vk_tgui_focus_t) const vsf_tgui_control_t *current_ptr
vsf_tgui_location_t location_pre[2]
Definition vsf_tgui.h:144
vsf_err_t vk_tgui_close_root_container(vsf_tgui_t *gui_ptr)
Definition vsf_tgui.c:178
int8_t finger_idx_pre
Definition vsf_tgui.h:144
vsf_tgui_cfg_t
Definition vsf_tgui.h:162
const vsf_tgui_control_t * previous_ptr
Definition vsf_tgui.h:89
uint8_t status
Definition vsf_tgui.h:144
struct vsf_tgui_control_t vsf_tgui_control_t
Definition vsf_tgui_common.h:555
struct vsf_tgui_root_container_t vsf_tgui_root_container_t
Definition vsf_tgui_common.h:556
bool __vk_tgui_send_gesture_evt(vsf_tgui_t *tgui_ptr, uint_fast8_t finger_idx, vsf_evt_t msg, vsf_tgui_location_t delta, int32_t duration)
Definition vsf_tgui_input.c:53
vsf_err_t vsf_tgui_send_touch_evt(vsf_tgui_t *tgui_ptr, uint_fast8_t finger_idx, vsf_tgui_location_t position, bool is_down, int32_t duration)
Definition vsf_tgui_input.c:73
bool __vk_tgui_send_touch_evt(vsf_tgui_t *tgui_ptr, uint_fast8_t finger_idx, vsf_evt_t msg, vsf_tgui_location_t position)
Definition vsf_tgui_input.c:37
def_structure(vsf_tgui_v_port_t) vk_disp_t *disp
vsf_tgui_region_t * vsf_tgui_v_refresh_loop_begin(vsf_tgui_t *gui_ptr, const vsf_tgui_region_t *planned_refresh_region_ptr)
begin a refresh loop !
Definition vsf_tgui_sv_port.c:372
bool vsf_tgui_v_refresh_loop_end(vsf_tgui_t *gui_ptr)
Definition vsf_tgui_sv_port.c:451