VSF Documented
vsf_tgui_list.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/****************************************************************************
19* Copyright 2020 by Gorgon Meducer (Email:embedded_zhuoran@hotmail.com) *
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_TGUI_CONTROLS_LIST_H__
36#define __VSF_TGUI_CONTROLS_LIST_H__
37
38/*============================ INCLUDES ======================================*/
39
40#include "./vsf_tgui_control.h"
41#include "./__vk_tgui_slider.h"
42
43#if VSF_TGUI_CFG_SUPPORT_LIST == ENABLED
49#if defined(__VSF_TGUI_CONTROLS_LIST_CLASS_IMPLEMENT)
50# define __PLOOC_CLASS_IMPLEMENT__
51# undef __VSF_TGUI_CONTROLS_LIST_CLASS_IMPLEMENT
52#elif defined(__VSF_TGUI_CONTROLS_LIST_CLASS_INHERIT)
53# define __PLOOC_CLASS_INHERIT__
54# undef __VSF_TGUI_CONTROLS_LIST_CLASS_INHERIT
55#endif
56
57#include "utilities/ooc_class.h"
58
59
60/*============================ MACROS ========================================*/
61
62# define __VSF_TGUI_INTERFACE_CONTROLS_LIST { \
63 .msg_handler = { \
64 VSF_MSGT_NODE_HANDLER_TYPE_FSM, \
65 (vsf_msgt_method_fsm_t *)&vsf_tgui_list_msg_handler, \
66 }, \
67 .Status = (vsf_msgt_method_status_t *) \
68 &vsf_tgui_control_status_get, \
69 .Shoot = (vsf_msgt_method_shoot_t *)&vsf_tgui_control_shoot, \
70 }
71
72
73/*============================ MACROFIED FUNCTIONS ===========================*/
74
75# define __tgui_list( __NAME, \
76 __PARENT_ADDR, \
77 __PREVIOUS, \
78 __NEXT, ...) \
79 tgui_container_base( __NAME, \
80 VSF_TGUI_COMPONENT_ID_LIST, \
81 vsf_tgui_list_t, \
82 (__PARENT_ADDR), \
83 __PREVIOUS, \
84 __NEXT, \
85 VSF_TGUI_V_LIST_STATIC_INIT_DEFAULT \
86 __VA_ARGS__ \
87 VSF_TGUI_V_LIST_STATIC_INIT_OVERRIDE \
88 \
89 .ContainerAttribute \
90 .u5Type = VSF_TGUI_CONTAINER_TYPE_PLANE, \
91 .ContainerAttribute \
92 .bIsAutoSize = false, \
93 .bIsHideContentInsideContainer = false, \
94 .list.parent_ptr = \
95 (vsf_msgt_container_t *)&((__PARENT_ADDR)-> \
96 __NAME.use_as__vsf_msgt_node_t), \
97 .list.id = VSF_TGUI_COMPONENT_ID_CONTAINER, \
98 .list.Offset = {0}, \
99 .list.is_container = true, \
100 .list.bIsTransparent = true, \
101 .list.ContainerAttribute \
102 .bIsAutoSize = true, \
103 .list.bIsEnabled = true, \
104 .list.bIsVisible = true, \
105 .list.node_ptr = \
106 (vsf_msgt_node_t*) \
107 &((__PARENT_ADDR)-> \
108 __NAME.list.list_FirstNode), \
109 .list \
110 __tgui_name_string_tag( __NAME.list, \
111 vsf_tgui_list_t) \
112 )
113
114
115#define tgui_list( __NAME, \
116 __PARENT_ADDR, \
117 __PREVIOUS, \
118 __NEXT, \
119 ...) \
120 __tgui_list( __NAME, \
121 (__PARENT_ADDR), \
122 __PREVIOUS, \
123 __NEXT, \
124 __VA_ARGS__)
125
126# define tgui_list_items(...) \
127 .list = { \
128 VSF_TGUI_V_CONTAINER_STATIC_INIT_DEFAULT \
129 .is_container = false, \
130 .bIsTransparent = false, \
131 __VA_ARGS__ \
132 VSF_TGUI_V_CONTAINER_STATIC_INIT_OVERRIDE \
133 },
134
135
136#define __use_tgui_list(__NAME, ...) \
137 struct { \
138 implement(vsf_tgui_list_t); \
139 union { \
140 vsf_msgt_node_t __NAME##_FirstNode ; \
141 use_tgui_container(list, __VA_ARGS__) \
142 }; \
143 } __NAME;
144
145#define use_tgui_list(__NAME, ...) __use_tgui_list(__NAME, __VA_ARGS__)
146
147
148/*============================ TYPES =========================================*/
149
150typedef enum {
152 VSF_TGUI_LIST_MODE_FREE_MOVE , /* reserve for future */
153 VSF_TGUI_LIST_MODE_ITEM_SELECTION , /* reserve for future */
156
161
162declare_class(vsf_tgui_list_t)
163
164def_class(vsf_tgui_list_t,
166 implement(vsf_tgui_container_t)
167 implement(vsf_tgui_v_list_t)
168 )
170 union {
171 struct {
172 private_member(
173 implement(__vk_tgui_slider_t)
174 /* use vsf_tgui_list_work_mode_t value*/
175 struct {
176 uint8_t u2WorkMode : 2;
177 uint8_t bIsSliding : 1;
178 uint8_t : 5;
179 }tMode;
180 union {
181 uint8_t chStartIndex;
182 uint8_t chSelectIndex;
183 };
184 )
185 };
186 struct {
187 inherit_ex(__vk_tgui_slider_t, tSlider)
188 /* use vsf_tgui_list_work_mode_t value*/
189 uint8_t u2WorkMode : 2;
190 };
191 };
192#else
193 union {
194 struct {
195 private_member(
196 /* use vsf_tgui_list_work_mode_t value*/
197 struct {
198 uint8_t u2WorkMode : 2;
199 uint8_t bIsSliding : 1;
200 uint8_t : 5;
201 }tMode;
202 union {
203 uint8_t chStartIndex;
204 uint8_t chSelectIndex;
205 };
206 )
207 };
208 struct {
209 /* use vsf_tgui_list_work_mode_t value*/
210 uint8_t u2WorkMode : 2;
211 };
212 };
213#endif
214 vsf_tgui_container_t ptList[];
215)
216
217end_def_class(vsf_tgui_list_t)
218
219/*============================ GLOBAL VARIABLES ==============================*/
220/*============================ PROTOTYPES ====================================*/
221
222extern
223fsm_rt_t vk_tgui_list_update(vsf_tgui_list_t* ptList);
224
225extern
226fsm_rt_t vk_tgui_list_init(vsf_tgui_list_t* ptList);
227
228extern
231
232#if VSF_TGUI_CFG_LIST_SUPPORT_SCROOLBAR == ENABLED
233VSF_CAL_SECTION(".text.vsf.component.tgui.vsf_tgui_list_scrollbar_regions_generate")
234extern
237 const vsf_tgui_list_t* ptList,
238 uint_fast8_t chScalingRatio,
239 vsf_tgui_list_scrollbar_region_t *ptOutputBuffer);
240#endif
241
242/*----------------------------------------------------------------------------*
243 * APIs for VSF_TGUI_LIST_MODE_FREE_MOVE_STICK_TO_ITEM mode *
244 *----------------------------------------------------------------------------*/
245extern
247
248extern
250 uint_fast8_t chStartIndex);
251
252/*----------------------------------------------------------------------------*
253 * APIs for VSF_TGUI_LIST_MODE_ITEM_SELECTION(_*) mode *
254 *----------------------------------------------------------------------------*/
255extern
257
258extern
260 uint_fast8_t chSelectIndex);
261
262#endif
263#endif
264/* EOF */
#define VSF_CAL_SECTION(__SEC)
Definition __compiler.h:181
#define ENABLED
Definition __type.h:28
unsigned char uint8_t
Definition lvgl.h:40
unsigned char uint_fast8_t
Definition stdint.h:23
short int_fast16_t
Definition stdint.h:24
Definition vsf_tgui_list.h:157
vsf_tgui_region_t tBar
Definition vsf_tgui_list.h:159
vsf_tgui_region_t tTrack
Definition vsf_tgui_list.h:158
Definition vsf_tgui_common.h:552
Definition vsf_tgui_common.h:275
fsm_rt_t
Definition vsf_fsm.h:315
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 VSF_TGUI_CFG_LIST_SUPPORT_SLIDE
Definition vsf_tgui_cfg.h:224
struct vsf_tgui_control_t vsf_tgui_control_t
Definition vsf_tgui_common.h:549
which(vsf_tgui_control_t vsf_tgui_v_label_t) public vsf_tgui_msg_t * ptMSG
Definition vsf_tgui_label.h:157
fsm_rt_t vk_tgui_list_update(vsf_tgui_list_t *ptList)
Definition vsf_tgui_list.c:392
which(vsf_tgui_container_t vsf_tgui_v_list_t) union
Definition vsf_tgui_list.h:165
declare_class(vsf_tgui_list_t) def_class(vsf_tgui_list_t
int_fast16_t vk_tgui_list_selected_item_get(vsf_tgui_list_t *ptList)
Definition vsf_tgui_list.c:458
vsf_tgui_container_t ptList[]
Definition vsf_tgui_list.h:214
int_fast16_t vk_tgui_list_display_item_start_get(vsf_tgui_list_t *ptList)
Definition vsf_tgui_list.c:432
end_def_class(vsf_tgui_list_t) extern fsm_rt_t vk_tgui_list_update(vsf_tgui_list_t *ptList)
int_fast16_t vk_tgui_list_selected_item_set(vsf_tgui_list_t *ptList, uint_fast8_t chSelectIndex)
Definition vsf_tgui_list.c:469
fsm_rt_t vsf_tgui_list_msg_handler(vsf_tgui_list_t *control_ptr, vsf_tgui_msg_t *ptMSG)
Definition vsf_tgui_list.c:284
int_fast16_t vk_tgui_list_display_item_start_set(vsf_tgui_list_t *ptList, uint_fast8_t chStartIndex)
Definition vsf_tgui_list.c:443
vsf_tgui_list_scrollbar_region_t * vsf_tgui_list_scrollbar_regions_generate(const vsf_tgui_control_t *control_ptr, const vsf_tgui_list_t *ptList, uint_fast8_t chScalingRatio, vsf_tgui_list_scrollbar_region_t *ptOutputBuffer)
Definition vsf_tgui_list.c:487
vsf_tgui_list_work_mode_t
Definition vsf_tgui_list.h:150
@ VSF_TGUI_LIST_MODE_ITEM_SELECTION
Definition vsf_tgui_list.h:153
@ VSF_TGUI_LIST_MODE_ITEM_SELECTION_CENTER_ALIGN
Definition vsf_tgui_list.h:154
@ VSF_TGUI_LIST_MODE_FREE_MOVE_STICK_TO_ITEM
Definition vsf_tgui_list.h:151
@ VSF_TGUI_LIST_MODE_FREE_MOVE
Definition vsf_tgui_list.h:152
fsm_rt_t vk_tgui_list_init(vsf_tgui_list_t *ptList)
Definition vsf_tgui_list.c:411
const vsf_tgui_control_t * control_ptr
Definition vsf_tgui_scguiv_port.h:87