GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_radio_button_create.c Lines: 12 12 100.0 %
Date: 2024-12-05 08:52:37 Branches: 18 18 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_button.h"
28
#include "gx_system.h"
29
30
/* Bring in externs for caller checking code.  */
31
GX_CALLER_CHECKING_EXTERNS
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gxe_radio_button_create                            PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This service checks for error in radio button create call.          */
46
/*                                                                        */
47
/*  INPUT                                                                 */
48
/*                                                                        */
49
/*    button                                Button control block          */
50
/*    name                                  Name of button                */
51
/*    parent                                Parent widget control block   */
52
/*    text_id                               text resource id              */
53
/*    style                                 Style of button               */
54
/*    radio_button_id                       Application-defined ID of     */
55
/*                                            radio button                */
56
/*    size                                  Button size                   */
57
/*    radio_button_control_block_size       Size of the radio button      */
58
/*                                            control block               */
59
/*                                                                        */
60
/*  OUTPUT                                                                */
61
/*                                                                        */
62
/*    status                                Completion status             */
63
/*                                                                        */
64
/*  CALLS                                                                 */
65
/*                                                                        */
66
/*    _gx_radio_button_create               The actual radio button       */
67
/*                                            create function             */
68
/*                                                                        */
69
/*  CALLED BY                                                             */
70
/*                                                                        */
71
/*    Application Code                                                    */
72
/*                                                                        */
73
/*  RELEASE HISTORY                                                       */
74
/*                                                                        */
75
/*    DATE              NAME                      DESCRIPTION             */
76
/*                                                                        */
77
/*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
78
/*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
79
/*                                            resulting in version 6.1    */
80
/*                                                                        */
81
/**************************************************************************/
82
5353
UINT  _gxe_radio_button_create(GX_RADIO_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
83
                               GX_RESOURCE_ID text_id, ULONG style, USHORT radio_btton_id,
84
                               GX_CONST GX_RECTANGLE *size, UINT radio_button_control_block_size)
85
{
86
UINT status;
87
88
    /* Check for appropriate caller.  */
89

5353
    GX_INIT_AND_THREADS_CALLER_CHECKING
90
91
    /* Check error for valid pointer. */
92

5351
    if ((button == GX_NULL) || (size == GX_NULL))
93
    {
94
2
        return(GX_PTR_ERROR);
95
    }
96
97
    /* Check for widget already created.  */
98
5349
    if (button -> gx_widget_type != 0)
99
    {
100
1
        return(GX_ALREADY_CREATED);
101
    }
102
103
    /* Check for invalid control block size. */
104
5348
    if (radio_button_control_block_size != sizeof(GX_RADIO_BUTTON))
105
    {
106
1
        return(GX_INVALID_SIZE);
107
    }
108
109
    /* Check for invalid parent widget. */
110

5347
    if (parent && parent -> gx_widget_type == 0)
111
    {
112
1
        return(GX_INVALID_WIDGET);
113
    }
114
115
    /* Call the actual function.  */
116
5346
    status = _gx_radio_button_create(button, name, parent, text_id, style, radio_btton_id, size);
117
118
    /* Return completion status.  */
119
5346
    return(status);
120
}
121