GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_icon_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_icon_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 icon button create function. */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    button                                Button control block          */
51
/*    name                                  Name of button                */
52
/*    parent                                Parent widget control block   */
53
/*    icon_id                               Resource ID of icon           */
54
/*    style                                 Style of icon                 */
55
/*    icon_button_id                        Application-definedID of icon */
56
/*    size                                  Button size                   */
57
/*    buton_control_block_size              Size of the button control    */
58
/*                                            block                       */
59
/*                                                                        */
60
/*  OUTPUT                                                                */
61
/*                                                                        */
62
/*    status                                Completion status             */
63
/*                                                                        */
64
/*  CALLS                                                                 */
65
/*                                                                        */
66
/*    _gx_icon_button_create                Actual icon button create call*/
67
/*                                                                        */
68
/*  CALLED BY                                                             */
69
/*                                                                        */
70
/*    Application Code                                                    */
71
/*                                                                        */
72
/**************************************************************************/
73
2939
UINT  _gxe_icon_button_create(GX_ICON_BUTTON *button,
74
                              GX_CONST GX_CHAR *name,
75
                              GX_WIDGET *parent,
76
                              GX_RESOURCE_ID icon_id,
77
                              ULONG style,
78
                              USHORT icon_button_id,
79
                              GX_CONST GX_RECTANGLE *size,
80
                              UINT button_control_block_size)
81
{
82
UINT status;
83
84
    /* Check for appropriate caller.  */
85

2939
    GX_INIT_AND_THREADS_CALLER_CHECKING
86
87
    /* Check for invalid input pointers.  */
88

2937
    if ((button == GX_NULL) || (size == GX_NULL))
89
    {
90
2
        return(GX_PTR_ERROR);
91
    }
92
93
2935
    if (button_control_block_size != sizeof(GX_ICON_BUTTON))
94
    {
95
1
        return(GX_INVALID_SIZE);
96
    }
97
98
    /* Check for widget already created.  */
99
2934
    if (button -> gx_widget_type != 0)
100
    {
101
1
        return(GX_ALREADY_CREATED);
102
    }
103
104
    /* Call the actual icon button create function.  */
105
2933
    status = _gx_icon_button_create(button, name, parent, icon_id, style, icon_button_id, size);
106
107
    /* Return completion status.  */
108
2933
    return status;
109
}
110