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