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_update                            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 /*                                                                        */
54 /*  OUTPUT                                                                */
55 /*                                                                        */
56 /*    None                                                                */
57 /*                                                                        */
58 /*  CALLS                                                                 */
59 /*    _gx_widget_pixelmap_get               Retrieve the pixelmap         */
60 /*                                                                        */
61 /*    _gx_utility_rectangle_define          Defines the icon area         */
62 /*    _gx_widget_resize                     Set up the icon size          */
63 /*                                                                        */
64 /*  CALLED BY                                                             */
65 /*                                                                        */
66 /*    _gx_icon_event_process                                              */
67 /*    _gx_icon_pixelmap_set                                               */
68 /*                                                                        */
69 /*  RELEASE HISTORY                                                       */
70 /*                                                                        */
71 /*    DATE              NAME                      DESCRIPTION             */
72 /*                                                                        */
73 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
74 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
75 /*                                            resulting in version 6.1    */
76 /*                                                                        */
77 /**************************************************************************/
_gx_icon_pixelmap_update(GX_ICON * icon)78 VOID _gx_icon_pixelmap_update(GX_ICON *icon)
79 {
80 GX_RECTANGLE size;
81 GX_PIXELMAP *map;
82 
83     _gx_widget_pixelmap_get((GX_WIDGET *)icon, icon -> gx_icon_normal_pixelmap, &map);
84 
85     if (map)
86     {
87         _gx_utility_rectangle_define(&size,
88                                      icon -> gx_widget_size.gx_rectangle_left,
89                                      icon -> gx_widget_size.gx_rectangle_top,
90                                      (GX_VALUE)(icon -> gx_widget_size.gx_rectangle_left + map -> gx_pixelmap_width - 1),
91                                      (GX_VALUE)(icon -> gx_widget_size.gx_rectangle_top + map -> gx_pixelmap_height - 1));
92         _gx_widget_resize((GX_WIDGET *)icon, &size);
93     }
94 }
95 
96