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 /**   Icon Management (Icon)                                              */
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_utility.h"
30 #include "gx_prompt.h"
31 #include "gx_system.h"
32 #include "gx_icon.h"
33 
34 
35 /**************************************************************************/
36 /*                                                                        */
37 /*  FUNCTION                                               RELEASE        */
38 /*                                                                        */
39 /*    _gx_icon_pixelmap_set                               PORTABLE C      */
40 /*                                                           6.1          */
41 /*  AUTHOR                                                                */
42 /*                                                                        */
43 /*    Kenneth Maxwell, Microsoft Corporation                              */
44 /*                                                                        */
45 /*  DESCRIPTION                                                           */
46 /*                                                                        */
47 /*    Change the pixelmap associated with an icon after the icon has      */
48 /*    been created.                                                       */
49 /*                                                                        */
50 /*  INPUT                                                                 */
51 /*                                                                        */
52 /*    icon                                  Pointer to icon control block */
53 /*    normal_pixelmap_id                    Normal state pixelamp         */
54 /*                                            resource ID                 */
55 /*    selected_pixelmap_id                  Selected state pixelmap       */
56 /*                                            resource ID                 */
57 /*                                                                        */
58 /*  OUTPUT                                                                */
59 /*                                                                        */
60 /*    status                                Completion status             */
61 /*                                                                        */
62 /*  CALLS                                                                 */
63 /*                                                                        */
64 /*    _gx_icon_pixelmap_update              Change the pixelmap           */
65 /*    _gx_system_dirty_mark                 Mark the widget dirty         */
66 /*                                                                        */
67 /*  CALLED BY                                                             */
68 /*                                                                        */
69 /*    Application Code                                                    */
70 /*                                                                        */
71 /*  RELEASE HISTORY                                                       */
72 /*                                                                        */
73 /*    DATE              NAME                      DESCRIPTION             */
74 /*                                                                        */
75 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
76 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
77 /*                                            resulting in version 6.1    */
78 /*                                                                        */
79 /**************************************************************************/
_gx_icon_pixelmap_set(GX_ICON * icon,GX_RESOURCE_ID normal_pixelmap_id,GX_RESOURCE_ID selected_pixelmap_id)80 UINT  _gx_icon_pixelmap_set(GX_ICON *icon,
81                             GX_RESOURCE_ID normal_pixelmap_id,
82                             GX_RESOURCE_ID selected_pixelmap_id)
83 {
84     icon -> gx_icon_normal_pixelmap = normal_pixelmap_id;
85     icon -> gx_icon_selected_pixelmap = selected_pixelmap_id;
86 
87     if (icon -> gx_widget_status & GX_STATUS_VISIBLE)
88     {
89         _gx_icon_pixelmap_update(icon);
90 
91         /* Mark widget area as dirty. */
92         _gx_system_dirty_mark((GX_WIDGET *)icon);
93     }
94 
95     return(GX_SUCCESS);
96 }
97 
98