1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Button Management (Button)                                          */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_widget.h"
29 #include "gx_button.h"
30 #include "gx_system.h"
31 #include "gx_utility.h"
32 
33 
34 /**************************************************************************/
35 /*                                                                        */
36 /*  FUNCTION                                               RELEASE        */
37 /*                                                                        */
38 /*    _gx_radio_button_pixelmap_set                       PORTABLE C      */
39 /*                                                           6.1          */
40 /*  AUTHOR                                                                */
41 /*                                                                        */
42 /*    Kenneth Maxwell, Microsoft Corporation                              */
43 /*                                                                        */
44 /*  DESCRIPTION                                                           */
45 /*                                                                        */
46 /*    This function creates a pixelmap button, which is a special type of */
47 /*    button.                                                             */
48 /*                                                                        */
49 /*  INPUT                                                                 */
50 /*                                                                        */
51 /*    button                                Button control block          */
52 /*    off_id                                Resource ID of the pixelmap   */
53 /*                                            used for drawing button off */
54 /*    on_id                                 Resource ID of the pixelmap   */
55 /*                                            used for drawing button on  */
56 /*    off_disabled_id                       Resource ID of the pixelmap   */
57 /*                                            used for draw button off    */
58 /*                                            disabled                    */
59 /*    on_disabled_id                        Resource ID of the pixelmap   */
60 /*                                            used for drawing button on  */
61 /*                                            disabled                    */
62 /*                                                                        */
63 /*  OUTPUT                                                                */
64 /*                                                                        */
65 /*    status                                Completion status             */
66 /*                                                                        */
67 /*  CALLS                                                                 */
68 /*                                                                        */
69 /*    _gx_system_dirty_mark                 Mark the widget dirty         */
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 /*                                                                        */
83 /**************************************************************************/
_gx_radio_button_pixelmap_set(GX_RADIO_BUTTON * button,GX_RESOURCE_ID off_id,GX_RESOURCE_ID on_id,GX_RESOURCE_ID off_disabled_id,GX_RESOURCE_ID on_disabled_id)84 UINT  _gx_radio_button_pixelmap_set(GX_RADIO_BUTTON *button,
85                                     GX_RESOURCE_ID off_id,
86                                     GX_RESOURCE_ID on_id,
87                                     GX_RESOURCE_ID off_disabled_id,
88                                     GX_RESOURCE_ID on_disabled_id)
89 {
90 
91     if (off_id)
92     {
93         button -> gx_radio_button_off_pixelmap_id = off_id;
94     }
95     if (on_id)
96     {
97         button -> gx_radio_button_on_pixelmap_id = on_id;
98     }
99     if (off_disabled_id)
100     {
101         button -> gx_radio_button_off_disabled_pixelmap_id = off_disabled_id;
102     }
103     if (on_disabled_id)
104     {
105         button -> gx_radio_button_on_disabled_pixelmap_id = on_disabled_id;
106     }
107 
108     if (button -> gx_widget_status & GX_STATUS_VISIBLE)
109     {
110         /* Mark widget as needing to be re-painted.  */
111         _gx_system_dirty_mark((GX_WIDGET *)button);
112     }
113     return(GX_SUCCESS);
114 }
115 
116