GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_text_button_create.c Lines: 12 12 100.0 %
Date: 2026-03-06 19:21:09 Branches: 18 18 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
/**   Text 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_button.h"
29
30
GX_CALLER_CHECKING_EXTERNS
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gxe_text_button_create                             PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function checks for errors in the text button create function  */
45
/*    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
/*    size                                  Button size                   */
55
/*    text_button_control_block_size        Size of the text button       */
56
/*                                            control block               */
57
/*                                                                        */
58
/*  OUTPUT                                                                */
59
/*                                                                        */
60
/*    status                                Completion status             */
61
/*                                                                        */
62
/*  CALLS                                                                 */
63
/*                                                                        */
64
/*    _gx_text_button_create                Actual text button create     */
65
/*                                          function                      */
66
/*                                                                        */
67
/*  CALLED BY                                                             */
68
/*                                                                        */
69
/*    Application Code                                                    */
70
/*                                                                        */
71
/**************************************************************************/
72
8855
UINT  _gxe_text_button_create(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
73
                              GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
74
                              GX_CONST GX_RECTANGLE *size, UINT text_button_control_block_size)
75
{
76
77
UINT status;
78
79
    /* Check for appropriate caller.  */
80

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

8853
    if ((button == GX_NULL) || (size == GX_NULL))
84
    {
85
2
        return(GX_PTR_ERROR);
86
    }
87
88
    /* Check for invalid control block size. */
89
8851
    if (text_button_control_block_size != sizeof(GX_TEXT_BUTTON))
90
    {
91
1
        return(GX_INVALID_SIZE);
92
    }
93
94
    /* Check for id is created.  */
95
8850
    if (button -> gx_widget_type != 0)
96
    {
97
1
        return(GX_ALREADY_CREATED);
98
    }
99
100
    /* Check for invalid widget. */
101

8849
    if (parent && (parent -> gx_widget_type == 0))
102
    {
103
1
        return(GX_INVALID_WIDGET);
104
    }
105
106
    /* Call the actual text button create function.  */
107
8848
    status = _gx_text_button_create(button, name, parent, text_id, style, Id, size);
108
109
    /* Return completion status.  */
110
8848
    return status;
111
}
112