GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_prompt_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
/**   Prompt Management (Prompt)                                          */
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_prompt.h"
30
#include "gx_system.h"
31
32
33
/**************************************************************************/
34
/*                                                                        */
35
/*  FUNCTION                                               RELEASE        */
36
/*                                                                        */
37
/*    _gx_prompt_create                                   PORTABLE C      */
38
/*                                                           6.1          */
39
/*  AUTHOR                                                                */
40
/*                                                                        */
41
/*    Kenneth Maxwell, Microsoft Corporation                              */
42
/*                                                                        */
43
/*  DESCRIPTION                                                           */
44
/*                                                                        */
45
/*    This function creates a prompt, which is a special type of          */
46
/*    widget.                                                             */
47
/*                                                                        */
48
/*  INPUT                                                                 */
49
/*                                                                        */
50
/*    prompt                                Prompt control block          */
51
/*    name                                  Name of prompt                */
52
/*    parent                                Parent widget control block   */
53
/*    text_id                               Resource string id            */
54
/*    style                                 Style of prompt               */
55
/*    prompt_id                             Application-defined ID of     */
56
/*                                            prompt.                     */
57
/*    size                                  Prompt size                   */
58
/*                                                                        */
59
/*  OUTPUT                                                                */
60
/*                                                                        */
61
/*    status                                Completion status             */
62
/*                                                                        */
63
/*  CALLS                                                                 */
64
/*                                                                        */
65
/*    _gx_widget_create                     Create the underlying widget  */
66
/*    _gx_widget_link                       Link the widget to its parent */
67
/*                                                                        */
68
/*  CALLED BY                                                             */
69
/*                                                                        */
70
/*    Application Code                                                    */
71
/*                                                                        */
72
/**************************************************************************/
73
73549
UINT  _gx_prompt_create(GX_PROMPT *prompt, GX_CONST GX_CHAR *name, GX_WIDGET *parent,
74
                        GX_RESOURCE_ID text_id, ULONG style, USHORT prompt_id,
75
                        GX_CONST GX_RECTANGLE *size)
76
{
77
78
    /* Call the widget create function.  */
79
73549
    _gx_widget_create((GX_WIDGET *)prompt, name, GX_NULL, style, prompt_id, size);
80
81
    /* Populate the rest of prompt control block - overriding as necessary.  */
82
73549
    prompt -> gx_widget_type =                  GX_TYPE_PROMPT;
83
73549
    prompt -> gx_prompt_text_id =               text_id;
84
73549
    prompt -> gx_prompt_normal_text_color =     GX_COLOR_ID_TEXT;
85
73549
    prompt -> gx_prompt_selected_text_color =   GX_COLOR_ID_SELECTED_TEXT;
86
73549
    prompt -> gx_prompt_disabled_text_color =   GX_COLOR_ID_DISABLED_TEXT;
87
73549
    prompt -> gx_prompt_string.gx_string_ptr =  GX_NULL;
88
73549
    prompt -> gx_prompt_string.gx_string_length = 0;
89
73549
    prompt -> gx_prompt_font_id =               GX_FONT_ID_PROMPT;
90
73549
    prompt -> gx_widget_draw_function =         (VOID (*)(GX_WIDGET *))_gx_prompt_draw;
91
73549
    prompt -> gx_widget_event_process_function = (UINT(*)(GX_WIDGET*, GX_EVENT*))_gx_prompt_event_process;
92
73549
    prompt -> gx_prompt_text_get_function =     (VOID (*)(GX_PROMPT *, GX_STRING *))(void (*)(void))_gx_prompt_text_get_ext;
93
94
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
95
    prompt -> gx_prompt_bidi_resolved_text_info = GX_NULL;
96
#endif
97
98
    /* Determine if a parent widget was provided.  */
99
73549
    if (parent)
100
    {
101
57212
        _gx_widget_link(parent, (GX_WIDGET *)prompt);
102
    }
103
104
    /* Return the status from widget create.  */
105
73549
    return(GX_SUCCESS);
106
}
107