GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_button_create.c Lines: 10 10 100.0 %
Date: 2026-03-06 19:21:09 Branches: 14 14 100.0 %

Line Branch Exec Source
1
/***************************************************************************
2
 * Copyright (c) 2024 Microsoft Corporation
3
 * Copyright (c) 2026-present Eclipse ThreadX contributors
4
 *
5
 * This program and the accompanying materials are made available under the
6
 * terms of the MIT License which is available at
7
 * https://opensource.org/licenses/MIT.
8
 *
9
 * SPDX-License-Identifier: MIT
10
 **************************************************************************/
11
12
13
/**************************************************************************/
14
/**************************************************************************/
15
/**                                                                       */
16
/** GUIX Component                                                        */
17
/**                                                                       */
18
/**   Button Management (Button)                                          */
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_button.h"
30
31
/* Bring in externs for caller checking code.  */
32
GX_CALLER_CHECKING_EXTERNS
33
34
/**************************************************************************/
35
/*                                                                        */
36
/*  FUNCTION                                               RELEASE        */
37
/*                                                                        */
38
/*    _gxe_button_create                                  PORTABLE C      */
39
/*                                                           6.1          */
40
/*  AUTHOR                                                                */
41
/*                                                                        */
42
/*    Kenneth Maxwell, Microsoft Corporation                              */
43
/*                                                                        */
44
/*  DESCRIPTION                                                           */
45
/*                                                                        */
46
/*    This function checks for errors in the button create function call. */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    button                                Pointer to button control     */
51
/*                                            block                       */
52
/*    name                                  Logical name of button        */
53
/*    parent                                Pointer to parent widget      */
54
/*                                            of button                   */
55
/*    style                                 Button stuyle                 */
56
/*    button_id                             Application-defined ID of     */
57
/*                                            the button                  */
58
/*    size                                  Size of the button            */
59
60
/*                                                                        */
61
/*  OUTPUT                                                                */
62
/*                                                                        */
63
/*    status                                Completion status             */
64
/*                                                                        */
65
/*  CALLS                                                                 */
66
/*                                                                        */
67
/*    _gx_button_create                     Actual button create function */
68
/*                                                                        */
69
/*  CALLED BY                                                             */
70
/*                                                                        */
71
/*    Application Code                                                    */
72
/*                                                                        */
73
/**************************************************************************/
74
809
UINT  _gxe_button_create(GX_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent, ULONG style,
75
                         USHORT button_id, GX_CONST GX_RECTANGLE *size, UINT button_control_block_size)
76
{
77
UINT status;
78
79
    /* Check for appropriate caller.  */
80

809
    GX_INIT_AND_THREADS_CALLER_CHECKING
81
82
    /* Check for invalid input pointers.  */
83

807
    if ((button == GX_NULL) || (size == GX_NULL))
84
    {
85
3
        return(GX_PTR_ERROR);
86
    }
87
88
    /* Check for invalid widget control block size. */
89
804
    if (button_control_block_size != sizeof(GX_BUTTON))
90
    {
91
1
        return(GX_INVALID_SIZE);
92
    }
93
94
    /* Check for widget already created.  */
95
803
    if (button -> gx_widget_type != 0)
96
    {
97
1
        return(GX_ALREADY_CREATED);
98
    }
99
100
    /* Call the actual button create function.  */
101
802
    status = _gx_button_create(button, name, parent, style, button_id, size);
102
103
    /* Return completion status.  */
104
802
    return status;
105
}
106