GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_radio_button_create.c Lines: 12 12 100.0 %
Date: 2024-12-05 08:52:37 Branches: 2 2 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 (radio_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
30
31
/**************************************************************************/
32
/*                                                                        */
33
/*  FUNCTION                                               RELEASE        */
34
/*                                                                        */
35
/*    _gx_radio_button_create                             PORTABLE C      */
36
/*                                                           6.1          */
37
/*  AUTHOR                                                                */
38
/*                                                                        */
39
/*    Kenneth Maxwell, Microsoft Corporation                              */
40
/*                                                                        */
41
/*  DESCRIPTION                                                           */
42
/*                                                                        */
43
/*    This service creates a radio button widget.                         */
44
/*                                                                        */
45
/*  INPUT                                                                 */
46
/*                                                                        */
47
/*    button                                Button control block          */
48
/*    name                                  Name of button                */
49
/*    parent                                Parent widget control block   */
50
/*    text_id                               text resource id              */
51
/*    style                                 Style of button               */
52
/*    radio_button_id                       Application-defined ID of     */
53
/*                                            radio button                */
54
/*    size                                  Button size                   */
55
/*                                                                        */
56
/*  OUTPUT                                                                */
57
/*                                                                        */
58
/*    status                                Completion status             */
59
/*                                                                        */
60
/*  CALLS                                                                 */
61
/*                                                                        */
62
/*    _gx_text_button_create                Create text button            */
63
/*    _gx_widget_link                       Link the widget to its parent */
64
/*                                                                        */
65
/*  CALLED BY                                                             */
66
/*                                                                        */
67
/*    Application Code                                                    */
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
/**************************************************************************/
78
5346
UINT  _gx_radio_button_create(GX_RADIO_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
79
                              GX_RESOURCE_ID text_id, ULONG style, USHORT radio_btton_id,
80
                              GX_CONST GX_RECTANGLE *size)
81
{
82
83
5346
    style |= GX_STYLE_BUTTON_RADIO;
84
85
    /* Call the button create function.  */
86
5346
    _gx_text_button_create((GX_TEXT_BUTTON *)button, name, GX_NULL, text_id, style, radio_btton_id, size);
87
88
    /* Populate the rest of button control block - overriding as necessary.  */
89
5346
    button -> gx_widget_type = GX_TYPE_RADIO_BUTTON;
90
5346
    button -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_radio_button_draw;
91
5346
    button -> gx_radio_button_on_pixelmap_id = GX_PIXELMAP_RADIO_ON_ID;
92
5346
    button -> gx_radio_button_off_pixelmap_id = GX_PIXELMAP_RADIO_OFF_ID;
93
5346
    button -> gx_radio_button_on_disabled_pixelmap_id = GX_PIXELMAP_RADIO_ON_ID;
94
5346
    button -> gx_radio_button_off_disabled_pixelmap_id = GX_PIXELMAP_RADIO_OFF_ID;
95
96
    /* Determine if a parent widget was provided.  */
97
5346
    if (parent)
98
    {
99
5345
        _gx_widget_link(parent, (GX_WIDGET *)button);
100
    }
101
102
    /* Return the status from button create.  */
103
5346
    return(GX_SUCCESS);
104
}
105