1 /**************************************************************************/
2 /* */
3 /* Copyright (c) Microsoft Corporation. All rights reserved. */
4 /* */
5 /* This software is licensed under the Microsoft Software License */
6 /* Terms for Microsoft Azure RTOS. Full text of the license can be */
7 /* found in the LICENSE file at https://aka.ms/AzureRTOS_EULA */
8 /* and in the root directory of this software. */
9 /* */
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 /* RELEASE HISTORY */
69 /* */
70 /* DATE NAME DESCRIPTION */
71 /* */
72 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
73 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
74 /* resulting in version 6.1 */
75 /* */
76 /**************************************************************************/
_gx_prompt_text_draw(GX_PROMPT * prompt)77 VOID _gx_prompt_text_draw(GX_PROMPT *prompt)
78 {
79 GX_WIDGET *widget = (GX_WIDGET *)prompt;
80 GX_RESOURCE_ID color;
81 GX_STRING pText;
82
83 /* Draw text. */
84
85 if (widget -> gx_widget_style & GX_STYLE_ENABLED)
86 {
87 if ((widget -> gx_widget_style & GX_STYLE_DRAW_SELECTED) &&
88 prompt -> gx_prompt_selected_text_color != 0)
89 {
90 color = prompt -> gx_prompt_selected_text_color;
91 }
92 else
93 {
94 color = prompt -> gx_prompt_normal_text_color;
95 }
96 }
97 else
98 {
99 color = prompt -> gx_prompt_disabled_text_color;
100 }
101
102 memset((GX_STRING *)&pText, 0, sizeof(GX_STRING));
103 prompt -> gx_prompt_text_get_function(prompt, &pText);
104
105 if (pText.gx_string_ptr)
106 {
107 _gx_widget_text_draw_ext((GX_WIDGET *)prompt, color,
108 prompt -> gx_prompt_font_id, &pText, 0, 0);
109 }
110 }
111
112