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