GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_pixelmap_button_create.c Lines: 11 11 100.0 %
Date: 2026-03-06 19:21:09 Branches: 2 2 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
#include "gx_system.h"
31
#include "gx_utility.h"
32
33
34
/**************************************************************************/
35
/*                                                                        */
36
/*  FUNCTION                                               RELEASE        */
37
/*                                                                        */
38
/*    _gx_pixelmap_button_create                          PORTABLE C      */
39
/*                                                           6.1          */
40
/*  AUTHOR                                                                */
41
/*                                                                        */
42
/*    Kenneth Maxwell, Microsoft Corporation                              */
43
/*                                                                        */
44
/*  DESCRIPTION                                                           */
45
/*                                                                        */
46
/*    This function creates a pixelmap button, which is a special type of */
47
/*    button.                                                             */
48
/*                                                                        */
49
/*  INPUT                                                                 */
50
/*                                                                        */
51
/*    button                                Button control block          */
52
/*    name                                  Name of button                */
53
/*    parent                                Parent widget control block   */
54
/*    normal_id                             Normal state pixelmap id      */
55
/*    selected_id                           Selected state pixelmap id    */
56
/*    disabled_id                           Disabled state pixelmap id    */
57
/*    style                                 Style of button               */
58
/*    pixelmap_button_id                    Application-defined ID of     */
59
/*                                            the pixelmap button         */
60
/*    size                                  Button size                   */
61
/*                                                                        */
62
/*  OUTPUT                                                                */
63
/*                                                                        */
64
/*    status                                Completion status             */
65
/*                                                                        */
66
/*  CALLS                                                                 */
67
/*                                                                        */
68
/*    _gx_button_create                     Create the underlying button  */
69
/*    _gx_pixelmap_transparent_detect       Detect whether or not a       */
70
/*                                            pixelmap is transparent     */
71
/*    _gx_widget_status_add                 Set the widget status flag    */
72
/*    _gx_widget_link                       Link the widget to its parent */
73
/*                                                                        */
74
/*  CALLED BY                                                             */
75
/*                                                                        */
76
/*    Application Code                                                    */
77
/*                                                                        */
78
/**************************************************************************/
79
1079
UINT  _gx_pixelmap_button_create(GX_PIXELMAP_BUTTON *button,
80
                                 GX_CONST GX_CHAR *name,
81
                                 GX_WIDGET *parent,
82
                                 GX_RESOURCE_ID normal_id,
83
                                 GX_RESOURCE_ID selected_id,
84
                                 GX_RESOURCE_ID disabled_id,
85
                                 ULONG style,
86
                                 USHORT pixelmap_button_id,
87
                                 GX_CONST GX_RECTANGLE *size)
88
{
89
    /* Call the button create function.  */
90
1079
    _gx_button_create((GX_BUTTON *)button, name, GX_NULL, style, pixelmap_button_id, size);
91
92
1079
    button -> gx_widget_type = GX_TYPE_PIXELMAP_BUTTON;
93
1079
    button -> gx_widget_draw_function = (VOID (*)(GX_WIDGET *))_gx_pixelmap_button_draw;
94
1079
    button -> gx_widget_event_process_function = (UINT (*)(GX_WIDGET *, GX_EVENT *))_gx_pixelmap_button_event_process;
95
1079
    button -> gx_pixelmap_button_normal_id = normal_id;
96
1079
    button -> gx_pixelmap_button_selected_id = selected_id;
97
1079
    button -> gx_pixelmap_button_disabled_id = disabled_id;
98
99
    /* Determine if a parent widget was provided.  */
100
1079
    if (parent)
101
    {
102
1078
        _gx_widget_link(parent, (GX_WIDGET *)button);
103
    }
104
105
1079
    return(GX_SUCCESS);
106
}
107