1 /***************************************************************************
2 * Copyright (c) 2024 Microsoft Corporation
3 *
4 * This program and the accompanying materials are made available under the
5 * terms of the MIT License which is available at
6 * https://opensource.org/licenses/MIT.
7 *
8 * SPDX-License-Identifier: MIT
9 **************************************************************************/
10
11
12 /**************************************************************************/
13 /**************************************************************************/
14 /** */
15 /** GUIX Component */
16 /** */
17 /** Prompt Management (Prompt) */
18 /** */
19 /**************************************************************************/
20
21 #define GX_SOURCE_CODE
22
23
24 /* Include necessary system files. */
25
26 #include "gx_api.h"
27 #include "gx_system.h"
28 #include "gx_display.h"
29 #include "gx_context.h"
30 #include "gx_widget.h"
31 #include "gx_prompt.h"
32
33
34 /**************************************************************************/
35 /* */
36 /* FUNCTION RELEASE */
37 /* */
38 /* _gx_prompt_text_draw PORTABLE C */
39 /* 6.1 */
40 /* AUTHOR */
41 /* */
42 /* Kenneth Maxwell, Microsoft Corporation */
43 /* */
44 /* DESCRIPTION */
45 /* */
46 /* This function draws the specified prompt with text. */
47 /* */
48 /* INPUT */
49 /* */
50 /* prompt Prompt control block */
51 /* */
52 /* OUTPUT */
53 /* */
54 /* None */
55 /* */
56 /* CALLS */
57 /* */
58 /* [gx_prompt_text_get_function] Prompt-specified text get */
59 /* function */
60 /* _gx_widget_text_draw Draw the text on the widget */
61 /* */
62 /* CALLED BY */
63 /* */
64 /* Application Code */
65 /* GUIX Internal Code */
66 /* */
67 /* RELEASE HISTORY */
68 /* */
69 /* DATE NAME DESCRIPTION */
70 /* */
71 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
72 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
73 /* resulting in version 6.1 */
74 /* */
75 /**************************************************************************/
_gx_prompt_text_draw(GX_PROMPT * prompt)76 VOID _gx_prompt_text_draw(GX_PROMPT *prompt)
77 {
78 GX_WIDGET *widget = (GX_WIDGET *)prompt;
79 GX_RESOURCE_ID color;
80 GX_STRING pText;
81
82 /* Draw text. */
83
84 if (widget -> gx_widget_style & GX_STYLE_ENABLED)
85 {
86 if ((widget -> gx_widget_style & GX_STYLE_DRAW_SELECTED) &&
87 prompt -> gx_prompt_selected_text_color != 0)
88 {
89 color = prompt -> gx_prompt_selected_text_color;
90 }
91 else
92 {
93 color = prompt -> gx_prompt_normal_text_color;
94 }
95 }
96 else
97 {
98 color = prompt -> gx_prompt_disabled_text_color;
99 }
100
101 memset((GX_STRING *)&pText, 0, sizeof(GX_STRING));
102 prompt -> gx_prompt_text_get_function(prompt, &pText);
103
104 if (pText.gx_string_ptr)
105 {
106 _gx_widget_text_draw_ext((GX_WIDGET *)prompt, color,
107 prompt -> gx_prompt_font_id, &pText, 0, 0);
108 }
109 }
110
111