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 /*    _gx_checkbox_pixelmap_set                           PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function creates a pixelmap button, which is a special type of */
46 /*    button.                                                             */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    checkbox                              Checkbox 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_system_dirty_mark                 Mark the widget dirty         */
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 /**************************************************************************/
_gx_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)83 UINT  _gx_checkbox_pixelmap_set(GX_CHECKBOX *checkbox,
84                                 GX_RESOURCE_ID unchecked_id,
85                                 GX_RESOURCE_ID checked_id,
86                                 GX_RESOURCE_ID unchecked_disabled_id,
87                                 GX_RESOURCE_ID checked_disabled_id)
88 {
89     if (unchecked_id)
90     {
91         checkbox -> gx_checkbox_unchecked_pixelmap_id = unchecked_id;
92     }
93     if (checked_id)
94     {
95         checkbox -> gx_checkbox_checked_pixelmap_id = checked_id;
96     }
97     if (unchecked_disabled_id)
98     {
99         checkbox -> gx_checkbox_unchecked_disabled_pixelmap_id = unchecked_disabled_id;
100     }
101     if (checked_disabled_id)
102     {
103         checkbox -> gx_checkbox_checked_disabled_pixelmap_id = checked_disabled_id;
104     }
105 
106     if (checkbox -> gx_widget_status & GX_STATUS_VISIBLE)
107     {
108         /* Mark widget as needing to be re-painted.  */
109         _gx_system_dirty_mark((GX_WIDGET *)checkbox);
110     }
111     return(GX_SUCCESS);
112 }
113 
114