1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Drop List Management (List)                                         */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_widget.h"
29 #include "gx_window.h"
30 #include "gx_system.h"
31 #include "gx_scrollbar.h"
32 #include "gx_drop_list.h"
33 
34 
35 #define GX_FLICK_TIMER 1001
36 
37 /**************************************************************************/
38 /*                                                                        */
39 /*  FUNCTION                                               RELEASE        */
40 /*                                                                        */
41 /*    _gx_drop_list_event_process                         PORTABLE C      */
42 /*                                                           6.1          */
43 /*  AUTHOR                                                                */
44 /*                                                                        */
45 /*    Kenneth Maxwell, Microsoft Corporation                              */
46 /*                                                                        */
47 /*  DESCRIPTION                                                           */
48 /*                                                                        */
49 /*    This service processes an event for the vertical list.              */
50 /*                                                                        */
51 /*  INPUT                                                                 */
52 /*                                                                        */
53 /*    drop_list                             Drop list widget control block*/
54 /*    event_ptr                             Pointer to event to process   */
55 /*                                                                        */
56 /*  OUTPUT                                                                */
57 /*                                                                        */
58 /*    status                                Completion status             */
59 /*                                                                        */
60 /*  CALLS                                                                 */
61 /*                                                                        */
62 /*    _gx_vertical_list_selected_set        Set the list entry at the     */
63 /*                                          current list index            */
64 /*    _gx_drop_list_close                   Close a drop list             */
65 /*    _gx_drop_list_open                    Open a drop list              */
66 /*    _gx_first_client_child_get            Get the first client child    */
67 /*    _gx_widget_event_process              Process events for the        */
68 /*                                          specified window              */
69 /*                                                                        */
70 /*  CALLED BY                                                             */
71 /*                                                                        */
72 /*    Application Code                                                    */
73 /*                                                                        */
74 /*  RELEASE HISTORY                                                       */
75 /*                                                                        */
76 /*    DATE              NAME                      DESCRIPTION             */
77 /*                                                                        */
78 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
79 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
80 /*                                            resulting in version 6.1    */
81 /*                                                                        */
82 /**************************************************************************/
83 
_gx_drop_list_event_process(GX_DROP_LIST * drop_list,GX_EVENT * event_ptr)84 UINT _gx_drop_list_event_process(GX_DROP_LIST *drop_list, GX_EVENT *event_ptr)
85 {
86 GX_WIDGET *widget;
87 
88     widget = (GX_WIDGET *)drop_list;
89 
90     switch (event_ptr -> gx_event_type)
91     {
92     case GX_EVENT_SHOW:
93         _gx_widget_event_process(widget, event_ptr);
94         break;
95 
96     case GX_EVENT_HIDE:
97         if (drop_list -> gx_drop_list_popup_open)
98         {
99             _gx_drop_list_close(drop_list);
100         }
101         _gx_widget_event_process(widget, event_ptr);
102         break;
103 
104     case GX_SIGNAL(ID_DROP_LIST_BUTTON, GX_EVENT_CLICKED):
105         if (drop_list -> gx_drop_list_popup_open)
106         {
107             _gx_drop_list_close(drop_list);
108         }
109         else
110         {
111             _gx_drop_list_open(drop_list);
112         }
113         break;
114 
115     case GX_EVENT_CLOSE_POPUP:
116         _gx_drop_list_close(drop_list);
117         break;
118 
119     default:
120         return _gx_widget_event_process(widget, event_ptr);
121     }
122     return(GX_SUCCESS);
123 }
124 
125