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 /** Menu Management (Menu) */
19 /** */
20 /**************************************************************************/
21
22 #define GX_SOURCE_CODE
23
24
25 /* Include necessary system files. */
26
27 #include "gx_api.h"
28 #include "gx_menu.h"
29 #include "gx_widget.h"
30
31 /**************************************************************************/
32 /* */
33 /* FUNCTION RELEASE */
34 /* */
35 /* _gx_menu_text_draw PORTABLE C */
36 /* 6.1 */
37 /* AUTHOR */
38 /* */
39 /* Kenneth Maxwell, Microsoft Corporation */
40 /* */
41 /* DESCRIPTION */
42 /* */
43 /* This function draws the text of a menu widget. */
44 /* */
45 /* INPUT */
46 /* */
47 /* menu Pointer to menu control block */
48 /* */
49 /* OUTPUT */
50 /* */
51 /* None */
52 /* */
53 /* CALLS */
54 /* */
55 /* _gx_widget_text_draw Draw text to a widget */
56 /* */
57 /* CALLED BY */
58 /* */
59 /* Application Code */
60 /* GUIX Internal Code */
61 /* */
62 /* RELEASE HISTORY */
63 /* */
64 /* DATE NAME DESCRIPTION */
65 /* */
66 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
67 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
68 /* resulting in version 6.1 */
69 /* */
70 /**************************************************************************/
_gx_menu_text_draw(GX_MENU * menu)71 VOID _gx_menu_text_draw(GX_MENU *menu)
72 {
73 GX_WIDGET *widget = (GX_WIDGET *)menu;
74 GX_RESOURCE_ID color;
75 GX_STRING pText;
76
77 /* Draw text. */
78
79 if ((widget -> gx_widget_style & GX_STYLE_DRAW_SELECTED) &&
80 (menu -> gx_prompt_selected_text_color != 0))
81 {
82 color = menu -> gx_prompt_selected_text_color;
83 }
84 else
85 {
86 color = menu -> gx_prompt_normal_text_color;
87 }
88
89 memset((GX_STRING *)&pText, 0, sizeof(GX_STRING));
90 menu -> gx_prompt_text_get_function((GX_PROMPT *)menu, &pText);
91
92 if (pText.gx_string_ptr)
93 {
94 _gx_widget_text_draw_ext((GX_WIDGET *)menu, color,
95 menu -> gx_prompt_font_id,
96 &pText,
97 menu -> gx_menu_text_x_offset,
98 menu -> gx_menu_text_y_offset);
99 }
100 }
101
102