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