MPLABĀ® Harmony Graphics Suite
legato_event.h
Go to the documentation of this file.
1 /*******************************************************************************
2 * Copyright (C) 2020 Microchip Technology Inc. and its subsidiaries.
3 *
4 * Subject to your compliance with these terms, you may use Microchip software
5 * and any derivatives exclusively with Microchip products. It is your
6 * responsibility to comply with third party license terms applicable to your
7 * use of third party software (including open source software) that may
8 * accompany Microchip software.
9 *
10 * THIS SOFTWARE IS SUPPLIED BY MICROCHIP "AS IS". NO WARRANTIES, WHETHER
11 * EXPRESS, IMPLIED OR STATUTORY, APPLY TO THIS SOFTWARE, INCLUDING ANY IMPLIED
12 * WARRANTIES OF NON-INFRINGEMENT, MERCHANTABILITY, AND FITNESS FOR A
13 * PARTICULAR PURPOSE.
14 *
15 * IN NO EVENT WILL MICROCHIP BE LIABLE FOR ANY INDIRECT, SPECIAL, PUNITIVE,
16 * INCIDENTAL OR CONSEQUENTIAL LOSS, DAMAGE, COST OR EXPENSE OF ANY KIND
17 * WHATSOEVER RELATED TO THE SOFTWARE, HOWEVER CAUSED, EVEN IF MICROCHIP HAS
18 * BEEN ADVISED OF THE POSSIBILITY OR THE DAMAGES ARE FORESEEABLE. TO THE
19 * FULLEST EXTENT ALLOWED BY LAW, MICROCHIP'S TOTAL LIABILITY ON ALL CLAIMS IN
20 * ANY WAY RELATED TO THIS SOFTWARE WILL NOT EXCEED THE AMOUNT OF FEES, IF ANY,
21 * THAT YOU HAVE PAID DIRECTLY TO MICROCHIP FOR THIS SOFTWARE.
22 *******************************************************************************/
23 
24 /*******************************************************************************
25  Module for Microchip Graphics Library - Legato User Interface Library
26 
27  Company:
28  Microchip Technology Inc.
29 
30  File Name:
31  legato_event.h
32 
33  Summary:
34  Defines events that are used in the UI library. Events are created and
35  stored for later processing during a library context's update loop.
36 
37 *******************************************************************************/
38 
46 #ifndef LEGATO_EVENT_H
47 #define LEGATO_EVENT_H
48 
51 
52 // *****************************************************************************
53 // *****************************************************************************
54 // Section: Data Types and Constants
55 // *****************************************************************************
56 // *****************************************************************************
57 
58 // *****************************************************************************
59 
64 typedef enum leEventID
65 {
66  // internal events
73  // widget events
80 
81 
82 // *****************************************************************************
87 typedef struct leEvent
88 {
91 
92 // *****************************************************************************
100 
101 // *****************************************************************************
102 
108 typedef struct leEventState
109 {
110 #ifndef _WIN32
111 #ifdef LEGATO_USE_OSAL
112  OSAL_SEM_HANDLE_TYPE eventCountSem;
113  OSAL_MUTEX_HANDLE_TYPE eventLock;
114 #endif
115 #endif
119 
120 /* internal use only */
125 leEventState* _leGetEventState();
126 leResult leEvent_Init();
127 void leEvent_Shutdown();
133 // *****************************************************************************
134 /* Enumeration:
135  leEventResult
136 
137  Summary:
138  Defines what happened when processing an event
139 */
140 
145 typedef enum leEventResult
146 {
147  // internal events
152 
153 
154 // *****************************************************************************
155 // *****************************************************************************
156 // Section: Routines
157 // *****************************************************************************
158 // *****************************************************************************
159 
160 // *****************************************************************************
161 /* Function:
162  uint32_t leEvent_GetCount()
163 
164  Summary:
165  Returns the number of events listed in the current context
166 
167  Description:
168  Returns the number of events listed in the current context
169 
170  Parameters:
171  void
172 
173  Returns:
174  uint32_t
175 
176  Remarks:
177 
178 */
179 
188 uint32_t leEvent_GetCount();
189 
190 // *****************************************************************************
191 /* Function:
192  leResult leEvent_SetFilter(leEvent_FilterEvent cb)
193 
194  Summary:
195  Set callback pointer for current context filter event
196 
197  Description:
198  Set callback pointer for current context filter event
199  Parameters:
200  leEvent_FilterEvent
201 
202  Returns:
203  leResult
204  Remarks:
205 
206 */
207 
219 
220 // *****************************************************************************
221 /* Function:
222  leResult leEvent_AddEvent(leEvent* evt)
223 
224  Summary:
225  Add the mentioned event callback to the list of events maintained by the current context
226 
227  Description:
228  Add the mentioned event callback to the list of events maintained by the current context
229 
230  Parameters:
231  leEvent*
232 
233  Returns:
234  leResult
235 
236  Remarks:
237 
238 */
239 
251 
252 // *****************************************************************************
253 /* Function:
254  leResult leEvent_ClearList()
255 
256  Summary:
257  Clear the event list maintained by the current context.
258 
259  Description:
260  Clear the event list maintained by the current context.
261 
262  Parameters:
263  void
264 
265  Returns:
266  leResult
267 
268  Remarks:
269 
270 */
271 
281 
282 // *****************************************************************************
283 /* Function:
284  leResult leEvent_ProcessEvents()
285 
286  Summary:
287  Processes any pending events
288 
289  Description:
290  Processes any pending events
291 
292  Parameters:
293  void
294 
295  Returns:
296  leResult
297 
298  Remarks:
299 
300 */
301 
311 
312 #endif /* LEGATO_EVENT_H */
leEventResult
leEventResult
This enum represents an event result.
Definition: legato_event.h:146
legato_input.h
Legato input definitions.
leResult
leResult
This enum represents function call results.
Definition: legato_common.h:134
LE_WIDGET_EVENT_MOVED
@ LE_WIDGET_EVENT_MOVED
Definition: legato_event.h:75
leEvent_AddEvent
leResult leEvent_AddEvent(leEvent *evt)
Add event.
Definition: legato_event.c:73
leEventState
struct leEventState leEventState
This struct represents an event state.
LE_EVENT_TOUCH_DOWN
@ LE_EVENT_TOUCH_DOWN
Definition: legato_event.h:68
leList::head
leListNode * head
Definition: legato_list.h:92
leEventID
leEventID
This enum represents valid event IDs.
Definition: legato_event.h:65
LE_EVENT_DEFERRED
@ LE_EVENT_DEFERRED
Definition: legato_event.h:149
leList
This struct represents a list.
Definition: legato_list.h:91
leEventState::events
leList events
Definition: legato_event.h:116
leEvent
This enum presents a event. An event contains valid event ids.
Definition: legato_event.h:88
leEvent_SetFilter
LIB_EXPORT leResult leEvent_SetFilter(leEvent_FilterEvent cb)
Set filter event callback.
Definition: legato_event.c:66
legato_memory.h
Memory functions and definitions.
leList_PushBack
int32_t leList_PushBack(leList *list, void *val)
Push value on back.
Definition: legato_list.c:141
LE_EVENT_TOUCH_UP
@ LE_EVENT_TOUCH_UP
Definition: legato_event.h:69
legato_event.h
Legato event definitions.
leEvent_GetCount
uint32_t leEvent_GetCount()
Get Event Count.
Definition: legato_event.c:61
leEvent_FilterEvent
leBool(* leEvent_FilterEvent)(leEvent *)
FilterEvent function pointer.
Definition: legato_event.h:99
leList_Destroy
void leList_Destroy(leList *list)
Remove array.
Definition: legato_list.c:446
LE_WIDGET_EVENT_FOCUS_LOST
@ LE_WIDGET_EVENT_FOCUS_LOST
Definition: legato_event.h:78
leList::size
size_t size
Definition: legato_list.h:94
leBool
leBool
This enum represents booleans.
Definition: legato_common.h:157
leList_Remove
int32_t leList_Remove(leList *list, void *val)
Remove item.
Definition: legato_list.c:285
legato_list.h
A linked list implementation.
LE_WIDGET_EVENT_PAINT
@ LE_WIDGET_EVENT_PAINT
Definition: legato_event.h:74
leEvent
struct leEvent leEvent
This enum presents a event. An event contains valid event ids.
LE_FALSE
@ LE_FALSE
Definition: legato_common.h:158
leEventState
This struct represents an event state.
Definition: legato_event.h:109
LE_WIDGET_EVENT_RESIZED
@ LE_WIDGET_EVENT_RESIZED
Definition: legato_event.h:76
leWidgetEvent
Used to define widget event.
Definition: legato_widget.h:352
LE_EVENT_TOUCH_MOVE
@ LE_EVENT_TOUCH_MOVE
Definition: legato_event.h:70
leEvent_ProcessEvents
leResult leEvent_ProcessEvents()
Process events.
Definition: legato_event.c:90
leEvent::id
leEventID id
Definition: legato_event.h:89
leWidget
Used to define a widget.
Definition: legato_widget.h:623
leList_Create
int32_t leList_Create(leList *list)
Create a new list.
Definition: legato_list.c:31
leEventState::filter
leEvent_FilterEvent filter
Definition: legato_event.h:117
LE_EVENT_NONE
@ LE_EVENT_NONE
Definition: legato_event.h:67
LE_EVENT_LANGUAGE_CHANGED
@ LE_EVENT_LANGUAGE_CHANGED
Definition: legato_event.h:71
leListNode::next
struct leListNode * next
Definition: legato_list.h:70
LE_EVENT_RESET_QUEUE
@ LE_EVENT_RESET_QUEUE
Definition: legato_event.h:150
LE_WIDGET_EVENT_FOCUS_GAINED
@ LE_WIDGET_EVENT_FOCUS_GAINED
Definition: legato_event.h:77
leEvent_ClearList
leResult leEvent_ClearList()
Clear event list.
Definition: legato_event.c:83
LE_EVENT_HANDLED
@ LE_EVENT_HANDLED
Definition: legato_event.h:148
LE_TRUE
@ LE_TRUE
Definition: legato_common.h:159
legato_common.h
Common macros and definitions used by Legato.
leListNode::val
void * val
Definition: legato_list.h:71
leListNode
This struct represents a list node .
Definition: legato_list.h:69