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#include "./vsf_tgui_cfg.h"
40
41#if VSF_USE_TINY_GUI == ENABLED
42
43#ifndef VSF_TGUI_V_TEMPLATE_TYPE_HEADER_FILE
44#if VSF_TGUI_CFG_RENDERING_TEMPLATE_SEL == VSF_TGUI_V_TEMPLATE_SIMPLE_VIEW
45# define VSF_TGUI_V_TEMPLATE_TYPE_HEADER_FILE "./view/simple_view/vsf_tgui_v_type.h"
46#elif VSF_TGUI_CFG_RENDERING_TEMPLATE_SEL == VSF_TGUI_V_TEMPLATE_SCGUI_VIEW
47# define VSF_TGUI_V_TEMPLATE_TYPE_HEADER_FILE "./view/scgui_view/vsf_tgui_v_type.h"
48#else
49# undef VSF_TGUI_CFG_RENDERING_TEMPLATE_SEL
50# define VSF_TGUI_CFG_RENDERING_TEMPLATE_SEL VSF_TGUI_V_TEMPLATE_EXAMPLE
51# define VSF_TGUI_V_TEMPLATE_TYPE_HEADER_FILE "./view/template/vsf_tgui_v_type.h"
52#endif
53#include VSF_TGUI_V_TEMPLATE_TYPE_HEADER_FILE
54#endif
55
57
62#if defined(__VSF_TGUI_CLASS_IMPLEMENT)
63# define __PLOOC_CLASS_IMPLEMENT__
64
65#elif defined(__VSF_TGUI_CLASS_INHERIT)
66# define __PLOOC_CLASS_INHERIT__
67
68#endif
69
70#include "utilities/ooc_class.h"
71
72/*============================ MACROS ========================================*/
73/*============================ MACROFIED FUNCTIONS ===========================*/
74/*============================ TYPES =========================================*/
75
76declare_vsf_rng_buf(__vsf_tgui_evt_queue_t)
77
78def_vsf_rng_buf(__vsf_tgui_evt_queue_t, vsf_tgui_evt_t)
79
80declare_structure(__vk_tgui_focus_t)
81
82def_structure(__vk_tgui_focus_t)
83 const vsf_tgui_control_t* current_ptr;
85end_def_structure(__vk_tgui_focus_t)
86
87declare_vsf_pt(__vsf_tgui_evt_shooter_t)
88
89def_vsf_pt(__vsf_tgui_evt_shooter_t,
91 __vsf_tgui_evt_queue_t* queue_ptr;
92 vsf_msgt_t* msg_tree_ptr;
93 const vsf_tgui_root_container_t * root_node_ptr;
94 const vsf_msgt_node_t* node_ptr;
95 vsf_tgui_evt_t event;
96 const vsf_tgui_region_t* region_ptr;
97 vsf_tgui_region_t temp_region;
98
99 __vk_tgui_focus_t Activated;
100
101#if VSF_TGUI_CFG_SUPPORT_MOUSE_LIKE_EVENTS == ENABLED
102 __vk_tgui_focus_t pointer_above;
103#endif
104
105 struct {
106 //uint8_t bIsActivatedControlChanged : 1;
107 uint8_t is_queue_drain : 1;
108#if VSF_TGUI_CFG_SUPPORT_DIRTY_REGION == ENABLED \
109 && VSF_TGUI_CFG_SUPPORT_TRANSPARENT_CONTROL == ENABLED
110 uint8_t is_dirty_region_include_transparent_area : 1;
111#endif
112 } Attribute;
113
114 ))
115end_def_vsf_pt(__vsf_tgui_evt_shooter_t)
116
117
118declare_class(vsf_tgui_t)
119
120def_class(vsf_tgui_t,
121 private_member(
122 implement(vsf_msgt_t)
123 implement_ex(__vsf_tgui_evt_shooter_t, consumer)
124 __vsf_tgui_evt_queue_t msg_queue;
125
126 struct {
128 union {
129 struct {
132 uint8_t : 6;
134 };
136 }finger;
138 }input;
140 protected_member(
141 implement(vsf_tgui_v_port_t)
142 )
143)
144end_def_class(vsf_tgui_t)
145
146typedef struct vsf_tgui_cfg_t {
147 vsf_mem_t evt_queue;
148
149#if VSF_TGUI_CFG_REFRESH_SCHEME == VSF_TGUI_REFRESH_SCHEME_BREADTH_FIRST_TRAVERSAL
150 vsf_mem_t bfs_queue;
151#endif
152
153 const vsf_tgui_root_container_t* root_node_ptr;
154 vsf_prio_t priority;
155 bool is_ignore_first_refresh;
156
158
159/*============================ GLOBAL VARIABLES ==============================*/
160/*============================ PROTOTYPES ====================================*/
161
162
163extern
164vsf_err_t vk_tgui_init(vsf_tgui_t* gui_ptr, const vsf_tgui_cfg_t *cfg_ptr);
165
166extern
167vsf_err_t vk_tgui_set_root_container(vsf_tgui_t* gui_ptr,
168 vsf_tgui_root_container_t *root_node_ptr,
169 bool req_first_refresh);
170
171extern
172vsf_err_t vk_tgui_close_root_container(vsf_tgui_t* gui_ptr);
173
174extern
175bool vk_tgui_send_message(vsf_tgui_t *gui_ptr, vsf_tgui_evt_t event);
176
177extern
178bool vk_tgui_update(vsf_tgui_t *gui_ptr,
179 const vsf_tgui_control_t *target_ptr);
180
181extern
182bool vk_tgui_update_tree(vsf_tgui_t* gui_ptr,
183 const vsf_tgui_control_t* target_ptr);
184
185extern
186bool vk_tgui_send_timer_event( vsf_tgui_t* gui_ptr,
187 const vsf_tgui_control_t* target_ptr);
188
189extern
190const vsf_tgui_control_t *vsf_tgui_actived_control_get(vsf_tgui_t *gui_ptr);
191
192#if VSF_TGUI_CFG_SUPPORT_MOUSE_LIKE_EVENTS == ENABLED
193extern
194const vsf_tgui_control_t *vsf_tgui_pointed_control_get(vsf_tgui_t *gui_ptr);
195#endif
196
197#if VSF_TGUI_CFG_REFRESH_SCHEME != VSF_TGUI_REFRESH_SCHEME_NONE
198extern
199bool vk_tgui_refresh(vsf_tgui_t *gui_ptr);
200
201// region_ptr is relative region to target_ptr
202extern
203bool vk_tgui_refresh_ex( vsf_tgui_t *gui_ptr,
204 const vsf_tgui_control_t *target_ptr,
205 const vsf_tgui_region_t *region_ptr);
206
207extern
208bool vk_tgui_refresh_dirty( vsf_tgui_t* gui_ptr,
209 vsf_tgui_control_t* target_ptr);
210
211
222extern
224 vsf_tgui_t* gui_ptr,
225 const vsf_tgui_region_t* ptPlannedRefreshRegion);
226
232extern
233bool vsf_tgui_v_refresh_loop_end(vsf_tgui_t* gui_ptr);
234
235extern
236void vsf_tgui_low_level_refresh_ready(vsf_tgui_t *gui_ptr);
237
238/*----------------------------------------------------------------------------*
239 * Input related APIs *
240 *----------------------------------------------------------------------------*/
241extern
242vsf_err_t vsf_tgui_send_touch_evt( vsf_tgui_t *tgui_ptr,
243 uint_fast8_t finger_idx,
245 bool is_down,
247extern
248const vsf_tgui_location_t *vsf_tgui_get_pointer_location(vsf_tgui_t *gui_ptr,
249 int_fast8_t idx);
250
251extern
252bool vsf_tgui_set_pointer_location( vsf_tgui_t *gui_ptr,
253 int_fast8_t idx,
254 vsf_tgui_location_t *location_ptr);
255
256#ifdef __VSF_TGUI_CLASS_IMPLEMENT
257extern
258bool __vk_tgui_send_touch_evt( vsf_tgui_t *tgui_ptr,
259 uint_fast8_t finger_idx,
260 vsf_evt_t msg,
262
263extern
264bool __vk_tgui_send_gesture_evt(vsf_tgui_t *tgui_ptr,
265 uint_fast8_t finger_idx,
266 vsf_evt_t msg,
269#endif
270
271/*============================ INCLUDES ======================================*/
272
274#include "./view/vsf_tgui_v.h"
275
277
278#include "./port/vsf_tgui_port.h"
279
280#endif
281#endif
282
283#undef __VSF_TGUI_CLASS_IMPLEMENT
284#undef __VSF_TGUI_CLASS_INHERIT
285#endif
286/* 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:265
Definition vsf_tgui_common.h:275
Definition vsf_tgui_common.h:585
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 @749 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:139
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:139
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:139
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:144
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:139
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:139
vsf_tgui_cfg_t
Definition vsf_tgui.h:157
const vsf_tgui_control_t * previous_ptr
Definition vsf_tgui.h:84
uint8_t status
Definition vsf_tgui.h:139
struct vsf_tgui_control_t vsf_tgui_control_t
Definition vsf_tgui_common.h:549
struct vsf_tgui_root_container_t vsf_tgui_root_container_t
Definition vsf_tgui_common.h:550
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