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_widget.h"
28 #include "gx_button.h"
29 #include "gx_system.h"
30 #include "gx_utility.h"
31 
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gxe_checkbox_pixelmap_set                          PORTABLE C      */
38 /*                                                           6.3.0        */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function checks for errors in the checkbox pixlemap set        */
46 /*    routine.                                                            */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    button                                Button control block          */
51 /*    unchecked_id                          Resource ID of the pixelmap   */
52 /*                                            used for unchecked box      */
53 /*    checked_id                            Resource ID of the pixelmap   */
54 /*                                            used for checked box        */
55 /*    unchecked_disabled_id                 Resource ID of the pixelmap   */
56 /*                                            used for unchecked disabled */
57 /*                                             box                        */
58 /*    checked_disabled_id                   Resource ID of the pixelmap   */
59 /*                                            used for checked disabled   */
60 /*                                            box                         */
61 /*                                                                        */
62 /*  OUTPUT                                                                */
63 /*                                                                        */
64 /*    status                                Completion status             */
65 /*                                                                        */
66 /*  CALLS                                                                 */
67 /*                                                                        */
68 /*    _gx_checkbox_pixelmap_set             Actual function sets the      */
69 /*                                            pixelmap                    */
70 /*                                                                        */
71 /*  CALLED BY                                                             */
72 /*                                                                        */
73 /*    Application Code                                                    */
74 /*                                                                        */
75 /*  RELEASE HISTORY                                                       */
76 /*                                                                        */
77 /*    DATE              NAME                      DESCRIPTION             */
78 /*                                                                        */
79 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
80 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
81 /*                                            resulting in version 6.1    */
82 /*  10-31-2023     Ting Zhu                 Modified comment(s),          */
83 /*                                            added invalid widget check, */
84 /*                                            resulting in version 6.3.0  */
85 /*                                                                        */
86 /**************************************************************************/
_gxe_checkbox_pixelmap_set(GX_CHECKBOX * checkbox,GX_RESOURCE_ID unchecked_id,GX_RESOURCE_ID checked_id,GX_RESOURCE_ID unchecked_disabled_id,GX_RESOURCE_ID checked_disabled_id)87 UINT  _gxe_checkbox_pixelmap_set(GX_CHECKBOX *checkbox,
88                                  GX_RESOURCE_ID unchecked_id,
89                                  GX_RESOURCE_ID checked_id,
90                                  GX_RESOURCE_ID unchecked_disabled_id,
91                                  GX_RESOURCE_ID checked_disabled_id)
92 {
93 UINT status;
94 
95     /* Check for the invalid input pointers.  */
96     if (checkbox == GX_NULL)
97     {
98         return(GX_PTR_ERROR);
99     }
100 
101     /* Check for the invalid widget.  */
102     if (checkbox -> gx_widget_type == 0)
103     {
104         return(GX_INVALID_WIDGET);
105     }
106 
107     status = _gx_checkbox_pixelmap_set(checkbox, unchecked_id, checked_id,
108                                        unchecked_disabled_id, checked_disabled_id);
109 
110     return(status);
111 }
112 
113