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 (Button)                                          */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 
24 /* Include necessary system files.  */
25 
26 #include "gx_api.h"
27 #include "gx_button.h"
28 #include "gx_system.h"
29 
30 
31 /**************************************************************************/
32 /*                                                                        */
33 /*  FUNCTION                                               RELEASE        */
34 /*                                                                        */
35 /*    _gx_pixelmap_button_pixelmap_set                    PORTABLE C      */
36 /*                                                           6.1          */
37 /*  AUTHOR                                                                */
38 /*                                                                        */
39 /*    Kenneth Maxwell, Microsoft Corporation                              */
40 /*                                                                        */
41 /*  DESCRIPTION                                                           */
42 /*                                                                        */
43 /*    This function sets a  pixelmap to the pixelmap button.              */
44 /*                                                                        */
45 /*  INPUT                                                                 */
46 /*                                                                        */
47 /*    button                                Button control block          */
48 /*    normal_id                             normal state pixelmap id      */
49 /*    selected_id                           selected state pixelmap id    */
50 /*    disabled_id                           disabled state pixelmap id    */
51 /*                                                                        */
52 /*  OUTPUT                                                                */
53 /*                                                                        */
54 /*    status                                Completion status             */
55 /*                                                                        */
56 /*  CALLS                                                                 */
57 /*                                                                        */
58 /*    _gx_pixelmap_button_transparent_detect                              */
59 /*                                          Detect the transparency       */
60 /*    _gx_system_dirty_mark                 Mark the widget as dirty      */
61 /*                                                                        */
62 /*  CALLED BY                                                             */
63 /*                                                                        */
64 /*    Application Code                                                    */
65 /*                                                                        */
66 /*  RELEASE HISTORY                                                       */
67 /*                                                                        */
68 /*    DATE              NAME                      DESCRIPTION             */
69 /*                                                                        */
70 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
71 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
72 /*                                            resulting in version 6.1    */
73 /*                                                                        */
74 /**************************************************************************/
_gx_pixelmap_button_pixelmap_set(GX_PIXELMAP_BUTTON * button,GX_RESOURCE_ID normal_id,GX_RESOURCE_ID selected_id,GX_RESOURCE_ID disabled_id)75 UINT  _gx_pixelmap_button_pixelmap_set(GX_PIXELMAP_BUTTON *button,
76                                        GX_RESOURCE_ID normal_id,
77                                        GX_RESOURCE_ID selected_id,
78                                        GX_RESOURCE_ID disabled_id)
79 {
80     button -> gx_pixelmap_button_normal_id = normal_id;
81     button -> gx_pixelmap_button_selected_id = selected_id;
82     button -> gx_pixelmap_button_disabled_id = disabled_id;
83 
84     /* check to see if any of my pixelmaps have transparency, and if so mark
85        myself as being transparent.  */
86 
87     if (button -> gx_widget_status & GX_STATUS_VISIBLE)
88     {
89         _gx_pixelmap_button_transparent_detect(button);
90 
91         /* Mark widget as needing to be re-painted.  */
92         _gx_system_dirty_mark((GX_WIDGET *)button);
93     }
94     return(GX_SUCCESS);
95 }
96 
97