GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gxe_pixelmap_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
GX_CALLER_CHECKING_EXTERNS
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gxe_pixelmap_button_create                         PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function checks for errors in the pixelmap button create       */
46
/*                                         function.                      */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    button                                Button control block          */
51
/*    name                                  Name of button                */
52
/*    parent                                Parent widget control block   */
53
/*    normal_id                             Normal state pixelmap id      */
54
/*    selected_id                           Selected state pixelmap id    */
55
/*    disabled_id                           Disabled state pixelmap id    */
56
/*    style                                 Style of checkbox             */
57
/*    pixelmap_button_id                    Application-defined ID of     */
58
/*                                            the pixelmap button         */
59
/*    size                                  Button size                   */
60
/*    button_control_block_size             Size of the pixelmap button   */
61
/*                                            control block               */
62
/*                                                                        */
63
/*  OUTPUT                                                                */
64
/*                                                                        */
65
/*    status                                Completion status             */
66
/*                                                                        */
67
/*  CALLS                                                                 */
68
/*                                                                        */
69
/*    _gx_pixelmap_button_create            the actual function           */
70
/*                                                                        */
71
/*  CALLED BY                                                             */
72
/*                                                                        */
73
/*    Application Code                                                    */
74
/*                                                                        */
75
/**************************************************************************/
76
1085
UINT  _gxe_pixelmap_button_create(GX_PIXELMAP_BUTTON *button,
77
                                  GX_CONST GX_CHAR *name,
78
                                  GX_WIDGET *parent,
79
                                  GX_RESOURCE_ID normal_id,
80
                                  GX_RESOURCE_ID selected_id,
81
                                  GX_RESOURCE_ID disabled_id,
82
                                  ULONG style,
83
                                  USHORT pixelmap_button_id,
84
                                  GX_CONST GX_RECTANGLE *size,
85
                                  UINT button_control_block_size)
86
{
87
UINT status;
88
89
    /* Check for invalid caller.  */
90

1085
    GX_INIT_AND_THREADS_CALLER_CHECKING
91
92
    /* Check error for valid pointer.  */
93

1083
    if ((button == GX_NULL) || (size == GX_NULL))
94
    {
95
2
        return(GX_PTR_ERROR);
96
    }
97
98
    /* Check for invalid control block size. */
99
1081
    if (button_control_block_size != sizeof(GX_PIXELMAP_BUTTON))
100
    {
101
1
        return(GX_INVALID_SIZE);
102
    }
103
104
    /* Check error for valid widget.  */
105
1080
    if (button -> gx_widget_type != 0)
106
    {
107
1
        return(GX_ALREADY_CREATED);
108
    }
109
110
1079
    status = _gx_pixelmap_button_create(button, name, parent, normal_id, selected_id, disabled_id, style, pixelmap_button_id, size);
111
1079
    return(status);
112
}
113