GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_text_button_create.c Lines: 16 16 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
/**   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_widget.h"
29
#include "gx_button.h"
30
31
32
/**************************************************************************/
33
/*                                                                        */
34
/*  FUNCTION                                               RELEASE        */
35
/*                                                                        */
36
/*    _gx_text_button_create                              PORTABLE C      */
37
/*                                                           6.1          */
38
/*  AUTHOR                                                                */
39
/*                                                                        */
40
/*    Kenneth Maxwell, Microsoft Corporation                              */
41
/*                                                                        */
42
/*  DESCRIPTION                                                           */
43
/*                                                                        */
44
/*    This function creates a text button, which is a special type of     */
45
/*    button (widget).                                                    */
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
/*                                                                        */
56
/*  OUTPUT                                                                */
57
/*                                                                        */
58
/*    status                                Completion status             */
59
/*                                                                        */
60
/*  CALLS                                                                 */
61
/*                                                                        */
62
/*    memset                                Set control block to zero     */
63
/*    _gx_button_create                     Create the underlying button  */
64
/*    _gx_widget_link                       Link the button to its parent */
65
/*                                                                        */
66
/*  CALLED BY                                                             */
67
/*                                                                        */
68
/*    Application Code                                                    */
69
/*                                                                        */
70
/**************************************************************************/
71
18526
UINT  _gx_text_button_create(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *name,
72
                             GX_WIDGET *parent, GX_RESOURCE_ID text_id, ULONG style, USHORT Id,
73
                             GX_CONST GX_RECTANGLE *size)
74
{
75
76
    /* Call the prompt create function.  */
77
18526
    _gx_button_create((GX_BUTTON *)button, name, GX_NULL, style, Id, size);
78
79
    /* Populate the rest of button control block - overriding as necessary.  */
80
18526
    button -> gx_widget_type =                     GX_TYPE_TEXT_BUTTON;
81
18526
    button -> gx_text_button_text_id =             text_id;
82
18526
    button -> gx_text_button_string.gx_string_ptr =  GX_NULL;
83
18526
    button -> gx_text_button_string.gx_string_length = 0;
84
18526
    button -> gx_widget_draw_function =            (VOID (*)(GX_WIDGET *))_gx_text_button_draw;
85
18526
    button -> gx_widget_event_process_function = (UINT(*)(GX_WIDGET*, GX_EVENT*))_gx_text_button_event_process;
86
18526
    button -> gx_text_button_normal_text_color =   GX_COLOR_ID_BUTTON_TEXT;
87
18526
    button -> gx_text_button_selected_text_color = GX_COLOR_ID_BUTTON_TEXT;
88
18526
    button -> gx_text_button_disabled_text_color = GX_COLOR_ID_DISABLED_TEXT;
89
18526
    button -> gx_widget_disabled_fill_color = GX_COLOR_ID_DISABLED_FILL;
90
18526
    button -> gx_text_button_font_id =             GX_FONT_ID_BUTTON;
91
92
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
93
    button -> gx_text_button_bidi_resolved_text_info = GX_NULL;
94
#endif
95
96
    /* Determine if a parent widget was provided.  */
97
18526
    if (parent)
98
    {
99
8845
        _gx_widget_link(parent, (GX_WIDGET *)button);
100
    }
101
102
    /* Return the status from button create.  */
103
18526
    return(GX_SUCCESS);
104
}
105