GCC Code Coverage Report
Directory: ./ Exec Total Coverage
File: gx_prompt_text_draw.c Lines: 14 14 100.0 %
Date: 2026-03-06 19:21:09 Branches: 8 8 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_system.h"
29
#include "gx_display.h"
30
#include "gx_context.h"
31
#include "gx_widget.h"
32
#include "gx_prompt.h"
33
34
35
/**************************************************************************/
36
/*                                                                        */
37
/*  FUNCTION                                               RELEASE        */
38
/*                                                                        */
39
/*    _gx_prompt_text_draw                                PORTABLE C      */
40
/*                                                           6.1          */
41
/*  AUTHOR                                                                */
42
/*                                                                        */
43
/*    Kenneth Maxwell, Microsoft Corporation                              */
44
/*                                                                        */
45
/*  DESCRIPTION                                                           */
46
/*                                                                        */
47
/*    This function draws the specified prompt with text.                 */
48
/*                                                                        */
49
/*  INPUT                                                                 */
50
/*                                                                        */
51
/*    prompt                                Prompt control block          */
52
/*                                                                        */
53
/*  OUTPUT                                                                */
54
/*                                                                        */
55
/*    None                                                                */
56
/*                                                                        */
57
/*  CALLS                                                                 */
58
/*                                                                        */
59
/*    [gx_prompt_text_get_function]         Prompt-specified text get     */
60
/*                                            function                    */
61
/*    _gx_widget_text_draw                  Draw the text on the widget   */
62
/*                                                                        */
63
/*  CALLED BY                                                             */
64
/*                                                                        */
65
/*    Application Code                                                    */
66
/*    GUIX Internal Code                                                  */
67
/*                                                                        */
68
/**************************************************************************/
69
458216
VOID  _gx_prompt_text_draw(GX_PROMPT *prompt)
70
{
71
458216
GX_WIDGET     *widget = (GX_WIDGET *)prompt;
72
GX_RESOURCE_ID color;
73
GX_STRING      pText;
74
75
    /* Draw text.  */
76
77
458216
    if (widget -> gx_widget_style & GX_STYLE_ENABLED)
78
    {
79
301395
        if ((widget -> gx_widget_style & GX_STYLE_DRAW_SELECTED) &&
80
5526
            prompt -> gx_prompt_selected_text_color != 0)
81
        {
82
5508
            color = prompt -> gx_prompt_selected_text_color;
83
        }
84
        else
85
        {
86
295887
            color = prompt -> gx_prompt_normal_text_color;
87
        }
88
    }
89
    else
90
    {
91
156821
        color = prompt -> gx_prompt_disabled_text_color;
92
    }
93
94
458216
    memset((GX_STRING *)&pText, 0, sizeof(GX_STRING));
95
458216
    prompt -> gx_prompt_text_get_function(prompt, &pText);
96
97
458216
    if (pText.gx_string_ptr)
98
    {
99
457508
        _gx_widget_text_draw_ext((GX_WIDGET *)prompt, color,
100
457508
                                 prompt -> gx_prompt_font_id, &pText, 0, 0);
101
    }
102
458216
}
103