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