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 /**   Button Management (checkbox)                                        */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_system.h"
28 #include "gx_widget.h"
29 #include "gx_button.h"
30 
31 
32 /**************************************************************************/
33 /*                                                                        */
34 /*  FUNCTION                                               RELEASE        */
35 /*                                                                        */
36 /*    _gx_checkbox_event_process                          PORTABLE C      */
37 /*                                                           6.1          */
38 /*  AUTHOR                                                                */
39 /*                                                                        */
40 /*    Kenneth Maxwell, Microsoft Corporation                              */
41 /*                                                                        */
42 /*  DESCRIPTION                                                           */
43 /*                                                                        */
44 /*    This function processes events for the specified button.            */
45 /*                                                                        */
46 /*  INPUT                                                                 */
47 /*                                                                        */
48 /*    checkbox                              Checkbox control block        */
49 /*    event_ptr                             Incoming event to process     */
50 /*                                                                        */
51 /*  OUTPUT                                                                */
52 /*                                                                        */
53 /*    status                                Completion status             */
54 /*                                                                        */
55 /*  CALLS                                                                 */
56 /*                                                                        */
57 /*    [_gx_button_select_handler]           Button select callback        */
58 /*    _gx_text_button_event_process         Default widget event process  */
59 /*    _gx_widget_event_to_parent            Pass event to parent          */
60 /*                                                                        */
61 /*  CALLED BY                                                             */
62 /*                                                                        */
63 /*    Application Code                                                    */
64 /*    GUIX Internal Code                                                  */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
71 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
72 /*                                            updated default call,       */
73 /*                                            resulting in version 6.1    */
74 /*                                                                        */
75 /**************************************************************************/
_gx_checkbox_event_process(GX_CHECKBOX * checkbox,GX_EVENT * event_ptr)76 UINT  _gx_checkbox_event_process(GX_CHECKBOX *checkbox, GX_EVENT *event_ptr)
77 {
78 UINT status;
79 
80     /* Default status to success.  */
81     status =  GX_SUCCESS;
82 
83     /* Process relative to the type of event.  */
84     switch (event_ptr -> gx_event_type)
85     {
86 
87     case GX_EVENT_PEN_DOWN:
88         checkbox -> gx_button_select_handler((GX_WIDGET *)checkbox);
89 
90         /* Pass event to parent. */
91         status = _gx_widget_event_to_parent((GX_WIDGET *)checkbox, event_ptr);
92         break;
93 
94     default:
95 
96         /* Call the widget default processing.  */
97         status = _gx_text_button_event_process((GX_TEXT_BUTTON *)checkbox, event_ptr);
98     }
99 
100     /* Return completion status.  */
101     return(status);
102 }
103 
104