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 /** Text Button Management (Button) */
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_button.h"
30 #include "gx_utility.h"
31
32
33 /**************************************************************************/
34 /* */
35 /* FUNCTION RELEASE */
36 /* */
37 /* _gx_text_button_text_set PORTABLE C */
38 /* 6.1 */
39 /* AUTHOR */
40 /* */
41 /* Kenneth Maxwell, Microsoft Corporation */
42 /* */
43 /* DESCRIPTION */
44 /* */
45 /* This function assigns a string literal to the specified prompt. */
46 /* */
47 /* */
48 /* INPUT */
49 /* */
50 /* button Button control block */
51 /* text pointer to text string */
52 /* */
53 /* OUTPUT */
54 /* */
55 /* status Completion status */
56 /* */
57 /* CALLS */
58 /* */
59 /* _gx_system_dirty_mark Mark this button as dirty */
60 /* */
61 /* CALLED BY */
62 /* */
63 /* Application Code */
64 /* */
65 /* RELEASE HISTORY */
66 /* */
67 /* DATE NAME DESCRIPTION */
68 /* */
69 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
70 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
71 /* resulting in version 6.1 */
72 /* */
73 /**************************************************************************/
74 #if defined(GX_ENABLE_DEPRECATED_STRING_API)
_gx_text_button_text_set(GX_TEXT_BUTTON * button,GX_CONST GX_CHAR * text)75 UINT _gx_text_button_text_set(GX_TEXT_BUTTON *button, GX_CONST GX_CHAR *text)
76 {
77 UINT status = GX_SUCCESS;
78 UINT length = 0;
79 GX_STRING string;
80
81 if (text)
82 {
83 status = _gx_utility_string_length_check(text, &length, GX_MAX_STRING_LENGTH);
84 }
85
86 if (status == GX_SUCCESS)
87 {
88 string.gx_string_ptr = text;
89 string.gx_string_length = length;
90 status = _gx_text_button_text_set_ext(button, &string);
91 }
92 return status;
93 }
94 #endif
95
96 /**************************************************************************/
97 /* */
98 /* FUNCTION RELEASE */
99 /* */
100 /* _gx_text_button_text_set_ext PORTABLE C */
101 /* 6.1 */
102 /* AUTHOR */
103 /* */
104 /* Kenneth Maxwell, Microsoft Corporation */
105 /* */
106 /* DESCRIPTION */
107 /* */
108 /* This function assigns a string literal to the specified prompt. */
109 /* */
110 /* */
111 /* INPUT */
112 /* */
113 /* button Button control block */
114 /* text pointer to text string */
115 /* */
116 /* OUTPUT */
117 /* */
118 /* status Completion status */
119 /* */
120 /* CALLS */
121 /* */
122 /* _gx_system_dirty_mark Mark this button as dirty */
123 /* */
124 /* CALLED BY */
125 /* */
126 /* Application Code */
127 /* */
128 /* RELEASE HISTORY */
129 /* */
130 /* DATE NAME DESCRIPTION */
131 /* */
132 /* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */
133 /* 09-30-2020 Kenneth Maxwell Modified comment(s), */
134 /* added logic to delete */
135 /* dynamic bidi text, */
136 /* resulting in version 6.1 */
137 /* */
138 /**************************************************************************/
_gx_text_button_text_set_ext(GX_TEXT_BUTTON * button,GX_CONST GX_STRING * string)139 UINT _gx_text_button_text_set_ext(GX_TEXT_BUTTON *button, GX_CONST GX_STRING *string)
140 {
141 UINT status = GX_SUCCESS;
142
143 button -> gx_text_button_text_id = 0;
144
145 if (button -> gx_widget_style & GX_STYLE_TEXT_COPY)
146 {
147 status = _gx_system_private_string_copy(&button -> gx_text_button_string, string);
148 }
149 else
150 {
151 if (string)
152 {
153 button -> gx_text_button_string = *string;
154 }
155 else
156 {
157 button -> gx_text_button_string.gx_string_ptr = GX_NULL;
158 button -> gx_text_button_string.gx_string_length = 0;
159 }
160 }
161
162 #if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT)
163 if (button -> gx_text_button_bidi_resolved_text_info)
164 {
165 _gx_utility_bidi_resolved_text_info_delete(&button -> gx_text_button_bidi_resolved_text_info);
166 }
167 #endif
168
169 if (button -> gx_widget_status & GX_STATUS_VISIBLE)
170 {
171 _gx_system_dirty_mark((GX_WIDGET *)button);
172 }
173
174 return(status);
175 }
176
177