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
44
49#if defined(__VSF_TGUI_CLASS_IMPLEMENT)
50# define __PLOOC_CLASS_IMPLEMENT__
51
52#elif defined(__VSF_TGUI_CLASS_INHERIT)
53# define __PLOOC_CLASS_INHERIT__
54
55#endif
56
57#include "utilities/ooc_class.h"
58
59/*============================ MACROS ========================================*/
60/*============================ MACROFIED FUNCTIONS ===========================*/
61/*============================ TYPES =========================================*/
62
63declare_vsf_rng_buf(__vsf_tgui_evt_queue_t)
64
65def_vsf_rng_buf(__vsf_tgui_evt_queue_t, vsf_tgui_evt_t)
66
67declare_structure(__vk_tgui_focus_t)
68
69def_structure(__vk_tgui_focus_t)
70 const vsf_tgui_control_t* current_ptr;
72end_def_structure(__vk_tgui_focus_t)
73
74declare_vsf_pt(__vsf_tgui_evt_shooter_t)
75
76def_vsf_pt(__vsf_tgui_evt_shooter_t,
78 __vsf_tgui_evt_queue_t* queue_ptr;
79 vsf_msgt_t* msg_tree_ptr;
80 const vsf_tgui_root_container_t * root_node_ptr;
81 const vsf_msgt_node_t* node_ptr;
82 vsf_tgui_evt_t event;
83 const vsf_tgui_region_t* region_ptr;
84 vsf_tgui_region_t temp_region;
85
86 __vk_tgui_focus_t Activated;
87
88#if VSF_TGUI_CFG_SUPPORT_MOUSE_LIKE_EVENTS == ENABLED
89 __vk_tgui_focus_t pointer_above;
90#endif
91
92 struct {
93 //uint8_t bIsActivatedControlChanged : 1;
94 uint8_t is_queue_drain : 1;
95 } Attribute;
96
97 ))
98end_def_vsf_pt(__vsf_tgui_evt_shooter_t)
99
100
101declare_class(vsf_tgui_t)
102
103def_class(vsf_tgui_t,
104 private_member(
105 implement(vsf_msgt_t)
106 implement_ex(__vsf_tgui_evt_shooter_t, consumer)
107 __vsf_tgui_evt_queue_t msg_queue;
108
109 struct {
111 union {
112 struct {
115 uint8_t : 6;
117 };
119 }finger;
121 }input;
123)
124end_def_class(vsf_tgui_t)
125
126typedef struct vsf_tgui_cfg_t {
127 vsf_mem_t evt_queue;
128
129#if VSF_TGUI_CFG_REFRESH_SCHEME == VSF_TGUI_REFRESH_SCHEME_BREADTH_FIRST_TRAVERSAL
130 vsf_mem_t bfs_queue;
131#endif
132
133 const vsf_tgui_root_container_t* root_node_ptr;
134 vsf_prio_t priority;
135 bool is_ignore_first_refresh;
136
137}vsf_tgui_cfg_t;
138
139/*============================ GLOBAL VARIABLES ==============================*/
140/*============================ PROTOTYPES ====================================*/
141
142
143extern
144vsf_err_t vk_tgui_init(vsf_tgui_t* gui_ptr, const vsf_tgui_cfg_t *cfg_ptr);
145
146extern
147vsf_err_t vk_tgui_set_root_container(vsf_tgui_t* gui_ptr,
148 vsf_tgui_root_container_t *root_node_ptr,
149 bool req_first_refresh);
150
151extern
152vsf_err_t vk_tgui_close_root_container(vsf_tgui_t* gui_ptr);
153
154extern
155bool vk_tgui_send_message(vsf_tgui_t *gui_ptr, vsf_tgui_evt_t event);
156
157extern
158bool vk_tgui_update(vsf_tgui_t *gui_ptr,
159 const vsf_tgui_control_t *target_ptr);
160
161extern
162bool vk_tgui_update_tree(vsf_tgui_t* gui_ptr,
163 const vsf_tgui_control_t* target_ptr);
164
165extern
166bool vk_tgui_send_timer_event( vsf_tgui_t* gui_ptr,
167 const vsf_tgui_control_t* target_ptr);
168
169extern
170const vsf_tgui_control_t *vsf_tgui_actived_control_get(vsf_tgui_t *gui_ptr);
171
172#if VSF_TGUI_CFG_SUPPORT_MOUSE_LIKE_EVENTS == ENABLED
173extern
174const vsf_tgui_control_t *vsf_tgui_pointed_control_get(vsf_tgui_t *gui_ptr);
175#endif
176
177#if VSF_TGUI_CFG_REFRESH_SCHEME != VSF_TGUI_REFRESH_SCHEME_NONE
178extern
179bool vk_tgui_refresh(vsf_tgui_t *gui_ptr);
180
181extern
182bool vk_tgui_refresh_ex( vsf_tgui_t *gui_ptr,
183 const vsf_tgui_control_t *target_ptr,
184 const vsf_tgui_region_t *region_ptr);
185
186
187
198extern
199vsf_tgui_region_t* vsf_tgui_v_refresh_loop_begin(
200 vsf_tgui_t* gui_ptr,
201 const vsf_tgui_region_t* ptPlannedRefreshRegion);
202
208extern
209bool vsf_tgui_v_refresh_loop_end(vsf_tgui_t* gui_ptr);
210
211extern
212void vsf_tgui_low_level_refresh_ready(vsf_tgui_t *gui_ptr);
213
214/*----------------------------------------------------------------------------*
215 * Input related APIs *
216 *----------------------------------------------------------------------------*/
217extern
218vsf_err_t vsf_tgui_send_touch_evt( vsf_tgui_t *tgui_ptr,
219 uint_fast8_t finger_idx,
221 bool is_down,
223extern
224const vsf_tgui_location_t *vsf_tgui_get_pointer_location(vsf_tgui_t *gui_ptr,
225 int_fast8_t idx);
226
227extern
228bool vsf_tgui_set_pointer_location( vsf_tgui_t *gui_ptr,
229 int_fast8_t idx,
230 vsf_tgui_location_t *location_ptr);
231
232#ifdef __VSF_TGUI_CLASS_IMPLEMENT
233extern
234bool __vk_tgui_send_touch_evt( vsf_tgui_t *tgui_ptr,
235 uint_fast8_t finger_idx,
236 vsf_evt_t msg,
238
239extern
240bool __vk_tgui_send_gesture_evt(vsf_tgui_t *tgui_ptr,
241 uint_fast8_t finger_idx,
242 vsf_evt_t msg,
245#endif
246
247/*============================ INCLUDES ======================================*/
249#include "view/vsf_tgui_v.h"
250
251#endif
252#endif
253
254#undef __VSF_TGUI_CLASS_IMPLEMENT
255#undef __VSF_TGUI_CLASS_INHERIT
256#endif
257/* 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
unsigned char uint_fast8_t
Definition stdint.h:23
int int32_t
Definition stdint.h:8
unsigned char uint8_t
Definition stdint.h:5
signed char int8_t
Definition stdint.h:4
char int_fast8_t
Definition stdint.h:22
Definition vsf_utilities.h:51
Definition vsf_tgui_common.h:226
Definition vsf_tgui_common.h:236
Definition vsf_tgui_common.h:539
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 @733 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 vk_tgui_update_tree(vsf_tgui_t *gui_ptr, const vsf_tgui_control_t *target_ptr)
Definition vsf_tgui.c:252
bool vk_tgui_update(vsf_tgui_t *gui_ptr, const vsf_tgui_control_t *target_ptr)
Definition vsf_tgui.c:216
bool vk_tgui_send_message(vsf_tgui_t *gui_ptr, vsf_tgui_evt_t event)
tgui msg queue producer
Definition vsf_tgui.c:191
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:468
const vsf_tgui_control_t * vsf_tgui_actived_control_get(vsf_tgui_t *gui_ptr)
Definition vsf_tgui.c:454
bool vk_tgui_send_timer_event(vsf_tgui_t *gui_ptr, const vsf_tgui_control_t *target_ptr)
Definition vsf_tgui.c:234
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:140
const vsf_tgui_control_t * vsf_tgui_pointed_control_get(vsf_tgui_t *gui_ptr)
Definition vsf_tgui.c:461
void vsf_tgui_low_level_refresh_ready(vsf_tgui_t *gui_ptr)
Definition vsf_tgui.c:503
vsf_err_t vk_tgui_close_root_container(vsf_tgui_t *gui_ptr)
Definition vsf_tgui.c:168
const vsf_tgui_location_t * vsf_tgui_get_pointer_location(vsf_tgui_t *gui_ptr, int_fast8_t idx)
Definition vsf_tgui.c:489
uint8_t is_finger1_down
Definition vsf_tgui.h:122
vsf_tgui_location_t current[2]
Definition vsf_tgui.h:122
uint8_t is_finger0_down
Definition vsf_tgui.h:122
union @155::@156 finger
end_def_structure(__vk_tgui_focus_t) declare_vsf_pt(__vsf_tgui_evt_shooter_t) def_vsf_pt(__vsf_tgui_evt_shooter_t
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:122
int8_t finger_idx_pre
Definition vsf_tgui.h:122
const vsf_tgui_control_t * previous_ptr
Definition vsf_tgui.h:71
uint8_t status
Definition vsf_tgui.h:122
struct vsf_tgui_control_t vsf_tgui_control_t
Definition vsf_tgui_common.h:506
struct vsf_tgui_root_container_t vsf_tgui_root_container_t
Definition vsf_tgui_common.h:507
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_button_t) end_def_structure(vsf_tgui_v_button_t) extern fsm_rt_t vsf_tgui_button_v_init(vsf_tgui_button_t *ptButton)