1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
10 |
|
|
**************************************************************************/ |
11 |
|
|
|
12 |
|
|
|
13 |
|
|
/**************************************************************************/ |
14 |
|
|
/**************************************************************************/ |
15 |
|
|
/** */ |
16 |
|
|
/** GUIX Component */ |
17 |
|
|
/** */ |
18 |
|
|
/** Prompt Management (Prompt) */ |
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_display.h" |
30 |
|
|
#include "gx_widget.h" |
31 |
|
|
#include "gx_prompt.h" |
32 |
|
|
#include "gx_utility.h" |
33 |
|
|
|
34 |
|
|
/**************************************************************************/ |
35 |
|
|
/* */ |
36 |
|
|
/* FUNCTION RELEASE */ |
37 |
|
|
/* */ |
38 |
|
|
/* _gx_prompt_text_set PORTABLE C */ |
39 |
|
|
/* 6.1 */ |
40 |
|
|
/* AUTHOR */ |
41 |
|
|
/* */ |
42 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
43 |
|
|
/* */ |
44 |
|
|
/* DESCRIPTION (deprecated) */ |
45 |
|
|
/* */ |
46 |
|
|
/* This service sets the text of a prompt widget. */ |
47 |
|
|
/* */ |
48 |
|
|
/* */ |
49 |
|
|
/* INPUT */ |
50 |
|
|
/* */ |
51 |
|
|
/* prompt Pointer to prompt widget */ |
52 |
|
|
/* control block */ |
53 |
|
|
/* text Pointer to text */ |
54 |
|
|
/* */ |
55 |
|
|
/* OUTPUT */ |
56 |
|
|
/* */ |
57 |
|
|
/* status Completion status */ |
58 |
|
|
/* */ |
59 |
|
|
/* CALLS */ |
60 |
|
|
/* */ |
61 |
|
|
/* _gx_prompt_text_set_ext New text set API */ |
62 |
|
|
/* */ |
63 |
|
|
/* CALLED BY */ |
64 |
|
|
/* */ |
65 |
|
|
/* Application Code */ |
66 |
|
|
/* */ |
67 |
|
|
/**************************************************************************/ |
68 |
|
|
#if defined(GX_ENABLE_DEPRECATED_STRING_API) |
69 |
|
534 |
UINT _gx_prompt_text_set(GX_PROMPT *prompt, GX_CONST GX_CHAR *text) |
70 |
|
|
{ |
71 |
|
534 |
UINT status = GX_SUCCESS; |
72 |
|
534 |
UINT length = 0; |
73 |
|
|
GX_STRING string; |
74 |
|
|
|
75 |
✓✓ |
534 |
if (text) |
76 |
|
|
{ |
77 |
|
532 |
status = _gx_utility_string_length_check(text, &length, GX_MAX_STRING_LENGTH); |
78 |
|
|
} |
79 |
|
|
|
80 |
✓✓ |
534 |
if (status == GX_SUCCESS) |
81 |
|
|
{ |
82 |
|
533 |
string.gx_string_ptr = text; |
83 |
|
533 |
string.gx_string_length = length; |
84 |
|
533 |
status = _gx_prompt_text_set_ext(prompt, &string); |
85 |
|
|
} |
86 |
|
|
|
87 |
|
534 |
return(status); |
88 |
|
|
} |
89 |
|
|
#endif |
90 |
|
|
|
91 |
|
|
/**************************************************************************/ |
92 |
|
|
/* */ |
93 |
|
|
/* FUNCTION RELEASE */ |
94 |
|
|
/* */ |
95 |
|
|
/* _gx_prompt_text_set_ext PORTABLE C */ |
96 |
|
|
/* 6.1 */ |
97 |
|
|
/* AUTHOR */ |
98 |
|
|
/* */ |
99 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
100 |
|
|
/* */ |
101 |
|
|
/* DESCRIPTION */ |
102 |
|
|
/* */ |
103 |
|
|
/* This service sets the text of a prompt widget. */ |
104 |
|
|
/* */ |
105 |
|
|
/* */ |
106 |
|
|
/* INPUT */ |
107 |
|
|
/* */ |
108 |
|
|
/* prompt Pointer to prompt widget */ |
109 |
|
|
/* control block */ |
110 |
|
|
/* text Pointer to text */ |
111 |
|
|
/* */ |
112 |
|
|
/* OUTPUT */ |
113 |
|
|
/* */ |
114 |
|
|
/* status Completion status */ |
115 |
|
|
/* */ |
116 |
|
|
/* CALLS */ |
117 |
|
|
/* */ |
118 |
|
|
/* _gx_system_dirty_mark Mark this prompt as dirty */ |
119 |
|
|
/* */ |
120 |
|
|
/* CALLED BY */ |
121 |
|
|
/* */ |
122 |
|
|
/* Application Code */ |
123 |
|
|
/* */ |
124 |
|
|
/**************************************************************************/ |
125 |
|
29657 |
UINT _gx_prompt_text_set_ext(GX_PROMPT *prompt, GX_CONST GX_STRING *string) |
126 |
|
|
{ |
127 |
|
29657 |
UINT status = GX_SUCCESS; |
128 |
|
|
|
129 |
|
29657 |
prompt -> gx_prompt_text_id = 0; |
130 |
|
|
|
131 |
✓✓ |
29657 |
if (prompt -> gx_widget_style & GX_STYLE_TEXT_COPY) |
132 |
|
|
{ |
133 |
|
16 |
status = _gx_system_private_string_copy(&prompt -> gx_prompt_string, string); |
134 |
|
|
} |
135 |
|
|
else |
136 |
|
|
{ |
137 |
✓✓ |
29641 |
if (string) |
138 |
|
|
{ |
139 |
|
29638 |
prompt -> gx_prompt_string = *string; |
140 |
|
|
} |
141 |
|
|
else |
142 |
|
|
{ |
143 |
|
3 |
prompt -> gx_prompt_string.gx_string_ptr = GX_NULL; |
144 |
|
3 |
prompt -> gx_prompt_string.gx_string_length = 0; |
145 |
|
|
} |
146 |
|
|
} |
147 |
|
|
|
148 |
|
|
#if defined(GX_DYNAMIC_BIDI_TEXT_SUPPORT) |
149 |
|
|
if (prompt -> gx_prompt_bidi_resolved_text_info) |
150 |
|
|
{ |
151 |
|
|
_gx_utility_bidi_resolved_text_info_delete(&prompt -> gx_prompt_bidi_resolved_text_info); |
152 |
|
|
} |
153 |
|
|
#endif |
154 |
|
|
|
155 |
✓✓ |
29657 |
if (prompt -> gx_widget_status & GX_STATUS_VISIBLE) |
156 |
|
|
{ |
157 |
|
1032 |
_gx_system_dirty_mark((GX_WIDGET *)prompt); |
158 |
|
|
} |
159 |
|
|
|
160 |
|
29657 |
return(status); |
161 |
|
|
} |
162 |
|
|
|