GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_radio_button_pixelmap_set.c Lines: 12 12 100.0 %
Date: 2024-12-05 08:52:37 Branches: 10 10 100.0 %

Line Branch Exec Source
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_widget.h"
28
#include "gx_button.h"
29
#include "gx_system.h"
30
#include "gx_utility.h"
31
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_radio_button_pixelmap_set                       PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function creates a pixelmap button, which is a special type of */
46
/*    button.                                                             */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    button                                Button control block          */
51
/*    off_id                                Resource ID of the pixelmap   */
52
/*                                            used for drawing button off */
53
/*    on_id                                 Resource ID of the pixelmap   */
54
/*                                            used for drawing button on  */
55
/*    off_disabled_id                       Resource ID of the pixelmap   */
56
/*                                            used for draw button off    */
57
/*                                            disabled                    */
58
/*    on_disabled_id                        Resource ID of the pixelmap   */
59
/*                                            used for drawing button on  */
60
/*                                            disabled                    */
61
/*                                                                        */
62
/*  OUTPUT                                                                */
63
/*                                                                        */
64
/*    status                                Completion status             */
65
/*                                                                        */
66
/*  CALLS                                                                 */
67
/*                                                                        */
68
/*    _gx_system_dirty_mark                 Mark the widget dirty         */
69
/*                                                                        */
70
/*  CALLED BY                                                             */
71
/*                                                                        */
72
/*    Application Code                                                    */
73
/*                                                                        */
74
/*  RELEASE HISTORY                                                       */
75
/*                                                                        */
76
/*    DATE              NAME                      DESCRIPTION             */
77
/*                                                                        */
78
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
79
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
80
/*                                            resulting in version 6.1    */
81
/*                                                                        */
82
/**************************************************************************/
83
49
UINT  _gx_radio_button_pixelmap_set(GX_RADIO_BUTTON *button,
84
                                    GX_RESOURCE_ID off_id,
85
                                    GX_RESOURCE_ID on_id,
86
                                    GX_RESOURCE_ID off_disabled_id,
87
                                    GX_RESOURCE_ID on_disabled_id)
88
{
89
90
49
    if (off_id)
91
    {
92
48
        button -> gx_radio_button_off_pixelmap_id = off_id;
93
    }
94
49
    if (on_id)
95
    {
96
47
        button -> gx_radio_button_on_pixelmap_id = on_id;
97
    }
98
49
    if (off_disabled_id)
99
    {
100
2
        button -> gx_radio_button_off_disabled_pixelmap_id = off_disabled_id;
101
    }
102
49
    if (on_disabled_id)
103
    {
104
2
        button -> gx_radio_button_on_disabled_pixelmap_id = on_disabled_id;
105
    }
106
107
49
    if (button -> gx_widget_status & GX_STATUS_VISIBLE)
108
    {
109
        /* Mark widget as needing to be re-painted.  */
110
3
        _gx_system_dirty_mark((GX_WIDGET *)button);
111
    }
112
49
    return(GX_SUCCESS);
113
}
114