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_widget.h" |
30 |
|
|
#include "gx_prompt.h" |
31 |
|
|
#include "gx_utility.h" |
32 |
|
|
|
33 |
|
|
/**************************************************************************/ |
34 |
|
|
/* */ |
35 |
|
|
/* FUNCTION RELEASE */ |
36 |
|
|
/* */ |
37 |
|
|
/* _gx_prompt_text_get PORTABLE C */ |
38 |
|
|
/* 6.1 */ |
39 |
|
|
/* AUTHOR */ |
40 |
|
|
/* */ |
41 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
42 |
|
|
/* */ |
43 |
|
|
/* DESCRIPTION (deprecated) */ |
44 |
|
|
/* */ |
45 |
|
|
/* This service gets the text of a prompt widget. */ |
46 |
|
|
/* */ |
47 |
|
|
/* */ |
48 |
|
|
/* INPUT */ |
49 |
|
|
/* */ |
50 |
|
|
/* prompt Pointer to prompt widget */ |
51 |
|
|
/* control block */ |
52 |
|
|
/* return_text Pointer to destination for */ |
53 |
|
|
/* the text */ |
54 |
|
|
/* */ |
55 |
|
|
/* OUTPUT */ |
56 |
|
|
/* */ |
57 |
|
|
/* status Completion status */ |
58 |
|
|
/* */ |
59 |
|
|
/* CALLS */ |
60 |
|
|
/* */ |
61 |
|
|
/* _gx_system_string_get Obtain the string */ |
62 |
|
|
/* */ |
63 |
|
|
/* CALLED BY */ |
64 |
|
|
/* */ |
65 |
|
|
/* Application 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 |
|
|
/**************************************************************************/ |
76 |
|
|
#if defined(GX_ENABLE_DEPRECATED_STRING_API) |
77 |
|
2 |
UINT _gx_prompt_text_get(GX_PROMPT *prompt, GX_CONST GX_CHAR **return_text) |
78 |
|
|
{ |
79 |
|
|
UINT status; |
80 |
|
|
GX_STRING string; |
81 |
|
|
|
82 |
|
2 |
string.gx_string_ptr = GX_NULL; |
83 |
|
2 |
string.gx_string_length = 0; |
84 |
|
|
|
85 |
|
2 |
status = _gx_prompt_text_get_ext(prompt, &string); |
86 |
|
|
|
87 |
✓✓ |
2 |
if (status == GX_SUCCESS) |
88 |
|
|
{ |
89 |
|
1 |
*return_text = string.gx_string_ptr; |
90 |
|
|
} |
91 |
|
|
|
92 |
|
2 |
return(status); |
93 |
|
|
} |
94 |
|
|
#endif |
95 |
|
|
|
96 |
|
|
/**************************************************************************/ |
97 |
|
|
/* */ |
98 |
|
|
/* FUNCTION RELEASE */ |
99 |
|
|
/* */ |
100 |
|
|
/* _gx_prompt_text_get_ext PORTABLE C */ |
101 |
|
|
/* 6.1.10 */ |
102 |
|
|
/* AUTHOR */ |
103 |
|
|
/* */ |
104 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
105 |
|
|
/* */ |
106 |
|
|
/* DESCRIPTION */ |
107 |
|
|
/* */ |
108 |
|
|
/* This service gets the text of a prompt widget. */ |
109 |
|
|
/* */ |
110 |
|
|
/* */ |
111 |
|
|
/* INPUT */ |
112 |
|
|
/* */ |
113 |
|
|
/* prompt Pointer to prompt widget */ |
114 |
|
|
/* control block */ |
115 |
|
|
/* return_text Pointer to destination for */ |
116 |
|
|
/* the text */ |
117 |
|
|
/* */ |
118 |
|
|
/* OUTPUT */ |
119 |
|
|
/* */ |
120 |
|
|
/* status Completion status */ |
121 |
|
|
/* */ |
122 |
|
|
/* CALLS */ |
123 |
|
|
/* */ |
124 |
|
|
/* _gx_system_string_get_ext Obtain the string */ |
125 |
|
|
/* */ |
126 |
|
|
/* CALLED BY */ |
127 |
|
|
/* */ |
128 |
|
|
/* Application Code */ |
129 |
|
|
/* */ |
130 |
|
|
/* RELEASE HISTORY */ |
131 |
|
|
/* */ |
132 |
|
|
/* DATE NAME DESCRIPTION */ |
133 |
|
|
/* */ |
134 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
135 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
136 |
|
|
/* added logic to retrieve */ |
137 |
|
|
/* dynamic bidi text, */ |
138 |
|
|
/* resulting in version 6.1 */ |
139 |
|
|
/* 01-31-2022 Ting Zhu Modified comment(s), */ |
140 |
|
|
/* updated with new bidi text */ |
141 |
|
|
/* reorder function call, */ |
142 |
|
|
/* resulting in version 6.1.10 */ |
143 |
|
|
/* */ |
144 |
|
|
/**************************************************************************/ |
145 |
|
462162 |
UINT _gx_prompt_text_get_ext(GX_PROMPT *prompt, GX_STRING *return_string) |
146 |
|
|
{ |
147 |
|
462162 |
UINT status = GX_SUCCESS; |
148 |
|
|
|
149 |
|
|
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT) |
150 |
|
|
GX_BIDI_TEXT_INFO text_info; |
151 |
|
|
GX_BIDI_RESOLVED_TEXT_INFO *resolved_info; |
152 |
|
|
GX_CANVAS *canvas; |
153 |
|
|
GX_DISPLAY *display; |
154 |
|
|
#endif |
155 |
|
|
|
156 |
✓✓ |
462162 |
if (prompt -> gx_prompt_text_id) |
157 |
|
|
{ |
158 |
|
420667 |
status = _gx_widget_string_get_ext((GX_WIDGET *)prompt, prompt -> gx_prompt_text_id, return_string); |
159 |
|
|
} |
160 |
|
|
else |
161 |
|
|
{ |
162 |
|
41495 |
_gx_system_private_string_get(&prompt -> gx_prompt_string, return_string, prompt -> gx_widget_style); |
163 |
|
|
} |
164 |
|
|
|
165 |
|
|
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT) |
166 |
|
|
if (_gx_system_bidi_text_enabled) |
167 |
|
|
{ |
168 |
|
|
if (prompt -> gx_prompt_bidi_resolved_text_info) |
169 |
|
|
{ |
170 |
|
|
*return_string = *prompt -> gx_prompt_bidi_resolved_text_info -> gx_bidi_resolved_text_info_text; |
171 |
|
|
} |
172 |
|
|
else |
173 |
|
|
{ |
174 |
|
|
text_info.gx_bidi_text_info_text = *return_string; |
175 |
|
|
text_info.gx_bidi_text_info_font = GX_NULL; |
176 |
|
|
text_info.gx_bidi_text_info_display_width = -1; |
177 |
|
|
GX_UTILITY_TEXT_DIRECTION_GET(text_info.gx_bidi_text_info_direction, prompt, canvas, display); |
178 |
|
|
|
179 |
|
|
if (_gx_utility_bidi_paragraph_reorder_ext(&text_info, &resolved_info) == GX_SUCCESS) |
180 |
|
|
{ |
181 |
|
|
prompt -> gx_prompt_bidi_resolved_text_info = resolved_info; |
182 |
|
|
*return_string = *resolved_info -> gx_bidi_resolved_text_info_text; |
183 |
|
|
} |
184 |
|
|
} |
185 |
|
|
} |
186 |
|
|
#endif |
187 |
|
|
|
188 |
|
462162 |
return(status); |
189 |
|
|
} |
190 |
|
|
|