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 |
|
|
/** String Scroll Wheel Management (Scroll Wheel) */ |
18 |
|
|
/** */ |
19 |
|
|
/**************************************************************************/ |
20 |
|
|
|
21 |
|
|
#define GX_SOURCE_CODE |
22 |
|
|
|
23 |
|
|
|
24 |
|
|
/* Include necessary system files. */ |
25 |
|
|
|
26 |
|
|
#include "gx_api.h" |
27 |
|
|
#include "gx_scroll_wheel.h" |
28 |
|
|
#include "gx_utility.h" |
29 |
|
|
|
30 |
|
|
GX_CALLER_CHECKING_EXTERNS |
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gxe_string_scroll_wheel_string_list_set PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function checks for errors in string scroll wheel string list */ |
45 |
|
|
/* set call. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* wheel Scroll wheel control block */ |
50 |
|
|
/* string_list String list to be set */ |
51 |
|
|
/* string_count The number of assigned strings*/ |
52 |
|
|
/* */ |
53 |
|
|
/* OUTPUT */ |
54 |
|
|
/* */ |
55 |
|
|
/* status Completion status */ |
56 |
|
|
/* */ |
57 |
|
|
/* CALLS */ |
58 |
|
|
/* */ |
59 |
|
|
/* _gx_string_scroll_wheel_string_list_set */ |
60 |
|
|
/* Actual string scroll wheel */ |
61 |
|
|
/* string list set call */ |
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 |
|
34 |
UINT _gxe_string_scroll_wheel_string_list_set(GX_STRING_SCROLL_WHEEL *wheel, |
78 |
|
|
GX_CONST GX_CHAR **string_list, |
79 |
|
|
INT string_count) |
80 |
|
|
{ |
81 |
|
|
UINT status; |
82 |
|
|
|
83 |
|
|
/* Check for appropriate caller. */ |
84 |
✓✓✓✓ ✓✓ |
34 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
85 |
|
|
|
86 |
|
|
/* Check for invalid pointer. */ |
87 |
✓✓ |
32 |
if (wheel == GX_NULL) |
88 |
|
|
{ |
89 |
|
1 |
return GX_PTR_ERROR; |
90 |
|
|
} |
91 |
|
|
|
92 |
|
|
/* Check for invalid widget. */ |
93 |
✓✓ |
31 |
if (wheel -> gx_widget_type == 0) |
94 |
|
|
{ |
95 |
|
1 |
return GX_INVALID_WIDGET; |
96 |
|
|
} |
97 |
|
|
|
98 |
|
|
/* Check for invalid list size. */ |
99 |
✓✓ |
30 |
if (string_count < 0) |
100 |
|
|
{ |
101 |
|
1 |
return GX_INVALID_VALUE; |
102 |
|
|
} |
103 |
|
|
|
104 |
|
29 |
status = _gx_string_scroll_wheel_string_list_set(wheel, string_list, string_count); |
105 |
|
|
|
106 |
|
29 |
return status; |
107 |
|
|
} |
108 |
|
|
#endif |
109 |
|
|
|
110 |
|
|
/**************************************************************************/ |
111 |
|
|
/* */ |
112 |
|
|
/* FUNCTION RELEASE */ |
113 |
|
|
/* */ |
114 |
|
|
/* _gxe_string_scroll_wheel_string_list_set_ext PORTABLE C */ |
115 |
|
|
/* 6.1 */ |
116 |
|
|
/* AUTHOR */ |
117 |
|
|
/* */ |
118 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
119 |
|
|
/* */ |
120 |
|
|
/* DESCRIPTION */ |
121 |
|
|
/* */ |
122 |
|
|
/* This function checks for errors in string scroll wheel string list */ |
123 |
|
|
/* set call. */ |
124 |
|
|
/* */ |
125 |
|
|
/* INPUT */ |
126 |
|
|
/* */ |
127 |
|
|
/* wheel Scroll wheel control block */ |
128 |
|
|
/* string_list String list to be set */ |
129 |
|
|
/* string_count The number of assigned strings*/ |
130 |
|
|
/* */ |
131 |
|
|
/* OUTPUT */ |
132 |
|
|
/* */ |
133 |
|
|
/* status Completion status */ |
134 |
|
|
/* */ |
135 |
|
|
/* CALLS */ |
136 |
|
|
/* */ |
137 |
|
|
/* _gx_string_scroll_wheel_string_list_set_ext */ |
138 |
|
|
/* Actual string scroll wheel */ |
139 |
|
|
/* string list set ext call */ |
140 |
|
|
/* */ |
141 |
|
|
/* CALLED BY */ |
142 |
|
|
/* */ |
143 |
|
|
/* Application Code */ |
144 |
|
|
/* */ |
145 |
|
|
/* RELEASE HISTORY */ |
146 |
|
|
/* */ |
147 |
|
|
/* DATE NAME DESCRIPTION */ |
148 |
|
|
/* */ |
149 |
|
|
/* 05-19-2020 Kenneth Maxwell Initial Version 6.0 */ |
150 |
|
|
/* 09-30-2020 Kenneth Maxwell Modified comment(s), */ |
151 |
|
|
/* resulting in version 6.1 */ |
152 |
|
|
/* */ |
153 |
|
|
/**************************************************************************/ |
154 |
|
26 |
UINT _gxe_string_scroll_wheel_string_list_set_ext(GX_STRING_SCROLL_WHEEL *wheel, |
155 |
|
|
GX_CONST GX_STRING *string_list, |
156 |
|
|
INT string_count) |
157 |
|
|
{ |
158 |
|
|
UINT status; |
159 |
|
|
INT string_id; |
160 |
|
|
GX_CONST GX_STRING *string; |
161 |
|
|
UINT string_length; |
162 |
|
|
|
163 |
|
|
/* Check for appropriate caller. */ |
164 |
✓✓✓✓ ✓✓ |
26 |
GX_INIT_AND_THREADS_CALLER_CHECKING |
165 |
|
|
|
166 |
|
|
/* Check for invalid pointer. */ |
167 |
✓✓ |
24 |
if (wheel == GX_NULL) |
168 |
|
|
{ |
169 |
|
1 |
return GX_PTR_ERROR; |
170 |
|
|
} |
171 |
|
|
|
172 |
|
|
/* Check for invalid widget. */ |
173 |
✓✓ |
23 |
if (wheel -> gx_widget_type == 0) |
174 |
|
|
{ |
175 |
|
1 |
return GX_INVALID_WIDGET; |
176 |
|
|
} |
177 |
|
|
|
178 |
|
|
/* Check for invalid list size. */ |
179 |
✓✓ |
22 |
if (string_count < 0) |
180 |
|
|
{ |
181 |
|
1 |
return GX_INVALID_VALUE; |
182 |
|
|
} |
183 |
|
|
|
184 |
✓✓ |
21 |
if (string_list) |
185 |
|
|
{ |
186 |
|
|
/* Test string length. */ |
187 |
✓✓ |
133 |
for (string_id = 0; string_id < string_count; string_id++) |
188 |
|
|
{ |
189 |
|
117 |
string = &string_list[string_id]; |
190 |
✓✓ |
117 |
if (string -> gx_string_ptr) |
191 |
|
|
{ |
192 |
|
113 |
status = _gx_utility_string_length_check(string -> gx_string_ptr, &string_length, string -> gx_string_length); |
193 |
|
|
|
194 |
✓✓ |
113 |
if (status != GX_SUCCESS) |
195 |
|
|
{ |
196 |
|
1 |
return status; |
197 |
|
|
} |
198 |
|
|
} |
199 |
|
|
else |
200 |
|
|
{ |
201 |
|
4 |
string_length = 0; |
202 |
|
|
} |
203 |
|
|
|
204 |
✓✓ |
116 |
if (string_length != string -> gx_string_length) |
205 |
|
|
{ |
206 |
|
1 |
return GX_INVALID_STRING_LENGTH; |
207 |
|
|
} |
208 |
|
|
} |
209 |
|
|
} |
210 |
|
|
|
211 |
|
19 |
status = _gx_string_scroll_wheel_string_list_set_ext(wheel, string_list, string_count); |
212 |
|
|
|
213 |
|
19 |
return status; |
214 |
|
|
} |
215 |
|
|
|