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 /**   Menu Management (Menu)                                              */
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_prompt.h"
29 #include "gx_menu.h"
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gx_menu_event_process                              PORTABLE C      */
36 /*                                                           6.1.3        */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function processes events for the specified menu.              */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    menu                                  Pointer to menu control       */
48 /*                                            block                       */
49 /*    event_ptr                             Incoming event to process     */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    status                                Completion status             */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*    _gx_widget_delete                     Delete a widget               */
58 /*    _gx_prompt_event_process              Default prompt event process  */
59 /*                                                                        */
60 /*  CALLED BY                                                             */
61 /*                                                                        */
62 /*    Application Code                                                    */
63 /*    GUIX Internal Code                                                  */
64 /*                                                                        */
65 /*  RELEASE HISTORY                                                       */
66 /*                                                                        */
67 /*    DATE              NAME                      DESCRIPTION             */
68 /*                                                                        */
69 /*  12-31-2020     Kenneth Maxwell          Initial Version 6.1.3         */
70 /*                                                                        */
71 /**************************************************************************/
_gx_menu_event_process(GX_MENU * menu,GX_EVENT * event_ptr)72 UINT  _gx_menu_event_process(GX_MENU *menu, GX_EVENT *event_ptr)
73 {
74 
75     /* Process relative to the type of event.  */
76     switch (event_ptr -> gx_event_type)
77     {
78     case GX_EVENT_DELETE:
79         if (menu -> gx_menu_list.gx_widget_first_child &&
80             (menu -> gx_menu_list.gx_widget_parent == GX_NULL))
81         {
82             _gx_widget_delete((GX_WIDGET *)&menu -> gx_menu_list);
83         }
84         break;
85 
86     default:
87 
88         /* Do nothing.  */
89         break;
90     }
91 
92     /* Return completion status.  */
93     return _gx_prompt_event_process((GX_PROMPT *)menu, event_ptr);
94 }
95 
96