1 /*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 * http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15 #include "style_modifier.h"
16
17 #include <cstddef>
18 #include <cstdint>
19 #include <map>
20 #include <unordered_map>
21 #include <regex>
22 #include <string>
23 #include "securec.h"
24 #include "drawable_descriptor.h"
25 #include <cstdlib>
26
27 #include "frame_information.h"
28 #include "native_node.h"
29 #include "native_type.h"
30 #include "node_extened.h"
31 #include "node_model.h"
32 #include "node_transition.h"
33 #include "styled_string.h"
34 #include "waterflow_section_option.h"
35
36 #include "base/error/error_code.h"
37 #include "base/log/log_wrapper.h"
38 #include "base/utils/string_utils.h"
39 #include "base/utils/utils.h"
40 #include "bridge/common/utils/utils.h"
41 #include "core/components/common/properties/color.h"
42 #include "core/components_ng/base/frame_node.h"
43 #include "core/interfaces/arkoala/arkoala_api.h"
44 #include "core/interfaces/native/node/node_api.h"
45
46 namespace OHOS::Ace::NodeModel {
47 namespace {
48 const std::regex COLOR_WITH_MAGIC("#[0-9A-Fa-f]{8}");
49 const std::regex BRACKETS("\\(.*?\\)");
50 const std::regex FLOAT_MAGIC("^[0-9]+(\\.[0-9]+)?$");
51 const std::regex SIZE_TYPE_MAGIC("([0-9]+)([a-z]+)");
52 constexpr char PARAMS_SEPARATOR_LEVEL1 = ';';
53 constexpr int UNIT_PX = 0;
54 constexpr int UNIT_VP = 1;
55 constexpr int UNIT_FP = 2;
56 constexpr int UNIT_PERCENT = 3;
57 constexpr int NUM_0 = 0;
58 constexpr int NUM_1 = 1;
59 constexpr int NUM_2 = 2;
60 constexpr int NUM_3 = 3;
61 constexpr int NUM_4 = 4;
62 constexpr int NUM_5 = 5;
63 constexpr int NUM_6 = 6;
64 constexpr int NUM_7 = 7;
65 constexpr int NUM_8 = 8;
66 constexpr int NUM_9 = 9;
67 constexpr int NUM_10 = 10;
68 constexpr int NUM_11 = 11;
69 constexpr int NUM_12 = 12;
70 constexpr int NUM_13 = 13;
71 constexpr int NUM_15 = 15;
72 constexpr int NUM_16 = 16;
73 constexpr int NUM_23 = 23;
74 constexpr int NUM_29 = 29;
75 constexpr int NUM_31 = 31;
76 constexpr int NUM_59 = 59;
77 constexpr int NUM_100 = 100;
78 constexpr int NUM_400 = 400;
79 const int ALLOW_SIZE_1(1);
80 const int ALLOW_SIZE_2(2);
81 const int ALLOW_SIZE_3(3);
82 const int ALLOW_SIZE_4(4);
83 const int ALLOW_SIZE_5(5);
84 const int ALLOW_SIZE_7(7);
85 const int ALLOW_SIZE_8(8);
86 const int ALLOW_SIZE_16(16);
87 const int ALLOW_SIZE_10(10);
88
89 constexpr int DEFAULT_SIZE_18 = 18;
90 constexpr int DEFAULT_SIZE_24 = 24;
91 constexpr int DEFAULT_SIZE_50 = 50;
92 constexpr int COLOR_STRATEGY_STYLE = 1;
93 constexpr int COLOR_STYLE = 2;
94 constexpr int DISPLAY_ARROW_FALSE = 0;
95 constexpr int DISPLAY_ARROW_TRUE = 1;
96 constexpr int32_t X_INDEX = 0;
97 constexpr int32_t Y_INDEX = 1;
98 constexpr int32_t Z_INDEX = 2;
99 constexpr int32_t CENTER_X_INDEX = 0;
100 constexpr int32_t CENTER_Y_INDEX = 1;
101 constexpr int32_t CENTER_Z_INDEX = 2;
102 constexpr int32_t CENTER_X_PERCENT_INDEX = 3;
103 constexpr int32_t CENTER_Y_PERCENT_INDEX = 4;
104 constexpr int32_t CENTER_Z_PERCENT_INDEX = 5;
105 constexpr int32_t ROTATE_PERSPECTIVE_INDEX = 4;
106 constexpr int32_t ROTATE_ANGLE_INDEX = 3;
107 constexpr uint32_t ARRAY_SIZE = 3;
108 constexpr int32_t BACKGROUND_IMAGE_WIDTH_INDEX = 0;
109 constexpr int32_t BACKGROUND_IMAGE_HEIGHT_INDEX = 1;
110 constexpr float DEFAULT_OPACITY = 1.0f;
111
112 constexpr int32_t BLUR_STYLE_INDEX = 0;
113 constexpr int32_t COLOR_MODE_INDEX = 1;
114 constexpr int32_t ADAPTIVE_COLOR_INDEX = 2;
115 constexpr int32_t SCALE_INDEX = 3;
116 constexpr int32_t GRAY_SCALE_START = 4;
117 constexpr int32_t GRAY_SCALE_END = 5;
118 constexpr float MAX_GRAYSCALE = 127.0f;
119 constexpr int32_t DECORATION_COLOR_INDEX = 1;
120 constexpr int32_t DECORATION_STYLE_INDEX = 2;
121 constexpr int32_t PROGRESS_TYPE_LINEAR = 1;
122 constexpr int32_t PROGRESS_TYPE_RING = 2;
123 constexpr int32_t PROGRESS_TYPE_SCALE = 3;
124 constexpr int32_t PROGRESS_TYPE_MOON = 7;
125 constexpr int32_t PROGRESS_TYPE_CAPSULE = 9;
126 const std::vector<int32_t> PROGRESS_TYPE_ARRAY = { PROGRESS_TYPE_LINEAR, PROGRESS_TYPE_RING, PROGRESS_TYPE_MOON,
127 PROGRESS_TYPE_SCALE, PROGRESS_TYPE_CAPSULE};
128 constexpr int32_t OBJECT_FIT_FILL = 0;
129 constexpr int32_t OBJECT_FIT_CONTAIN = 1;
130 constexpr int32_t OBJECT_FIT_COVER = 2;
131 constexpr int32_t OBJECT_FIT_AUTO = 3;
132 constexpr int32_t OBJECT_FIT_NONE = 5;
133 constexpr int32_t OBJECT_FIT_SCALE_DOWN = 6;
134 constexpr int32_t OBJECT_FIT_NONE_ALIGN_TOP_START = 7;
135 constexpr int32_t OBJECT_FIT_NONE_ALIGN_TOP = 8;
136 constexpr int32_t OBJECT_FIT_NONE_ALIGN_TOP_END = 9;
137 constexpr int32_t OBJECT_FIT_NONE_ALIGN_START = 10;
138 constexpr int32_t OBJECT_FIT_NONE_ALIGN_CENTER = 11;
139 constexpr int32_t OBJECT_FIT_NONE_ALIGN_END = 12;
140 constexpr int32_t OBJECT_FIT_NONE_ALIGN_BOTTOM_START = 13;
141 constexpr int32_t OBJECT_FIT_NONE_ALIGN_BOTTOM = 14;
142 constexpr int32_t OBJECT_FIT_NONE_ALIGN_BOTTOM_END = 15;
143 const std::vector<int32_t> OBJECT_FIT_ARRAY = { OBJECT_FIT_CONTAIN, OBJECT_FIT_COVER, OBJECT_FIT_AUTO,
144 OBJECT_FIT_FILL, OBJECT_FIT_SCALE_DOWN, OBJECT_FIT_NONE,
145 OBJECT_FIT_NONE_ALIGN_TOP_START, OBJECT_FIT_NONE_ALIGN_TOP, OBJECT_FIT_NONE_ALIGN_TOP_END,
146 OBJECT_FIT_NONE_ALIGN_START, OBJECT_FIT_NONE_ALIGN_CENTER, OBJECT_FIT_NONE_ALIGN_END,
147 OBJECT_FIT_NONE_ALIGN_BOTTOM_START, OBJECT_FIT_NONE_ALIGN_BOTTOM, OBJECT_FIT_NONE_ALIGN_BOTTOM_END };
148 constexpr int32_t IMAGE_SPAN_ALIGNMENT_BASELINE = 4;
149 constexpr int32_t IMAGE_SPAN_ALIGNMENT_BOTTOM = 3;
150 constexpr int32_t IMAGE_SPAN_ALIGNMENT_CENTER = 2;
151 constexpr int32_t IMAGE_SPAN_ALIGNMENT_TOP = 1;
152 const std::vector<int32_t> IMAGE_SPAN_ALIGNMENT_ARRAY = { IMAGE_SPAN_ALIGNMENT_BASELINE, IMAGE_SPAN_ALIGNMENT_BOTTOM,
153 IMAGE_SPAN_ALIGNMENT_CENTER, IMAGE_SPAN_ALIGNMENT_TOP };
154 const std::vector<std::string> CURVE_ARRAY = { "linear", "ease", "ease-in", "ease-out", "ease-in-out",
155 "fast-out-slow-in", "linear-out-slow-in", "fast-out-linear-in", "extreme-deceleration", "sharp", "rhythm", "smooth",
156 "friction" };
157 const std::vector<std::string> FONT_STYLES = { "normal", "italic" };
158 const std::vector<std::string> LENGTH_METRIC_UNIT = { "px", "vp", "fp" };
159 std::unordered_map<int32_t, bool> SPAN_ATTRIBUTES_MAP = {
160 { static_cast<int32_t>(NODE_SPAN_CONTENT), true },
161 { static_cast<int32_t>(NODE_TEXT_DECORATION), true },
162 { static_cast<int32_t>(NODE_FONT_COLOR), true },
163 { static_cast<int32_t>(NODE_FONT_SIZE), true },
164 { static_cast<int32_t>(NODE_FONT_STYLE), true },
165 { static_cast<int32_t>(NODE_FONT_WEIGHT), true },
166 { static_cast<int32_t>(NODE_TEXT_LINE_HEIGHT), true },
167 { static_cast<int32_t>(NODE_TEXT_CASE), true },
168 { static_cast<int32_t>(NODE_TEXT_LETTER_SPACING), true },
169 { static_cast<int32_t>(NODE_FONT_FAMILY), true },
170 { static_cast<int32_t>(NODE_TEXT_TEXT_SHADOW), true },
171 { static_cast<int32_t>(NODE_SPAN_TEXT_BACKGROUND_STYLE), true },
172 { static_cast<int32_t>(NODE_SPAN_BASELINE_OFFSET), true },
173 };
174 constexpr int32_t ANIMATION_DURATION_INDEX = 0;
175 constexpr int32_t ANIMATION_CURVE_INDEX = 1;
176 constexpr int32_t ANIMATION_DELAY_INDEX = 2;
177 constexpr int32_t ANIMATION_INTERATION_INDEX = 3;
178 constexpr int32_t ANIMATION_PLAY_MODE_INDEX = 4;
179 constexpr int32_t ANIMATION_TEMPO_INDEX = 5;
180 constexpr int32_t ANIMATION_PLAY_MODE_REVERSE_VALUE = 2;
181 constexpr int32_t ANIMATION_PLAY_MODE_ALTERNATE_VALUE = 1;
182 constexpr int32_t OPACITY_ANIMATION_BASE = 1;
183 constexpr int32_t MOVE_ANIMATION_BASE = 1;
184 constexpr int32_t ROTATE_ANIMATION_BASE = 5;
185 constexpr int32_t SCALE_ANIMATION_BASE = 3;
186 constexpr int32_t TRANSLATE_ANIMATION_BASE = 3;
187 constexpr int32_t DEFAULT_DURATION = 1000;
188 const std::vector<std::string> ALIGN_RULES_HORIZONTAL_ARRAY = { "start", "center", "end" };
189 const std::vector<std::string> ALIGN_RULES_VERTICAL_ARRAY = { "top", "center", "bottom" };
190 constexpr int32_t TWO = 2;
191 constexpr float ZERO_F = 0.0f;
192 constexpr float HUNDRED = 100.0f;
193 constexpr float SLIDER_STEP_MIN_F = 0.01f;
194 constexpr float HALF = 0.5f;
195 constexpr float DEFAULT_HINT_RADIUS = 16.0f;
196 constexpr int32_t REQUIRED_ONE_PARAM = 1;
197 constexpr int32_t REQUIRED_TWO_PARAM = 2;
198 constexpr int32_t REQUIRED_THREE_PARAM = 3;
199 constexpr int32_t REQUIRED_FOUR_PARAM = 4;
200 constexpr int32_t REQUIRED_FIVE_PARAM = 5;
201 constexpr int32_t REQUIRED_SEVEN_PARAM = 7;
202 constexpr int32_t REQUIRED_TWENTY_PARAM = 20;
203 constexpr int32_t MAX_ATTRIBUTE_ITEM_LEN = 20;
204 std::string g_stringValue;
205 ArkUI_NumberValue g_numberValues[MAX_ATTRIBUTE_ITEM_LEN] = { 0 };
206 ArkUI_AttributeItem g_attributeItem = { g_numberValues, MAX_ATTRIBUTE_ITEM_LEN, nullptr, nullptr };
207
208 constexpr uint32_t DEFAULT_COLOR = 0xFF000000; // Black
209 constexpr uint32_t DEFAULT_FIll_COLOR = 0x00000000;
210 constexpr int32_t DEFAULT_X = 0;
211 constexpr int32_t DEFAULT_Y = 0;
212
213 constexpr int32_t DEFAULT_TRUE = 1;
214 constexpr int32_t DEFAULT_FALSE = 0;
215
216 constexpr int32_t RETURN_SIZE_ONE = 1;
217 constexpr int32_t EDGE_TYPE_INDEX = 0;
218 constexpr int32_t EDGE_OFFSET_X_INDEX = 1;
219 constexpr int32_t EDGE_OFFSET_Y_INDEX = 2;
220 constexpr int32_t SELECTED_YEAR_INDEX = 0;
221 constexpr int32_t SELECTED_MONTH_INDEX = 1;
222 constexpr int32_t SELECTED_DAY_INDEX = 2;
223 constexpr int32_t DATEPICKER_START_TIME = 1970;
224 constexpr int32_t DATEPICKER_END_TIME = 2100;
225 constexpr int32_t CALENDAR_PICKER_FONT_COLOR_INDEX = 0;
226 constexpr int32_t CALENDAR_PICKER_FONT_SIZE_INDEX = 1;
227 constexpr int32_t CALENDAR_PICKER_FONT_WEIGHT_INDEX = 2;
228 constexpr int32_t IMAGE_SIZE_TYPE_CONTAIN_INDEX = 0;
229 constexpr int32_t IMAGE_SIZE_TYPE_COVER_INDEX = 1;
230 constexpr int32_t IMAGE_SIZE_TYPE_AUTO_INDEX = 2;
231 constexpr int32_t ERROR_CODE = -1;
232 constexpr int32_t OUTLINE_LEFT_WIDTH_INDEX = 0;
233 constexpr int32_t OUTLINE_TOP_WIDTH_INDEX = 1;
234 constexpr int32_t OUTLINE_RIGHT_WIDTH_INDEX = 2;
235 constexpr int32_t OUTLINE_BOTTOM_WIDTH_INDEX = 3;
236 constexpr uint32_t CONVERT_CONTENT_TYPE = 5;
237 constexpr uint32_t DEFAULT_PICKER_STYLE_COLOR = 0xFF182431;
238 constexpr uint32_t DEFAULT_PICKER_SELECTED_COLOR = 0xFF007DFF;
239 const std::string EMPTY_STR = "";
240 const std::vector<std::string> ACCESSIBILITY_LEVEL_VECTOR = { "auto", "yes", "no", "no-hide-descendants" };
241 std::map<std::string, int32_t> ACCESSIBILITY_LEVEL_MAP = { { "auto", 0 }, { "yes", 1 }, { "no", 2 },
242 { "no-hide-descendants", 3 } };
243
244 std::unordered_map<uint32_t, std::string> ACCESSIBILITY_ROLE_CONVERT_PROPERTY_MAP = {
245 { static_cast<uint32_t>(ARKUI_NODE_CUSTOM), "Custom" },
246 { static_cast<uint32_t>(ARKUI_NODE_TEXT), "Text" },
247 { static_cast<uint32_t>(ARKUI_NODE_SPAN), "Span" },
248 { static_cast<uint32_t>(ARKUI_NODE_IMAGE_SPAN), "ImageSpan" },
249 { static_cast<uint32_t>(ARKUI_NODE_IMAGE), "Image" },
250 { static_cast<uint32_t>(ARKUI_NODE_TOGGLE), "Toggle" },
251 { static_cast<uint32_t>(ARKUI_NODE_LOADING_PROGRESS), "LoadingProgress" },
252 { static_cast<uint32_t>(ARKUI_NODE_TEXT_INPUT), "TextInput" },
253 { static_cast<uint32_t>(ARKUI_NODE_TEXT_AREA), "TextArea" },
254 { static_cast<uint32_t>(ARKUI_NODE_BUTTON), "Button" },
255 { static_cast<uint32_t>(ARKUI_NODE_PROGRESS), "Progress" },
256 { static_cast<uint32_t>(ARKUI_NODE_CHECKBOX), "Checkbox" },
257 { static_cast<uint32_t>(ARKUI_NODE_XCOMPONENT), "Xcomponent" },
258 { static_cast<uint32_t>(ARKUI_NODE_DATE_PICKER), "DatePicker" },
259 { static_cast<uint32_t>(ARKUI_NODE_TIME_PICKER), "TimePicker" },
260 { static_cast<uint32_t>(ARKUI_NODE_TEXT_PICKER), "TextPicker" },
261 { static_cast<uint32_t>(ARKUI_NODE_CALENDAR_PICKER), "CalendarPicker" },
262 { static_cast<uint32_t>(ARKUI_NODE_SLIDER), "Slider" },
263 { static_cast<uint32_t>(ARKUI_NODE_RADIO), "Radio" },
264 { static_cast<uint32_t>(ARKUI_NODE_STACK), "Stack" },
265 { static_cast<uint32_t>(ARKUI_NODE_SWIPER), "Swiper" },
266 { static_cast<uint32_t>(ARKUI_NODE_SCROLL), "Scroll" },
267 { static_cast<uint32_t>(ARKUI_NODE_LIST), "List" },
268 { static_cast<uint32_t>(ARKUI_NODE_LIST_ITEM), "ListItem" },
269 { static_cast<uint32_t>(ARKUI_NODE_LIST_ITEM_GROUP), "ListItemGroup" },
270 { static_cast<uint32_t>(ARKUI_NODE_COLUMN), "Column" },
271 { static_cast<uint32_t>(ARKUI_NODE_ROW), "Row" },
272 { static_cast<uint32_t>(ARKUI_NODE_FLEX), "Flex" },
273 { static_cast<uint32_t>(ARKUI_NODE_REFRESH), "Refresh" },
274 { static_cast<uint32_t>(ARKUI_NODE_WATER_FLOW), "WaterFlow" },
275 { static_cast<uint32_t>(ARKUI_NODE_FLOW_ITEM), "FlowItem" },
276 { static_cast<uint32_t>(ARKUI_NODE_RELATIVE_CONTAINER), "RelativeContainer" },
277 { static_cast<uint32_t>(ARKUI_NODE_GRID), "Grid" },
278 { static_cast<uint32_t>(ARKUI_NODE_GRID_ITEM), "GridItem" },
279 { static_cast<uint32_t>(ARKUI_NODE_CUSTOM_SPAN), "CustomSpan" },
280 };
281
282 std::unordered_map<std::string, uint32_t> ACCESSIBILITY_ROLE_CONVERT_NATIVE_MAP = {
283 { "Custom", static_cast<uint32_t>(ARKUI_NODE_CUSTOM) },
284 { "Text", static_cast<uint32_t>(ARKUI_NODE_TEXT) },
285 { "Span", static_cast<uint32_t>(ARKUI_NODE_SPAN) },
286 { "ImageSpan", static_cast<uint32_t>(ARKUI_NODE_IMAGE_SPAN) },
287 { "Image", static_cast<uint32_t>(ARKUI_NODE_IMAGE) },
288 { "Toggle", static_cast<uint32_t>(ARKUI_NODE_TOGGLE) },
289 { "LoadingProgress", static_cast<uint32_t>(ARKUI_NODE_LOADING_PROGRESS) },
290 { "TextInput", static_cast<uint32_t>(ARKUI_NODE_TEXT_INPUT) },
291 { "TextArea", static_cast<uint32_t>(ARKUI_NODE_TEXT_AREA) },
292 { "Button", static_cast<uint32_t>(ARKUI_NODE_BUTTON) },
293 { "Progress", static_cast<uint32_t>(ARKUI_NODE_PROGRESS) },
294 { "Checkbox", static_cast<uint32_t>(ARKUI_NODE_CHECKBOX) },
295 { "Xcomponent", static_cast<uint32_t>(ARKUI_NODE_XCOMPONENT) },
296 { "DatePicker", static_cast<uint32_t>(ARKUI_NODE_DATE_PICKER) },
297 { "TimePicker", static_cast<uint32_t>(ARKUI_NODE_TIME_PICKER) },
298 { "TextPicker", static_cast<uint32_t>(ARKUI_NODE_TEXT_PICKER) },
299 { "CalendarPicker", static_cast<uint32_t>(ARKUI_NODE_CALENDAR_PICKER) },
300 { "Slider", static_cast<uint32_t>(ARKUI_NODE_SLIDER) },
301 { "Radio", static_cast<uint32_t>(ARKUI_NODE_RADIO) },
302 { "Stack", static_cast<uint32_t>(ARKUI_NODE_STACK) },
303 { "Swiper", static_cast<uint32_t>(ARKUI_NODE_SWIPER) },
304 { "Scroll", static_cast<uint32_t>(ARKUI_NODE_SCROLL) },
305 { "List", static_cast<uint32_t>(ARKUI_NODE_LIST) },
306 { "ListItem", static_cast<uint32_t>(ARKUI_NODE_LIST_ITEM) },
307 { "ListItemGroup", static_cast<uint32_t>(ARKUI_NODE_LIST_ITEM_GROUP) },
308 { "Column", static_cast<uint32_t>(ARKUI_NODE_COLUMN) },
309 { "Row", static_cast<uint32_t>(ARKUI_NODE_ROW) },
310 { "Flex", static_cast<uint32_t>(ARKUI_NODE_FLEX) },
311 { "Refresh", static_cast<uint32_t>(ARKUI_NODE_REFRESH) },
312 { "WaterFlow", static_cast<uint32_t>(ARKUI_NODE_WATER_FLOW) },
313 { "FlowItem", static_cast<uint32_t>(ARKUI_NODE_FLOW_ITEM) },
314 { "RelativeContainer", static_cast<uint32_t>(ARKUI_NODE_RELATIVE_CONTAINER) },
315 { "Grid", static_cast<uint32_t>(ARKUI_NODE_GRID) },
316 { "GridItem", static_cast<uint32_t>(ARKUI_NODE_GRID_ITEM) },
317 { "CustomSpan", static_cast<uint32_t>(ARKUI_NODE_CUSTOM_SPAN) },
318 };
319
ResetAttributeItem()320 void ResetAttributeItem()
321 {
322 for (int i = 0; i < MAX_ATTRIBUTE_ITEM_LEN; ++i) {
323 g_numberValues[i].i32 = 0;
324 }
325 g_attributeItem.size = 0;
326 g_attributeItem.string = nullptr;
327 g_attributeItem.object = nullptr;
328 }
StringToColorInt(const char * string,uint32_t defaultValue=0)329 uint32_t StringToColorInt(const char* string, uint32_t defaultValue = 0)
330 {
331 std::smatch matches;
332 std::string colorStr(string);
333 if (std::regex_match(colorStr, matches, COLOR_WITH_MAGIC)) {
334 colorStr.erase(0, 1);
335 constexpr int colorNumFormat = 16;
336 errno = 0;
337 char* end = nullptr;
338 unsigned long int value = strtoul(colorStr.c_str(), &end, colorNumFormat);
339 if (errno == ERANGE) {
340 LOGE("%{public}s is out of range.", colorStr.c_str());
341 }
342 if (value == 0 && end == colorStr.c_str()) {
343 LOGW("input %{public}s can not covert to number, use default color:0x00000000" , colorStr.c_str());
344 }
345
346 return value;
347 }
348 return defaultValue;
349 }
350
GetDefaultUnit(ArkUI_NodeHandle nodePtr,int32_t defaultUnit)351 int32_t GetDefaultUnit(ArkUI_NodeHandle nodePtr, int32_t defaultUnit)
352 {
353 if (nodePtr->lengthMetricUnit == ARKUI_LENGTH_METRIC_UNIT_DEFAULT) {
354 return defaultUnit;
355 }
356 return static_cast<int32_t>(nodePtr->lengthMetricUnit);
357 }
358
StringToInt(const char * string,int defaultValue=0)359 int StringToInt(const char* string, int defaultValue = 0)
360 {
361 char* end;
362 auto value = std::strtol(string, &end, 10);
363 if (end == string || errno == ERANGE || (value < INT_MIN || value > INT_MAX)) {
364 return defaultValue;
365 }
366 return value;
367 }
368
StringToEnumInt(const char * value,const std::vector<std::string> & vec,int defaultValue)369 int StringToEnumInt(const char* value, const std::vector<std::string>& vec, int defaultValue)
370 {
371 std::string input(value);
372 auto it = std::find_if(vec.begin(), vec.end(), [&input](const std::string& str) { return str == input; });
373 if (it != vec.end()) {
374 return std::distance(vec.begin(), it);
375 }
376 return defaultValue;
377 }
378
CurveToString(int curve)379 std::string CurveToString(int curve)
380 {
381 std::string curveStr = "linear";
382 switch (curve) {
383 case ArkUI_AnimationCurve::ARKUI_CURVE_LINEAR:
384 curveStr = "linear";
385 break;
386 case ArkUI_AnimationCurve::ARKUI_CURVE_EASE:
387 curveStr = "ease";
388 break;
389 case ArkUI_AnimationCurve::ARKUI_CURVE_EASE_IN:
390 curveStr = "ease-in";
391 break;
392 case ArkUI_AnimationCurve::ARKUI_CURVE_EASE_OUT:
393 curveStr = "ease-out";
394 break;
395 case ArkUI_AnimationCurve::ARKUI_CURVE_EASE_IN_OUT:
396 curveStr = "ease-in-out";
397 break;
398 case ArkUI_AnimationCurve::ARKUI_CURVE_FAST_OUT_SLOW_IN:
399 curveStr = "fast-out-slow-in";
400 break;
401 case ArkUI_AnimationCurve::ARKUI_CURVE_LINEAR_OUT_SLOW_IN:
402 curveStr = "linear-out-slow-in";
403 break;
404 case ArkUI_AnimationCurve::ARKUI_CURVE_FAST_OUT_LINEAR_IN:
405 curveStr = "fast-out-linear-in";
406 break;
407 case ArkUI_AnimationCurve::ARKUI_CURVE_EXTREME_DECELERATION:
408 curveStr = "extreme-deceleration";
409 break;
410 case ArkUI_AnimationCurve::ARKUI_CURVE_SHARP:
411 curveStr = "sharp";
412 break;
413 case ArkUI_AnimationCurve::ARKUI_CURVE_RHYTHM:
414 curveStr = "rhythm";
415 break;
416 case ArkUI_AnimationCurve::ARKUI_CURVE_SMOOTH:
417 curveStr = "smooth";
418 break;
419 case ArkUI_AnimationCurve::ARKUI_CURVE_FRICTION:
420 curveStr = "friction";
421 break;
422 default:
423 break;
424 }
425 return curveStr;
426 }
427
ShapeToString(int shape)428 std::string ShapeToString(int shape)
429 {
430 std::string shapeStr = "rect";
431 switch (shape) {
432 case NUM_0:
433 shapeStr = "rect";
434 break;
435 case NUM_1:
436 shapeStr = "circle";
437 break;
438 case NUM_2:
439 shapeStr = "ellipse";
440 break;
441 case NUM_3:
442 shapeStr = "path";
443 break;
444 case NUM_4:
445 shapeStr = "progress";
446 break;
447 default:
448 break;
449 }
450 return shapeStr;
451 }
452
ConvertBlurStyle(int32_t originBlurStyle)453 int32_t ConvertBlurStyle(int32_t originBlurStyle)
454 {
455 if (originBlurStyle < static_cast<int32_t>(ARKUI_BLUR_STYLE_NONE)) {
456 return originBlurStyle + 1;
457 } else if (originBlurStyle == static_cast<int32_t>(ARKUI_BLUR_STYLE_NONE)) {
458 return 0;
459 }
460 return originBlurStyle;
461 }
462
UnConvertBlurStyle(int32_t blurStyle)463 int32_t UnConvertBlurStyle(int32_t blurStyle)
464 {
465 if (blurStyle == 0) {
466 return static_cast<int32_t>(ARKUI_BLUR_STYLE_NONE);
467 } else if (blurStyle <= static_cast<int32_t>(ARKUI_BLUR_STYLE_NONE)) {
468 return blurStyle - 1;
469 }
470 return blurStyle;
471 }
472
ConvertAnimationDirection(int32_t animationPlayMode)473 int32_t ConvertAnimationDirection(int32_t animationPlayMode)
474 {
475 if (animationPlayMode == static_cast<int32_t>(ARKUI_ANIMATION_PLAY_MODE_REVERSE)) {
476 return ANIMATION_PLAY_MODE_REVERSE_VALUE;
477 } else if (animationPlayMode == static_cast<int32_t>(ARKUI_ANIMATION_PLAY_MODE_ALTERNATE)) {
478 return ANIMATION_PLAY_MODE_ALTERNATE_VALUE;
479 }
480 return animationPlayMode;
481 }
482
UnConvertAnimationDirection(int32_t animationPlayMode)483 int32_t UnConvertAnimationDirection(int32_t animationPlayMode)
484 {
485 if (animationPlayMode == static_cast<int32_t>(ANIMATION_PLAY_MODE_REVERSE_VALUE)) {
486 return static_cast<int32_t>(ARKUI_ANIMATION_PLAY_MODE_REVERSE);
487 } else if (animationPlayMode == static_cast<int32_t>(ANIMATION_PLAY_MODE_ALTERNATE_VALUE)) {
488 return static_cast<int32_t>(ARKUI_ANIMATION_PLAY_MODE_ALTERNATE);
489 }
490 return animationPlayMode;
491 }
492
ConvertAccessibilityRole(uint32_t nodeTypeInt)493 std::string ConvertAccessibilityRole(uint32_t nodeTypeInt)
494 {
495 std::string nodeTypeString = EMPTY_STR;
496 auto it = ACCESSIBILITY_ROLE_CONVERT_PROPERTY_MAP.find(nodeTypeInt);
497 if (it != ACCESSIBILITY_ROLE_CONVERT_PROPERTY_MAP.end()) {
498 return ACCESSIBILITY_ROLE_CONVERT_PROPERTY_MAP[nodeTypeInt];
499 }
500 return nodeTypeString;
501 }
502
UnConvertAccessibilityRole(const std::string & nodeTypeString)503 int32_t UnConvertAccessibilityRole(const std::string& nodeTypeString)
504 {
505 int32_t nodeTypeInt = ERROR_CODE;
506 auto it = ACCESSIBILITY_ROLE_CONVERT_NATIVE_MAP.find(nodeTypeString);
507 if (it != ACCESSIBILITY_ROLE_CONVERT_NATIVE_MAP.end()) {
508 return static_cast<int32_t>(ACCESSIBILITY_ROLE_CONVERT_NATIVE_MAP[nodeTypeString]);
509 }
510 return nodeTypeInt;
511 }
512
IsLeapYear(uint32_t year)513 bool IsLeapYear(uint32_t year)
514 {
515 return (year % NUM_4 == 0 && year % NUM_100 != 0) || (year % NUM_400 == 0);
516 }
517
IsValidDate(uint32_t year,uint32_t month,uint32_t day)518 bool IsValidDate(uint32_t year, uint32_t month, uint32_t day)
519 {
520 if (year <= 0) {
521 return false;
522 }
523 if (month < NUM_1 || month > NUM_12) {
524 return false;
525 }
526 uint32_t daysInMonth[] = { 31, IsLeapYear(year) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
527 if (day < 1 || day > daysInMonth[month - 1]) {
528 return false;
529 }
530 return true;
531 }
532
CheckAttributeItemArray(const ArkUI_AttributeItem * item,int32_t requiredAtLeastSize)533 int32_t CheckAttributeItemArray(const ArkUI_AttributeItem* item, int32_t requiredAtLeastSize)
534 {
535 CHECK_NULL_RETURN(item, -1);
536 if (item->size < requiredAtLeastSize) {
537 return -1;
538 }
539 return item->size;
540 }
541
CheckAttributeIsBool(int32_t value)542 bool CheckAttributeIsBool(int32_t value)
543 {
544 if (value == DEFAULT_FALSE || value == DEFAULT_TRUE) {
545 return true;
546 }
547 return false;
548 }
549
CheckAttributeIsAlignment(int32_t value)550 bool CheckAttributeIsAlignment(int32_t value)
551 {
552 int32_t minEnumValue = static_cast<int32_t>(ArkUI_Alignment::ARKUI_ALIGNMENT_TOP_START);
553 int32_t maxEnumValue = static_cast<int32_t>(ArkUI_Alignment::ARKUI_ALIGNMENT_BOTTOM_END);
554 return value >= minEnumValue && value <= maxEnumValue;
555 }
556
CheckAttributeIsFontWeight(int32_t value)557 bool CheckAttributeIsFontWeight(int32_t value)
558 {
559 int32_t minEnumValue = static_cast<int32_t>(ArkUI_FontWeight::ARKUI_FONT_WEIGHT_W100);
560 int32_t maxEnumValue = static_cast<int32_t>(ArkUI_FontWeight::ARKUI_FONT_WEIGHT_REGULAR);
561 return value >= minEnumValue && value <= maxEnumValue;
562 }
563
CheckAttributeIsFontStyle(int32_t value)564 bool CheckAttributeIsFontStyle(int32_t value)
565 {
566 int32_t minEnumValue = static_cast<int32_t>(ArkUI_FontStyle::ARKUI_FONT_STYLE_NORMAL);
567 int32_t maxEnumValue = static_cast<int32_t>(ArkUI_FontStyle::ARKUI_FONT_STYLE_ITALIC);
568 return value >= minEnumValue && value <= maxEnumValue;
569 }
570
CheckAttributeIsTextHeightAdaptivePolicy(int32_t value)571 bool CheckAttributeIsTextHeightAdaptivePolicy(int32_t value)
572 {
573 int32_t minEnumValue =
574 static_cast<int32_t>(ArkUI_TextHeightAdaptivePolicy::ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_MAX_LINES_FIRST);
575 int32_t maxEnumValue =
576 static_cast<int32_t>(ArkUI_TextHeightAdaptivePolicy::ARKUI_TEXT_HEIGHT_ADAPTIVE_POLICY_LAYOUT_CONSTRAINT_FIRST);
577 return value >= minEnumValue && value <= maxEnumValue;
578 }
579
CheckAttributeIsCopyOptions(int32_t value)580 bool CheckAttributeIsCopyOptions(int32_t value)
581 {
582 int32_t minEnumValue = static_cast<int32_t>(ArkUI_CopyOptions::ARKUI_COPY_OPTIONS_NONE);
583 int32_t maxEnumValue = static_cast<int32_t>(ArkUI_CopyOptions::ARKUI_COPY_OPTIONS_CROSS_DEVICE);
584 return value >= minEnumValue && value <= maxEnumValue;
585 }
586
CheckAttributeIsAnimationCurve(int32_t value)587 bool CheckAttributeIsAnimationCurve(int32_t value)
588 {
589 int32_t minEnumValue = static_cast<int32_t>(ArkUI_AnimationCurve::ARKUI_CURVE_LINEAR);
590 int32_t maxEnumValue = static_cast<int32_t>(ArkUI_AnimationCurve::ARKUI_CURVE_FRICTION);
591 return value >= minEnumValue && value <= maxEnumValue;
592 }
593
CheckAttributeIsScrollNestedMode(int32_t value)594 bool CheckAttributeIsScrollNestedMode(int32_t value)
595 {
596 int32_t minEnumValue = static_cast<int32_t>(ArkUI_ScrollNestedMode::ARKUI_SCROLL_NESTED_MODE_SELF_ONLY);
597 int32_t maxEnumValue = static_cast<int32_t>(ArkUI_ScrollNestedMode::ARKUI_SCROLL_NESTED_MODE_PARALLEL);
598 return value >= minEnumValue && value <= maxEnumValue;
599 }
600
CheckAttributeIsSliderStyle(int32_t value)601 bool CheckAttributeIsSliderStyle(int32_t value)
602 {
603 int32_t minEnumValue = static_cast<int32_t>(ArkUI_SliderStyle::ARKUI_SLIDER_STYLE_OUT_SET);
604 int32_t maxEnumValue = static_cast<int32_t>(ArkUI_SliderStyle::ARKUI_SLIDER_STYLE_NONE);
605 return value >= minEnumValue && value <= maxEnumValue;
606 }
607
CheckAttributeIsSliderBlockStyle(int32_t value)608 bool CheckAttributeIsSliderBlockStyle(int32_t value)
609 {
610 int32_t minEnumValue = static_cast<int32_t>(ArkUI_SliderBlockStyle::ARKUI_SLIDER_BLOCK_STYLE_DEFAULT);
611 int32_t maxEnumValue = static_cast<int32_t>(ArkUI_SliderBlockStyle::ARKUI_SLIDER_BLOCK_STYLE_SHAPE);
612 return value >= minEnumValue && value <= maxEnumValue;
613 }
614
CheckAttributeIsSliderDirection(int32_t value)615 bool CheckAttributeIsSliderDirection(int32_t value)
616 {
617 int32_t minEnumValue = static_cast<int32_t>(ArkUI_SliderDirection::ARKUI_SLIDER_DIRECTION_VERTICAL);
618 int32_t maxEnumValue = static_cast<int32_t>(ArkUI_SliderDirection::ARKUI_SLIDER_DIRECTION_HORIZONTAL);
619 return value >= minEnumValue && value <= maxEnumValue;
620 }
621
CheckAttributeIsCheckboxShape(int32_t value)622 bool CheckAttributeIsCheckboxShape(int32_t value)
623 {
624 int32_t minEnumValue = static_cast<int32_t>(ArkUI_CheckboxShape::ArkUI_CHECKBOX_SHAPE_CIRCLE);
625 int32_t maxEnumValue = static_cast<int32_t>(ArkUI_CheckboxShape::ArkUI_CHECKBOX_SHAPE_ROUNDED_SQUARE);
626 return value >= minEnumValue && value <= maxEnumValue;
627 }
628
CheckAttributeIsListItemAlign(int32_t value)629 bool CheckAttributeIsListItemAlign(int32_t value)
630 {
631 int32_t minEnumValue = static_cast<int32_t>(ArkUI_ListItemAlignment::ARKUI_LIST_ITEM_ALIGNMENT_START);
632 int32_t maxEnumValue =
633 static_cast<int32_t>(ArkUI_ListItemAlignment::ARKUI_LIST_ITEM_ALIGNMENT_END);
634 return value >= minEnumValue && value <= maxEnumValue;
635 }
636
CheckAttributeIsAccessibilityLevel(int32_t value)637 bool CheckAttributeIsAccessibilityLevel(int32_t value)
638 {
639 int32_t minEnumValue = static_cast<int32_t>(ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_AUTO);
640 int32_t maxEnumValue =
641 static_cast<int32_t>(ArkUI_AccessibilityMode::ARKUI_ACCESSIBILITY_MODE_DISABLED_FOR_DESCENDANTS);
642 return value >= minEnumValue && value <= maxEnumValue;
643 }
644
CheckAttributeIsChainStyle(int32_t value)645 bool CheckAttributeIsChainStyle(int32_t value)
646 {
647 int32_t minEnumValue =
648 static_cast<int32_t>(ArkUI_RelativeLayoutChainStyle::ARKUI_RELATIVE_LAYOUT_CHAIN_STYLE_SPREAD);
649 int32_t maxEnumValue =
650 static_cast<int32_t>(ArkUI_RelativeLayoutChainStyle::ARKUI_RELATIVE_LAYOUT_CHAIN_STYLE_PACKED);
651 return value >= minEnumValue && value <= maxEnumValue;
652 }
653
CheckAttributeIsAxis(int32_t value)654 bool CheckAttributeIsAxis(int32_t value)
655 {
656 int32_t minEnumValue = static_cast<int32_t>(ArkUI_Axis::ARKUI_AXIS_VERTICAL);
657 int32_t maxEnumValue =
658 static_cast<int32_t>(ArkUI_Axis::ARKUI_AXIS_HORIZONTAL);
659 return value >= minEnumValue && value <= maxEnumValue;
660 }
661
CheckAttributeString(const ArkUI_AttributeItem * item)662 bool CheckAttributeString(const ArkUI_AttributeItem* item)
663 {
664 CHECK_NULL_RETURN(item, false);
665 if (!item->string) {
666 return false;
667 }
668 return true;
669 }
670
CheckAttributeObject(const ArkUI_AttributeItem * item)671 bool CheckAttributeObject(const ArkUI_AttributeItem* item)
672 {
673 CHECK_NULL_RETURN(item, false);
674 if (!item->object) {
675 return false;
676 }
677 return true;
678 }
679
CheckAttributeObjectAndSize(const ArkUI_AttributeItem * item)680 bool CheckAttributeObjectAndSize(const ArkUI_AttributeItem* item)
681 {
682 CHECK_NULL_RETURN(item, false);
683 if (!item->object || item->size == 0) {
684 return false;
685 }
686 return true;
687 }
688
ParseImages(const ArkUI_AttributeItem * item,ArkUIImageFrameInfo * imageInfos,ArkUI_NodeHandle node)689 bool ParseImages(const ArkUI_AttributeItem* item, ArkUIImageFrameInfo* imageInfos, ArkUI_NodeHandle node)
690 {
691 auto images = reinterpret_cast<ArkUI_ImageAnimatorFrameInfo**>(item->object);
692 if (!images) {
693 return false;
694 }
695 for (int32_t i = 0; i < item->size; i++) {
696 CHECK_NULL_RETURN(images[i], false);
697 if (images[i]->drawableDescriptor) {
698 if (images[i]->drawableDescriptor->drawableDescriptor) {
699 imageInfos[i].drawable = images[i]->drawableDescriptor->drawableDescriptor.get();
700 } else if (images[i]->drawableDescriptor->resource) {
701 imageInfos[i].src = images[i]->drawableDescriptor->resource->src.c_str();
702 }
703 } else {
704 imageInfos[i].src = images[i]->src.c_str();
705 }
706 imageInfos[i].width = images[i]->width.value_or(0);
707 imageInfos[i].height = images[i]->height.value_or(0);
708 imageInfos[i].top = images[i]->top.value_or(0);
709 imageInfos[i].left = images[i]->left.value_or(0);
710 imageInfos[i].unit = GetDefaultUnit(node, UNIT_PX);
711 imageInfos[i].duration = images[i]->duration.value_or(0);
712 }
713 node->imageFrameInfos = images;
714 return true;
715 }
716
CheckAttributeIndicator(const ArkUI_AttributeItem * item)717 bool CheckAttributeIndicator(const ArkUI_AttributeItem* item)
718 {
719 CHECK_NULL_RETURN(item, false);
720 if (item->value[0].i32 != ARKUI_SWIPER_INDICATOR_TYPE_DOT &&
721 item->value[0].i32 != ARKUI_SWIPER_INDICATOR_TYPE_DIGIT) {
722 return false;
723 }
724 if (!item->object) {
725 return false;
726 }
727 return true;
728 }
729
CheckAnimation(const ArkUI_AttributeItem * item,int32_t size,int32_t animationIndexBase)730 bool CheckAnimation(const ArkUI_AttributeItem* item, int32_t size, int32_t animationIndexBase)
731 {
732 CHECK_NULL_RETURN(item, false);
733 const int32_t animationCurveIndex = animationIndexBase + ANIMATION_CURVE_INDEX;
734 if (animationCurveIndex < size &&
735 (item->value[animationCurveIndex].i32 < 0 ||
736 item->value[animationCurveIndex].i32 > static_cast<int32_t>(ARKUI_CURVE_FRICTION))) {
737 return false;
738 }
739 const int32_t playModeIndex = animationIndexBase + ANIMATION_PLAY_MODE_INDEX;
740 if (playModeIndex < size &&
741 (item->value[playModeIndex].i32 < 0 ||
742 item->value[playModeIndex].i32 > static_cast<int32_t>(ARKUI_ANIMATION_PLAY_MODE_ALTERNATE_REVERSE))) {
743 return false;
744 }
745 const int32_t animationTempoIndex = animationIndexBase + ANIMATION_TEMPO_INDEX;
746 if (animationTempoIndex < size && LessNotEqual(item->value[animationTempoIndex].f32, 0.0f)) {
747 return false;
748 }
749 return true;
750 }
751
ParseAnimation(const ArkUI_AttributeItem * item,int32_t actualSize,ArkUIAnimationOptionType & animationOption,const int animationIndexBase)752 void ParseAnimation(const ArkUI_AttributeItem* item, int32_t actualSize, ArkUIAnimationOptionType& animationOption,
753 const int animationIndexBase)
754 {
755 const int32_t animationDurationIndex = animationIndexBase + ANIMATION_DURATION_INDEX;
756 int32_t duration = DEFAULT_DURATION;
757 if (animationDurationIndex < actualSize) {
758 duration = item->value[animationDurationIndex].i32;
759 }
760 const int32_t animationCurveIndex = animationIndexBase + ANIMATION_CURVE_INDEX;
761 int32_t curve = 0;
762 if (animationCurveIndex < actualSize &&
763 item->value[animationCurveIndex].i32 < static_cast<int32_t>(CURVE_ARRAY.size())) {
764 curve = item->value[animationCurveIndex].i32;
765 }
766 const int32_t animationDelayIndex = animationIndexBase + ANIMATION_DELAY_INDEX;
767 int32_t delay = 0;
768 if (animationDelayIndex < actualSize) {
769 delay = item->value[animationDelayIndex].i32;
770 }
771 const int32_t animationIterationsIndex = animationIndexBase + ANIMATION_INTERATION_INDEX;
772 int32_t iterations = 1;
773 if (animationIterationsIndex < actualSize) {
774 iterations = item->value[animationIterationsIndex].i32;
775 }
776 const int32_t animationPlayModeIndex = animationIndexBase + ANIMATION_PLAY_MODE_INDEX;
777 int32_t direction = 0;
778 if (animationPlayModeIndex < actualSize) {
779 direction = ConvertAnimationDirection(item->value[animationPlayModeIndex].i32);
780 }
781 const int32_t animationTempoIndex = animationIndexBase + ANIMATION_TEMPO_INDEX;
782 float tempo = 1.0f;
783 if (animationTempoIndex < actualSize) {
784 tempo = item->value[animationTempoIndex].f32;
785 }
786 animationOption.duration = duration;
787 animationOption.curve = curve;
788 animationOption.delay = delay;
789 animationOption.iteration = iterations;
790 animationOption.playMode = direction;
791 animationOption.tempo = tempo;
792 }
793
ResetAnimation(ArkUIAnimationOptionType & animationOption)794 void ResetAnimation(ArkUIAnimationOptionType& animationOption)
795 {
796 animationOption.duration = DEFAULT_DURATION;
797 animationOption.curve = 0;
798 animationOption.delay = 0;
799 animationOption.iteration = 1;
800 animationOption.playMode = 0;
801 animationOption.tempo = 1.0f;
802 }
803
804 // Common Attributes functions
SetWidth(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)805 int32_t SetWidth(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
806 {
807 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
808 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
809 return ERROR_CODE_PARAM_INVALID;
810 }
811 // already check in entry point.
812 auto* fullImpl = GetFullImpl();
813 // 1 for vp. check in DimensionUnit.
814 fullImpl->getNodeModifiers()->getCommonModifier()->setWidth(
815 node->uiNodeHandle, item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr);
816 return ERROR_CODE_NO_ERROR;
817 }
818
ResetWidth(ArkUI_NodeHandle node)819 void ResetWidth(ArkUI_NodeHandle node)
820 {
821 auto* fullImpl = GetFullImpl();
822 fullImpl->getNodeModifiers()->getCommonModifier()->resetWidth(node->uiNodeHandle);
823 }
824
GetWidth(ArkUI_NodeHandle node)825 const ArkUI_AttributeItem* GetWidth(ArkUI_NodeHandle node)
826 {
827 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
828 g_numberValues[0].f32 = modifier->getWidth(node->uiNodeHandle, GetDefaultUnit(node, UNIT_VP));
829 if (LessNotEqual(g_numberValues[0].f32, 0.0f)) {
830 return nullptr;
831 }
832 return &g_attributeItem;
833 }
834
SetHeight(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)835 int32_t SetHeight(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
836 {
837 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
838 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
839 return ERROR_CODE_PARAM_INVALID;
840 }
841 // already check in entry point.
842 auto* fullImpl = GetFullImpl();
843 // 1 for vp. check in DimensionUnit.
844 fullImpl->getNodeModifiers()->getCommonModifier()->setHeight(
845 node->uiNodeHandle, item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr);
846 return ERROR_CODE_NO_ERROR;
847 }
848
ResetHeight(ArkUI_NodeHandle node)849 void ResetHeight(ArkUI_NodeHandle node)
850 {
851 auto* fullImpl = GetFullImpl();
852 fullImpl->getNodeModifiers()->getCommonModifier()->resetHeight(node->uiNodeHandle);
853 }
854
GetHeight(ArkUI_NodeHandle node)855 const ArkUI_AttributeItem* GetHeight(ArkUI_NodeHandle node)
856 {
857 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
858 g_numberValues[0].f32 = modifier->getHeight(node->uiNodeHandle, GetDefaultUnit(node, UNIT_VP));
859 if (LessNotEqual(g_numberValues[0].f32, 0.0f)) {
860 return nullptr;
861 }
862 return &g_attributeItem;
863 }
864
SetBackgroundColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)865 int32_t SetBackgroundColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
866 {
867 if (item->size == 0) {
868 return ERROR_CODE_PARAM_INVALID;
869 }
870 // already check in entry point.
871 auto* fullImpl = GetFullImpl();
872 if (node->type == ARKUI_NODE_BUTTON) {
873 fullImpl->getNodeModifiers()->getButtonModifier()->setButtonBackgroundColor(
874 node->uiNodeHandle, item->value[NUM_0].u32);
875 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
876 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputBackgroundColor(
877 node->uiNodeHandle, item->value[NUM_0].u32);
878 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
879 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBackgroundColor(
880 node->uiNodeHandle, item->value[NUM_0].u32);
881 } else {
882 fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundColor(
883 node->uiNodeHandle, item->value[NUM_0].u32);
884 }
885 return ERROR_CODE_NO_ERROR;
886 }
887
ResetBackgroundColor(ArkUI_NodeHandle node)888 void ResetBackgroundColor(ArkUI_NodeHandle node)
889 {
890 auto* fullImpl = GetFullImpl();
891 if (node->type == ARKUI_NODE_BUTTON) {
892 fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonBackgroundColor(node->uiNodeHandle);
893 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
894 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputBackgroundColor(node->uiNodeHandle);
895 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
896 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaBackgroundColor(node->uiNodeHandle);
897 } else {
898 fullImpl->getNodeModifiers()->getCommonModifier()->resetBackgroundColor(node->uiNodeHandle);
899 }
900 }
901
GetBackgroundColor(ArkUI_NodeHandle node)902 const ArkUI_AttributeItem* GetBackgroundColor(ArkUI_NodeHandle node)
903 {
904 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
905 g_numberValues[0].u32 = modifier->getBackgroundColor(node->uiNodeHandle);
906 return &g_attributeItem;
907 }
908
SetBackgroundImage(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)909 int32_t SetBackgroundImage(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
910 {
911 if ((!item->string && !item->object) || (item->string && item->object)) {
912 return ERROR_CODE_PARAM_INVALID;
913 }
914 if (item->size == NUM_1 &&
915 (item->value[NUM_0].i32 < 0 || item->value[NUM_0].i32 > static_cast<int32_t>(ARKUI_IMAGE_REPEAT_XY))) {
916 return ERROR_CODE_PARAM_INVALID;
917 }
918 // already check in entry point.
919 auto* fullImpl = GetFullImpl();
920 std::string bundle;
921 std::string module;
922 int repeat = item->size == NUM_1 ? item->value[NUM_0].i32 : ARKUI_IMAGE_REPEAT_NONE;
923 if (item->string) {
924 fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundImage(
925 node->uiNodeHandle, item->string, bundle.c_str(), module.c_str(), repeat);
926 } else {
927 auto drawableDescriptor = reinterpret_cast<ArkUI_DrawableDescriptor*>(item->object);
928 if (!drawableDescriptor->drawableDescriptor) {
929 return ERROR_CODE_PARAM_INVALID;
930 }
931 fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundImagePixelMap(
932 node->uiNodeHandle, drawableDescriptor->drawableDescriptor.get(), repeat);
933 }
934 return ERROR_CODE_NO_ERROR;
935 }
936
ResetBackgroundImage(ArkUI_NodeHandle node)937 void ResetBackgroundImage(ArkUI_NodeHandle node)
938 {
939 auto* fullImpl = GetFullImpl();
940 fullImpl->getNodeModifiers()->getCommonModifier()->resetBackgroundImage(node->uiNodeHandle);
941 }
942
GetBackgroundImage(ArkUI_NodeHandle node)943 const ArkUI_AttributeItem* GetBackgroundImage(ArkUI_NodeHandle node)
944 {
945 auto* fullImpl = GetFullImpl();
946 ArkUIBackgroundImage options;
947 fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundImage(node->uiNodeHandle, &options);
948 g_numberValues[NUM_0].i32 = options.repeat;
949 g_attributeItem.string = options.src;
950 return &g_attributeItem;
951 }
952
SetPadding(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)953 int32_t SetPadding(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
954 {
955 if (item->size != NUM_1 && item->size != NUM_4) {
956 return ERROR_CODE_PARAM_INVALID;
957 }
958 // already check in entry point.
959 auto* fullImpl = GetFullImpl();
960 int topIndex = NUM_0;
961 int rightIndex = item->size == NUM_1 ? NUM_0 : NUM_1;
962 int bottomIndex = item->size == NUM_1 ? NUM_0 : NUM_2;
963 int leftIndex = item->size == NUM_1 ? NUM_0 : NUM_3;
964 int32_t unit = GetDefaultUnit(node, UNIT_VP);
965 struct ArkUISizeType top = { item->value[topIndex].f32, unit };
966 struct ArkUISizeType right = { item->value[rightIndex].f32, unit };
967 struct ArkUISizeType bottom = { item->value[bottomIndex].f32, unit };
968 struct ArkUISizeType left = { item->value[leftIndex].f32, unit };
969 if (node->type == ARKUI_NODE_TEXT_INPUT) {
970 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPadding(
971 node->uiNodeHandle, &top, &right, &bottom, &left);
972 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
973 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaPadding(
974 node->uiNodeHandle, &top, &right, &bottom, &left);
975 } else {
976 fullImpl->getNodeModifiers()->getCommonModifier()->setPadding(
977 node->uiNodeHandle, &top, &right, &bottom, &left);
978 }
979 return ERROR_CODE_NO_ERROR;
980 }
981
ResetPadding(ArkUI_NodeHandle node)982 void ResetPadding(ArkUI_NodeHandle node)
983 {
984 auto* fullImpl = GetFullImpl();
985 if (node->type == ARKUI_NODE_TEXT_INPUT) {
986 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputPadding(node->uiNodeHandle);
987 } else {
988 fullImpl->getNodeModifiers()->getCommonModifier()->resetPadding(node->uiNodeHandle);
989 }
990 }
991
GetPadding(ArkUI_NodeHandle node)992 const ArkUI_AttributeItem* GetPadding(ArkUI_NodeHandle node)
993 {
994 auto* fullImpl = GetFullImpl();
995 ArkUI_Float32 paddings[NUM_4];
996 ArkUI_Int32 length = 0;
997 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
998 if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
999 fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaPadding(
1000 node->uiNodeHandle, &paddings, length, unit);
1001 } else {
1002 fullImpl->getNodeModifiers()->getCommonModifier()->getPadding(node->uiNodeHandle, &paddings, length, unit);
1003 }
1004 g_numberValues[NUM_0].f32 = paddings[NUM_0];
1005 g_numberValues[NUM_1].f32 = paddings[NUM_1];
1006 g_numberValues[NUM_2].f32 = paddings[NUM_2];
1007 g_numberValues[NUM_3].f32 = paddings[NUM_3];
1008 return &g_attributeItem;
1009 }
1010
SetKey(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1011 int32_t SetKey(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1012 {
1013 if (!item->string) {
1014 return ERROR_CODE_PARAM_INVALID;
1015 }
1016 // already check in entry point.
1017 auto* fullImpl = GetFullImpl();
1018 fullImpl->getNodeModifiers()->getCommonModifier()->setKey(node->uiNodeHandle, item->string);
1019 return ERROR_CODE_NO_ERROR;
1020 }
1021
ResetKey(ArkUI_NodeHandle node)1022 void ResetKey(ArkUI_NodeHandle node)
1023 {
1024 auto* fullImpl = GetFullImpl();
1025 fullImpl->getNodeModifiers()->getCommonModifier()->resetKey(node->uiNodeHandle);
1026 }
1027
GetKey(ArkUI_NodeHandle node)1028 const ArkUI_AttributeItem* GetKey(ArkUI_NodeHandle node)
1029 {
1030 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1031 g_attributeItem.string = modifier->getKey(node->uiNodeHandle);
1032 return &g_attributeItem;
1033 }
1034
SetEnabled(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1035 int32_t SetEnabled(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1036 {
1037 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
1038 if (actualSize < 0 || item->value[NUM_0].i32 < 0) {
1039 return ERROR_CODE_PARAM_INVALID;
1040 }
1041 // already check in entry point.
1042 auto* fullImpl = GetFullImpl();
1043 fullImpl->getNodeModifiers()->getCommonModifier()->setEnabled(node->uiNodeHandle, item->value[0].i32);
1044 return ERROR_CODE_NO_ERROR;
1045 }
1046
ResetEnabled(ArkUI_NodeHandle node)1047 void ResetEnabled(ArkUI_NodeHandle node)
1048 {
1049 auto* fullImpl = GetFullImpl();
1050 fullImpl->getNodeModifiers()->getCommonModifier()->resetEnabled(node->uiNodeHandle);
1051 }
1052
GetEnabled(ArkUI_NodeHandle node)1053 const ArkUI_AttributeItem* GetEnabled(ArkUI_NodeHandle node)
1054 {
1055 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1056 g_numberValues[0].i32 = modifier->getEnabled(node->uiNodeHandle);
1057 return &g_attributeItem;
1058 }
1059
SetMargin(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1060 int32_t SetMargin(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1061 {
1062 if (!item || (item->size != NUM_4 && item->size != NUM_1)) {
1063 return ERROR_CODE_PARAM_INVALID;
1064 }
1065 auto* fullImpl = GetFullImpl();
1066 ArkUISizeType top, right, bottom, left;
1067 top.value = right.value = bottom.value = left.value = NUM_0;
1068 top.unit = right.unit = bottom.unit = left.unit = GetDefaultUnit(node, UNIT_VP);
1069 if (item->size == NUM_1) {
1070 top.value = right.value = bottom.value = left.value = item->value[NUM_0].f32;
1071 } else if (item->size == NUM_4) {
1072 top.value = item->value[NUM_0].f32;
1073 right.value = item->value[NUM_1].f32;
1074 bottom.value = item->value[NUM_2].f32;
1075 left.value = item->value[NUM_3].f32;
1076 }
1077 if (node->type == ARKUI_NODE_TEXT_INPUT) {
1078 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputMargin(
1079 node->uiNodeHandle, &top, &right, &bottom, &left);
1080 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
1081 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaMargin(
1082 node->uiNodeHandle, &top, &right, &bottom, &left);
1083 } else {
1084 fullImpl->getNodeModifiers()->getCommonModifier()->setMargin(node->uiNodeHandle, &top, &right, &bottom, &left);
1085 }
1086 return ERROR_CODE_NO_ERROR;
1087 }
1088
ResetMargin(ArkUI_NodeHandle node)1089 void ResetMargin(ArkUI_NodeHandle node)
1090 {
1091 // already check in entry point.
1092 auto* fullImpl = GetFullImpl();
1093 if (node->type == ARKUI_NODE_TEXT_INPUT) {
1094 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputMargin(node->uiNodeHandle);
1095 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
1096 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaMargin(node->uiNodeHandle);
1097 } else {
1098 fullImpl->getNodeModifiers()->getCommonModifier()->resetMargin(node->uiNodeHandle);
1099 }
1100 }
1101
GetMargin(ArkUI_NodeHandle node)1102 const ArkUI_AttributeItem* GetMargin(ArkUI_NodeHandle node)
1103 {
1104 auto* fullImpl = GetFullImpl();
1105 ArkUI_Float32 margins[NUM_4];
1106 ArkUI_Int32 length = 0;
1107 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
1108 if (node->type == ARKUI_NODE_TEXT_INPUT) {
1109 fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputMargin(
1110 node->uiNodeHandle, &margins, length, unit);
1111 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
1112 fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaMargin(
1113 node->uiNodeHandle, &margins, length, unit);
1114 } else {
1115 fullImpl->getNodeModifiers()->getCommonModifier()->getMargin(node->uiNodeHandle, &margins, length, unit);
1116 }
1117 g_numberValues[NUM_0].f32 = margins[NUM_0];
1118 g_numberValues[NUM_1].f32 = margins[NUM_1];
1119 g_numberValues[NUM_2].f32 = margins[NUM_2];
1120 g_numberValues[NUM_3].f32 = margins[NUM_3];
1121 return &g_attributeItem;
1122 }
1123
SetTranslate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1124 int32_t SetTranslate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1125 {
1126 auto actualSize = CheckAttributeItemArray(item, REQUIRED_THREE_PARAM);
1127 if (actualSize < 0) {
1128 return ERROR_CODE_PARAM_INVALID;
1129 }
1130 auto fullImpl = GetFullImpl();
1131 ArkUI_Float32 values[item->size];
1132 ArkUI_Int32 units[item->size];
1133 int32_t unit = GetDefaultUnit(node, UNIT_VP);
1134 for (int i = 0; i < item->size; ++i) {
1135 values[i] = item->value[i].f32;
1136 units[i] = unit;
1137 }
1138
1139 fullImpl->getNodeModifiers()->getCommonModifier()->setTranslate(node->uiNodeHandle, values, units, item->size);
1140 return ERROR_CODE_NO_ERROR;
1141 }
1142
ResetTranslate(ArkUI_NodeHandle node)1143 void ResetTranslate(ArkUI_NodeHandle node)
1144 {
1145 // already check in entry point.
1146 auto* fullImpl = GetFullImpl();
1147
1148 fullImpl->getNodeModifiers()->getCommonModifier()->resetTranslate(node->uiNodeHandle);
1149 }
1150
GetTranslate(ArkUI_NodeHandle node)1151 const ArkUI_AttributeItem* GetTranslate(ArkUI_NodeHandle node)
1152 {
1153 auto* fullImpl = GetFullImpl();
1154 ArkUI_Float32 translate[NUM_3];
1155 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
1156 fullImpl->getNodeModifiers()->getCommonModifier()->getTranslate(node->uiNodeHandle, &translate, unit);
1157 g_numberValues[NUM_0].f32 = translate[NUM_0];
1158 g_numberValues[NUM_1].f32 = translate[NUM_1];
1159 g_numberValues[NUM_2].f32 = translate[NUM_2];
1160 return &g_attributeItem;
1161 }
1162
SetScale(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1163 int32_t SetScale(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1164 {
1165 auto fullImpl = GetFullImpl();
1166
1167 if (item->size != NUM_5 && item->size != NUM_2) {
1168 return ERROR_CODE_PARAM_INVALID;
1169 }
1170 ArkUI_Float32 values[item->size];
1171 for (int i = 0; i < item->size; i++) {
1172 values[i] = item->value[i].f32;
1173 }
1174 int32_t unit = GetDefaultUnit(node, UNIT_VP);
1175 ArkUI_Int32 units[NUM_2] = { unit, unit };
1176 fullImpl->getNodeModifiers()->getCommonModifier()->setScale(node->uiNodeHandle, values, item->size, units, NUM_2);
1177 return ERROR_CODE_NO_ERROR;
1178 }
1179
ResetScale(ArkUI_NodeHandle node)1180 void ResetScale(ArkUI_NodeHandle node)
1181 {
1182 // already check in entry point.
1183 auto* fullImpl = GetFullImpl();
1184
1185 fullImpl->getNodeModifiers()->getCommonModifier()->resetScale(node->uiNodeHandle);
1186 }
1187
GetScale(ArkUI_NodeHandle node)1188 const ArkUI_AttributeItem* GetScale(ArkUI_NodeHandle node)
1189 {
1190 auto* fullImpl = GetFullImpl();
1191 ArkUIScaleType scaleType = { 0.0f, 0.0f };
1192 fullImpl->getNodeModifiers()->getCommonModifier()->getScale(node->uiNodeHandle, &scaleType);
1193 g_numberValues[NUM_0].f32 = scaleType.xValue;
1194 g_numberValues[NUM_1].f32 = scaleType.yValue;
1195 g_attributeItem.size = NUM_2;
1196 return &g_attributeItem;
1197 }
1198
SetRotate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1199 int32_t SetRotate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1200 {
1201 auto actualSize = CheckAttributeItemArray(item, REQUIRED_FIVE_PARAM);
1202 if (actualSize < 0) {
1203 return ERROR_CODE_PARAM_INVALID;
1204 }
1205 auto fullImpl = GetFullImpl();
1206 ArkUI_Float32 values[item->size];
1207 for (int i = 0; i < item->size; ++i) {
1208 values[i] = item->value[i].f32;
1209 }
1210
1211 fullImpl->getNodeModifiers()->getCommonModifier()->setRotateWithoutTransformCenter(
1212 node->uiNodeHandle, values, item->size);
1213 return ERROR_CODE_NO_ERROR;
1214 }
1215
ResetRotate(ArkUI_NodeHandle node)1216 void ResetRotate(ArkUI_NodeHandle node)
1217 {
1218 // already check in entry point.
1219 auto* fullImpl = GetFullImpl();
1220
1221 fullImpl->getNodeModifiers()->getCommonModifier()->resetRotate(node->uiNodeHandle);
1222 }
1223
GetRotate(ArkUI_NodeHandle node)1224 const ArkUI_AttributeItem* GetRotate(ArkUI_NodeHandle node)
1225 {
1226 auto* fullImpl = GetFullImpl();
1227 ArkUIRotateType rotateType = { 0.0f, 0.0f, 0.0f, 0.0f, 0.0f };
1228 fullImpl->getNodeModifiers()->getCommonModifier()->getRotate(node->uiNodeHandle, &rotateType);
1229 g_numberValues[NUM_0].f32 = rotateType.xCoordinate;
1230 g_numberValues[NUM_1].f32 = rotateType.yCoordinate;
1231 g_numberValues[NUM_2].f32 = rotateType.zCoordinate;
1232 g_numberValues[NUM_3].f32 = rotateType.angle;
1233 g_numberValues[NUM_4].f32 = rotateType.sightDistance;
1234 g_attributeItem.size = NUM_5;
1235 return &g_attributeItem;
1236 }
1237
SetBrightness(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1238 int32_t SetBrightness(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1239 {
1240 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
1241 if (actualSize < 0) {
1242 return ERROR_CODE_PARAM_INVALID;
1243 }
1244 if (LessNotEqual(item->value[0].f32, 0.0f)) {
1245 return ERROR_CODE_PARAM_INVALID;
1246 }
1247 auto fullImpl = GetFullImpl();
1248 auto brightness = item->value[NUM_0].f32;
1249 fullImpl->getNodeModifiers()->getCommonModifier()->setBrightness(node->uiNodeHandle, brightness);
1250 return ERROR_CODE_NO_ERROR;
1251 }
1252
ResetBrightness(ArkUI_NodeHandle node)1253 void ResetBrightness(ArkUI_NodeHandle node)
1254 {
1255 // already check in entry point.
1256 auto* fullImpl = GetFullImpl();
1257
1258 fullImpl->getNodeModifiers()->getCommonModifier()->resetBrightness(node->uiNodeHandle);
1259 }
1260
GetBrightness(ArkUI_NodeHandle node)1261 const ArkUI_AttributeItem* GetBrightness(ArkUI_NodeHandle node)
1262 {
1263 auto* fullImpl = GetFullImpl();
1264 g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getCommonModifier()->getBrightness(node->uiNodeHandle);
1265 g_attributeItem.size = NUM_1;
1266 return &g_attributeItem;
1267 }
1268
SetSaturate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1269 int32_t SetSaturate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1270 {
1271 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
1272 if (actualSize < 0 || !InRegion(NUM_0, DEFAULT_SIZE_50, item->value[NUM_0].f32)) {
1273 return ERROR_CODE_PARAM_INVALID;
1274 }
1275 auto fullImpl = GetFullImpl();
1276 auto saturate = item->value[NUM_0].f32;
1277 fullImpl->getNodeModifiers()->getCommonModifier()->setSaturate(node->uiNodeHandle, saturate);
1278 return ERROR_CODE_NO_ERROR;
1279 }
1280
ResetSaturate(ArkUI_NodeHandle node)1281 void ResetSaturate(ArkUI_NodeHandle node)
1282 {
1283 // already check in entry point.
1284 auto* fullImpl = GetFullImpl();
1285
1286 fullImpl->getNodeModifiers()->getCommonModifier()->resetSaturate(node->uiNodeHandle);
1287 }
1288
GetSaturate(ArkUI_NodeHandle node)1289 const ArkUI_AttributeItem* GetSaturate(ArkUI_NodeHandle node)
1290 {
1291 auto* fullImpl = GetFullImpl();
1292 g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getCommonModifier()->getSaturate(node->uiNodeHandle);
1293 g_attributeItem.size = NUM_1;
1294 return &g_attributeItem;
1295 }
1296
SetBlur(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1297 int32_t SetBlur(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1298 {
1299 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
1300 if (actualSize < 0) {
1301 return ERROR_CODE_PARAM_INVALID;
1302 }
1303 auto fullImpl = GetFullImpl();
1304 ArkUI_Float64 blur = item->value[NUM_0].f32;
1305 BlurOption blurOption;
1306 fullImpl->getNodeModifiers()->getCommonModifier()->setBlur(
1307 node->uiNodeHandle, blur, blurOption.grayscale.data(), blurOption.grayscale.size());
1308 return ERROR_CODE_NO_ERROR;
1309 }
1310
GetBlur(ArkUI_NodeHandle node)1311 const ArkUI_AttributeItem* GetBlur(ArkUI_NodeHandle node)
1312 {
1313 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getBlur(node->uiNodeHandle);
1314 g_numberValues[0].f32 = resultValue;
1315 return &g_attributeItem;
1316 }
1317
ResetBlur(ArkUI_NodeHandle node)1318 void ResetBlur(ArkUI_NodeHandle node)
1319 {
1320 // already check in entry point.
1321 auto* fullImpl = GetFullImpl();
1322
1323 fullImpl->getNodeModifiers()->getCommonModifier()->resetBlur(node->uiNodeHandle);
1324 }
1325
SetLinearGradient(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1326 int32_t SetLinearGradient(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1327 {
1328 if (item->size < NUM_3) {
1329 return ERROR_CODE_PARAM_INVALID;
1330 }
1331 if (item->object == nullptr) {
1332 return ERROR_CODE_PARAM_INVALID;
1333 }
1334 //save direction value in node;
1335 node->linearGradientDirection = item->value[NUM_1].i32;
1336 auto* fullImpl = GetFullImpl();
1337 const ArkUI_ColorStop* colorStop = reinterpret_cast<ArkUI_ColorStop*>(item->object);
1338 int size = colorStop->size;
1339 ArkUIInt32orFloat32 colors[size * NUM_3];
1340 for (int i = 0; i < size; i++) {
1341 colors[i * NUM_3 + NUM_0].u32 = colorStop->colors[i];
1342 colors[i * NUM_3 + NUM_1].i32 = true;
1343 colors[i * NUM_3 + NUM_2].f32 = colorStop->stops[i] < 0 ? 0 : colorStop->stops[i];
1344 }
1345
1346 auto isCustomDirection = item->value[NUM_1].i32 == static_cast<ArkUI_Int32>(ARKUI_LINEAR_GRADIENT_DIRECTION_CUSTOM);
1347 ArkUIInt32orFloat32 values[NUM_4] = {
1348 {.i32 = static_cast<ArkUI_Int32>(isCustomDirection)}, //angleHasValue
1349 {.f32 = item->value[NUM_0].f32}, //angleValue
1350 {.i32 = item->value[NUM_1].i32}, //directionValue
1351 {.i32 = item->value[NUM_2].i32} //repeating
1352 };
1353
1354 fullImpl->getNodeModifiers()->getCommonModifier()->setLinearGradient(
1355 node->uiNodeHandle, values, NUM_4, colors, size * NUM_3);
1356 return ERROR_CODE_NO_ERROR;
1357 }
1358
GetLinearGradient(ArkUI_NodeHandle node)1359 const ArkUI_AttributeItem* GetLinearGradient(ArkUI_NodeHandle node)
1360 {
1361 //default size 3
1362 ArkUI_Float32 values[NUM_3];
1363 //default size 10
1364 ArkUI_Uint32 colors[NUM_10];
1365 //default size 10
1366 ArkUI_Float32 stops[NUM_10];
1367 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getLinearGradient(
1368 node->uiNodeHandle, &values, &colors, &stops);
1369 //angle
1370 g_numberValues[0].f32 = values[0];
1371 //direction
1372 g_numberValues[1].i32 = node->linearGradientDirection > -1 ? node->linearGradientDirection : values[1];
1373 //repeated
1374 g_numberValues[2].i32 = values[2];
1375 //size
1376 g_attributeItem.size = NUM_3;
1377 if (resultValue < NUM_1) {
1378 return &g_attributeItem;
1379 }
1380
1381 static ArkUI_ColorStop colorStop;
1382 static uint32_t gradientColors[NUM_10];
1383 static float gradientStops[NUM_10];
1384 for (int i = 0; i < resultValue; i++) {
1385 gradientColors[i] = colors[i];
1386 gradientStops[i] = stops[i] / 100.0f; //百分比转换为小数
1387 }
1388 colorStop.colors = gradientColors;
1389 colorStop.stops = gradientStops;
1390 colorStop.size = resultValue;
1391 g_attributeItem.object = &colorStop;
1392 return &g_attributeItem;
1393 }
1394
ResetLinearGradient(ArkUI_NodeHandle node)1395 void ResetLinearGradient(ArkUI_NodeHandle node)
1396 {
1397 // already check in entry point.
1398 auto* fullImpl = GetFullImpl();
1399
1400 fullImpl->getNodeModifiers()->getCommonModifier()->resetLinearGradient(node->uiNodeHandle);
1401 }
1402
SetAlign(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1403 int32_t SetAlign(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1404 {
1405 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
1406 if (actualSize < 0 || !InRegion(NUM_0, NUM_8, item->value[0].i32)) {
1407 return ERROR_CODE_PARAM_INVALID;
1408 }
1409 auto fullImpl = GetFullImpl();
1410 auto attrVal = item->value[NUM_0].i32;
1411 fullImpl->getNodeModifiers()->getCommonModifier()->setAlign(node->uiNodeHandle, attrVal);
1412 return ERROR_CODE_NO_ERROR;
1413 }
1414
GetAlign(ArkUI_NodeHandle node)1415 const ArkUI_AttributeItem* GetAlign(ArkUI_NodeHandle node)
1416 {
1417 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getAlign(node->uiNodeHandle);
1418 g_numberValues[0].i32 = resultValue;
1419 return &g_attributeItem;
1420 }
1421
ResetAlign(ArkUI_NodeHandle node)1422 void ResetAlign(ArkUI_NodeHandle node)
1423 {
1424 // already check in entry point.
1425 auto* fullImpl = GetFullImpl();
1426
1427 fullImpl->getNodeModifiers()->getCommonModifier()->resetAlign(node->uiNodeHandle);
1428 }
1429
SetOpacity(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1430 int32_t SetOpacity(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1431 {
1432 if (item->size == 0) {
1433 return ERROR_CODE_PARAM_INVALID;
1434 }
1435 if (LessNotEqual(item->value[0].f32, 0.0f) || GreatNotEqual(item->value[0].f32, 1.0f)) {
1436 return ERROR_CODE_PARAM_INVALID;
1437 }
1438 // already check in entry point.
1439 auto* fullImpl = GetFullImpl();
1440 fullImpl->getNodeModifiers()->getCommonModifier()->setOpacity(node->uiNodeHandle, item->value[0].f32);
1441 return ERROR_CODE_NO_ERROR;
1442 }
1443
ResetOpacity(ArkUI_NodeHandle node)1444 void ResetOpacity(ArkUI_NodeHandle node)
1445 {
1446 auto* fullImpl = GetFullImpl();
1447 fullImpl->getNodeModifiers()->getCommonModifier()->resetOpacity(node->uiNodeHandle);
1448 }
1449
GetOpacity(ArkUI_NodeHandle node)1450 const ArkUI_AttributeItem* GetOpacity(ArkUI_NodeHandle node)
1451 {
1452 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1453 g_numberValues[0].f32 = modifier->getOpacity(node->uiNodeHandle);
1454 return &g_attributeItem;
1455 }
1456
SetBorderWidth(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1457 int32_t SetBorderWidth(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1458 {
1459 if (item->size == 0) {
1460 return ERROR_CODE_PARAM_INVALID;
1461 }
1462 // already check in entry point.
1463 auto* fullImpl = GetFullImpl();
1464 int32_t unit = GetDefaultUnit(node, UNIT_VP);
1465 float widthVals[ALLOW_SIZE_4] = { 0, 0, 0, 0 };
1466 int widthUnits[ALLOW_SIZE_4] = { unit, unit, unit, unit };
1467
1468 if (item->size == 1) {
1469 if (LessNotEqual(item->value[0].f32, 0.0f)) {
1470 return ERROR_CODE_PARAM_INVALID;
1471 }
1472 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1473 widthVals[i] = item->value[0].f32;
1474 }
1475 } else if (item->size == ALLOW_SIZE_4) {
1476 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1477 if (LessNotEqual(item->value[i].f32, 0.0f)) {
1478 return ERROR_CODE_PARAM_INVALID;
1479 } else {
1480 widthVals[i] = item->value[i].f32;
1481 }
1482 }
1483 } else {
1484 return ERROR_CODE_PARAM_INVALID;
1485 }
1486 if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1487 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderWidth(
1488 node->uiNodeHandle, widthVals, widthUnits, ALLOW_SIZE_4);
1489 } else {
1490 fullImpl->getNodeModifiers()->getCommonModifier()->setBorderWidth(
1491 node->uiNodeHandle, widthVals, widthUnits, ALLOW_SIZE_4);
1492 }
1493 return ERROR_CODE_NO_ERROR;
1494 }
1495
ResetBorderWidth(ArkUI_NodeHandle node)1496 void ResetBorderWidth(ArkUI_NodeHandle node)
1497 {
1498 auto* fullImpl = GetFullImpl();
1499 if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1500 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaBorderWidth(node->uiNodeHandle);
1501 } else {
1502 fullImpl->getNodeModifiers()->getCommonModifier()->resetBorderWidth(node->uiNodeHandle);
1503 }
1504 }
1505
GetBorderWidth(ArkUI_NodeHandle node)1506 const ArkUI_AttributeItem* GetBorderWidth(ArkUI_NodeHandle node)
1507 {
1508 auto* fullImpl = GetFullImpl();
1509 ArkUI_Float32 borderWidth[NUM_4];
1510 auto unit = GetDefaultUnit(node, UNIT_VP);
1511 fullImpl->getNodeModifiers()->getCommonModifier()->getBorderWidth(node->uiNodeHandle, &borderWidth, unit);
1512 g_numberValues[NUM_0].f32 = borderWidth[NUM_0];
1513 g_numberValues[NUM_1].f32 = borderWidth[NUM_1];
1514 g_numberValues[NUM_2].f32 = borderWidth[NUM_2];
1515 g_numberValues[NUM_3].f32 = borderWidth[NUM_3];
1516 return &g_attributeItem;
1517 }
1518
SetBorderRadius(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1519 int32_t SetBorderRadius(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1520 {
1521 if (item->size == 0) {
1522 return ERROR_CODE_PARAM_INVALID;
1523 }
1524 // already check in entry point.
1525 auto* fullImpl = GetFullImpl();
1526 float radiusVals[ALLOW_SIZE_4] = { NUM_1, NUM_1, NUM_1, NUM_1 };
1527 int32_t unit = GetDefaultUnit(node, UNIT_VP);
1528 int radiusUnits[ALLOW_SIZE_4] = { unit, unit, unit, unit };
1529
1530 if (item->size == 1) {
1531 if (LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
1532 return ERROR_CODE_PARAM_INVALID;
1533 }
1534 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1535 radiusVals[i] = item->value[NUM_0].f32;
1536 }
1537 } else if (item->size == ALLOW_SIZE_4) {
1538 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1539 if (LessNotEqual(item->value[i].f32, 0.0f)) {
1540 return ERROR_CODE_PARAM_INVALID;
1541 } else {
1542 radiusVals[i] = item->value[i].f32;
1543 }
1544 }
1545 } else {
1546 return ERROR_CODE_PARAM_INVALID;
1547 }
1548 if (node->type == ARKUI_NODE_IMAGE) {
1549 fullImpl->getNodeModifiers()->getImageModifier()->setImageBorderRadius(
1550 node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1551 } else if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1552 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderRadius(
1553 node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1554 } else if (node->type == ARKUI_NODE_IMAGE_SPAN) {
1555 fullImpl->getNodeModifiers()->getImageSpanModifier()->setImageSpanBorderRadius(
1556 node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1557 } else {
1558 fullImpl->getNodeModifiers()->getCommonModifier()->setBorderRadius(
1559 node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1560 }
1561 return ERROR_CODE_NO_ERROR;
1562 }
1563
ResetBorderRadius(ArkUI_NodeHandle node)1564 void ResetBorderRadius(ArkUI_NodeHandle node)
1565 {
1566 auto* fullImpl = GetFullImpl();
1567 if (node->type == ARKUI_NODE_IMAGE) {
1568 fullImpl->getNodeModifiers()->getImageModifier()->resetImageBorderRadius(node->uiNodeHandle);
1569 } else if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1570 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaBorderRadius(node->uiNodeHandle);
1571 } else if (node->type == ARKUI_NODE_IMAGE_SPAN) {
1572 fullImpl->getNodeModifiers()->getImageSpanModifier()->resetImageSpanBorderRadius(node->uiNodeHandle);
1573 } else {
1574 fullImpl->getNodeModifiers()->getCommonModifier()->resetBorderRadius(node->uiNodeHandle);
1575 }
1576 }
1577
GetBorderRadius(ArkUI_NodeHandle node)1578 const ArkUI_AttributeItem* GetBorderRadius(ArkUI_NodeHandle node)
1579 {
1580 auto* fullImpl = GetFullImpl();
1581 ArkUI_Float32 borderRadius[NUM_4];
1582 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
1583 fullImpl->getNodeModifiers()->getCommonModifier()->getBorderRadius(node->uiNodeHandle, &borderRadius, unit);
1584 g_numberValues[NUM_0].f32 = borderRadius[NUM_0];
1585 g_numberValues[NUM_1].f32 = borderRadius[NUM_1];
1586 g_numberValues[NUM_2].f32 = borderRadius[NUM_2];
1587 g_numberValues[NUM_3].f32 = borderRadius[NUM_3];
1588 return &g_attributeItem;
1589 }
1590
SetBorderWidthPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1591 int32_t SetBorderWidthPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1592 {
1593 if (item->size == 0) {
1594 return ERROR_CODE_PARAM_INVALID;
1595 }
1596 // already check in entry point.
1597 auto* fullImpl = GetFullImpl();
1598 float widthVals[ALLOW_SIZE_4] = { 0, 0, 0, 0 };
1599 int widthUnits[ALLOW_SIZE_4] = { UNIT_PERCENT, UNIT_PERCENT, UNIT_PERCENT, UNIT_PERCENT };
1600
1601 if (item->size == 1) {
1602 if (LessNotEqual(item->value[0].f32, 0.0f)) {
1603 return ERROR_CODE_PARAM_INVALID;
1604 }
1605 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1606 widthVals[i] = item->value[0].f32;
1607 }
1608 } else if (item->size == ALLOW_SIZE_4) {
1609 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1610 if (LessNotEqual(item->value[i].f32, 0.0f)) {
1611 return ERROR_CODE_PARAM_INVALID;
1612 } else {
1613 widthVals[i] = item->value[i].f32;
1614 }
1615 }
1616 } else {
1617 return ERROR_CODE_PARAM_INVALID;
1618 }
1619 if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1620 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderWidth(
1621 node->uiNodeHandle, widthVals, widthUnits, ALLOW_SIZE_4);
1622 } else {
1623 fullImpl->getNodeModifiers()->getCommonModifier()->setBorderWidth(
1624 node->uiNodeHandle, widthVals, widthUnits, ALLOW_SIZE_4);
1625 }
1626 return ERROR_CODE_NO_ERROR;
1627 }
1628
ResetBorderWidthPercent(ArkUI_NodeHandle node)1629 void ResetBorderWidthPercent(ArkUI_NodeHandle node)
1630 {
1631 ResetBorderWidth(node);
1632 }
1633
GetBorderWidthPercent(ArkUI_NodeHandle node)1634 const ArkUI_AttributeItem* GetBorderWidthPercent(ArkUI_NodeHandle node)
1635 {
1636 auto* fullImpl = GetFullImpl();
1637 ArkUI_Float32 borderWidth[NUM_4];
1638 fullImpl->getNodeModifiers()->getCommonModifier()->getBorderWidth(node->uiNodeHandle, &borderWidth, UNIT_PERCENT);
1639 g_numberValues[NUM_0].f32 = borderWidth[NUM_0];
1640 g_numberValues[NUM_1].f32 = borderWidth[NUM_1];
1641 g_numberValues[NUM_2].f32 = borderWidth[NUM_2];
1642 g_numberValues[NUM_3].f32 = borderWidth[NUM_3];
1643 return &g_attributeItem;
1644 }
1645
SetBorderRadiusPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1646 int32_t SetBorderRadiusPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1647 {
1648 if (item->size == 0) {
1649 return ERROR_CODE_PARAM_INVALID;
1650 }
1651 // already check in entry point.
1652 auto* fullImpl = GetFullImpl();
1653 float radiusVals[ALLOW_SIZE_4] = { NUM_1, NUM_1, NUM_1, NUM_1 };
1654 int radiusUnits[ALLOW_SIZE_4] = { UNIT_PERCENT, UNIT_PERCENT, UNIT_PERCENT, UNIT_PERCENT };
1655
1656 if (item->size == 1) {
1657 if (LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
1658 return ERROR_CODE_PARAM_INVALID;
1659 }
1660 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1661 radiusVals[i] = item->value[NUM_0].f32;
1662 }
1663 } else if (item->size == ALLOW_SIZE_4) {
1664 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1665 if (LessNotEqual(item->value[i].f32, 0.0f)) {
1666 return ERROR_CODE_PARAM_INVALID;
1667 } else {
1668 radiusVals[i] = item->value[i].f32;
1669 }
1670 }
1671 } else {
1672 return ERROR_CODE_PARAM_INVALID;
1673 }
1674 if (node->type == ARKUI_NODE_IMAGE) {
1675 fullImpl->getNodeModifiers()->getImageModifier()->setImageBorderRadius(
1676 node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1677 } else if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1678 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderRadius(
1679 node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1680 } else {
1681 fullImpl->getNodeModifiers()->getCommonModifier()->setBorderRadius(
1682 node->uiNodeHandle, radiusVals, radiusUnits, ALLOW_SIZE_4);
1683 }
1684 return ERROR_CODE_NO_ERROR;
1685 }
1686
ResetBorderRadiusPercent(ArkUI_NodeHandle node)1687 void ResetBorderRadiusPercent(ArkUI_NodeHandle node)
1688 {
1689 ResetBorderRadius(node);
1690 }
1691
GetBorderRadiusPercent(ArkUI_NodeHandle node)1692 const ArkUI_AttributeItem* GetBorderRadiusPercent(ArkUI_NodeHandle node)
1693 {
1694 auto* fullImpl = GetFullImpl();
1695 ArkUI_Float32 borderRadius[NUM_4];
1696 fullImpl->getNodeModifiers()->getCommonModifier()->getBorderRadius(node->uiNodeHandle, &borderRadius, UNIT_PERCENT);
1697 g_numberValues[NUM_0].f32 = borderRadius[NUM_0];
1698 g_numberValues[NUM_1].f32 = borderRadius[NUM_1];
1699 g_numberValues[NUM_2].f32 = borderRadius[NUM_2];
1700 g_numberValues[NUM_3].f32 = borderRadius[NUM_3];
1701 return &g_attributeItem;
1702 }
1703
SetBorderColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1704 int32_t SetBorderColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1705 {
1706 if (item->size == 0) {
1707 return ERROR_CODE_PARAM_INVALID;
1708 }
1709 // already check in entry point.
1710 auto* fullImpl = GetFullImpl();
1711 uint32_t colors[ALLOW_SIZE_4] = { DEFAULT_COLOR, DEFAULT_COLOR, DEFAULT_COLOR, DEFAULT_COLOR };
1712 if (item->size == 1) {
1713 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1714 colors[i] = item->value[0].u32;
1715 }
1716 } else if (item->size == ALLOW_SIZE_4) {
1717 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1718 colors[i] = item->value[i].u32;
1719 }
1720 } else {
1721 return ERROR_CODE_PARAM_INVALID;
1722 }
1723 if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1724 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderColor(
1725 node->uiNodeHandle, colors[NUM_0], colors[NUM_1], colors[NUM_2], colors[NUM_3]);
1726 } else {
1727 fullImpl->getNodeModifiers()->getCommonModifier()->setBorderColor(
1728 node->uiNodeHandle, colors[NUM_0], colors[NUM_1], colors[NUM_2], colors[NUM_3]);
1729 }
1730 return ERROR_CODE_NO_ERROR;
1731 }
1732
ResetBorderColor(ArkUI_NodeHandle node)1733 void ResetBorderColor(ArkUI_NodeHandle node)
1734 {
1735 auto* fullImpl = GetFullImpl();
1736 if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1737 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaBorderColor(node->uiNodeHandle);
1738 } else {
1739 fullImpl->getNodeModifiers()->getCommonModifier()->resetBorderColor(node->uiNodeHandle);
1740 }
1741 }
1742
GetBorderColor(ArkUI_NodeHandle node)1743 const ArkUI_AttributeItem* GetBorderColor(ArkUI_NodeHandle node)
1744 {
1745 auto* fullImpl = GetFullImpl();
1746 ArkUI_Uint32 colors[NUM_4];
1747 fullImpl->getNodeModifiers()->getCommonModifier()->getBorderColor(node->uiNodeHandle, &colors);
1748 g_numberValues[NUM_0].u32 = colors[NUM_0];
1749 g_numberValues[NUM_1].u32 = colors[NUM_1];
1750 g_numberValues[NUM_2].u32 = colors[NUM_2];
1751 g_numberValues[NUM_3].u32 = colors[NUM_3];
1752 return &g_attributeItem;
1753 }
1754
SetBorderStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1755 int32_t SetBorderStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1756 {
1757 if (item->size == 0) {
1758 return ERROR_CODE_PARAM_INVALID;
1759 }
1760 // already check in entry point.
1761 auto* fullImpl = GetFullImpl();
1762 int styles[ALLOW_SIZE_4] = { 0, 0, 0, 0 };
1763 if (item->size == 1) {
1764 if (item->value[0].i32 < ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID ||
1765 item->value[0].i32 > ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DOTTED) {
1766 return ERROR_CODE_PARAM_INVALID;
1767 }
1768 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1769 styles[i] = item->value[0].i32;
1770 }
1771 } else if (item->size == ALLOW_SIZE_4) {
1772 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
1773 if (item->value[i].i32 < ArkUI_BorderStyle::ARKUI_BORDER_STYLE_SOLID ||
1774 item->value[i].i32 > ArkUI_BorderStyle::ARKUI_BORDER_STYLE_DOTTED) {
1775 return ERROR_CODE_PARAM_INVALID;
1776 } else {
1777 styles[i] = item->value[i].i32;
1778 }
1779 }
1780 } else {
1781 return ERROR_CODE_PARAM_INVALID;
1782 }
1783 if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1784 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaBorderStyle(
1785 node->uiNodeHandle, styles, ALLOW_SIZE_4);
1786 } else {
1787 fullImpl->getNodeModifiers()->getCommonModifier()->setBorderStyle(node->uiNodeHandle, styles, ALLOW_SIZE_4);
1788 }
1789 return ERROR_CODE_NO_ERROR;
1790 }
1791
ResetBorderStyle(ArkUI_NodeHandle node)1792 void ResetBorderStyle(ArkUI_NodeHandle node)
1793 {
1794 auto* fullImpl = GetFullImpl();
1795 if (node->type == ARKUI_NODE_TEXT_INPUT || node->type == ARKUI_NODE_TEXT_AREA) {
1796 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaBorderStyle(node->uiNodeHandle);
1797 } else {
1798 fullImpl->getNodeModifiers()->getCommonModifier()->resetBorderStyle(node->uiNodeHandle);
1799 }
1800 }
1801
GetBorderStyle(ArkUI_NodeHandle node)1802 const ArkUI_AttributeItem* GetBorderStyle(ArkUI_NodeHandle node)
1803 {
1804 auto* fullImpl = GetFullImpl();
1805 ArkUI_Int32 styles[NUM_4];
1806 fullImpl->getNodeModifiers()->getCommonModifier()->getBorderStyle(node->uiNodeHandle, &styles);
1807 g_numberValues[NUM_0].i32 = styles[NUM_0];
1808 g_numberValues[NUM_1].i32 = styles[NUM_1];
1809 g_numberValues[NUM_2].i32 = styles[NUM_2];
1810 g_numberValues[NUM_3].i32 = styles[NUM_3];
1811 return &g_attributeItem;
1812 }
1813
SetZIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1814 int32_t SetZIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1815 {
1816 if (item->size == 0) {
1817 return ERROR_CODE_PARAM_INVALID;
1818 }
1819 // already check in entry point.
1820 auto* fullImpl = GetFullImpl();
1821 fullImpl->getNodeModifiers()->getCommonModifier()->setZIndex(node->uiNodeHandle, item->value[0].i32);
1822 return ERROR_CODE_NO_ERROR;
1823 }
1824
ResetZIndex(ArkUI_NodeHandle node)1825 void ResetZIndex(ArkUI_NodeHandle node)
1826 {
1827 auto* fullImpl = GetFullImpl();
1828 fullImpl->getNodeModifiers()->getCommonModifier()->resetZIndex(node->uiNodeHandle);
1829 }
1830
GetZIndex(ArkUI_NodeHandle node)1831 const ArkUI_AttributeItem* GetZIndex(ArkUI_NodeHandle node)
1832 {
1833 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1834 g_numberValues[0].i32 = modifier->getZIndex(node->uiNodeHandle);
1835 return &g_attributeItem;
1836 }
1837
SetVisibility(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1838 int32_t SetVisibility(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1839 {
1840 if (item->size == 0) {
1841 return ERROR_CODE_PARAM_INVALID;
1842 }
1843 if (item->value[0].i32 < ArkUI_Visibility::ARKUI_VISIBILITY_VISIBLE ||
1844 item->value[0].i32 > ArkUI_Visibility::ARKUI_VISIBILITY_NONE) {
1845 return ERROR_CODE_PARAM_INVALID;
1846 }
1847 // already check in entry point.
1848 auto* fullImpl = GetFullImpl();
1849 fullImpl->getNodeModifiers()->getCommonModifier()->setVisibility(node->uiNodeHandle, item->value[0].i32);
1850 return ERROR_CODE_NO_ERROR;
1851 }
1852
ResetVisibility(ArkUI_NodeHandle node)1853 void ResetVisibility(ArkUI_NodeHandle node)
1854 {
1855 auto* fullImpl = GetFullImpl();
1856 fullImpl->getNodeModifiers()->getCommonModifier()->resetVisibility(node->uiNodeHandle);
1857 }
1858
GetVisibility(ArkUI_NodeHandle node)1859 const ArkUI_AttributeItem* GetVisibility(ArkUI_NodeHandle node)
1860 {
1861 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1862 g_numberValues[0].i32 = modifier->getVisibility(node->uiNodeHandle);
1863 return &g_attributeItem;
1864 }
1865
SetClip(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1866 int32_t SetClip(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1867 {
1868 if (item->size == 0) {
1869 return ERROR_CODE_PARAM_INVALID;
1870 }
1871 if (item->value[0].i32 < NUM_0 || item->value[0].i32 > NUM_1) {
1872 return ERROR_CODE_PARAM_INVALID;
1873 }
1874 auto* fullImpl = GetFullImpl();
1875 fullImpl->getNodeModifiers()->getCommonModifier()->setClip(node->uiNodeHandle, item->value[0].i32);
1876 return ERROR_CODE_NO_ERROR;
1877 }
1878
ResetClip(ArkUI_NodeHandle node)1879 void ResetClip(ArkUI_NodeHandle node)
1880 {
1881 auto* fullImpl = GetFullImpl();
1882 fullImpl->getNodeModifiers()->getCommonModifier()->resetClip(node->uiNodeHandle);
1883 }
1884
GetClip(ArkUI_NodeHandle node)1885 const ArkUI_AttributeItem* GetClip(ArkUI_NodeHandle node)
1886 {
1887 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
1888 g_numberValues[0].i32 = modifier->getClip(node->uiNodeHandle);
1889 return &g_attributeItem;
1890 }
1891
SetClipShape(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1892 int32_t SetClipShape(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1893 {
1894 if (item->size == 0) {
1895 return ERROR_CODE_PARAM_INVALID;
1896 }
1897 if (!InRegion(NUM_0, NUM_3, item->value[NUM_0].i32)) {
1898 return ERROR_CODE_PARAM_INVALID;
1899 }
1900 auto* fullImpl = GetFullImpl();
1901 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
1902 if (item->value[0].i32 == ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH) {
1903 if (item->string == nullptr) {
1904 return ERROR_CODE_PARAM_INVALID;
1905 }
1906 ArkUI_Float32 pathAttributes[NUM_2];
1907 if (LessNotEqual(item->value[NUM_1].f32, 0.0f) || LessNotEqual(item->value[NUM_2].f32, 0.0f)) {
1908 return ERROR_CODE_PARAM_INVALID;
1909 } else {
1910 pathAttributes[NUM_0] = item->value[NUM_1].f32;
1911 pathAttributes[NUM_1] = item->value[NUM_2].f32;
1912 }
1913 fullImpl->getNodeModifiers()->getCommonModifier()->setClipPath(
1914 node->uiNodeHandle, "path", &pathAttributes, item->string, unit);
1915 } else {
1916 ArkUI_Float32 attributes[item->size - NUM_1];
1917 for (int i = NUM_1; i < item->size; i++) {
1918 if (LessNotEqual(item->value[i].f32, 0.0f)) {
1919 return ERROR_CODE_PARAM_INVALID;
1920 } else {
1921 attributes[i - NUM_1] = item->value[i].f32;
1922 }
1923 }
1924 fullImpl->getNodeModifiers()->getCommonModifier()->setClipShape(
1925 node->uiNodeHandle, ShapeToString(item->value[0].i32).c_str(), attributes, item->size - NUM_1, unit);
1926 }
1927 return ERROR_CODE_NO_ERROR;
1928 }
1929
ResetClipShape(ArkUI_NodeHandle node)1930 void ResetClipShape(ArkUI_NodeHandle node)
1931 {
1932 auto* fullImpl = GetFullImpl();
1933 fullImpl->getNodeModifiers()->getCommonModifier()->resetClip(node->uiNodeHandle);
1934 }
1935
GetClipShape(ArkUI_NodeHandle node)1936 const ArkUI_AttributeItem* GetClipShape(ArkUI_NodeHandle node)
1937 {
1938 ArkUIClipShapeOptions options;
1939 auto unit = GetDefaultUnit(node, UNIT_VP);
1940 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getClipShape(node->uiNodeHandle, &options, unit);
1941 int type = options.type;
1942 if (type == static_cast<ArkUI_Int32>(BasicShapeType::RECT)) {
1943 g_numberValues[NUM_0].i32 = static_cast<ArkUI_Int32>(ArkUI_ClipType::ARKUI_CLIP_TYPE_RECTANGLE);
1944 g_numberValues[NUM_1].f32 = options.width;
1945 g_numberValues[NUM_2].f32 = options.height;
1946 g_numberValues[NUM_3].f32 = options.radiusWidth;
1947 g_numberValues[NUM_4].f32 = options.radiusHeight;
1948 g_numberValues[NUM_5].f32 = options.topLeftRadius;
1949 g_numberValues[NUM_6].f32 = options.bottomLeftRadius;
1950 g_numberValues[NUM_7].f32 = options.topRightRadius;
1951 g_numberValues[NUM_8].f32 = options.bottomRightRadius;
1952 } else if (type == static_cast<ArkUI_Int32>(BasicShapeType::CIRCLE)) {
1953 g_numberValues[NUM_0].i32 = static_cast<ArkUI_Int32>(ArkUI_ClipType::ARKUI_CLIP_TYPE_CIRCLE);
1954 g_numberValues[NUM_1].f32 = options.width;
1955 g_numberValues[NUM_2].f32 = options.height;
1956 } else if (type == static_cast<ArkUI_Int32>(BasicShapeType::ELLIPSE)) {
1957 g_numberValues[NUM_0].i32 = static_cast<ArkUI_Int32>(ArkUI_ClipType::ARKUI_CLIP_TYPE_ELLIPSE);
1958 g_numberValues[NUM_1].f32 = options.width;
1959 g_numberValues[NUM_2].f32 = options.height;
1960 } else if (type == static_cast<ArkUI_Int32>(BasicShapeType::PATH)) {
1961 g_numberValues[NUM_0].i32 = static_cast<ArkUI_Int32>(ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH);
1962 g_numberValues[NUM_1].f32 = options.width;
1963 g_numberValues[NUM_2].f32 = options.height;
1964 g_attributeItem.string = options.commands;
1965 } else {
1966 return nullptr;
1967 }
1968 return &g_attributeItem;
1969 }
1970
SetTransform(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)1971 int32_t SetTransform(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
1972 {
1973 if (item->size == 0) {
1974 return ERROR_CODE_PARAM_INVALID;
1975 }
1976 // already check in entry point.
1977 auto* fullImpl = GetFullImpl();
1978 float transforms[ALLOW_SIZE_16] = { 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1, 0, 0, 0, 0, 1 };
1979 for (int i = 0; i < item->size; ++i) {
1980 transforms[i] = item->value[i].f32;
1981 }
1982 fullImpl->getNodeModifiers()->getCommonModifier()->setTransform(node->uiNodeHandle, transforms, ALLOW_SIZE_16);
1983 return ERROR_CODE_NO_ERROR;
1984 }
1985
ResetTransform(ArkUI_NodeHandle node)1986 void ResetTransform(ArkUI_NodeHandle node)
1987 {
1988 auto* fullImpl = GetFullImpl();
1989 fullImpl->getNodeModifiers()->getCommonModifier()->resetTransform(node->uiNodeHandle);
1990 }
1991
GetTransform(ArkUI_NodeHandle node)1992 const ArkUI_AttributeItem* GetTransform(ArkUI_NodeHandle node)
1993 {
1994 ArkUI_Float32 values[NUM_16];
1995 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getTransform(node->uiNodeHandle, &values);
1996 for (int i = 0; i < NUM_16; i++) {
1997 g_numberValues[i].f32 = values[i];
1998 }
1999 return &g_attributeItem;
2000 }
2001
SetHitTestBehavior(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2002 int32_t SetHitTestBehavior(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2003 {
2004 if (item->size == 0) {
2005 return ERROR_CODE_PARAM_INVALID;
2006 }
2007 if (item->value[0].i32 < ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_DEFAULT ||
2008 item->value[0].i32 > ArkUI_HitTestMode::ARKUI_HIT_TEST_MODE_NONE) {
2009 return ERROR_CODE_PARAM_INVALID;
2010 }
2011 // already check in entry point.
2012 auto* fullImpl = GetFullImpl();
2013 fullImpl->getNodeModifiers()->getCommonModifier()->setHitTestBehavior(node->uiNodeHandle, item->value[0].i32);
2014 return ERROR_CODE_NO_ERROR;
2015 }
2016
ResetHitTestBehavior(ArkUI_NodeHandle node)2017 void ResetHitTestBehavior(ArkUI_NodeHandle node)
2018 {
2019 auto* fullImpl = GetFullImpl();
2020 fullImpl->getNodeModifiers()->getCommonModifier()->resetHitTestBehavior(node->uiNodeHandle);
2021 }
2022
GetHitTestBehavior(ArkUI_NodeHandle node)2023 const ArkUI_AttributeItem* GetHitTestBehavior(ArkUI_NodeHandle node)
2024 {
2025 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2026 g_numberValues[0].i32 = modifier->getHitTestBehavior(node->uiNodeHandle);
2027 return &g_attributeItem;
2028 }
2029
SetPosition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2030 int32_t SetPosition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2031 {
2032 if (item->size == 0 && item->size != ALLOW_SIZE_2) {
2033 return ERROR_CODE_PARAM_INVALID;
2034 }
2035 // already check in entry point.
2036 auto* fullImpl = GetFullImpl();
2037 int32_t unit = GetDefaultUnit(node, UNIT_VP);
2038 fullImpl->getNodeModifiers()->getCommonModifier()->setPosition(
2039 node->uiNodeHandle, item->value[0].f32, unit, item->value[1].f32, unit);
2040 return ERROR_CODE_NO_ERROR;
2041 }
2042
ResetPosition(ArkUI_NodeHandle node)2043 void ResetPosition(ArkUI_NodeHandle node)
2044 {
2045 auto* fullImpl = GetFullImpl();
2046 fullImpl->getNodeModifiers()->getCommonModifier()->resetPosition(node->uiNodeHandle);
2047 }
2048
GetPosition(ArkUI_NodeHandle node)2049 const ArkUI_AttributeItem* GetPosition(ArkUI_NodeHandle node)
2050 {
2051 ArkUIPositionOptions options;
2052 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
2053 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getPosition(node->uiNodeHandle, &options, unit);
2054 g_numberValues[NUM_0].f32 = options.x;
2055 g_numberValues[NUM_1].f32 = options.y;
2056 return &g_attributeItem;
2057 }
2058
SetShadow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2059 int32_t SetShadow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2060 {
2061 if (item->size == 0) {
2062 return ERROR_CODE_PARAM_INVALID;
2063 }
2064 if (item->value[0].i32 < ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS ||
2065 item->value[0].i32 > ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_FLOATING_MD) {
2066 return ERROR_CODE_PARAM_INVALID;
2067 }
2068 auto* fullImpl = GetFullImpl();
2069 ArkUIInt32orFloat32 shadows[NUM_1] = { {.i32 = ArkUI_ShadowStyle::ARKUI_SHADOW_STYLE_OUTER_DEFAULT_XS} };
2070 shadows[NUM_0].i32 = item->value[0].i32;
2071 fullImpl->getNodeModifiers()->getCommonModifier()->setBackShadow(node->uiNodeHandle, shadows, ALLOW_SIZE_1);
2072 return ERROR_CODE_NO_ERROR;
2073 }
2074
ResetShadow(ArkUI_NodeHandle node)2075 void ResetShadow(ArkUI_NodeHandle node)
2076 {
2077 auto* fullImpl = GetFullImpl();
2078 fullImpl->getNodeModifiers()->getCommonModifier()->resetBackShadow(node->uiNodeHandle);
2079 }
2080
GetShadow(ArkUI_NodeHandle node)2081 const ArkUI_AttributeItem* GetShadow(ArkUI_NodeHandle node)
2082 {
2083 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2084 g_numberValues[0].i32 = modifier->getShadow(node->uiNodeHandle);
2085 return &g_attributeItem;
2086 }
2087
SetCustomShadow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2088 int32_t SetCustomShadow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2089 {
2090 if (item->size == 0) {
2091 return ERROR_CODE_PARAM_INVALID;
2092 }
2093 auto* fullImpl = GetFullImpl();
2094 ArkUIInt32orFloat32 shadows[ALLOW_SIZE_7] = { 0, { .i32 = NUM_2 }, 0, 0, { .i32 = 0 }, { .u32 = 0 }, { .i32 = 0 } };
2095 int length = item->size;
2096 if (length > NUM_0) {
2097 if (LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
2098 return ERROR_CODE_PARAM_INVALID;
2099 }
2100 shadows[NUM_0].f32 = item->value[NUM_0].f32; // radius
2101 }
2102 if (length > NUM_2) {
2103 shadows[NUM_2].f32 = item->value[NUM_2].f32; // OffsetX
2104 }
2105 if (length > NUM_3) {
2106 shadows[NUM_3].f32 = item->value[NUM_3].f32; // OffsetY
2107 }
2108 if (length > NUM_4) {
2109 if (!InRegion(NUM_0, NUM_1, item->value[NUM_4].i32)) {
2110 return ERROR_CODE_PARAM_INVALID;
2111 }
2112 shadows[NUM_4].i32 = item->value[NUM_4].i32;
2113 }
2114 if (length > NUM_5) {
2115 if (item->value[NUM_1].i32) {
2116 if (!InRegion(NUM_0, NUM_2, item->value[NUM_5].i32)) {
2117 return ERROR_CODE_PARAM_INVALID;
2118 }
2119 shadows[NUM_1].i32 = COLOR_STRATEGY_STYLE;
2120 shadows[NUM_5].i32 = item->value[NUM_5].i32;
2121 } else {
2122 shadows[NUM_1].i32 = COLOR_STYLE;
2123 shadows[NUM_5].u32 = item->value[NUM_5].u32;
2124 }
2125 }
2126 if (length > NUM_6) {
2127 shadows[NUM_6].i32 = item->value[NUM_6].i32;
2128 }
2129 fullImpl->getNodeModifiers()->getCommonModifier()->setBackShadow(node->uiNodeHandle, shadows, ALLOW_SIZE_7);
2130 return ERROR_CODE_NO_ERROR;
2131 }
2132
ResetCustomShadow(ArkUI_NodeHandle node)2133 void ResetCustomShadow(ArkUI_NodeHandle node)
2134 {
2135 auto* fullImpl = GetFullImpl();
2136 fullImpl->getNodeModifiers()->getCommonModifier()->resetBackShadow(node->uiNodeHandle);
2137 }
2138
GetCustomShadow(ArkUI_NodeHandle node)2139 const ArkUI_AttributeItem* GetCustomShadow(ArkUI_NodeHandle node)
2140 {
2141 ArkUICustomShadowOptions options;
2142 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getCustomShadow(node->uiNodeHandle, &options);
2143 g_numberValues[NUM_0].f32 = options.radius;
2144 g_numberValues[NUM_1].i32 = options.colorStrategy;
2145 g_numberValues[NUM_2].f32 = options.offsetX;
2146 g_numberValues[NUM_3].f32 = options.offsetY;
2147 g_numberValues[NUM_4].i32 = options.shadowType;
2148 g_numberValues[NUM_5].u32 = options.color;
2149 g_numberValues[NUM_6].i32 = options.fill;
2150 return &g_attributeItem;
2151 }
2152
SetFocusable(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2153 int32_t SetFocusable(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2154 {
2155 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
2156 return ERROR_CODE_PARAM_INVALID;
2157 }
2158 auto* fullImpl = GetFullImpl();
2159 fullImpl->getNodeModifiers()->getCommonModifier()->setFocusable(node->uiNodeHandle, item->value[0].i32);
2160 return ERROR_CODE_NO_ERROR;
2161 }
2162
GetFocusable(ArkUI_NodeHandle node)2163 const ArkUI_AttributeItem* GetFocusable(ArkUI_NodeHandle node)
2164 {
2165 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getFocusable(node->uiNodeHandle);
2166 g_numberValues[0].i32 = resultValue;
2167 return &g_attributeItem;
2168 }
2169
ResetFocusable(ArkUI_NodeHandle node)2170 void ResetFocusable(ArkUI_NodeHandle node)
2171 {
2172 auto* fullImpl = GetFullImpl();
2173 fullImpl->getNodeModifiers()->getCommonModifier()->resetFocusable(node->uiNodeHandle);
2174 }
2175
SetAccessibilityGroup(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2176 int32_t SetAccessibilityGroup(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2177 {
2178 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
2179 return ERROR_CODE_PARAM_INVALID;
2180 }
2181 auto* fullImpl = GetFullImpl();
2182 fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityGroup(node->uiNodeHandle, item->value[0].i32);
2183 return ERROR_CODE_NO_ERROR;
2184 }
2185
GetAccessibilityGroup(ArkUI_NodeHandle node)2186 const ArkUI_AttributeItem* GetAccessibilityGroup(ArkUI_NodeHandle node)
2187 {
2188 auto resultValue =
2189 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getAccessibilityGroup(node->uiNodeHandle);
2190 g_numberValues[0].i32 = resultValue;
2191 return &g_attributeItem;
2192 }
2193
ResetAccessibilityGroup(ArkUI_NodeHandle node)2194 void ResetAccessibilityGroup(ArkUI_NodeHandle node)
2195 {
2196 auto* fullImpl = GetFullImpl();
2197 fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityGroup(node->uiNodeHandle);
2198 }
2199
SetAccessibilityText(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2200 int32_t SetAccessibilityText(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2201 {
2202 if (item->string == nullptr) {
2203 return ERROR_CODE_PARAM_INVALID;
2204 }
2205 auto* fullImpl = GetFullImpl();
2206 fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityText(node->uiNodeHandle, item->string);
2207 return ERROR_CODE_NO_ERROR;
2208 }
2209
GetAccessibilityText(ArkUI_NodeHandle node)2210 const ArkUI_AttributeItem* GetAccessibilityText(ArkUI_NodeHandle node)
2211 {
2212 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getAccessibilityText(node->uiNodeHandle);
2213 g_attributeItem.string = resultValue;
2214 g_attributeItem.size = 0;
2215 return &g_attributeItem;
2216 }
2217
ResetAccessibilityText(ArkUI_NodeHandle node)2218 void ResetAccessibilityText(ArkUI_NodeHandle node)
2219 {
2220 auto* fullImpl = GetFullImpl();
2221 fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityText(node->uiNodeHandle);
2222 }
2223
SetAccessibilityLevel(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2224 int32_t SetAccessibilityLevel(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2225 {
2226 if (item->size == 0 || !CheckAttributeIsAccessibilityLevel(item->value[0].i32)) {
2227 return ERROR_CODE_PARAM_INVALID;
2228 }
2229 auto* fullImpl = GetFullImpl();
2230 auto levelString = ACCESSIBILITY_LEVEL_VECTOR[item->value[0].i32];
2231 fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityLevel(node->uiNodeHandle, levelString.c_str());
2232 return ERROR_CODE_NO_ERROR;
2233 }
2234
GetAccessibilityLevel(ArkUI_NodeHandle node)2235 const ArkUI_AttributeItem* GetAccessibilityLevel(ArkUI_NodeHandle node)
2236 {
2237 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getAccessibilityLevel(
2238 node->uiNodeHandle);
2239 std::string levelString(resultValue);
2240 g_numberValues[0].i32 = ACCESSIBILITY_LEVEL_MAP[levelString];
2241 return &g_attributeItem;
2242 }
2243
ResetAccessibilityLevel(ArkUI_NodeHandle node)2244 void ResetAccessibilityLevel(ArkUI_NodeHandle node)
2245 {
2246 auto* fullImpl = GetFullImpl();
2247 fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityLevel(node->uiNodeHandle);
2248 }
2249
SetAccessibilityDescription(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2250 int32_t SetAccessibilityDescription(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2251 {
2252 if (item->string == nullptr) {
2253 return ERROR_CODE_PARAM_INVALID;
2254 }
2255 auto* fullImpl = GetFullImpl();
2256 fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityDescription(node->uiNodeHandle, item->string);
2257 return ERROR_CODE_NO_ERROR;
2258 }
2259
GetAccessibilityDescription(ArkUI_NodeHandle node)2260 const ArkUI_AttributeItem* GetAccessibilityDescription(ArkUI_NodeHandle node)
2261 {
2262 auto resultValue =
2263 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getAccessibilityDescription(node->uiNodeHandle);
2264 g_attributeItem.string = resultValue;
2265 g_attributeItem.size = 0;
2266 return &g_attributeItem;
2267 }
2268
ResetAccessibilityDescription(ArkUI_NodeHandle node)2269 void ResetAccessibilityDescription(ArkUI_NodeHandle node)
2270 {
2271 auto* fullImpl = GetFullImpl();
2272 fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityDescription(node->uiNodeHandle);
2273 }
2274
SetAccessibilityActions(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2275 int32_t SetAccessibilityActions(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2276 {
2277 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
2278 if (actualSize < 0) {
2279 return ERROR_CODE_PARAM_INVALID;
2280 }
2281 if (item->value[0].u32 > 0b11111) {
2282 return ERROR_CODE_PARAM_INVALID;
2283 }
2284 auto* fullImpl = GetFullImpl();
2285 fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityActions(
2286 node->uiNodeHandle, item->value[0].u32);
2287 return ERROR_CODE_NO_ERROR;
2288 }
2289
ResetAccessibilityActions(ArkUI_NodeHandle node)2290 void ResetAccessibilityActions(ArkUI_NodeHandle node)
2291 {
2292 auto* fullImpl = GetFullImpl();
2293 fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityActions(node->uiNodeHandle);
2294 }
2295
GetAccessibilityActions(ArkUI_NodeHandle node)2296 const ArkUI_AttributeItem* GetAccessibilityActions(ArkUI_NodeHandle node)
2297 {
2298 auto* fullImpl = GetFullImpl();
2299 g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getCommonModifier()->getAccessibilityActions(
2300 node->uiNodeHandle);
2301 g_attributeItem.size = REQUIRED_ONE_PARAM;
2302 return &g_attributeItem;
2303 }
2304
SetAccessibilityRole(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2305 int32_t SetAccessibilityRole(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2306 {
2307 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
2308 if (actualSize < 0) {
2309 return ERROR_CODE_PARAM_INVALID;
2310 }
2311 std::string nodeTypeString = ConvertAccessibilityRole(item->value[0].u32);
2312 if (nodeTypeString == EMPTY_STR) {
2313 return ERROR_CODE_PARAM_INVALID;
2314 }
2315 auto* fullImpl = GetFullImpl();
2316 fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityRole(
2317 node->uiNodeHandle, nodeTypeString.c_str());
2318 return ERROR_CODE_NO_ERROR;
2319 }
2320
ResetAccessibilityRole(ArkUI_NodeHandle node)2321 void ResetAccessibilityRole(ArkUI_NodeHandle node)
2322 {
2323 auto* fullImpl = GetFullImpl();
2324 fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityRole(node->uiNodeHandle);
2325 }
2326
GetAccessibilityRole(ArkUI_NodeHandle node)2327 const ArkUI_AttributeItem* GetAccessibilityRole(ArkUI_NodeHandle node)
2328 {
2329 auto* fullImpl = GetFullImpl();
2330 std::string nodeTypeString = fullImpl->getNodeModifiers()->getCommonModifier()->getAccessibilityRole(
2331 node->uiNodeHandle);
2332 g_numberValues[0].u32 = static_cast<uint32_t>(UnConvertAccessibilityRole(nodeTypeString));
2333 g_attributeItem.size = REQUIRED_ONE_PARAM;
2334 return &g_attributeItem;
2335 }
2336
SetDefaultFocus(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2337 int32_t SetDefaultFocus(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2338 {
2339 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
2340 return ERROR_CODE_PARAM_INVALID;
2341 }
2342 auto* fullImpl = GetFullImpl();
2343 fullImpl->getNodeModifiers()->getCommonModifier()->setDefaultFocus(node->uiNodeHandle, item->value[0].i32);
2344 return ERROR_CODE_NO_ERROR;
2345 }
2346
GetDefaultFocus(ArkUI_NodeHandle node)2347 const ArkUI_AttributeItem* GetDefaultFocus(ArkUI_NodeHandle node)
2348 {
2349 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getDefaultFocus(node->uiNodeHandle);
2350 g_numberValues[0].i32 = resultValue;
2351 return &g_attributeItem;
2352 }
2353
ResetDefaultFocus(ArkUI_NodeHandle node)2354 void ResetDefaultFocus(ArkUI_NodeHandle node)
2355 {
2356 auto* fullImpl = GetFullImpl();
2357 fullImpl->getNodeModifiers()->getCommonModifier()->resetDefaultFocus(node->uiNodeHandle);
2358 }
2359
SetResponseRegion(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2360 int32_t SetResponseRegion(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2361 {
2362 if (item->size == 0 || item->size % NUM_4 > 0) {
2363 return ERROR_CODE_PARAM_INVALID;
2364 }
2365 auto* fullImpl = GetFullImpl();
2366
2367 std::vector<float> valuesArray;
2368 std::vector<int> unitsArray;
2369
2370 for (int i = 0; i < item->size; i++) {
2371 int remainder = i % NUM_4;
2372 valuesArray.push_back(remainder > 1 ? (item->value[i].f32) / HUNDRED : item->value[i].f32);
2373 // unit 1 3
2374 unitsArray.push_back(remainder > 1 ? NUM_3 : NUM_1);
2375 }
2376 fullImpl->getNodeModifiers()->getCommonModifier()->setResponseRegion(
2377 node->uiNodeHandle, valuesArray.data(), unitsArray.data(), valuesArray.size());
2378 return ERROR_CODE_NO_ERROR;
2379 }
2380
GetResponseRegion(ArkUI_NodeHandle node)2381 const ArkUI_AttributeItem* GetResponseRegion(ArkUI_NodeHandle node)
2382 {
2383 ArkUI_Float32 values[32];
2384 auto valueSize =
2385 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getResponseRegion(node->uiNodeHandle, &values);
2386 for (int i = 0; i < valueSize; i++) {
2387 g_numberValues[i].f32 = values[i];
2388 }
2389
2390 g_attributeItem.size = valueSize;
2391 return &g_attributeItem;
2392 }
2393
ResetResponseRegion(ArkUI_NodeHandle node)2394 void ResetResponseRegion(ArkUI_NodeHandle node)
2395 {
2396 auto* fullImpl = GetFullImpl();
2397 fullImpl->getNodeModifiers()->getCommonModifier()->resetResponseRegion(node->uiNodeHandle);
2398 }
2399
SetOverlay(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2400 int32_t SetOverlay(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2401 {
2402 if (item->string == nullptr) {
2403 return ERROR_CODE_PARAM_INVALID;
2404 }
2405 auto* fullImpl = GetFullImpl();
2406
2407 ArkUI_Float32 values[ALLOW_SIZE_10] = { 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0 };
2408
2409 if (item->size > 0) {
2410 values[0] = 1;
2411 if (!CheckAttributeIsAlignment(item->value[0].i32)) {
2412 return ERROR_CODE_PARAM_INVALID;
2413 }
2414 values[1] = item->value[0].i32;
2415 }
2416
2417 if (item->size > 1) {
2418 values[2] = 1;
2419 values[3] = item->value[1].f32;
2420 values[NUM_4] = GetDefaultUnit(node, UNIT_VP);
2421 }
2422
2423 if (item->size > 2) {
2424 values[5] = 1;
2425 values[6] = item->value[2].f32;
2426 values[NUM_7] = GetDefaultUnit(node, UNIT_VP);
2427 }
2428 values[8] = item->size > 0 ? 1 : 0;
2429 values[9] = item->size > 1 ? 1 : 0;
2430 fullImpl->getNodeModifiers()->getCommonModifier()->setOverlay(
2431 node->uiNodeHandle, item->string, values, ALLOW_SIZE_10);
2432 return ERROR_CODE_NO_ERROR;
2433 }
2434
GetOverlay(ArkUI_NodeHandle node)2435 const ArkUI_AttributeItem* GetOverlay(ArkUI_NodeHandle node)
2436 {
2437 ArkUIOverlayOptions options;
2438 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
2439 auto contentStr = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getOverlay(
2440 node->uiNodeHandle, &options, unit);
2441 g_attributeItem.string = contentStr;
2442 int index = 0;
2443 //index 0 : align
2444 g_numberValues[index++].i32 = options.align;
2445 //index 1 : offset x
2446 g_numberValues[index++].f32 = options.x;
2447 //index 2 : offset y
2448 g_numberValues[index++].f32 = options.y;
2449 g_attributeItem.size = index;
2450 return &g_attributeItem;
2451 }
2452
ResetOverlay(ArkUI_NodeHandle node)2453 void ResetOverlay(ArkUI_NodeHandle node)
2454 {
2455 auto* fullImpl = GetFullImpl();
2456 fullImpl->getNodeModifiers()->getCommonModifier()->resetOverlay(node->uiNodeHandle);
2457 }
2458
SetBackgroundImagePosition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2459 int32_t SetBackgroundImagePosition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2460 {
2461 auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
2462 if (actualSize < 0) {
2463 return ERROR_CODE_PARAM_INVALID;
2464 }
2465 auto fullImpl = GetFullImpl();
2466 ArkUI_Float32 values[] = { item->value[NUM_0].f32, item->value[NUM_1].f32 };
2467 int32_t unit = GetDefaultUnit(node, UNIT_PX);
2468 ArkUI_Int32 units[] = { unit, unit };
2469
2470 fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundImagePosition(
2471 node->uiNodeHandle, values, units, false, NUM_2);
2472 return ERROR_CODE_NO_ERROR;
2473 }
2474
ResetBackgroundImagePosition(ArkUI_NodeHandle node)2475 void ResetBackgroundImagePosition(ArkUI_NodeHandle node)
2476 {
2477 auto* fullImpl = GetFullImpl();
2478
2479 fullImpl->getNodeModifiers()->getCommonModifier()->resetBackgroundImagePosition(node->uiNodeHandle);
2480 }
2481
GetBackgroundImagePosition(ArkUI_NodeHandle node)2482 const ArkUI_AttributeItem* GetBackgroundImagePosition(ArkUI_NodeHandle node)
2483 {
2484 auto fullImpl = GetFullImpl();
2485 ArkUIPositionOptions positionOption = { 0.0f, 0.0f };
2486 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_PX);
2487 fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundImagePosition(node->uiNodeHandle,
2488 &positionOption, unit);
2489 g_numberValues[NUM_0].f32 = positionOption.x;
2490 g_numberValues[NUM_1].f32 = positionOption.y;
2491 g_attributeItem.size = NUM_2;
2492 return &g_attributeItem;
2493 }
2494
SetSweepGradient(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2495 int32_t SetSweepGradient(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2496 {
2497 if (item->size == 0) {
2498 return ERROR_CODE_PARAM_INVALID;
2499 }
2500 if (item->object == nullptr) {
2501 return ERROR_CODE_PARAM_INVALID;
2502 }
2503 auto* fullImpl = GetFullImpl();
2504 const ArkUI_ColorStop* colorStop = reinterpret_cast<ArkUI_ColorStop*>(item->object);
2505 int size = colorStop->size;
2506 ArkUIInt32orFloat32 colors[size * NUM_3];
2507 for (int i = 0; i < size; i++) {
2508 colors[i * NUM_3 + NUM_0].u32 = colorStop->colors[i];
2509 colors[i * NUM_3 + NUM_1].i32 = true;
2510 colors[i * NUM_3 + NUM_2].f32 = colorStop->stops[i];
2511 }
2512 int32_t unit = GetDefaultUnit(node, UNIT_VP);
2513 ArkUIInt32orFloat32 values[NUM_13] = {
2514 {.i32 = static_cast<ArkUI_Int32>(false)},
2515 {.f32 = static_cast<ArkUI_Float32>(DEFAULT_X)},
2516 {.i32 = static_cast<ArkUI_Int32>(unit)},
2517 {.i32 = static_cast<ArkUI_Int32>(false)},
2518 {.f32 = static_cast<ArkUI_Float32>(DEFAULT_Y)},
2519 {.i32 = static_cast<ArkUI_Int32>(unit)},
2520 {.i32 = static_cast<ArkUI_Int32>(false)},
2521 {.f32 = static_cast<ArkUI_Float32>(NUM_0)},
2522 {.i32 = static_cast<ArkUI_Int32>(false)},
2523 {.f32 = static_cast<ArkUI_Float32>(NUM_0)},
2524 {.i32 = static_cast<ArkUI_Int32>(false)},
2525 {.f32 = static_cast<ArkUI_Float32>(NUM_0)},
2526 {.i32 = static_cast<ArkUI_Int32>(false)}};
2527
2528 if (item->size > NUM_0) {
2529 values[NUM_0].i32 = static_cast<ArkUI_Int32>(true);
2530 values[NUM_1].f32 = item->value[NUM_0].f32;
2531 }
2532
2533 if (item->size > NUM_1) {
2534 values[NUM_3].i32 = static_cast<ArkUI_Int32>(true);
2535 values[NUM_4].f32 = item->value[NUM_1].f32;
2536 }
2537
2538 if (item->size > NUM_2) {
2539 values[NUM_6].i32 = static_cast<ArkUI_Int32>(true);
2540 values[NUM_7].f32 = item->value[NUM_2].f32;
2541 }
2542
2543 if (item->size > NUM_3) {
2544 values[NUM_8].i32 = static_cast<ArkUI_Int32>(true);
2545 values[NUM_9].f32 = item->value[NUM_3].f32;
2546 }
2547
2548 if (item->size > NUM_4) {
2549 values[NUM_10].i32 = static_cast<ArkUI_Int32>(true);
2550 values[NUM_11].f32 = item->value[NUM_4].f32;
2551 }
2552
2553 values[NUM_12].i32 = item->size > NUM_5 ? item->value[NUM_5].i32 : static_cast<ArkUI_Int32>(true);
2554
2555 fullImpl->getNodeModifiers()->getCommonModifier()->setSweepGradient(
2556 node->uiNodeHandle, values, NUM_13, colors, size * NUM_3);
2557 return ERROR_CODE_NO_ERROR;
2558 }
2559
ResetSweepGradient(ArkUI_NodeHandle node)2560 void ResetSweepGradient(ArkUI_NodeHandle node)
2561 {
2562 auto* fullImpl = GetFullImpl();
2563 fullImpl->getNodeModifiers()->getCommonModifier()->resetSweepGradient(node->uiNodeHandle);
2564 }
2565
GetSweepGradient(ArkUI_NodeHandle node)2566 const ArkUI_AttributeItem* GetSweepGradient(ArkUI_NodeHandle node)
2567 {
2568 //default size 6
2569 ArkUI_Float32 values[NUM_6];
2570 //default size 10
2571 ArkUI_Uint32 colors[NUM_10];
2572 //default size 10
2573 ArkUI_Float32 stops[NUM_10];
2574 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
2575 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getSweepGradient(
2576 node->uiNodeHandle, &values, &colors, &stops, unit);
2577 //centerX
2578 g_numberValues[NUM_0].f32 = values[NUM_0];
2579 //centerY
2580 g_numberValues[NUM_1].f32 = values[NUM_1];
2581 //startAngle
2582 g_numberValues[NUM_2].f32 = values[NUM_2];
2583 //endAngle
2584 g_numberValues[NUM_3].f32 = values[NUM_3];
2585 //rotation
2586 g_numberValues[NUM_4].f32 = values[NUM_4];
2587 //repeating
2588 g_numberValues[NUM_5].i32 = values[NUM_5];
2589 //size
2590 g_attributeItem.size = NUM_6;
2591 if (resultValue < NUM_1) {
2592 return &g_attributeItem;
2593 }
2594
2595 static ArkUI_ColorStop colorStop;
2596 static uint32_t gradientColors[NUM_10];
2597 static float gradientStops[NUM_10];
2598 for (int i = 0; i < resultValue; i++) {
2599 gradientColors[i] = colors[i];
2600 gradientStops[i] = stops[i] / 100.0f; //百分比转换为小数
2601 }
2602 colorStop.colors = gradientColors;
2603 colorStop.stops = gradientStops;
2604 colorStop.size = resultValue;
2605 g_attributeItem.object = &colorStop;
2606 return &g_attributeItem;
2607 }
2608
SetRadialGradient(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2609 int32_t SetRadialGradient(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2610 {
2611 if (item->size == 0) {
2612 return ERROR_CODE_PARAM_INVALID;
2613 }
2614 if (item->object == nullptr) {
2615 return ERROR_CODE_PARAM_INVALID;
2616 }
2617 auto* fullImpl = GetFullImpl();
2618 const ArkUI_ColorStop* colorStop = reinterpret_cast<ArkUI_ColorStop*>(item->object);
2619 int size = colorStop->size;
2620 ArkUIInt32orFloat32 colors[size * NUM_3];
2621 for (int i = 0; i < size; i++) {
2622 colors[i * NUM_3 + NUM_0].u32 = colorStop->colors[i];
2623 colors[i * NUM_3 + NUM_1].i32 = true;
2624 colors[i * NUM_3 + NUM_2].f32 = colorStop->stops[i];
2625 }
2626 int32_t unit = GetDefaultUnit(node, UNIT_VP);
2627 ArkUIInt32orFloat32 values[NUM_10] = {
2628 {.i32 = static_cast<ArkUI_Int32>(false) },
2629 {.f32 = static_cast<ArkUI_Float32>(DEFAULT_X) },
2630 {.i32 = static_cast<ArkUI_Float32>(unit) },
2631 {.i32 = static_cast<ArkUI_Int32>(false) },
2632 {.f32 = static_cast<ArkUI_Float32>(DEFAULT_Y) },
2633 {.i32 = static_cast<ArkUI_Float32>(unit) },
2634 {.i32 = static_cast<ArkUI_Int32>(false) },
2635 {.f32 = static_cast<ArkUI_Float32>(NUM_0) },
2636 {.i32 = static_cast<ArkUI_Float32>(unit) },
2637 {.i32 = static_cast<ArkUI_Int32>(false) }
2638 };
2639
2640 if (item->size > NUM_0) {
2641 values[NUM_0].i32 = static_cast<ArkUI_Int32>(true);
2642 values[NUM_1].f32 = item->value[NUM_0].f32;
2643 }
2644
2645 if (item->size > NUM_1) {
2646 values[NUM_3].i32 = static_cast<ArkUI_Int32>(true);
2647 values[NUM_4].f32 = item->value[NUM_1].f32;
2648 }
2649
2650 if (item->size > NUM_2) {
2651 values[NUM_6].i32 = static_cast<ArkUI_Int32>(true);
2652 values[NUM_7].f32 = item->value[NUM_2].f32;
2653 }
2654
2655 values[NUM_9].i32 = item->size > NUM_3 ? item->value[NUM_3].i32 : static_cast<ArkUI_Int32>(false);
2656 fullImpl->getNodeModifiers()->getCommonModifier()->setRadialGradient(
2657 node->uiNodeHandle, values, NUM_10, colors, size * NUM_3);
2658 return ERROR_CODE_NO_ERROR;
2659 }
2660
ResetRadialGradient(ArkUI_NodeHandle node)2661 void ResetRadialGradient(ArkUI_NodeHandle node)
2662 {
2663 auto* fullImpl = GetFullImpl();
2664 fullImpl->getNodeModifiers()->getCommonModifier()->resetRadialGradient(node->uiNodeHandle);
2665 }
2666
GetRadialGradient(ArkUI_NodeHandle node)2667 const ArkUI_AttributeItem* GetRadialGradient(ArkUI_NodeHandle node)
2668 {
2669 //default size 4
2670 ArkUI_Float32 values[NUM_4];
2671 //default size 10
2672 ArkUI_Uint32 colors[NUM_10];
2673 //default size 10
2674 ArkUI_Float32 stops[NUM_10];
2675
2676 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
2677 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getRadialGradient(
2678 node->uiNodeHandle, &values, &colors, &stops, unit);
2679 //centerX
2680 g_numberValues[NUM_0].f32 = values[NUM_0];
2681 //centerY
2682 g_numberValues[NUM_1].f32 = values[NUM_1];
2683 //radius
2684 g_numberValues[NUM_2].f32 = values[NUM_2];
2685 //repeating
2686 g_numberValues[NUM_3].i32 = values[NUM_3];
2687 //size
2688 g_attributeItem.size = NUM_3;
2689 if (resultValue < NUM_1) {
2690 return &g_attributeItem;
2691 }
2692
2693 static ArkUI_ColorStop colorStop;
2694 static uint32_t gradientColors[NUM_10];
2695 static float gradientStops[NUM_10];
2696 for (int i = 0; i < resultValue; i++) {
2697 gradientColors[i] = colors[i];
2698 gradientStops[i] = stops[i] / 100.0f; //百分比转换为小数
2699 }
2700 colorStop.colors = gradientColors;
2701 colorStop.stops = gradientStops;
2702 colorStop.size = resultValue;
2703 g_attributeItem.object = &colorStop;
2704 return &g_attributeItem;
2705 }
2706
SetMask(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2707 int32_t SetMask(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2708 {
2709 if (item->size < NUM_4) {
2710 return ERROR_CODE_PARAM_INVALID;
2711 }
2712 auto* fullImpl = GetFullImpl();
2713 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
2714 if (item->value[NUM_3].i32 == ArkUI_MaskType::ARKUI_MASK_TYPE_PATH) {
2715 if (item->string == nullptr) {
2716 return ERROR_CODE_PARAM_INVALID;
2717 }
2718 auto fill = item->size > NUM_0 ? item->value[0].u32 : DEFAULT_FIll_COLOR;
2719 auto stroke = item->size > NUM_1 ? item->value[NUM_1].u32 : DEFAULT_FIll_COLOR;
2720 float strokeWidth = item->size > NUM_2 ? item->value[NUM_2].f32 : NUM_0;
2721 ArkUI_Float32 pathAttributes[NUM_2];
2722 if (item->size < NUM_5 || LessNotEqual(item->value[NUM_4].f32, 0.0f)) {
2723 return ERROR_CODE_PARAM_INVALID;
2724 }
2725 pathAttributes[NUM_0] = item->value[NUM_4].f32; // path width
2726 if (item->size < NUM_6 || LessNotEqual(item->value[NUM_5].f32, 0.0f)) {
2727 return ERROR_CODE_PARAM_INVALID;
2728 }
2729 pathAttributes[NUM_1] = item->value[NUM_5].f32; // path height
2730 fullImpl->getNodeModifiers()->getCommonModifier()->setMaskPath(
2731 node->uiNodeHandle, "path", fill, stroke, strokeWidth, &pathAttributes, item->string, unit);
2732 } else if (item->value[0].i32 == ArkUI_MaskType::ARKUI_MASK_TYPE_PROGRESS) {
2733 ArkUI_Float32 progressAttributes[NUM_2];
2734 if (LessNotEqual(item->value[NUM_1].f32, 0.0f) || LessNotEqual(item->value[NUM_2].f32, 0.0f)) {
2735 return ERROR_CODE_PARAM_INVALID;
2736 }
2737 progressAttributes[NUM_0] = item->value[NUM_1].f32; // value
2738 progressAttributes[NUM_1] = item->value[NUM_2].f32; // total
2739 uint32_t color = item->value[NUM_3].u32;
2740 fullImpl->getNodeModifiers()->getCommonModifier()->setProgressMask(
2741 node->uiNodeHandle, progressAttributes, color);
2742 } else {
2743 if (item->size < NUM_6) {
2744 return ERROR_CODE_PARAM_INVALID;
2745 }
2746 auto fill = item->size > NUM_0 ? item->value[0].u32 : DEFAULT_FIll_COLOR;
2747 auto stroke = item->size > NUM_1 ? item->value[NUM_1].u32 : DEFAULT_FIll_COLOR;
2748 float strokeWidth = item->size > NUM_2 ? item->value[NUM_2].f32 : NUM_0;
2749 auto index = item->size - NUM_4 < 0 ? 0 : item->size - NUM_4;
2750 ArkUI_Float32 attributes[index];
2751 for (int i = 0; i < index; i++) {
2752 if (LessNotEqual(item->value[i + NUM_4].f32, 0.0f)) {
2753 return ERROR_CODE_PARAM_INVALID;
2754 } else {
2755 attributes[i] = item->value[i + NUM_4].f32;
2756 }
2757 }
2758 fullImpl->getNodeModifiers()->getCommonModifier()->setMaskShape(node->uiNodeHandle,
2759 ShapeToString(item->value[NUM_3].i32).c_str(), fill, stroke, strokeWidth, attributes, item->size - NUM_4,
2760 unit);
2761 }
2762 return ERROR_CODE_NO_ERROR;
2763 }
2764
ResetMask(ArkUI_NodeHandle node)2765 void ResetMask(ArkUI_NodeHandle node)
2766 {
2767 auto* fullImpl = GetFullImpl();
2768 fullImpl->getNodeModifiers()->getCommonModifier()->resetMask(node->uiNodeHandle);
2769 }
2770
GetMask(ArkUI_NodeHandle node)2771 const ArkUI_AttributeItem* GetMask(ArkUI_NodeHandle node)
2772 {
2773 ArkUIMaskOptions options;
2774 auto unit = GetDefaultUnit(node, UNIT_VP);
2775 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getMask(node->uiNodeHandle, &options, unit);
2776 CHECK_NULL_RETURN(&options, nullptr);
2777 if (options.type == static_cast<ArkUI_Int32>(ArkUI_MaskType::ARKUI_MASK_TYPE_PROGRESS)) {
2778 g_numberValues[NUM_0].i32 = options.type;
2779 g_numberValues[NUM_1].f32 = options.value;
2780 g_numberValues[NUM_2].f32 = options.maxValue;
2781 g_numberValues[NUM_3].u32 = options.color;
2782 return &g_attributeItem;
2783 }
2784 switch (static_cast<BasicShapeType>(options.type)) {
2785 case BasicShapeType::RECT:
2786 g_numberValues[NUM_0].u32 = options.fill;
2787 g_numberValues[NUM_1].u32 = options.strokeColor;
2788 g_numberValues[NUM_2].f32 = options.strokeWidth;
2789 g_numberValues[NUM_3].i32 = static_cast<ArkUI_Int32>(ArkUI_MaskType::ARKUI_MASK_TYPE_RECTANGLE);
2790 g_numberValues[NUM_4].f32 = options.width;
2791 g_numberValues[NUM_5].f32 = options.height;
2792 g_numberValues[NUM_6].f32 = options.radiusWidth;
2793 g_numberValues[NUM_7].f32 = options.radiusHeight;
2794 g_numberValues[NUM_8].f32 = options.topLeftRadius;
2795 g_numberValues[NUM_9].f32 = options.bottomLeftRadius;
2796 g_numberValues[NUM_10].f32 = options.topRightRadius;
2797 g_numberValues[NUM_11].f32 = options.bottomRightRadius;
2798 break;
2799 case BasicShapeType::CIRCLE:
2800 g_numberValues[NUM_0].u32 = options.fill;
2801 g_numberValues[NUM_1].u32 = options.strokeColor;
2802 g_numberValues[NUM_2].f32 = options.strokeWidth;
2803 g_numberValues[NUM_3].i32 = static_cast<ArkUI_Int32>(ArkUI_MaskType::ARKUI_MASK_TYPE_CIRCLE);
2804 g_numberValues[NUM_4].f32 = options.width;
2805 g_numberValues[NUM_5].f32 = options.height;
2806 break;
2807 case BasicShapeType::ELLIPSE:
2808 g_numberValues[NUM_0].u32 = options.fill;
2809 g_numberValues[NUM_1].u32 = options.strokeColor;
2810 g_numberValues[NUM_2].f32 = options.strokeWidth;
2811 g_numberValues[NUM_3].i32 = static_cast<ArkUI_Int32>(ArkUI_MaskType::ARKUI_MASK_TYPE_ELLIPSE);
2812 g_numberValues[NUM_4].f32 = options.width;
2813 g_numberValues[NUM_5].f32 = options.height;
2814 break;
2815
2816 case BasicShapeType::PATH:
2817 g_numberValues[NUM_0].u32 = options.fill;
2818 g_numberValues[NUM_1].u32 = options.strokeColor;
2819 g_numberValues[NUM_2].f32 = options.strokeWidth;
2820 g_numberValues[NUM_3].i32 = static_cast<ArkUI_Int32>(ArkUI_MaskType::ARKUI_MASK_TYPE_PATH);
2821 g_numberValues[NUM_4].f32 = options.width;
2822 g_numberValues[NUM_5].f32 = options.height;
2823 g_attributeItem.string = options.commands;
2824 break;
2825 default:
2826 return nullptr;
2827 }
2828 return &g_attributeItem;
2829 }
2830
SetBlendMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2831 int32_t SetBlendMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2832 {
2833 if (item->size == 0) {
2834 return ERROR_CODE_PARAM_INVALID;
2835 }
2836 if (!InRegion(NUM_0, NUM_29, item->value[NUM_0].i32) || !InRegion(NUM_0, NUM_1, item->value[NUM_1].i32)) {
2837 return ERROR_CODE_PARAM_INVALID;
2838 }
2839
2840 auto* fullImpl = GetFullImpl();
2841 int blendMode = item->value[0].i32;
2842 int blendApplyType = NUM_0;
2843 if (item->size > NUM_1) {
2844 blendApplyType = item->value[1].i32;
2845 }
2846 fullImpl->getNodeModifiers()->getCommonModifier()->setBlendMode(node->uiNodeHandle, blendMode, blendApplyType);
2847 return ERROR_CODE_NO_ERROR;
2848 }
2849
ResetBlendMode(ArkUI_NodeHandle node)2850 void ResetBlendMode(ArkUI_NodeHandle node)
2851 {
2852 auto* fullImpl = GetFullImpl();
2853 fullImpl->getNodeModifiers()->getCommonModifier()->resetBlendMode(node->uiNodeHandle);
2854 }
2855
GetBlendMode(ArkUI_NodeHandle node)2856 const ArkUI_AttributeItem* GetBlendMode(ArkUI_NodeHandle node)
2857 {
2858 ArkUIBlendModeOptions options;
2859 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getBlendMode(node->uiNodeHandle, &options);
2860 g_numberValues[NUM_0].i32 = options.blendMode;
2861 g_numberValues[NUM_1].i32 = options.blendApplyType;
2862 return &g_attributeItem;
2863 }
2864
SetDirection(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2865 int32_t SetDirection(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2866 {
2867 if (item->size == 0) {
2868 return ERROR_CODE_PARAM_INVALID;
2869 }
2870 if (item->value[0].i32 < ArkUI_Direction::ARKUI_DIRECTION_LTR ||
2871 item->value[0].i32 > ArkUI_Direction::ARKUI_DIRECTION_AUTO) {
2872 return ERROR_CODE_PARAM_INVALID;
2873 }
2874 auto* fullImpl = GetFullImpl();
2875 fullImpl->getNodeModifiers()->getCommonModifier()->setDirection(node->uiNodeHandle, item->value[0].i32);
2876 return ERROR_CODE_NO_ERROR;
2877 }
2878
ResetDirection(ArkUI_NodeHandle node)2879 void ResetDirection(ArkUI_NodeHandle node)
2880 {
2881 auto* fullImpl = GetFullImpl();
2882 fullImpl->getNodeModifiers()->getCommonModifier()->resetDirection(node->uiNodeHandle);
2883 }
2884
GetDirection(ArkUI_NodeHandle node)2885 const ArkUI_AttributeItem* GetDirection(ArkUI_NodeHandle node)
2886 {
2887 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2888 g_numberValues[0].i32 = modifier->getDirection(node->uiNodeHandle);
2889 return &g_attributeItem;
2890 }
2891
SetAlignSelf(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2892 int32_t SetAlignSelf(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2893 {
2894 if (item->size == 0) {
2895 return ERROR_CODE_PARAM_INVALID;
2896 }
2897 if (item->value[0].i32 < ArkUI_ItemAlignment::ARKUI_ITEM_ALIGNMENT_AUTO ||
2898 item->value[0].i32 > ArkUI_ItemAlignment::ARKUI_ITEM_ALIGNMENT_BASELINE) {
2899 return ERROR_CODE_PARAM_INVALID;
2900 }
2901 auto* fullImpl = GetFullImpl();
2902 fullImpl->getNodeModifiers()->getCommonModifier()->setAlignSelf(node->uiNodeHandle, item->value[0].i32);
2903 return ERROR_CODE_NO_ERROR;
2904 }
2905
ResetAlignSelf(ArkUI_NodeHandle node)2906 void ResetAlignSelf(ArkUI_NodeHandle node)
2907 {
2908 auto* fullImpl = GetFullImpl();
2909 fullImpl->getNodeModifiers()->getCommonModifier()->resetAlignSelf(node->uiNodeHandle);
2910 }
2911
GetAlignSelf(ArkUI_NodeHandle node)2912 const ArkUI_AttributeItem* GetAlignSelf(ArkUI_NodeHandle node)
2913 {
2914 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2915 g_numberValues[0].i32 = modifier->getAlignSelf(node->uiNodeHandle);
2916 return &g_attributeItem;
2917 }
2918
SetFlexGrow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2919 int32_t SetFlexGrow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2920 {
2921 if (item->size == 0) {
2922 return ERROR_CODE_PARAM_INVALID;
2923 }
2924 if (LessNotEqual(item->value[0].f32, 0.0f)) {
2925 return ERROR_CODE_PARAM_INVALID;
2926 }
2927 auto fullImpl = GetFullImpl();
2928 fullImpl->getNodeModifiers()->getCommonModifier()->setFlexGrow(node->uiNodeHandle, item->value[0].f32);
2929 return ERROR_CODE_NO_ERROR;
2930 }
2931
ResetFlexGrow(ArkUI_NodeHandle node)2932 void ResetFlexGrow(ArkUI_NodeHandle node)
2933 {
2934 auto* fullImpl = GetFullImpl();
2935 fullImpl->getNodeModifiers()->getCommonModifier()->resetFlexGrow(node->uiNodeHandle);
2936 }
2937
GetFlexGrow(ArkUI_NodeHandle node)2938 const ArkUI_AttributeItem* GetFlexGrow(ArkUI_NodeHandle node)
2939 {
2940 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2941 g_numberValues[0].f32 = modifier->getFlexGrow(node->uiNodeHandle);
2942 return &g_attributeItem;
2943 }
2944
SetFlexShrink(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2945 int32_t SetFlexShrink(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2946 {
2947 if (item->size == 0) {
2948 return ERROR_CODE_PARAM_INVALID;
2949 }
2950 if (LessNotEqual(item->value[0].f32, 0.0f)) {
2951 return ERROR_CODE_PARAM_INVALID;
2952 }
2953 auto fullImpl = GetFullImpl();
2954 fullImpl->getNodeModifiers()->getCommonModifier()->setFlexShrink(node->uiNodeHandle, item->value[0].f32);
2955 return ERROR_CODE_NO_ERROR;
2956 }
2957
ResetFlexShrink(ArkUI_NodeHandle node)2958 void ResetFlexShrink(ArkUI_NodeHandle node)
2959 {
2960 auto* fullImpl = GetFullImpl();
2961 fullImpl->getNodeModifiers()->getCommonModifier()->resetFlexShrink(node->uiNodeHandle);
2962 }
2963
GetFlexShrink(ArkUI_NodeHandle node)2964 const ArkUI_AttributeItem* GetFlexShrink(ArkUI_NodeHandle node)
2965 {
2966 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2967 g_numberValues[0].f32 = modifier->getFlexShrink(node->uiNodeHandle);
2968 return &g_attributeItem;
2969 }
2970
SetFlexBasis(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2971 int32_t SetFlexBasis(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2972 {
2973 if (item->size == 0) {
2974 return ERROR_CODE_PARAM_INVALID;
2975 }
2976 if (LessNotEqual(item->value[0].f32, 0.0f)) {
2977 return ERROR_CODE_PARAM_INVALID;
2978 }
2979 auto fullImpl = GetFullImpl();
2980 struct ArkUIStringAndFloat basis = { item->value[0].f32, nullptr };
2981 fullImpl->getNodeModifiers()->getCommonModifier()->setFlexBasis(node->uiNodeHandle, &basis);
2982 return ERROR_CODE_NO_ERROR;
2983 }
2984
ResetFlexBasis(ArkUI_NodeHandle node)2985 void ResetFlexBasis(ArkUI_NodeHandle node)
2986 {
2987 auto* fullImpl = GetFullImpl();
2988 fullImpl->getNodeModifiers()->getCommonModifier()->resetFlexBasis(node->uiNodeHandle);
2989 }
2990
GetFlexBasis(ArkUI_NodeHandle node)2991 const ArkUI_AttributeItem* GetFlexBasis(ArkUI_NodeHandle node)
2992 {
2993 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
2994 g_numberValues[0].f32 = modifier->getFlexBasis(node->uiNodeHandle);
2995 return &g_attributeItem;
2996 }
2997
SetConstraintSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)2998 int32_t SetConstraintSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
2999 {
3000 if (item->size == 0 || item->size != ALLOW_SIZE_4) {
3001 return ERROR_CODE_PARAM_INVALID;
3002 }
3003
3004 auto* fullImpl = GetFullImpl();
3005 ArkUI_Float32 constraintSize[ALLOW_SIZE_4] = { 0.0f, FLT_MAX, 0.0f, FLT_MAX };
3006 int32_t unit = GetDefaultUnit(node, UNIT_VP);
3007 ArkUI_Int32 units[ALLOW_SIZE_4] = { unit, unit, unit, unit };
3008
3009 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
3010 if (LessNotEqual(item->value[i].f32, 0.0f)) {
3011 return ERROR_CODE_PARAM_INVALID;
3012 } else {
3013 constraintSize[i] = item->value[i].f32;
3014 }
3015 }
3016
3017 fullImpl->getNodeModifiers()->getCommonModifier()->setConstraintSize(node->uiNodeHandle, constraintSize, units);
3018 return ERROR_CODE_NO_ERROR;
3019 }
3020
ResetConstraintSize(ArkUI_NodeHandle node)3021 void ResetConstraintSize(ArkUI_NodeHandle node)
3022 {
3023 auto* fullImpl = GetFullImpl();
3024 fullImpl->getNodeModifiers()->getCommonModifier()->resetConstraintSize(node->uiNodeHandle);
3025 }
3026
GetConstraintSize(ArkUI_NodeHandle node)3027 const ArkUI_AttributeItem* GetConstraintSize(ArkUI_NodeHandle node)
3028 {
3029 ArkUIConstraintSizeOptions options;
3030 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
3031 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getConstraintSize(node->uiNodeHandle, &options, unit);
3032 g_numberValues[NUM_0].f32 = options.minWidth;
3033 g_numberValues[NUM_1].f32 = options.maxWidth;
3034 g_numberValues[NUM_2].f32 = options.minHeight;
3035 g_numberValues[NUM_3].f32 = options.maxHeight;
3036 return &g_attributeItem;
3037 }
3038
SetGrayscale(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3039 int32_t SetGrayscale(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3040 {
3041 if (item->size == 0) {
3042 return ERROR_CODE_PARAM_INVALID;
3043 }
3044 if (LessNotEqual(item->value[0].f32, 0.0f) || GreatNotEqual(item->value[0].f32, 1.0f)) {
3045 return ERROR_CODE_PARAM_INVALID;
3046 }
3047 auto* fullImpl = GetFullImpl();
3048 fullImpl->getNodeModifiers()->getCommonModifier()->setGrayscale(node->uiNodeHandle, item->value[0].f32);
3049 return ERROR_CODE_NO_ERROR;
3050 }
3051
ResetGrayscale(ArkUI_NodeHandle node)3052 void ResetGrayscale(ArkUI_NodeHandle node)
3053 {
3054 auto* fullImpl = GetFullImpl();
3055 fullImpl->getNodeModifiers()->getCommonModifier()->resetGrayscale(node->uiNodeHandle);
3056 }
3057
GetGrayscale(ArkUI_NodeHandle node)3058 const ArkUI_AttributeItem* GetGrayscale(ArkUI_NodeHandle node)
3059 {
3060 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3061 g_numberValues[0].f32 = modifier->getGrayScale(node->uiNodeHandle);
3062 return &g_attributeItem;
3063 }
3064
SetInvert(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3065 int32_t SetInvert(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3066 {
3067 if (item->size == 0) {
3068 return ERROR_CODE_PARAM_INVALID;
3069 }
3070 if (LessNotEqual(item->value[0].f32, 0.0f) || GreatNotEqual(item->value[0].f32, 1.0f)) {
3071 return ERROR_CODE_PARAM_INVALID;
3072 }
3073 auto fullImpl = GetFullImpl();
3074 ArkUI_Float32 invert[] = { item->value[0].f32 };
3075 fullImpl->getNodeModifiers()->getCommonModifier()->setInvert(node->uiNodeHandle, invert, NUM_1);
3076 return ERROR_CODE_NO_ERROR;
3077 }
3078
ResetInvert(ArkUI_NodeHandle node)3079 void ResetInvert(ArkUI_NodeHandle node)
3080 {
3081 auto* fullImpl = GetFullImpl();
3082 fullImpl->getNodeModifiers()->getCommonModifier()->resetInvert(node->uiNodeHandle);
3083 }
3084
GetInvert(ArkUI_NodeHandle node)3085 const ArkUI_AttributeItem* GetInvert(ArkUI_NodeHandle node)
3086 {
3087 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3088 g_numberValues[0].f32 = modifier->getInvert(node->uiNodeHandle);
3089 return &g_attributeItem;
3090 }
3091
SetSepia(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3092 int32_t SetSepia(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3093 {
3094 if (item->size == 0) {
3095 return ERROR_CODE_PARAM_INVALID;
3096 }
3097 if (LessNotEqual(item->value[0].f32, 0.0f) || GreatNotEqual(item->value[0].f32, 1.0f)) {
3098 return ERROR_CODE_PARAM_INVALID;
3099 }
3100 auto* fullImpl = GetFullImpl();
3101 fullImpl->getNodeModifiers()->getCommonModifier()->setSepia(node->uiNodeHandle, item->value[0].f32);
3102 return ERROR_CODE_NO_ERROR;
3103 }
3104
ResetSepia(ArkUI_NodeHandle node)3105 void ResetSepia(ArkUI_NodeHandle node)
3106 {
3107 auto* fullImpl = GetFullImpl();
3108 fullImpl->getNodeModifiers()->getCommonModifier()->resetSepia(node->uiNodeHandle);
3109 }
3110
GetSepia(ArkUI_NodeHandle node)3111 const ArkUI_AttributeItem* GetSepia(ArkUI_NodeHandle node)
3112 {
3113 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3114 g_numberValues[0].f32 = modifier->getSepia(node->uiNodeHandle);
3115 return &g_attributeItem;
3116 }
3117
SetContrast(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3118 int32_t SetContrast(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3119 {
3120 if (item->size == 0) {
3121 return ERROR_CODE_PARAM_INVALID;
3122 }
3123 if (LessNotEqual(item->value[0].f32, 0.0f) || GreatOrEqual(item->value[0].f32, 10.0f)) {
3124 return ERROR_CODE_PARAM_INVALID;
3125 }
3126 auto* fullImpl = GetFullImpl();
3127 fullImpl->getNodeModifiers()->getCommonModifier()->setContrast(node->uiNodeHandle, item->value[0].f32);
3128 return ERROR_CODE_NO_ERROR;
3129 }
3130
ResetContrast(ArkUI_NodeHandle node)3131 void ResetContrast(ArkUI_NodeHandle node)
3132 {
3133 auto* fullImpl = GetFullImpl();
3134 fullImpl->getNodeModifiers()->getCommonModifier()->resetContrast(node->uiNodeHandle);
3135 }
3136
GetContrast(ArkUI_NodeHandle node)3137 const ArkUI_AttributeItem* GetContrast(ArkUI_NodeHandle node)
3138 {
3139 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3140 g_numberValues[0].f32 = modifier->getContrast(node->uiNodeHandle);
3141 return &g_attributeItem;
3142 }
3143
SetForegroundColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3144 int32_t SetForegroundColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3145 {
3146 if (item->size == 0) {
3147 return ERROR_CODE_PARAM_INVALID;
3148 }
3149 auto* fullImpl = GetFullImpl();
3150 bool isColor = true;
3151 if (item->value[0].i32 == ArkUI_ColorStrategy::ARKUI_COLOR_STRATEGY_INVERT ||
3152 item->value[0].i32 == ArkUI_ColorStrategy::ARKUI_COLOR_STRATEGY_AVERAGE ||
3153 item->value[0].i32 == ArkUI_ColorStrategy::ARKUI_COLOR_STRATEGY_PRIMARY) {
3154 isColor = false;
3155 fullImpl->getNodeModifiers()->getCommonModifier()->setForegroundColor(
3156 node->uiNodeHandle, isColor, item->value[0].i32);
3157 } else {
3158 isColor = true;
3159 fullImpl->getNodeModifiers()->getCommonModifier()->setForegroundColor(
3160 node->uiNodeHandle, isColor, item->value[0].u32);
3161 }
3162 return ERROR_CODE_NO_ERROR;
3163 }
3164
ResetForegroundColor(ArkUI_NodeHandle node)3165 void ResetForegroundColor(ArkUI_NodeHandle node)
3166 {
3167 auto* fullImpl = GetFullImpl();
3168 fullImpl->getNodeModifiers()->getCommonModifier()->resetForegroundColor(node->uiNodeHandle);
3169 }
3170
GetForegroundColor(ArkUI_NodeHandle node)3171 const ArkUI_AttributeItem* GetForegroundColor(ArkUI_NodeHandle node)
3172 {
3173 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3174 g_numberValues[0].u32 = modifier->getForegroundColor(node->uiNodeHandle);
3175 return &g_attributeItem;
3176 }
3177
SetNeedFocus(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3178 int32_t SetNeedFocus(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3179 {
3180 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
3181 return ERROR_CODE_PARAM_INVALID;
3182 }
3183 GetFullImpl()->getNodeModifiers()->getCommonModifier()->setNeedFocus(
3184 node->uiNodeHandle, item->value[0].i32);
3185 return ERROR_CODE_NO_ERROR;
3186 }
3187
GetNeedFocus(ArkUI_NodeHandle node)3188 const ArkUI_AttributeItem* GetNeedFocus(ArkUI_NodeHandle node)
3189 {
3190 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getNeedFocus(node->uiNodeHandle);
3191 g_numberValues[0].i32 = resultValue;
3192 return &g_attributeItem;
3193 }
3194
SetAspectRatio(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3195 int32_t SetAspectRatio(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3196 {
3197 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3198 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
3199 return ERROR_CODE_PARAM_INVALID;
3200 }
3201 auto* fullImpl = GetFullImpl();
3202 fullImpl->getNodeModifiers()->getCommonModifier()->setAspectRatio(node->uiNodeHandle, item->value[NUM_0].f32);
3203 return ERROR_CODE_NO_ERROR;
3204 }
3205
ResetAspectRatio(ArkUI_NodeHandle node)3206 void ResetAspectRatio(ArkUI_NodeHandle node)
3207 {
3208 auto* fullImpl = GetFullImpl();
3209 fullImpl->getNodeModifiers()->getCommonModifier()->resetAspectRatio(node->uiNodeHandle);
3210 }
3211
GetAspectRatio(ArkUI_NodeHandle node)3212 const ArkUI_AttributeItem* GetAspectRatio(ArkUI_NodeHandle node)
3213 {
3214 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3215 g_numberValues[0].f32 = modifier->getAspectRatio(node->uiNodeHandle);
3216 return &g_attributeItem;
3217 }
3218
SetLayoutWeight(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3219 int32_t SetLayoutWeight(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3220 {
3221 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3222 if (actualSize < 0) {
3223 return ERROR_CODE_PARAM_INVALID;
3224 }
3225 auto* fullImpl = GetFullImpl();
3226 fullImpl->getNodeModifiers()->getCommonModifier()->setLayoutWeight(node->uiNodeHandle, item->value[0].u32);
3227 return ERROR_CODE_NO_ERROR;
3228 }
3229
ResetLayoutWeight(ArkUI_NodeHandle node)3230 void ResetLayoutWeight(ArkUI_NodeHandle node)
3231 {
3232 auto* fullImpl = GetFullImpl();
3233 fullImpl->getNodeModifiers()->getCommonModifier()->resetLayoutWeight(node->uiNodeHandle);
3234 }
3235
GetLayoutWeight(ArkUI_NodeHandle node)3236 const ArkUI_AttributeItem* GetLayoutWeight(ArkUI_NodeHandle node)
3237 {
3238 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3239 g_numberValues[0].u32 = static_cast<uint32_t>(modifier->getLayoutWeight(node->uiNodeHandle));
3240 g_attributeItem.size = REQUIRED_ONE_PARAM;
3241 return &g_attributeItem;
3242 }
3243
SetDisplayPriority(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3244 int32_t SetDisplayPriority(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3245 {
3246 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3247 if (actualSize < 0) {
3248 return ERROR_CODE_PARAM_INVALID;
3249 }
3250 auto* fullImpl = GetFullImpl();
3251 fullImpl->getNodeModifiers()->getCommonModifier()->setDisplayPriority(node->uiNodeHandle, item->value[0].u32);
3252 return ERROR_CODE_NO_ERROR;
3253 }
3254
ResetDisplayPriority(ArkUI_NodeHandle node)3255 void ResetDisplayPriority(ArkUI_NodeHandle node)
3256 {
3257 auto* fullImpl = GetFullImpl();
3258 fullImpl->getNodeModifiers()->getCommonModifier()->setDisplayPriority(node->uiNodeHandle, 0);
3259 }
3260
GetDisplayPriority(ArkUI_NodeHandle node)3261 const ArkUI_AttributeItem* GetDisplayPriority(ArkUI_NodeHandle node)
3262 {
3263 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3264 if (!modifier) {
3265 return nullptr;
3266 }
3267 g_numberValues[0].u32 = static_cast<uint32_t>(modifier->getDisplayPriority(node->uiNodeHandle));
3268 g_attributeItem.size = REQUIRED_ONE_PARAM;
3269 return &g_attributeItem;
3270 }
3271
SetOutlineWidth(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3272 int32_t SetOutlineWidth(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3273 {
3274 auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
3275 if (actualSize < 0) {
3276 return ERROR_CODE_PARAM_INVALID;
3277 }
3278 auto* fullImpl = GetFullImpl();
3279 fullImpl->getNodeModifiers()->getCommonModifier()->setOutlineWidthFloat(node->uiNodeHandle,
3280 item->value[OUTLINE_LEFT_WIDTH_INDEX].f32, item->value[OUTLINE_TOP_WIDTH_INDEX].f32,
3281 item->value[OUTLINE_RIGHT_WIDTH_INDEX].f32, item->value[OUTLINE_BOTTOM_WIDTH_INDEX].f32);
3282 return ERROR_CODE_NO_ERROR;
3283 }
3284
ResetOutlineWidth(ArkUI_NodeHandle node)3285 void ResetOutlineWidth(ArkUI_NodeHandle node)
3286 {
3287 auto* fullImpl = GetFullImpl();
3288 fullImpl->getNodeModifiers()->getCommonModifier()->setOutlineWidthFloat(node->uiNodeHandle,
3289 0.0f, 0.0f, 0.0f, 0.0f);
3290 }
3291
GetOutlineWidth(ArkUI_NodeHandle node)3292 const ArkUI_AttributeItem* GetOutlineWidth(ArkUI_NodeHandle node)
3293 {
3294 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3295 if (!modifier) {
3296 return nullptr;
3297 }
3298 std::array<float, REQUIRED_FOUR_PARAM> outlineWidthArray;
3299 modifier->getOutlineWidthFloat(node->uiNodeHandle, &outlineWidthArray[0], REQUIRED_FOUR_PARAM);
3300 g_numberValues[OUTLINE_LEFT_WIDTH_INDEX].f32 = outlineWidthArray[OUTLINE_LEFT_WIDTH_INDEX];
3301 g_numberValues[OUTLINE_TOP_WIDTH_INDEX].f32 = outlineWidthArray[OUTLINE_TOP_WIDTH_INDEX];
3302 g_numberValues[OUTLINE_RIGHT_WIDTH_INDEX].f32 = outlineWidthArray[OUTLINE_RIGHT_WIDTH_INDEX];
3303 g_numberValues[OUTLINE_BOTTOM_WIDTH_INDEX].f32 = outlineWidthArray[OUTLINE_BOTTOM_WIDTH_INDEX];
3304 g_attributeItem.size = REQUIRED_FOUR_PARAM;
3305 return &g_attributeItem;
3306 }
3307
SetGeometryTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3308 int32_t SetGeometryTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3309 {
3310 if (item->string == nullptr) {
3311 return ERROR_CODE_PARAM_INVALID;
3312 }
3313 ArkUIGeometryTransitionOptions options;
3314 ArkUI_Bool follow = false;
3315 if (item->size == 1) {
3316 follow = item->value[0].i32;
3317 }
3318 options.follow = follow;
3319 options.hierarchyStrategy = static_cast<int32_t>(TransitionHierarchyStrategy::ADAPTIVE);
3320
3321 auto* fullImpl = GetFullImpl();
3322 fullImpl->getNodeModifiers()->getCommonModifier()->setGeometryTransition(node->uiNodeHandle, item->string,
3323 &options);
3324 return ERROR_CODE_NO_ERROR;
3325 }
3326
ResetGeometryTransition(ArkUI_NodeHandle node)3327 void ResetGeometryTransition(ArkUI_NodeHandle node)
3328 {
3329 auto* fullImpl = GetFullImpl();
3330 fullImpl->getNodeModifiers()->getCommonModifier()->resetGeometryTransition(node->uiNodeHandle);
3331 }
3332
GetGeometryTransition(ArkUI_NodeHandle node)3333 const ArkUI_AttributeItem* GetGeometryTransition(ArkUI_NodeHandle node)
3334 {
3335 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3336 if (!modifier) {
3337 return nullptr;
3338 }
3339 ArkUIGeometryTransitionOptions options;
3340 g_attributeItem.string = modifier->getGeometryTransition(node->uiNodeHandle, &options);
3341 g_numberValues[NUM_0].i32 = options.follow;
3342 g_numberValues[NUM_1].i32 = options.hierarchyStrategy;
3343 return &g_attributeItem;
3344 }
3345
SetChainMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3346 int32_t SetChainMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3347 {
3348 auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
3349 if (actualSize < 0 || !CheckAttributeIsAxis(item->value[0].i32) ||
3350 !CheckAttributeIsChainStyle(item->value[1].i32)) {
3351 return ERROR_CODE_PARAM_INVALID;
3352 }
3353 auto* fullImpl = GetFullImpl();
3354 //index 0 direction index 1 style
3355 fullImpl->getNodeModifiers()->getCommonModifier()->setChainStyle(
3356 node->uiNodeHandle, item->value[0].i32, item->value[1].i32);
3357 return ERROR_CODE_NO_ERROR;
3358 }
3359
ResetChainMode(ArkUI_NodeHandle node)3360 void ResetChainMode(ArkUI_NodeHandle node)
3361 {
3362 auto* fullImpl = GetFullImpl();
3363 fullImpl->getNodeModifiers()->getCommonModifier()->resetChainStyle(node->uiNodeHandle);
3364 }
3365
GetChainMode(ArkUI_NodeHandle node)3366 const ArkUI_AttributeItem* GetChainMode(ArkUI_NodeHandle node)
3367 {
3368 //size = 2; direction and style
3369 ArkUI_Int32 values[ALLOW_SIZE_2];
3370 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getChainStyle(node->uiNodeHandle, &values);
3371 //index 0 direction
3372 g_numberValues[0].i32 = values[0];
3373 //index 1 style
3374 g_numberValues[1].i32 = values[1];
3375 g_attributeItem.size = ALLOW_SIZE_2;
3376
3377 return &g_attributeItem;
3378 }
3379
SetWidthPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3380 int32_t SetWidthPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3381 {
3382 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3383 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
3384 return ERROR_CODE_PARAM_INVALID;
3385 }
3386 auto* fullImpl = GetFullImpl();
3387 fullImpl->getNodeModifiers()->getCommonModifier()->setWidth(
3388 node->uiNodeHandle, item->value[NUM_0].f32, UNIT_PERCENT, nullptr);
3389 return ERROR_CODE_NO_ERROR;
3390 }
3391
ResetWidthPercent(ArkUI_NodeHandle node)3392 void ResetWidthPercent(ArkUI_NodeHandle node)
3393 {
3394 ResetWidth(node);
3395 }
3396
GetWidthPercent(ArkUI_NodeHandle node)3397 const ArkUI_AttributeItem* GetWidthPercent(ArkUI_NodeHandle node)
3398 {
3399 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3400 g_numberValues[0].f32 = modifier->getWidth(node->uiNodeHandle, UNIT_PERCENT);
3401 if (LessNotEqual(g_numberValues[0].f32, 0.0f)) {
3402 return nullptr;
3403 }
3404 return &g_attributeItem;
3405 }
3406
SetHeightPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3407 int32_t SetHeightPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3408 {
3409 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3410 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
3411 return ERROR_CODE_PARAM_INVALID;
3412 }
3413 auto* fullImpl = GetFullImpl();
3414 fullImpl->getNodeModifiers()->getCommonModifier()->setHeight(
3415 node->uiNodeHandle, item->value[NUM_0].f32, UNIT_PERCENT, nullptr);
3416 return ERROR_CODE_NO_ERROR;
3417 }
3418
ResetHeightPercent(ArkUI_NodeHandle node)3419 void ResetHeightPercent(ArkUI_NodeHandle node)
3420 {
3421 ResetHeight(node);
3422 }
3423
GetHeightPercent(ArkUI_NodeHandle node)3424 const ArkUI_AttributeItem* GetHeightPercent(ArkUI_NodeHandle node)
3425 {
3426 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3427 g_numberValues[0].f32 = modifier->getHeight(node->uiNodeHandle, UNIT_PERCENT);
3428 if (LessNotEqual(g_numberValues[0].f32, 0.0f)) {
3429 return nullptr;
3430 }
3431 return &g_attributeItem;
3432 }
3433
SetPaddingPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3434 int32_t SetPaddingPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3435 {
3436 if (item->size != NUM_1 && item->size != NUM_4) {
3437 return ERROR_CODE_PARAM_INVALID;
3438 }
3439 auto* fullImpl = GetFullImpl();
3440 int topIndex = NUM_0;
3441 int rightIndex = item->size == NUM_1 ? NUM_0 : NUM_1;
3442 int bottomIndex = item->size == NUM_1 ? NUM_0 : NUM_2;
3443 int leftIndex = item->size == NUM_1 ? NUM_0 : NUM_3;
3444 struct ArkUISizeType top = { item->value[topIndex].f32, UNIT_PERCENT };
3445 struct ArkUISizeType right = { item->value[rightIndex].f32, UNIT_PERCENT };
3446 struct ArkUISizeType bottom = { item->value[bottomIndex].f32, UNIT_PERCENT };
3447 struct ArkUISizeType left = { item->value[leftIndex].f32, UNIT_PERCENT };
3448 fullImpl->getNodeModifiers()->getCommonModifier()->setPadding(node->uiNodeHandle, &top, &right, &bottom, &left);
3449 return ERROR_CODE_NO_ERROR;
3450 }
3451
ResetPaddingPercent(ArkUI_NodeHandle node)3452 void ResetPaddingPercent(ArkUI_NodeHandle node)
3453 {
3454 ResetPadding(node);
3455 }
3456
GetPaddingPercent(ArkUI_NodeHandle node)3457 const ArkUI_AttributeItem* GetPaddingPercent(ArkUI_NodeHandle node)
3458 {
3459 auto* fullImpl = GetFullImpl();
3460 ArkUI_Float32 paddings[NUM_4];
3461 ArkUI_Int32 length = 0;
3462 fullImpl->getNodeModifiers()->getCommonModifier()->getPadding(node->uiNodeHandle, &paddings, length, UNIT_PERCENT);
3463 g_numberValues[NUM_0].f32 = paddings[NUM_0];
3464 g_numberValues[NUM_1].f32 = paddings[NUM_1];
3465 g_numberValues[NUM_2].f32 = paddings[NUM_2];
3466 g_numberValues[NUM_3].f32 = paddings[NUM_3];
3467 return &g_attributeItem;
3468 }
3469
SetMarginPercent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3470 int32_t SetMarginPercent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3471 {
3472 if (!item || (item->size != NUM_4 && item->size != NUM_1)) {
3473 return ERROR_CODE_PARAM_INVALID;
3474 }
3475 auto* fullImpl = GetFullImpl();
3476 int topIndex = NUM_0;
3477 int rightIndex = item->size == NUM_1 ? NUM_0 : NUM_1;
3478 int bottomIndex = item->size == NUM_1 ? NUM_0 : NUM_2;
3479 int leftIndex = item->size == NUM_1 ? NUM_0 : NUM_3;
3480 struct ArkUISizeType top = { item->value[topIndex].f32, UNIT_PERCENT };
3481 struct ArkUISizeType right = { item->value[rightIndex].f32, UNIT_PERCENT };
3482 struct ArkUISizeType bottom = { item->value[bottomIndex].f32, UNIT_PERCENT };
3483 struct ArkUISizeType left = { item->value[leftIndex].f32, UNIT_PERCENT };
3484 if (node->type == ARKUI_NODE_TEXT_INPUT) {
3485 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputMargin(
3486 node->uiNodeHandle, &top, &right, &bottom, &left);
3487 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3488 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaMargin(
3489 node->uiNodeHandle, &top, &right, &bottom, &left);
3490 } else {
3491 fullImpl->getNodeModifiers()->getCommonModifier()->setMargin(node->uiNodeHandle, &top, &right, &bottom, &left);
3492 }
3493 return ERROR_CODE_NO_ERROR;
3494 }
3495
ResetMarginPercent(ArkUI_NodeHandle node)3496 void ResetMarginPercent(ArkUI_NodeHandle node)
3497 {
3498 ResetMargin(node);
3499 }
3500
GetMarginPercent(ArkUI_NodeHandle node)3501 const ArkUI_AttributeItem* GetMarginPercent(ArkUI_NodeHandle node)
3502 {
3503 auto* fullImpl = GetFullImpl();
3504 ArkUI_Float32 margins[NUM_4];
3505 ArkUI_Int32 length = 0;
3506 fullImpl->getNodeModifiers()->getCommonModifier()->getMargin(node->uiNodeHandle, &margins, length, UNIT_PERCENT);
3507 g_numberValues[NUM_0].f32 = margins[NUM_0];
3508 g_numberValues[NUM_1].f32 = margins[NUM_1];
3509 g_numberValues[NUM_3].f32 = margins[NUM_3];
3510 return &g_attributeItem;
3511 }
3512
SetRenderFit(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3513 int32_t SetRenderFit(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3514 {
3515 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3516 if (actualSize < 0 ||
3517 item->value[NUM_0].i32 < ArkUI_RenderFit::ARKUI_RENDER_FIT_CENTER ||
3518 item->value[NUM_0].i32 > ArkUI_RenderFit::ARKUI_RENDER_FIT_RESIZE_COVER_BOTTOM_RIGHT) {
3519 return ERROR_CODE_PARAM_INVALID;
3520 }
3521 auto* fullImpl = GetFullImpl();
3522 fullImpl->getNodeModifiers()->getCommonModifier()->setRenderFit(node->uiNodeHandle, item->value[NUM_0].i32);
3523 return ERROR_CODE_NO_ERROR;
3524 }
3525
ResetRenderFit(ArkUI_NodeHandle node)3526 void ResetRenderFit(ArkUI_NodeHandle node)
3527 {
3528 auto* fullImpl = GetFullImpl();
3529 fullImpl->getNodeModifiers()->getCommonModifier()->resetRenderFit(node->uiNodeHandle);
3530 }
3531
GetRenderFit(ArkUI_NodeHandle node)3532 const ArkUI_AttributeItem* GetRenderFit(ArkUI_NodeHandle node)
3533 {
3534 auto modifier = GetFullImpl()->getNodeModifiers()->getCommonModifier();
3535 g_numberValues[0].i32 = modifier->getRenderFit(node->uiNodeHandle);
3536 return &g_attributeItem;
3537 }
3538
SetOutlineColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3539 int32_t SetOutlineColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3540 {
3541 if (item->size == 0) {
3542 return ERROR_CODE_PARAM_INVALID;
3543 }
3544 // already check in entry point.
3545 auto* fullImpl = GetFullImpl();
3546 uint32_t colors[ALLOW_SIZE_8] = { DEFAULT_TRUE, DEFAULT_COLOR, DEFAULT_TRUE, DEFAULT_COLOR,
3547 DEFAULT_TRUE, DEFAULT_COLOR, DEFAULT_TRUE, DEFAULT_COLOR };
3548 if (item->size == 1) {
3549 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
3550 colors[NUM_2 * i + NUM_1] = item->value[0].u32;
3551 }
3552 } else if (item->size == ALLOW_SIZE_4) {
3553 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
3554 colors[NUM_2 * i + NUM_1] = item->value[i].u32;
3555 }
3556 } else {
3557 return ERROR_CODE_PARAM_INVALID;
3558 }
3559
3560 fullImpl->getNodeModifiers()->getCommonModifier()->setOutlineColor(
3561 node->uiNodeHandle, colors, ALLOW_SIZE_8);
3562 return ERROR_CODE_NO_ERROR;
3563 }
3564
ResetOutlineColor(ArkUI_NodeHandle node)3565 void ResetOutlineColor(ArkUI_NodeHandle node)
3566 {
3567 auto* fullImpl = GetFullImpl();
3568 fullImpl->getNodeModifiers()->getCommonModifier()->resetOutlineColor(node->uiNodeHandle);
3569 }
3570
GetOutlineColor(ArkUI_NodeHandle node)3571 const ArkUI_AttributeItem* GetOutlineColor(ArkUI_NodeHandle node)
3572 {
3573 auto* fullImpl = GetFullImpl();
3574 ArkUI_Uint32 colors[NUM_4];
3575 fullImpl->getNodeModifiers()->getCommonModifier()->getOutlineColor(node->uiNodeHandle, &colors);
3576 g_numberValues[NUM_0].u32 = colors[NUM_0];
3577 g_numberValues[NUM_1].u32 = colors[NUM_1];
3578 g_numberValues[NUM_2].u32 = colors[NUM_2];
3579 g_numberValues[NUM_3].u32 = colors[NUM_3];
3580 return &g_attributeItem;
3581 }
3582
SetSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3583 int32_t SetSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3584 {
3585 if (item->size <= NUM_0 || item->size > NUM_2) {
3586 return ERROR_CODE_PARAM_INVALID;
3587 }
3588 ArkUI_Float32 size[NUM_2] = { ZERO_F, ZERO_F };
3589 for (auto i = 0; i < item->size; ++i) {
3590 size[i] = item->value[i].f32;
3591 }
3592 ArkUI_Int32 unit[NUM_2];
3593 unit[NUM_0] = GetDefaultUnit(node, UNIT_VP);
3594 unit[NUM_1] = GetDefaultUnit(node, UNIT_VP);
3595 // already check in entry point.
3596 auto* fullImpl = GetFullImpl();
3597 // 1 for vp. check in DimensionUnit.
3598 fullImpl->getNodeModifiers()->getCommonModifier()->setSize(
3599 node->uiNodeHandle, size, unit, nullptr);
3600 return ERROR_CODE_NO_ERROR;
3601 }
3602
ResetSize(ArkUI_NodeHandle node)3603 void ResetSize(ArkUI_NodeHandle node)
3604 {
3605 auto* fullImpl = GetFullImpl();
3606 fullImpl->getNodeModifiers()->getCommonModifier()->resetSize(node->uiNodeHandle);
3607 }
3608
GetSize(ArkUI_NodeHandle node)3609 const ArkUI_AttributeItem* GetSize(ArkUI_NodeHandle node)
3610 {
3611 auto* fullImpl = GetFullImpl();
3612 ArkUI_Float32 size[NUM_2];
3613 fullImpl->getNodeModifiers()->getCommonModifier()->getSize(
3614 node->uiNodeHandle, &size, GetDefaultUnit(node, UNIT_VP));
3615 g_numberValues[NUM_0].f32 = size[NUM_0];
3616 g_numberValues[NUM_1].f32 = size[NUM_1];
3617 return &g_attributeItem;
3618 }
3619
SetRenderGroup(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3620 int32_t SetRenderGroup(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3621 {
3622 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
3623 return ERROR_CODE_PARAM_INVALID;
3624 }
3625 auto* fullImpl = GetFullImpl();
3626 fullImpl->getNodeModifiers()->getCommonModifier()->setRenderGroup(
3627 node->uiNodeHandle, item->value[NUM_0].i32);
3628 return ERROR_CODE_NO_ERROR;
3629 }
3630
ResetRenderGroup(ArkUI_NodeHandle node)3631 void ResetRenderGroup(ArkUI_NodeHandle node)
3632 {
3633 auto* fullImpl = GetFullImpl();
3634 fullImpl->getNodeModifiers()->getCommonModifier()->resetRenderGroup(node->uiNodeHandle);
3635 }
3636
GetRenderGroup(ArkUI_NodeHandle node)3637 const ArkUI_AttributeItem* GetRenderGroup(ArkUI_NodeHandle node)
3638 {
3639 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getRenderGroup(node->uiNodeHandle);
3640 g_numberValues[0].i32 = resultValue;
3641 return &g_attributeItem;
3642 }
3643
SetColorBlend(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3644 int32_t SetColorBlend(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3645 {
3646 if (item->size != NUM_1) {
3647 return ERROR_CODE_PARAM_INVALID;
3648 }
3649 auto* fullImpl = GetFullImpl();
3650 fullImpl->getNodeModifiers()->getCommonModifier()->setColorBlend(
3651 node->uiNodeHandle, item->value[NUM_0].u32);
3652 return ERROR_CODE_NO_ERROR;
3653 }
3654
ResetColorBlend(ArkUI_NodeHandle node)3655 void ResetColorBlend(ArkUI_NodeHandle node)
3656 {
3657 auto* fullImpl = GetFullImpl();
3658 fullImpl->getNodeModifiers()->getCommonModifier()->resetColorBlend(node->uiNodeHandle);
3659 }
3660
GetColorBlend(ArkUI_NodeHandle node)3661 const ArkUI_AttributeItem* GetColorBlend(ArkUI_NodeHandle node)
3662 {
3663 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getColorBlend(node->uiNodeHandle);
3664 g_numberValues[0].u32 = resultValue;
3665 return &g_attributeItem;
3666 }
3667
SetExpandSafeArea(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3668 int32_t SetExpandSafeArea(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3669 {
3670 if (item->size == 0) {
3671 return ERROR_CODE_PARAM_INVALID;
3672 }
3673 ArkUI_Uint32 safeAreaType = NG::SAFE_AREA_TYPE_NONE;
3674 ArkUI_Uint32 safeAreaEdge = NG::SAFE_AREA_EDGE_NONE;
3675 if (item->size > 0 && item->value[0].u32 > 0) {
3676 if (item->value[0].u32 > NUM_7) {
3677 return ERROR_CODE_PARAM_INVALID;
3678 } else {
3679 safeAreaType = item->value[0].u32;
3680 }
3681 } else {
3682 safeAreaType = NG::SAFE_AREA_TYPE_ALL;
3683 }
3684 if (item->size > NUM_1 && item->value[1].u32 > 0) {
3685 if (item->value[1].u32 > NUM_15) {
3686 return ERROR_CODE_PARAM_INVALID;
3687 } else {
3688 safeAreaEdge = item->value[1].u32;
3689 }
3690 } else {
3691 safeAreaEdge = NG::SAFE_AREA_EDGE_ALL;
3692 }
3693 GetFullImpl()->getNodeModifiers()->getCommonModifier()->setExpandSafeArea(
3694 node->uiNodeHandle, safeAreaType, safeAreaEdge);
3695 return ERROR_CODE_NO_ERROR;
3696 }
3697
ResetExpandSafeArea(ArkUI_NodeHandle node)3698 void ResetExpandSafeArea(ArkUI_NodeHandle node)
3699 {
3700 auto* fullImpl = GetFullImpl();
3701 fullImpl->getNodeModifiers()->getCommonModifier()->resetExpandSafeArea(node->uiNodeHandle);
3702 }
3703
GetExpandSafeArea(ArkUI_NodeHandle node)3704 const ArkUI_AttributeItem* GetExpandSafeArea(ArkUI_NodeHandle node)
3705 {
3706 ArkUI_Uint32 values[NUM_2];
3707 GetFullImpl()->getNodeModifiers()->getCommonModifier()->getExpandSafeArea(node->uiNodeHandle, &values);
3708 g_numberValues[NUM_0].u32 = values[NUM_0];
3709 g_numberValues[NUM_1].u32 = values[NUM_1];
3710 return &g_attributeItem;
3711 }
3712
SetTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3713 int32_t SetTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3714 {
3715 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
3716 auto fullImpl = GetFullImpl();
3717 node->transitionOption = item->object;
3718 auto effectOption = reinterpret_cast<ArkUI_TransitionEffect*>(item->object);
3719 auto toEffectOption = OHOS::Ace::TransitionModel::ConvertToEffectOption(effectOption);
3720 fullImpl->getNodeModifiers()->getCommonModifier()->setTransition(node->uiNodeHandle, toEffectOption);
3721 return ERROR_CODE_NO_ERROR;
3722 }
3723
SetFocusBox(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3724 int32_t SetFocusBox(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3725 {
3726 if (item->size != NUM_3) {
3727 return ERROR_CODE_PARAM_INVALID;
3728 }
3729 auto* fullImpl = GetFullImpl();
3730 int32_t unit = GetDefaultUnit(node, UNIT_FP);
3731 fullImpl->getNodeModifiers()->getCommonModifier()->setFocusBoxStyle(
3732 node->uiNodeHandle, item->value[0].f32, unit, item->value[1].f32, unit, item->value[2].u32, NUM_7);
3733 return ERROR_CODE_NO_ERROR;
3734 }
3735
ResetFocusBox(ArkUI_NodeHandle node)3736 void ResetFocusBox(ArkUI_NodeHandle node)
3737 {
3738 auto* fullImpl = GetFullImpl();
3739 fullImpl->getNodeModifiers()->getCommonModifier()->resetFocusBoxStyle(node->uiNodeHandle);
3740 }
3741
GetTransition(ArkUI_NodeHandle node)3742 const ArkUI_AttributeItem* GetTransition(ArkUI_NodeHandle node)
3743 {
3744 g_attributeItem.object = node->transitionOption;
3745 return &g_attributeItem;
3746 }
3747
GetUniqueID(ArkUI_NodeHandle node)3748 const ArkUI_AttributeItem* GetUniqueID(ArkUI_NodeHandle node)
3749 {
3750 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getNodeUniqueId(node->uiNodeHandle);
3751 g_numberValues[0].i32 = resultValue;
3752 return &g_attributeItem;
3753 }
3754
3755 // Text
SetFontColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3756 int32_t SetFontColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3757 {
3758 if (item->size == NUM_0) {
3759 return ERROR_CODE_PARAM_INVALID;
3760 }
3761 // already check in entry point.
3762 auto* fullImpl = GetFullImpl();
3763 switch (node->type) {
3764 case ARKUI_NODE_TEXT_INPUT:
3765 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontColor(
3766 node->uiNodeHandle, item->value[0].u32);
3767 break;
3768 case ARKUI_NODE_TEXT:
3769 fullImpl->getNodeModifiers()->getTextModifier()->setFontColor(node->uiNodeHandle, item->value[0].u32);
3770 break;
3771 case ARKUI_NODE_SPAN:
3772 fullImpl->getNodeModifiers()->getSpanModifier()->setSpanFontColor(node->uiNodeHandle, item->value[0].u32);
3773 break;
3774 case ARKUI_NODE_BUTTON:
3775 fullImpl->getNodeModifiers()->getButtonModifier()->setButtonFontColor(
3776 node->uiNodeHandle, item->value[0].u32);
3777 break;
3778 case ARKUI_NODE_TEXT_AREA:
3779 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontColor(
3780 node->uiNodeHandle, item->value[0].u32);
3781 break;
3782 default:
3783 return ERROR_CODE_PARAM_INVALID;
3784 }
3785 return ERROR_CODE_NO_ERROR;
3786 }
3787
ResetFontColor(ArkUI_NodeHandle node)3788 void ResetFontColor(ArkUI_NodeHandle node)
3789 {
3790 auto* fullImpl = GetFullImpl();
3791 if (node->type == ARKUI_NODE_TEXT) {
3792 fullImpl->getNodeModifiers()->getTextModifier()->resetFontColor(node->uiNodeHandle);
3793 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
3794 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontColor(node->uiNodeHandle);
3795 } else if (node->type == ARKUI_NODE_SPAN) {
3796 fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanFontColor(node->uiNodeHandle);
3797 } else if (node->type == ARKUI_NODE_BUTTON) {
3798 fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonFontColor(node->uiNodeHandle);
3799 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3800 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontColor(node->uiNodeHandle);
3801 }
3802 }
3803
SetFontWeight(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3804 int32_t SetFontWeight(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3805 {
3806 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3807 if (actualSize < 0 || item->value[NUM_0].i32 < 0 ||
3808 item->value[NUM_0].i32 > static_cast<int32_t>(ARKUI_FONT_WEIGHT_REGULAR)) {
3809 return ERROR_CODE_PARAM_INVALID;
3810 }
3811 // already check in entry point.
3812 auto* fullImpl = GetFullImpl();
3813 switch (node->type) {
3814 case ARKUI_NODE_TEXT_INPUT:
3815 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontWeight(
3816 node->uiNodeHandle, item->value[0].i32);
3817 break;
3818 case ARKUI_NODE_TEXT:
3819 fullImpl->getNodeModifiers()->getTextModifier()->setFontWeight(node->uiNodeHandle, item->value[0].i32);
3820 break;
3821 case ARKUI_NODE_SPAN:
3822 fullImpl->getNodeModifiers()->getSpanModifier()->setSpanFontWeight(node->uiNodeHandle, item->value[0].i32);
3823 break;
3824 case ARKUI_NODE_BUTTON:
3825 fullImpl->getNodeModifiers()->getButtonModifier()->setButtonFontWeightEnum(
3826 node->uiNodeHandle, item->value[0].i32);
3827 break;
3828 case ARKUI_NODE_TEXT_AREA:
3829 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontWeight(
3830 node->uiNodeHandle, item->value[0].i32);
3831 break;
3832 default:
3833 return ERROR_CODE_PARAM_INVALID;
3834 }
3835 return ERROR_CODE_NO_ERROR;
3836 }
3837
ResetFontWeight(ArkUI_NodeHandle node)3838 void ResetFontWeight(ArkUI_NodeHandle node)
3839 {
3840 auto* fullImpl = GetFullImpl();
3841 if (node->type == ARKUI_NODE_TEXT) {
3842 fullImpl->getNodeModifiers()->getTextModifier()->resetFontWeight(node->uiNodeHandle);
3843 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
3844 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontWeight(node->uiNodeHandle);
3845 } else if (node->type == ARKUI_NODE_SPAN) {
3846 fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanFontWeight(node->uiNodeHandle);
3847 } else if (node->type == ARKUI_NODE_BUTTON) {
3848 fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonFontWeight(node->uiNodeHandle);
3849 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3850 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontWeight(node->uiNodeHandle);
3851 }
3852 }
3853
SetFontSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3854 int32_t SetFontSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3855 {
3856 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3857 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
3858 return ERROR_CODE_PARAM_INVALID;
3859 }
3860 auto* fullImpl = GetFullImpl();
3861 int32_t unit = GetDefaultUnit(node, UNIT_FP);
3862 if (node->type == ARKUI_NODE_TEXT_INPUT) {
3863 struct ArkUILengthType fontSize = { nullptr, item->value[0].f32, unit };
3864 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontSize(node->uiNodeHandle, &fontSize);
3865 } else if (node->type == ARKUI_NODE_TEXT) {
3866 fullImpl->getNodeModifiers()->getTextModifier()->setFontSize(node->uiNodeHandle, item->value[0].f32, unit);
3867 } else if (node->type == ARKUI_NODE_SPAN) {
3868 fullImpl->getNodeModifiers()->getSpanModifier()->setSpanFontSize(
3869 node->uiNodeHandle, item->value[0].f32, unit);
3870 } else if (node->type == ARKUI_NODE_BUTTON) {
3871 fullImpl->getNodeModifiers()->getButtonModifier()->setButtonFontSize(node->uiNodeHandle,
3872 item->value[0].f32, unit);
3873 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3874 struct ArkUIResourceLength fontSize = { item->value[0].f32, unit, nullptr };
3875 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontSize(node->uiNodeHandle, &fontSize);
3876 } else {
3877 return ERROR_CODE_PARAM_INVALID;
3878 }
3879 return ERROR_CODE_NO_ERROR;
3880 }
3881
ResetFontSize(ArkUI_NodeHandle node)3882 void ResetFontSize(ArkUI_NodeHandle node)
3883 {
3884 auto* fullImpl = GetFullImpl();
3885 if (node->type == ARKUI_NODE_TEXT) {
3886 fullImpl->getNodeModifiers()->getTextModifier()->resetFontSize(node->uiNodeHandle);
3887 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
3888 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontSize(node->uiNodeHandle);
3889 } else if (node->type == ARKUI_NODE_SPAN) {
3890 fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanFontSize(node->uiNodeHandle);
3891 } else if (node->type == ARKUI_NODE_BUTTON) {
3892 fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonFontSize(node->uiNodeHandle);
3893 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3894 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontSize(node->uiNodeHandle);
3895 }
3896 }
3897
SetFontStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3898 int32_t SetFontStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3899 {
3900 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3901 if (actualSize < 0 || item->value[NUM_0].i32 < 0 ||
3902 item->value[NUM_0].i32 > static_cast<int32_t>(ARKUI_FONT_STYLE_ITALIC)) {
3903 return ERROR_CODE_PARAM_INVALID;
3904 }
3905 // already check in entry point.
3906 auto* fullImpl = GetFullImpl();
3907 switch (node->type) {
3908 case ARKUI_NODE_TEXT_INPUT:
3909 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontStyle(
3910 node->uiNodeHandle, item->value[0].i32);
3911 break;
3912 case ARKUI_NODE_TEXT:
3913 fullImpl->getNodeModifiers()->getTextModifier()->setFontStyle(node->uiNodeHandle, item->value[0].i32);
3914 break;
3915 case ARKUI_NODE_SPAN:
3916 fullImpl->getNodeModifiers()->getSpanModifier()->setSpanFontStyle(node->uiNodeHandle, item->value[0].i32);
3917 break;
3918 case ARKUI_NODE_TEXT_AREA:
3919 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontStyle(
3920 node->uiNodeHandle, item->value[0].i32);
3921 break;
3922 default:
3923 return ERROR_CODE_PARAM_INVALID;
3924 }
3925 return ERROR_CODE_NO_ERROR;
3926 }
3927
ResetFontStyle(ArkUI_NodeHandle node)3928 void ResetFontStyle(ArkUI_NodeHandle node)
3929 {
3930 auto* fullImpl = GetFullImpl();
3931 if (node->type == ARKUI_NODE_TEXT) {
3932 fullImpl->getNodeModifiers()->getTextModifier()->resetFontStyle(node->uiNodeHandle);
3933 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
3934 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontStyle(node->uiNodeHandle);
3935 } else if (node->type == ARKUI_NODE_SPAN) {
3936 fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanFontStyle(node->uiNodeHandle);
3937 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
3938 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontStyle(node->uiNodeHandle);
3939 }
3940 }
3941
SetTextInputPlaceholder(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3942 int32_t SetTextInputPlaceholder(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3943 {
3944 // already check in entry point.
3945 auto* fullImpl = GetFullImpl();
3946 ArkUI_CharPtr itemString = item->string;
3947 if (!itemString) {
3948 itemString = "";
3949 }
3950 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPlaceholderString(
3951 node->uiNodeHandle, itemString);
3952 return ERROR_CODE_NO_ERROR;
3953 }
3954
GetTextInputPlaceholder(ArkUI_NodeHandle node)3955 const ArkUI_AttributeItem* GetTextInputPlaceholder(ArkUI_NodeHandle node)
3956 {
3957 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputPlaceholder(
3958 node->uiNodeHandle);
3959 g_attributeItem.string = resultValue;
3960 return &g_attributeItem;
3961 }
3962
ResetTextInputPlaceholder(ArkUI_NodeHandle node)3963 void ResetTextInputPlaceholder(ArkUI_NodeHandle node)
3964 {
3965 auto* fullImpl = GetFullImpl();
3966 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPlaceholderString(node->uiNodeHandle, "");
3967 }
3968
SetTextInputText(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3969 int32_t SetTextInputText(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3970 {
3971 // already check in entry point.
3972 auto* fullImpl = GetFullImpl();
3973 ArkUI_CharPtr itemString = item->string;
3974 if (!itemString) {
3975 itemString = "";
3976 }
3977 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputTextString(
3978 node->uiNodeHandle, itemString);
3979 return ERROR_CODE_NO_ERROR;
3980 }
3981
GetTextInputText(ArkUI_NodeHandle node)3982 const ArkUI_AttributeItem* GetTextInputText(ArkUI_NodeHandle node)
3983 {
3984 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputText(
3985 node->uiNodeHandle);
3986 g_attributeItem.string = resultValue;
3987 return &g_attributeItem;
3988 }
3989
ResetTextInputText(ArkUI_NodeHandle node)3990 void ResetTextInputText(ArkUI_NodeHandle node)
3991 {
3992 auto* fullImpl = GetFullImpl();
3993 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputTextString(node->uiNodeHandle, "");
3994 }
3995
SetCaretColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)3996 int32_t SetCaretColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
3997 {
3998 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
3999 if (actualSize < 0) {
4000 return ERROR_CODE_PARAM_INVALID;
4001 }
4002 // already check in entry point.
4003 auto* fullImpl = GetFullImpl();
4004 if (node->type == ARKUI_NODE_TEXT_INPUT) {
4005 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputCaretColor(
4006 node->uiNodeHandle, item->value[NUM_0].u32);
4007 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4008 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaCaretColor(
4009 node->uiNodeHandle, item->value[NUM_0].u32);
4010 } else {
4011 return ERROR_CODE_PARAM_INVALID;
4012 }
4013 return ERROR_CODE_NO_ERROR;
4014 }
4015
GetCaretColor(ArkUI_NodeHandle node)4016 const ArkUI_AttributeItem* GetCaretColor(ArkUI_NodeHandle node)
4017 {
4018 uint32_t resultValue = DEFAULT_COLOR;
4019 if (node->type == ARKUI_NODE_TEXT_INPUT) {
4020 resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputCaretColor(
4021 node->uiNodeHandle);
4022 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4023 resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaCaretColor(
4024 node->uiNodeHandle);
4025 }
4026 g_numberValues[0].u32 = resultValue;
4027 return &g_attributeItem;
4028 }
4029
ResetCaretColor(ArkUI_NodeHandle node)4030 void ResetCaretColor(ArkUI_NodeHandle node)
4031 {
4032 auto* fullImpl = GetFullImpl();
4033 switch (node->type) {
4034 case ARKUI_NODE_TEXT_INPUT:
4035 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputCaretColor(node->uiNodeHandle);
4036 break;
4037 case ARKUI_NODE_TEXT_AREA:
4038 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaCaretColor(node->uiNodeHandle);
4039 break;
4040 default:
4041 break;
4042 }
4043 }
4044
SetCaretStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4045 int32_t SetCaretStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4046 {
4047 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4048 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
4049 return ERROR_CODE_PARAM_INVALID;
4050 }
4051 // already check in entry point.
4052 auto* fullImpl = GetFullImpl();
4053 int32_t unit = GetDefaultUnit(node, UNIT_VP);
4054 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputCaret(
4055 node->uiNodeHandle, item->value[NUM_0].f32, unit);
4056 return ERROR_CODE_NO_ERROR;
4057 }
4058
GetCaretStyle(ArkUI_NodeHandle node)4059 const ArkUI_AttributeItem* GetCaretStyle(ArkUI_NodeHandle node)
4060 {
4061 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
4062 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputCaretStyle(
4063 node->uiNodeHandle, unit);
4064 g_numberValues[0].f32 = resultValue;
4065 return &g_attributeItem;
4066 }
4067
ResetCaretStyle(ArkUI_NodeHandle node)4068 void ResetCaretStyle(ArkUI_NodeHandle node)
4069 {
4070 auto* fullImpl = GetFullImpl();
4071 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputCaretStyle(node->uiNodeHandle);
4072 }
4073
SetShowUnderline(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4074 int32_t SetShowUnderline(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4075 {
4076 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4077 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
4078 return ERROR_CODE_PARAM_INVALID;
4079 }
4080 auto* fullImpl = GetFullImpl();
4081 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputShowUnderline(
4082 node->uiNodeHandle, item->value[NUM_0].i32);
4083 return ERROR_CODE_NO_ERROR;
4084 }
4085
GetShowUnderline(ArkUI_NodeHandle node)4086 const ArkUI_AttributeItem* GetShowUnderline(ArkUI_NodeHandle node)
4087 {
4088 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputShowUnderline(
4089 node->uiNodeHandle);
4090 g_numberValues[0].i32 = resultValue;
4091 return &g_attributeItem;
4092 }
4093
ResetShowUnderline(ArkUI_NodeHandle node)4094 void ResetShowUnderline(ArkUI_NodeHandle node)
4095 {
4096 auto* fullImpl = GetFullImpl();
4097 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputShowUnderline(node->uiNodeHandle);
4098 }
4099
SetMaxLength(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4100 int32_t SetMaxLength(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4101 {
4102 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4103 if (actualSize < 0 || item->value[NUM_0].i32 < 0) {
4104 return ERROR_CODE_PARAM_INVALID;
4105 }
4106 // already check in entry point.
4107 auto* fullImpl = GetFullImpl();
4108 if (node->type == ARKUI_NODE_TEXT_INPUT) {
4109 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputMaxLength(
4110 node->uiNodeHandle, item->value[NUM_0].i32);
4111 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4112 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaMaxLength(
4113 node->uiNodeHandle, item->value[NUM_0].i32);
4114 } else {
4115 return ERROR_CODE_PARAM_INVALID;
4116 }
4117 return ERROR_CODE_NO_ERROR;
4118 }
4119
GetMaxLength(ArkUI_NodeHandle node)4120 const ArkUI_AttributeItem* GetMaxLength(ArkUI_NodeHandle node)
4121 {
4122 float resultValue = NUM_0;
4123 if (node->type == ARKUI_NODE_TEXT_INPUT) {
4124 resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputMaxLength(
4125 node->uiNodeHandle);
4126 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4127 resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaMaxLength(
4128 node->uiNodeHandle);
4129 }
4130 g_numberValues[0].i32 = resultValue;
4131 return &g_attributeItem;
4132 }
4133
ResetMaxLength(ArkUI_NodeHandle node)4134 void ResetMaxLength(ArkUI_NodeHandle node)
4135 {
4136 auto* fullImpl = GetFullImpl();
4137 switch (node->type) {
4138 case ARKUI_NODE_TEXT_INPUT:
4139 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputMaxLength(node->uiNodeHandle);
4140 break;
4141 case ARKUI_NODE_TEXT_AREA:
4142 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaMaxLength(node->uiNodeHandle);
4143 break;
4144 default:
4145 break;
4146 }
4147 }
4148
SetEnterKeyType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4149 int32_t SetEnterKeyType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4150 {
4151 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4152 if (actualSize < 0 || item->value[NUM_0].i32 < static_cast<int32_t>(ARKUI_ENTER_KEY_TYPE_GO) ||
4153 item->value[NUM_0].i32 > static_cast<int32_t>(ARKUI_ENTER_KEY_TYPE_NEW_LINE)) {
4154 return ERROR_CODE_PARAM_INVALID;
4155 }
4156 // already check in entry point.
4157 auto* fullImpl = GetFullImpl();
4158 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputEnterKeyType(
4159 node->uiNodeHandle, item->value[NUM_0].i32);
4160 return ERROR_CODE_NO_ERROR;
4161 }
4162
GetEnterKeyType(ArkUI_NodeHandle node)4163 const ArkUI_AttributeItem* GetEnterKeyType(ArkUI_NodeHandle node)
4164 {
4165 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputEnterKeyType(
4166 node->uiNodeHandle);
4167 g_numberValues[0].i32 = resultValue;
4168 return &g_attributeItem;
4169 }
4170
ResetEnterKeyType(ArkUI_NodeHandle node)4171 void ResetEnterKeyType(ArkUI_NodeHandle node)
4172 {
4173 auto* fullImpl = GetFullImpl();
4174 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputEnterKeyType(node->uiNodeHandle);
4175 }
4176
SetPlaceholderColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4177 int32_t SetPlaceholderColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4178 {
4179 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4180 if (actualSize < 0) {
4181 return ERROR_CODE_PARAM_INVALID;
4182 }
4183 // already check in entry point.
4184 auto* fullImpl = GetFullImpl();
4185 if (node->type == ARKUI_NODE_TEXT_INPUT) {
4186 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPlaceholderColor(
4187 node->uiNodeHandle, item->value[NUM_0].u32);
4188 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4189 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaPlaceholderColor(
4190 node->uiNodeHandle, item->value[NUM_0].u32);
4191 } else {
4192 return ERROR_CODE_PARAM_INVALID;
4193 }
4194 return ERROR_CODE_NO_ERROR;
4195 }
4196
GetPlaceholderColor(ArkUI_NodeHandle node)4197 const ArkUI_AttributeItem* GetPlaceholderColor(ArkUI_NodeHandle node)
4198 {
4199 uint32_t resultValue = DEFAULT_COLOR;
4200 if (node->type == ARKUI_NODE_TEXT_INPUT) {
4201 resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputPlaceholderColor(
4202 node->uiNodeHandle);
4203 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
4204 resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaPlaceholderColor(
4205 node->uiNodeHandle);
4206 }
4207 g_numberValues[0].u32 = resultValue;
4208 return &g_attributeItem;
4209 }
4210
ResetPlaceholderColor(ArkUI_NodeHandle node)4211 void ResetPlaceholderColor(ArkUI_NodeHandle node)
4212 {
4213 auto* fullImpl = GetFullImpl();
4214 switch (node->type) {
4215 case ARKUI_NODE_TEXT_INPUT:
4216 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputPlaceholderColor(node->uiNodeHandle);
4217 break;
4218 case ARKUI_NODE_TEXT_AREA:
4219 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaPlaceholderColor(node->uiNodeHandle);
4220 break;
4221 default:
4222 break;
4223 }
4224 }
4225
SetTextInputPlaceholderFont(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4226 int32_t SetTextInputPlaceholderFont(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4227 {
4228 if (item == nullptr) {
4229 return ERROR_CODE_PARAM_INVALID;
4230 }
4231 auto* fullImpl = GetFullImpl();
4232 struct ArkUIResourceLength size = { 16.0, GetDefaultUnit(node, UNIT_FP) };
4233 int weight = ARKUI_FONT_WEIGHT_NORMAL;
4234 int style = ARKUI_FONT_STYLE_NORMAL;
4235 if (item->size > NUM_0) {
4236 if (LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
4237 return ERROR_CODE_PARAM_INVALID;
4238 }
4239 size.value = item->value[NUM_0].f32;
4240 }
4241 if (item->size > NUM_1) {
4242 if (item->value[NUM_1].i32 < 0 || item->value[NUM_1].i32 > static_cast<int32_t>(ARKUI_FONT_STYLE_ITALIC)) {
4243 return ERROR_CODE_PARAM_INVALID;
4244 }
4245 style = item->value[NUM_1].i32;
4246 }
4247 if (item->size > NUM_2) {
4248 if (item->value[NUM_2].i32 < 0 || item->value[NUM_2].i32 > static_cast<int32_t>(ARKUI_FONT_WEIGHT_REGULAR)) {
4249 return ERROR_CODE_PARAM_INVALID;
4250 }
4251 weight = item->value[NUM_2].i32;
4252 }
4253 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPlaceholderFontEnum(
4254 node->uiNodeHandle, &size, weight, item->string, style);
4255 return ERROR_CODE_NO_ERROR;
4256 }
4257
GetTextInputPlaceholderFont(ArkUI_NodeHandle node)4258 const ArkUI_AttributeItem* GetTextInputPlaceholderFont(ArkUI_NodeHandle node)
4259 {
4260 ArkUITextFont font;
4261 font.fontSizeUnit = GetDefaultUnit(node, UNIT_FP);
4262 GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputPlaceholderFont(
4263 node->uiNodeHandle, &font);
4264 int index = 0;
4265 g_numberValues[index++].f32 = font.fontSize;
4266 g_numberValues[index++].i32 = font.fontStyle;
4267 g_numberValues[index++].i32 = font.fontWeight;
4268 g_attributeItem.size = index;
4269 g_attributeItem.string = font.fontFamilies;
4270 return &g_attributeItem;
4271 }
4272
ResetTextInputPlaceholderFont(ArkUI_NodeHandle node)4273 void ResetTextInputPlaceholderFont(ArkUI_NodeHandle node)
4274 {
4275 auto* fullImpl = GetFullImpl();
4276 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputPlaceholderFont(node->uiNodeHandle);
4277 }
4278
SetEnableKeyboardOnFocus(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4279 int32_t SetEnableKeyboardOnFocus(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4280 {
4281 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4282 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
4283 return ERROR_CODE_PARAM_INVALID;
4284 }
4285 // already check in entry point.
4286 auto* fullImpl = GetFullImpl();
4287 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputEnableKeyboardOnFocus(
4288 node->uiNodeHandle, item->value[NUM_0].i32);
4289 return ERROR_CODE_NO_ERROR;
4290 }
4291
GetEnableKeyboardOnFocus(ArkUI_NodeHandle node)4292 const ArkUI_AttributeItem* GetEnableKeyboardOnFocus(ArkUI_NodeHandle node)
4293 {
4294 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputRequestKeyboardOnFocus(
4295 node->uiNodeHandle);
4296 g_numberValues[0].i32 = resultValue;
4297 return &g_attributeItem;
4298 }
4299
ResetEnableKeyboardOnFocus(ArkUI_NodeHandle node)4300 void ResetEnableKeyboardOnFocus(ArkUI_NodeHandle node)
4301 {
4302 auto* fullImpl = GetFullImpl();
4303 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputEnableKeyboardOnFocus(node->uiNodeHandle);
4304 }
4305
SetTextInputType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4306 int32_t SetTextInputType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4307 {
4308 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4309 if (actualSize < 0 || item->value[NUM_0].i32 < static_cast<int32_t>(ARKUI_TEXTINPUT_TYPE_NORMAL) ||
4310 item->value[NUM_0].i32 > static_cast<int32_t>(ARKUI_TEXTINPUT_TYPE_NUMBER_DECIMAL)) {
4311 return ERROR_CODE_PARAM_INVALID;
4312 }
4313 // already check in entry point.
4314 auto* fullImpl = GetFullImpl();
4315 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputType(
4316 node->uiNodeHandle, item->value[NUM_0].i32);
4317 return ERROR_CODE_NO_ERROR;
4318 }
4319
GetTextInputType(ArkUI_NodeHandle node)4320 const ArkUI_AttributeItem* GetTextInputType(ArkUI_NodeHandle node)
4321 {
4322 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputType(
4323 node->uiNodeHandle);
4324 g_numberValues[0].i32 = resultValue;
4325 return &g_attributeItem;
4326 }
4327
ResetTextInputType(ArkUI_NodeHandle node)4328 void ResetTextInputType(ArkUI_NodeHandle node)
4329 {
4330 auto* fullImpl = GetFullImpl();
4331 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputType(node->uiNodeHandle);
4332 }
4333
SetSelectedBackgroundColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4334 int32_t SetSelectedBackgroundColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4335 {
4336 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4337 if (actualSize < 0) {
4338 return ERROR_CODE_PARAM_INVALID;
4339 }
4340 // already check in entry point.
4341 auto* fullImpl = GetFullImpl();
4342 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputSelectedBackgroundColor(
4343 node->uiNodeHandle, item->value[0].u32);
4344 return ERROR_CODE_NO_ERROR;
4345 }
4346
GetSelectedBackgroundColor(ArkUI_NodeHandle node)4347 const ArkUI_AttributeItem* GetSelectedBackgroundColor(ArkUI_NodeHandle node)
4348 {
4349 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputSelectedBackgroundColor(
4350 node->uiNodeHandle);
4351 g_numberValues[0].u32 = resultValue;
4352 return &g_attributeItem;
4353 }
4354
ResetSelectedBackgroundColor(ArkUI_NodeHandle node)4355 void ResetSelectedBackgroundColor(ArkUI_NodeHandle node)
4356 {
4357 auto* fullImpl = GetFullImpl();
4358 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputSelectedBackgroundColor(node->uiNodeHandle);
4359 }
4360
SetShowPasswordIcon(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4361 int32_t SetShowPasswordIcon(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4362 {
4363 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4364 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
4365 return ERROR_CODE_PARAM_INVALID;
4366 }
4367 // already check in entry point.
4368 auto* fullImpl = GetFullImpl();
4369 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputShowPasswordIcon(
4370 node->uiNodeHandle, item->value[NUM_0].i32);
4371 return ERROR_CODE_NO_ERROR;
4372 }
4373
GetShowPasswordIcon(ArkUI_NodeHandle node)4374 const ArkUI_AttributeItem* GetShowPasswordIcon(ArkUI_NodeHandle node)
4375 {
4376 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputShowPasswordIcon(
4377 node->uiNodeHandle);
4378 g_numberValues[0].i32 = resultValue;
4379 return &g_attributeItem;
4380 }
4381
ResetShowPasswordIcon(ArkUI_NodeHandle node)4382 void ResetShowPasswordIcon(ArkUI_NodeHandle node)
4383 {
4384 auto* fullImpl = GetFullImpl();
4385 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputShowPasswordIcon(node->uiNodeHandle);
4386 }
4387
StopTextInputEditing(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4388 int32_t StopTextInputEditing(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4389 {
4390 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4391 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
4392 return ERROR_CODE_PARAM_INVALID;
4393 }
4394 // already check in entry point.
4395 auto* fullImpl = GetFullImpl();
4396 if (item->value[NUM_0].i32 == 0) {
4397 fullImpl->getNodeModifiers()->getTextInputModifier()->stopTextInputTextEditing(node->uiNodeHandle);
4398 }
4399 return ERROR_CODE_NO_ERROR;
4400 }
4401
GetTextInputEditing(ArkUI_NodeHandle node)4402 const ArkUI_AttributeItem* GetTextInputEditing(ArkUI_NodeHandle node)
4403 {
4404 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputEditing(
4405 node->uiNodeHandle);
4406 g_numberValues[0].i32 = resultValue;
4407 return &g_attributeItem;
4408 }
4409
SetTextInputCancelButton(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4410 int32_t SetTextInputCancelButton(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4411 {
4412 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4413 if (actualSize < 0 || !InRegion(static_cast<int32_t>(ARKUI_CANCELBUTTON_STYLE_CONSTANT),
4414 static_cast<int32_t>(ARKUI_CANCELBUTTON_STYLE_INPUT), item->value[NUM_0].i32)) {
4415 return ERROR_CODE_PARAM_INVALID;
4416 }
4417 struct ArkUISizeType size = { -1.0f, GetDefaultUnit(node, UNIT_VP) };
4418 if (item->size > NUM_1) {
4419 size.value = item->value[NUM_1].f32;
4420 }
4421 uint32_t color = DEFAULT_COLOR;
4422 if (item->size > NUM_2) {
4423 color = item->value[NUM_2].u32;
4424 }
4425 std::string str = "";
4426 if (item->string) {
4427 str.assign(item->string);
4428 }
4429 auto* fullImpl = GetFullImpl();
4430 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputCancelButton(node->uiNodeHandle,
4431 item->value[NUM_0].i32, &size, color, str.c_str());
4432 return ERROR_CODE_NO_ERROR;
4433 }
4434
GetTextInputCancelButton(ArkUI_NodeHandle node)4435 const ArkUI_AttributeItem* GetTextInputCancelButton(ArkUI_NodeHandle node)
4436 {
4437 int index = 0;
4438 g_numberValues[index++].i32 =
4439 GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputCancelButtonStyle(node->uiNodeHandle);
4440 g_numberValues[index++].f32 =
4441 GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputCancelIconSize(
4442 node->uiNodeHandle, GetDefaultUnit(node, UNIT_VP));
4443 g_numberValues[index++].u32 =
4444 GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputTextCancelIconColor(node->uiNodeHandle);
4445 g_attributeItem.size = index;
4446 g_attributeItem.string =
4447 GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputTextCancelIconSrc(node->uiNodeHandle);
4448 return &g_attributeItem;
4449 }
4450
ResetTextInputCancelButton(ArkUI_NodeHandle node)4451 void ResetTextInputCancelButton(ArkUI_NodeHandle node)
4452 {
4453 auto* fullImpl = GetFullImpl();
4454 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputCancelButton(node->uiNodeHandle);
4455 }
4456
SetTextInputTextSelection(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4457 int32_t SetTextInputTextSelection(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4458 {
4459 auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
4460 if (actualSize < 0) {
4461 return ERROR_CODE_PARAM_INVALID;
4462 }
4463 if (item->value[NUM_0].i32 > item->value[NUM_1].i32) {
4464 return ERROR_CODE_PARAM_INVALID;
4465 }
4466 // already check in entry point.
4467 auto* fullImpl = GetFullImpl();
4468 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputTextSelection(
4469 node->uiNodeHandle, item->value[NUM_0].i32, item->value[NUM_1].i32);
4470 return ERROR_CODE_NO_ERROR;
4471 }
4472
GetTextInputTextSelection(ArkUI_NodeHandle node)4473 const ArkUI_AttributeItem* GetTextInputTextSelection(ArkUI_NodeHandle node)
4474 {
4475 g_numberValues[0].i32 = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputTextSelectionIndex(
4476 node->uiNodeHandle, false);
4477 g_numberValues[1].i32 = GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputTextSelectionIndex(
4478 node->uiNodeHandle, true);
4479 g_attributeItem.size = REQUIRED_TWO_PARAM;
4480 return &g_attributeItem;
4481 }
4482
ResetTextInputTextSelection(ArkUI_NodeHandle node)4483 void ResetTextInputTextSelection(ArkUI_NodeHandle node)
4484 {
4485 auto* fullImpl = GetFullImpl();
4486 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputTextSelection(node->uiNodeHandle, NUM_0, NUM_0);
4487 }
4488
SetTextInputSelectionMenuHidden(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4489 int32_t SetTextInputSelectionMenuHidden(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4490 {
4491 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
4492 return ERROR_CODE_PARAM_INVALID;
4493 }
4494 auto* fullImpl = GetFullImpl();
4495 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputSelectionMenuHidden(
4496 node->uiNodeHandle, item->value[NUM_0].i32);
4497 return ERROR_CODE_NO_ERROR;
4498 }
4499
GetTextInputSelectionMenuHidden(ArkUI_NodeHandle node)4500 const ArkUI_AttributeItem* GetTextInputSelectionMenuHidden(ArkUI_NodeHandle node)
4501 {
4502 g_numberValues[0].i32 =
4503 GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputSelectionMenuHidden(node->uiNodeHandle);
4504 return &g_attributeItem;
4505 }
4506
ResetTextInputSelectionMenuHidden(ArkUI_NodeHandle node)4507 void ResetTextInputSelectionMenuHidden(ArkUI_NodeHandle node)
4508 {
4509 auto* fullImpl = GetFullImpl();
4510 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputSelectionMenuHidden(node->uiNodeHandle);
4511 }
4512
SetTextInputUnderlineColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4513 int32_t SetTextInputUnderlineColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4514 {
4515 auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
4516 if (actualSize < 0) {
4517 return ERROR_CODE_PARAM_INVALID;
4518 }
4519 ArkUI_Uint32 values[NUM_4];
4520 values[NUM_0] = item->value[NUM_0].u32;
4521 values[NUM_1] = item->value[NUM_1].u32;
4522 values[NUM_2] = item->value[NUM_2].u32;
4523 values[NUM_3] = item->value[NUM_3].u32;
4524 ArkUI_Bool hasValues[NUM_4] = { 1, 1, 1, 1 };
4525 auto* fullImpl = GetFullImpl();
4526 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputUserUnderlineColor(
4527 node->uiNodeHandle, values, hasValues, NUM_4);
4528 return ERROR_CODE_NO_ERROR;
4529 }
4530
GetTextInputUnderlineColor(ArkUI_NodeHandle node)4531 const ArkUI_AttributeItem* GetTextInputUnderlineColor(ArkUI_NodeHandle node)
4532 {
4533 ArkUI_Uint32 values[NUM_4];
4534 auto* fullImpl = GetFullImpl();
4535 fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputUserUnderlineColor(node->uiNodeHandle, &values);
4536 g_numberValues[NUM_0].u32 = values[NUM_0];
4537 g_numberValues[NUM_1].u32 = values[NUM_1];
4538 g_numberValues[NUM_2].u32 = values[NUM_2];
4539 g_numberValues[NUM_3].u32 = values[NUM_3];
4540 g_attributeItem.size = NUM_4;
4541 return &g_attributeItem;
4542 }
4543
ResetTextInputUnderlineColor(ArkUI_NodeHandle node)4544 void ResetTextInputUnderlineColor(ArkUI_NodeHandle node)
4545 {
4546 auto* fullImpl = GetFullImpl();
4547 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputUserUnderlineColor(node->uiNodeHandle);
4548 }
4549
SetTextInputEnableAutoFill(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4550 int32_t SetTextInputEnableAutoFill(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4551 {
4552 auto* fullImpl = GetFullImpl();
4553 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4554 if (actualSize < 0) {
4555 return ERROR_CODE_PARAM_INVALID;
4556 }
4557 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputEnableAutoFill(
4558 node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
4559 return ERROR_CODE_NO_ERROR;
4560 }
4561
GetTextInputEnableAutoFill(ArkUI_NodeHandle node)4562 const ArkUI_AttributeItem* GetTextInputEnableAutoFill(ArkUI_NodeHandle node)
4563 {
4564 auto fullImpl = GetFullImpl();
4565 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputEnableAutoFill(
4566 node->uiNodeHandle);
4567 g_attributeItem.size = REQUIRED_ONE_PARAM;
4568 return &g_attributeItem;
4569 }
4570
ResetTextInputEnableAutoFill(ArkUI_NodeHandle node)4571 void ResetTextInputEnableAutoFill(ArkUI_NodeHandle node)
4572 {
4573 auto* fullImpl = GetFullImpl();
4574 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputEnableAutoFill(node->uiNodeHandle);
4575 }
4576
SetTextInputContentType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4577 int32_t SetTextInputContentType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4578 {
4579 auto* fullImpl = GetFullImpl();
4580 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4581 if (actualSize < 0) {
4582 return ERROR_CODE_PARAM_INVALID;
4583 }
4584 // The enum values of native_type.h are different from those of text_content_type.h. Convert the enum values.
4585 auto value = static_cast<uint32_t>(item->value[0].i32);
4586 if (value >= static_cast<uint32_t>(ARKUI_TEXTINPUT_CONTENT_TYPE_NICKNAME)
4587 && value <= static_cast<uint32_t>(ARKUI_TEXTINPUT_CONTENT_TYPE_FORMAT_ADDRESS)) {
4588 value += CONVERT_CONTENT_TYPE;
4589 }
4590 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputContentType(
4591 node->uiNodeHandle, value);
4592 return ERROR_CODE_NO_ERROR;
4593 }
4594
GetTextInputContentType(ArkUI_NodeHandle node)4595 const ArkUI_AttributeItem* GetTextInputContentType(ArkUI_NodeHandle node)
4596 {
4597 auto fullImpl = GetFullImpl();
4598 auto value = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputContentType(
4599 node->uiNodeHandle);
4600 if (value >= static_cast<int32_t>(
4601 static_cast<uint32_t>(ARKUI_TEXTINPUT_CONTENT_TYPE_FORMAT_ADDRESS) + CONVERT_CONTENT_TYPE) &&
4602 value <= static_cast<int32_t>(
4603 static_cast<uint32_t>(ARKUI_TEXTINPUT_CONTENT_TYPE_FORMAT_ADDRESS) + CONVERT_CONTENT_TYPE)) {
4604 value -= CONVERT_CONTENT_TYPE;
4605 }
4606 g_numberValues[0].i32 = value;
4607 g_attributeItem.size = REQUIRED_ONE_PARAM;
4608 return &g_attributeItem;
4609 }
4610
ResetTextInputContentType(ArkUI_NodeHandle node)4611 void ResetTextInputContentType(ArkUI_NodeHandle node)
4612 {
4613 auto* fullImpl = GetFullImpl();
4614 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputContentType(node->uiNodeHandle);
4615 }
4616
SetTextInputPasswordRules(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4617 int32_t SetTextInputPasswordRules(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4618 {
4619 auto* fullImpl = GetFullImpl();
4620 ArkUI_CharPtr itemString = item->string;
4621 if(!itemString) {
4622 itemString = "";
4623 }
4624 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputPasswordRules(
4625 node->uiNodeHandle, itemString);
4626 return ERROR_CODE_NO_ERROR;
4627 }
4628
GetTextInputPasswordRules(ArkUI_NodeHandle node)4629 const ArkUI_AttributeItem* GetTextInputPasswordRules(ArkUI_NodeHandle node)
4630 {
4631 auto fullImpl = GetFullImpl();
4632 g_attributeItem.string = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputPasswordRules(
4633 node->uiNodeHandle);
4634 return &g_attributeItem;
4635 }
4636
ResetTextInputPasswordRules(ArkUI_NodeHandle node)4637 void ResetTextInputPasswordRules(ArkUI_NodeHandle node)
4638 {
4639 auto* fullImpl = GetFullImpl();
4640 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputPasswordRules(node->uiNodeHandle);
4641 }
4642
SetTextInputSelectAll(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4643 int32_t SetTextInputSelectAll(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4644 {
4645 auto* fullImpl = GetFullImpl();
4646 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4647 if (actualSize < 0) {
4648 return ERROR_CODE_PARAM_INVALID;
4649 }
4650 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputSelectAll(
4651 node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
4652 return ERROR_CODE_NO_ERROR;
4653 }
4654
GetTextInputSelectAll(ArkUI_NodeHandle node)4655 const ArkUI_AttributeItem* GetTextInputSelectAll(ArkUI_NodeHandle node)
4656 {
4657 auto fullImpl = GetFullImpl();
4658 g_numberValues[NUM_0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputSelectAll(
4659 node->uiNodeHandle);
4660 g_attributeItem.size = REQUIRED_ONE_PARAM;
4661 return &g_attributeItem;
4662 }
4663
ResetTextInputSelectAll(ArkUI_NodeHandle node)4664 void ResetTextInputSelectAll(ArkUI_NodeHandle node)
4665 {
4666 auto* fullImpl = GetFullImpl();
4667 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputSelectAll(node->uiNodeHandle);
4668 }
4669
SetTextInputCaretOffset(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4670 int32_t SetTextInputCaretOffset(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4671 {
4672 auto* fullImpl = GetFullImpl();
4673 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4674 if (actualSize < 0) {
4675 return ERROR_CODE_PARAM_INVALID;
4676 }
4677 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputCaretPosition(
4678 node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
4679 return ERROR_CODE_NO_ERROR;
4680 }
4681
4682
GetTextInputCaretOffset(ArkUI_NodeHandle node)4683 const ArkUI_AttributeItem* GetTextInputCaretOffset(ArkUI_NodeHandle node)
4684 {
4685 auto* fullImpl = GetFullImpl();
4686 g_numberValues[NUM_0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputCaretIndex(
4687 node->uiNodeHandle);
4688 ArkUI_Float32 values[NUM_2];
4689 fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputCaretOffset(node->uiNodeHandle, &values);
4690 g_numberValues[NUM_1].f32 = values[NUM_0];
4691 g_numberValues[NUM_2].f32 = values[NUM_1];
4692 g_attributeItem.size = REQUIRED_TWO_PARAM;
4693 return &g_attributeItem;
4694 }
4695
ResetTextInputCaretOffset(ArkUI_NodeHandle node)4696 void ResetTextInputCaretOffset(ArkUI_NodeHandle node)
4697 {
4698 auto* fullImpl = GetFullImpl();
4699 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputCaretPosition(node->uiNodeHandle);
4700 }
4701
SetInputFilter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4702 int32_t SetInputFilter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4703 {
4704 auto* fullImpl = GetFullImpl();
4705 ArkUI_CharPtr itemString = item->string;
4706 if(!itemString) {
4707 itemString = "";
4708 }
4709 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputInputFilter(
4710 node->uiNodeHandle, itemString);
4711 return ERROR_CODE_NO_ERROR;
4712 }
4713
GetInputFilter(ArkUI_NodeHandle node)4714 const ArkUI_AttributeItem* GetInputFilter(ArkUI_NodeHandle node)
4715 {
4716 auto fullImpl = GetFullImpl();
4717 g_attributeItem.string = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputInputFilter(
4718 node->uiNodeHandle);
4719 return &g_attributeItem;
4720 }
4721
ResetInputFilter(ArkUI_NodeHandle node)4722 void ResetInputFilter(ArkUI_NodeHandle node)
4723 {
4724 auto* fullImpl = GetFullImpl();
4725 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputInputFilter(node->uiNodeHandle);
4726 }
4727
SetTextInputStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4728 int32_t SetTextInputStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4729 {
4730 auto* fullImpl = GetFullImpl();
4731 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4732 if (actualSize < 0) {
4733 return ERROR_CODE_PARAM_INVALID;
4734 }
4735 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputStyle(
4736 node->uiNodeHandle, static_cast<int32_t>(item->value[0].i32));
4737 return ERROR_CODE_NO_ERROR;
4738 }
4739
GetTextInputStyle(ArkUI_NodeHandle node)4740 const ArkUI_AttributeItem* GetTextInputStyle(ArkUI_NodeHandle node)
4741 {
4742 auto fullImpl = GetFullImpl();
4743 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputStyle(node->uiNodeHandle);
4744 g_attributeItem.size = REQUIRED_ONE_PARAM;
4745 return &g_attributeItem;
4746 }
4747
ResetTextInputStyle(ArkUI_NodeHandle node)4748 void ResetTextInputStyle(ArkUI_NodeHandle node)
4749 {
4750 auto* fullImpl = GetFullImpl();
4751 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputStyle(node->uiNodeHandle);
4752 }
4753
GetTextInputContentRect(ArkUI_NodeHandle node)4754 const ArkUI_AttributeItem* GetTextInputContentRect(ArkUI_NodeHandle node)
4755 {
4756 ArkUI_Float32 values[NUM_4];
4757 auto* fullImpl = GetFullImpl();
4758 fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputContentRect(node->uiNodeHandle, &values);
4759 g_numberValues[NUM_0].f32 = values[NUM_0];
4760 g_numberValues[NUM_1].f32 = values[NUM_1];
4761 g_numberValues[NUM_2].f32 = values[NUM_2];
4762 g_numberValues[NUM_3].f32 = values[NUM_3];
4763 g_attributeItem.size = REQUIRED_FOUR_PARAM;
4764 return &g_attributeItem;
4765 }
4766
GetTextInputContentLineCount(ArkUI_NodeHandle node)4767 const ArkUI_AttributeItem* GetTextInputContentLineCount(ArkUI_NodeHandle node)
4768 {
4769 auto* fullImpl = GetFullImpl();
4770 g_numberValues[NUM_0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputContentLinesNum(
4771 node->uiNodeHandle);
4772 g_attributeItem.size = REQUIRED_ONE_PARAM;
4773 return &g_attributeItem;
4774 }
4775
SetInputCustomKeyboard(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4776 int32_t SetInputCustomKeyboard(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4777 {
4778 if (!item->object) {
4779 return ERROR_CODE_PARAM_INVALID;
4780 }
4781 auto fullImpl = GetFullImpl();
4782 auto customKeyboard = reinterpret_cast<ArkUI_NodeHandle>(item->object);
4783 auto supportAvoidance = false;
4784 if (item->size > 0) {
4785 supportAvoidance = static_cast<bool>(item->value[0].i32);
4786 }
4787 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputCustomKeyboard(
4788 node->uiNodeHandle, customKeyboard->uiNodeHandle, supportAvoidance);
4789 return ERROR_CODE_NO_ERROR;
4790 }
4791
GetInputCustomKeyboard(ArkUI_NodeHandle node)4792 const ArkUI_AttributeItem* GetInputCustomKeyboard(ArkUI_NodeHandle node)
4793 {
4794 auto fullImpl = GetFullImpl();
4795 auto* value = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputCustomKeyboard(
4796 node->uiNodeHandle);
4797 void* attachNode = fullImpl->getExtendedAPI()->getAttachNodePtr(value);
4798 if (attachNode) {
4799 g_attributeItem.object = reinterpret_cast<ArkUI_NodeHandle>(attachNode);
4800 }
4801 g_numberValues[NUM_0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
4802 getTextInputCustomKeyboardOption(node->uiNodeHandle);
4803 g_attributeItem.size = REQUIRED_ONE_PARAM;
4804 return &g_attributeItem;
4805 }
4806
ResetInputCustomKeyboard(ArkUI_NodeHandle node)4807 void ResetInputCustomKeyboard(ArkUI_NodeHandle node)
4808 {
4809 auto* fullImpl = GetFullImpl();
4810 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputCustomKeyboard(node->uiNodeHandle);
4811 }
4812
SetTextInputWordBreak(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4813 int32_t SetTextInputWordBreak(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4814 {
4815 auto* fullImpl = GetFullImpl();
4816 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4817 if (actualSize < 0) {
4818 return ERROR_CODE_PARAM_INVALID;
4819 }
4820 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputWordBreak(
4821 node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
4822 return ERROR_CODE_NO_ERROR;
4823 }
4824
GetTextInputWordBreak(ArkUI_NodeHandle node)4825 const ArkUI_AttributeItem* GetTextInputWordBreak(ArkUI_NodeHandle node)
4826 {
4827 auto fullImpl = GetFullImpl();
4828 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputWordBreak(
4829 node->uiNodeHandle);
4830 g_attributeItem.size = REQUIRED_ONE_PARAM;
4831 return &g_attributeItem;
4832 }
4833
ResetTextInputWordBreak(ArkUI_NodeHandle node)4834 void ResetTextInputWordBreak(ArkUI_NodeHandle node)
4835 {
4836 auto* fullImpl = GetFullImpl();
4837 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputWordBreak(node->uiNodeHandle);
4838 }
4839
SetTextInputNumberOfLines(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4840 int32_t SetTextInputNumberOfLines(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4841 {
4842 auto* fullImpl = GetFullImpl();
4843 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4844 if (actualSize < 0) {
4845 return ERROR_CODE_PARAM_INVALID;
4846 }
4847 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputNumberOfLines(
4848 node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
4849 return ERROR_CODE_NO_ERROR;
4850 }
4851
GetTextInputNumberOfLines(ArkUI_NodeHandle node)4852 const ArkUI_AttributeItem* GetTextInputNumberOfLines(ArkUI_NodeHandle node)
4853 {
4854 auto fullImpl = GetFullImpl();
4855 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputNumberOfLines(
4856 node->uiNodeHandle);
4857 g_attributeItem.size = REQUIRED_ONE_PARAM;
4858 return &g_attributeItem;
4859 }
4860
ResetTextInputNumberOfLines(ArkUI_NodeHandle node)4861 void ResetTextInputNumberOfLines(ArkUI_NodeHandle node)
4862 {
4863 auto* fullImpl = GetFullImpl();
4864 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputNumberOfLines(node->uiNodeHandle);
4865 }
4866
SetBlurOnSubmit(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4867 int32_t SetBlurOnSubmit(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4868 {
4869 auto actualSize = CheckAttributeItemArray(item, NUM_1);
4870 if (actualSize < 0) {
4871 return ERROR_CODE_PARAM_INVALID;
4872 }
4873 auto* fullImpl = GetFullImpl();
4874 fullImpl->getNodeModifiers()->getTextInputModifier()->setBlurOnSubmit(node->uiNodeHandle, item->value[0].i32);
4875 return ERROR_CODE_NO_ERROR;
4876 }
4877
ResetBlurOnSubmit(ArkUI_NodeHandle node)4878 void ResetBlurOnSubmit(ArkUI_NodeHandle node)
4879 {
4880 auto* fullImpl = GetFullImpl();
4881 switch (node->type) {
4882 case ARKUI_NODE_TEXT_INPUT:
4883 fullImpl->getNodeModifiers()->getTextInputModifier()->setBlurOnSubmit(node->uiNodeHandle, true);
4884 break;
4885 case ARKUI_NODE_TEXT_AREA:
4886 fullImpl->getNodeModifiers()->getTextInputModifier()->setBlurOnSubmit(node->uiNodeHandle, false);
4887 break;
4888 default:
4889 break;
4890 }
4891 }
4892
SetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4893 int32_t SetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4894 {
4895 auto* fullImpl = GetFullImpl();
4896 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4897 if (actualSize < 0) {
4898 return ERROR_CODE_PARAM_INVALID;
4899 }
4900 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputShowKeyBoardOnFocus(
4901 node->uiNodeHandle, item->value[0].i32);
4902 return ERROR_CODE_NO_ERROR;
4903 }
4904
GetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node)4905 const ArkUI_AttributeItem* GetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node)
4906 {
4907 auto fullImpl = GetFullImpl();
4908 g_numberValues[0].i32 =
4909 fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputShowKeyBoardOnFocus(node->uiNodeHandle);
4910 g_attributeItem.size = REQUIRED_ONE_PARAM;
4911 return &g_attributeItem;
4912 }
4913
ResetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node)4914 void ResetTextInputShowKeyBoardOnFocus(ArkUI_NodeHandle node)
4915 {
4916 auto* fullImpl = GetFullImpl();
4917 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputShowKeyBoardOnFocus(node->uiNodeHandle);
4918 }
4919
GetBlurOnSubmit(ArkUI_NodeHandle node)4920 const ArkUI_AttributeItem* GetBlurOnSubmit(ArkUI_NodeHandle node)
4921 {
4922 auto* fullImpl = GetFullImpl();
4923 g_numberValues[0].i32 =
4924 fullImpl->getNodeModifiers()->getTextInputModifier()->getBlurOnSubmit(node->uiNodeHandle);
4925 g_attributeItem.size = REQUIRED_ONE_PARAM;
4926 return &g_attributeItem;
4927 }
4928 // Stack Attribute functions
SetAlignContent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4929 int32_t SetAlignContent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4930 {
4931 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4932 if (actualSize < 0 || !InRegion(NUM_0, NUM_8, item->value[0].i32)) {
4933 return ERROR_CODE_PARAM_INVALID;
4934 }
4935 auto fullImpl = GetFullImpl();
4936 auto attrVal = item->value[NUM_0].i32;
4937 fullImpl->getNodeModifiers()->getStackModifier()->setAlignContent(node->uiNodeHandle, attrVal);
4938 return ERROR_CODE_NO_ERROR;
4939 }
4940
GetAlignContent(ArkUI_NodeHandle node)4941 const ArkUI_AttributeItem* GetAlignContent(ArkUI_NodeHandle node)
4942 {
4943 auto fullImpl = GetFullImpl();
4944 auto alignContent = fullImpl->getNodeModifiers()->getStackModifier()->getAlignContent(node->uiNodeHandle);
4945 g_numberValues[0].i32 = alignContent;
4946 g_attributeItem.size = REQUIRED_ONE_PARAM;
4947 return &g_attributeItem;
4948 }
4949
ResetAlignContent(ArkUI_NodeHandle node)4950 void ResetAlignContent(ArkUI_NodeHandle node)
4951 {
4952 // already check in entry point.
4953 auto* fullImpl = GetFullImpl();
4954
4955 fullImpl->getNodeModifiers()->getStackModifier()->resetAlignContent(node->uiNodeHandle);
4956 }
4957
GetScrollFriction(ArkUI_NodeHandle node)4958 const ArkUI_AttributeItem* GetScrollFriction(ArkUI_NodeHandle node)
4959 {
4960 if (node->type == ARKUI_NODE_LIST) {
4961 g_numberValues[0].f32 =
4962 GetFullImpl()->getNodeModifiers()->getListModifier()->getListFriction(node->uiNodeHandle);
4963 } else if (node->type == ARKUI_NODE_SCROLL) {
4964 g_numberValues[0].f32 =
4965 GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollFriction(node->uiNodeHandle);
4966 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
4967 g_numberValues[0].f32 =
4968 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowFriction(node->uiNodeHandle);
4969 }
4970 return &g_attributeItem;
4971 }
4972
SetScrollFriction(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)4973 int32_t SetScrollFriction(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
4974 {
4975 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
4976 if (actualSize < 0 || LessOrEqual(item->value[NUM_0].f32, 0.0f)) {
4977 return ERROR_CODE_PARAM_INVALID;
4978 }
4979 auto fullImpl = GetFullImpl();
4980 auto friction = item->value[NUM_0].f32;
4981 if (node->type == ARKUI_NODE_LIST) {
4982 fullImpl->getNodeModifiers()->getListModifier()->setListFriction(node->uiNodeHandle, friction);
4983 } else if (node->type == ARKUI_NODE_SCROLL) {
4984 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollFriction(node->uiNodeHandle, friction);
4985 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
4986 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowFriction(node->uiNodeHandle, friction);
4987 }
4988 return ERROR_CODE_NO_ERROR;
4989 }
4990
ResetScrollFriction(ArkUI_NodeHandle node)4991 void ResetScrollFriction(ArkUI_NodeHandle node)
4992 {
4993 // already check in entry point.
4994 auto* fullImpl = GetFullImpl();
4995
4996 if (node->type == ARKUI_NODE_LIST) {
4997 fullImpl->getNodeModifiers()->getListModifier()->resetListFriction(node->uiNodeHandle);
4998 } else if (node->type == ARKUI_NODE_SCROLL) {
4999 fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollFriction(node->uiNodeHandle);
5000 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5001 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterFlowFriction(node->uiNodeHandle);
5002 }
5003 }
5004
GetScrollScrollSnap(ArkUI_NodeHandle node)5005 const ArkUI_AttributeItem* GetScrollScrollSnap(ArkUI_NodeHandle node)
5006 {
5007 ArkUI_Float32 values[32];
5008 auto size =
5009 GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollScrollSnap(node->uiNodeHandle, &values);
5010
5011 //size index
5012 g_numberValues[NUM_0].i32 = values[NUM_0];
5013 g_numberValues[NUM_1].i32 = values[NUM_1];
5014 g_numberValues[NUM_2].i32 = values[NUM_2];
5015 for (auto i = NUM_3; i < size; i++) {
5016 g_numberValues[i].f32 = values[i];
5017 }
5018 g_attributeItem.size = size;
5019 return &g_attributeItem;
5020 }
5021
SetScrollScrollSnap(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5022 int32_t SetScrollScrollSnap(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5023 {
5024 auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
5025 if (actualSize < 0 || !InRegion(NUM_0, NUM_3, item->value[NUM_0].i32) ||
5026 !InRegion(NUM_0, NUM_1, item->value[NUM_1].i32) || !InRegion(NUM_0, NUM_1, item->value[NUM_2].i32)) {
5027 return ERROR_CODE_PARAM_INVALID;
5028 }
5029 auto fullImpl = GetFullImpl();
5030 auto snapAlign = item->value[NUM_0].i32;
5031 auto enableSnapToStart = item->value[NUM_1].i32;
5032 auto enableSnapToEnd = item->value[NUM_2].i32;
5033
5034 ArkUI_Float32 paginations[item->size - NUM_3];
5035 ArkUI_Int32 paginationParams[item->size + NUM_1];
5036 int32_t unit = GetDefaultUnit(node, UNIT_VP);
5037 for (int i = 0; i < item->size - NUM_3; ++i) {
5038 if (LessNotEqual(item->value[i + NUM_3].f32, 0.0f)) {
5039 return ERROR_CODE_PARAM_INVALID;
5040 }
5041 paginations[i] = item->value[i + NUM_3].f32;
5042 paginationParams[i] = unit;
5043 }
5044
5045 paginationParams[item->size - NUM_3 + NUM_0] = snapAlign;
5046 paginationParams[item->size - NUM_3 + NUM_1] = enableSnapToStart;
5047 paginationParams[item->size - NUM_3 + NUM_2] = enableSnapToEnd;
5048 paginationParams[item->size] = (item->size - NUM_3 > 1) ? true : false;
5049
5050 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollScrollSnap(
5051 node->uiNodeHandle, paginations, item->size - NUM_3, paginationParams, item->size + NUM_1);
5052 return ERROR_CODE_NO_ERROR;
5053 }
5054
ResetScrollScrollSnap(ArkUI_NodeHandle node)5055 void ResetScrollScrollSnap(ArkUI_NodeHandle node)
5056 {
5057 // already check in entry point.
5058 auto* fullImpl = GetFullImpl();
5059
5060 fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollScrollSnap(node->uiNodeHandle);
5061 }
5062
GetScrollScrollBar(ArkUI_NodeHandle node)5063 const ArkUI_AttributeItem* GetScrollScrollBar(ArkUI_NodeHandle node)
5064 {
5065 if (node->type == ARKUI_NODE_LIST) {
5066 g_numberValues[0].i32 =
5067 GetFullImpl()->getNodeModifiers()->getListModifier()->getListScrollBar(node->uiNodeHandle);
5068 } else if (node->type == ARKUI_NODE_SCROLL) {
5069 g_numberValues[0].i32 =
5070 GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollScrollBar(node->uiNodeHandle);
5071 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5072 g_numberValues[0].i32 =
5073 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowScrollBar(node->uiNodeHandle);
5074 }
5075 return &g_attributeItem;
5076 }
5077
SetScrollScrollBar(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5078 int32_t SetScrollScrollBar(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5079 {
5080 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5081 if (actualSize < 0 || !InRegion(NUM_0, NUM_2, item->value[NUM_0].i32)) {
5082 return ERROR_CODE_PARAM_INVALID;
5083 }
5084 auto fullImpl = GetFullImpl();
5085 auto attrVal = item->value[NUM_0].i32;
5086 if (node->type == ARKUI_NODE_LIST) {
5087 fullImpl->getNodeModifiers()->getListModifier()->setListScrollBar(node->uiNodeHandle, attrVal);
5088 } else if (node->type == ARKUI_NODE_SCROLL) {
5089 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollScrollBar(node->uiNodeHandle, attrVal);
5090 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5091 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowScrollBar(node->uiNodeHandle, attrVal);
5092 }
5093 return ERROR_CODE_NO_ERROR;
5094 }
5095
ResetScrollScrollBar(ArkUI_NodeHandle node)5096 void ResetScrollScrollBar(ArkUI_NodeHandle node)
5097 {
5098 // already check in entry point.
5099 auto* fullImpl = GetFullImpl();
5100
5101 if (node->type == ARKUI_NODE_LIST) {
5102 fullImpl->getNodeModifiers()->getListModifier()->resetListScrollBar(node->uiNodeHandle);
5103 } else if (node->type == ARKUI_NODE_SCROLL) {
5104 fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollScrollBar(node->uiNodeHandle);
5105 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5106 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterFlowScrollBar(node->uiNodeHandle);
5107 }
5108 }
5109
GetScrollScrollBarWidth(ArkUI_NodeHandle node)5110 const ArkUI_AttributeItem* GetScrollScrollBarWidth(ArkUI_NodeHandle node)
5111 {
5112 if (node->type == ARKUI_NODE_LIST) {
5113 g_numberValues[0].f32 =
5114 GetFullImpl()->getNodeModifiers()->getListModifier()->getListScrollBarWidth(node->uiNodeHandle);
5115 } else if (node->type == ARKUI_NODE_SCROLL) {
5116 g_numberValues[0].f32 =
5117 GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollScrollBarWidth(node->uiNodeHandle);
5118 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5119 g_numberValues[0].f32 =
5120 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowScrollBarWidth(node->uiNodeHandle);
5121 }
5122 return &g_attributeItem;
5123 }
5124
SetScrollScrollBarWidth(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5125 int32_t SetScrollScrollBarWidth(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5126 {
5127 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5128 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, NUM_0)) {
5129 return ERROR_CODE_PARAM_INVALID;
5130 }
5131 auto fullImpl = GetFullImpl();
5132 auto attrVal = item->value[NUM_0].f32;
5133 int32_t unit = GetDefaultUnit(node, UNIT_VP);
5134 if (node->type == ARKUI_NODE_LIST) {
5135 auto width = std::to_string(attrVal) + LENGTH_METRIC_UNIT[unit];
5136 fullImpl->getNodeModifiers()->getListModifier()->setListScrollBarWidth(node->uiNodeHandle, width.c_str());
5137 } else if (node->type == ARKUI_NODE_SCROLL) {
5138 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollScrollBarWidth(node->uiNodeHandle, attrVal, unit);
5139 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5140 auto width = std::to_string(attrVal) + LENGTH_METRIC_UNIT[unit];
5141 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowScrollBarWidth(
5142 node->uiNodeHandle, width.c_str());
5143 }
5144 return ERROR_CODE_NO_ERROR;
5145 }
5146
ResetScrollScrollBarWidth(ArkUI_NodeHandle node)5147 void ResetScrollScrollBarWidth(ArkUI_NodeHandle node)
5148 {
5149 // already check in entry point.
5150 auto* fullImpl = GetFullImpl();
5151 if (node->type == ARKUI_NODE_LIST) {
5152 fullImpl->getNodeModifiers()->getListModifier()->resetListScrollBarWidth(node->uiNodeHandle);
5153 } else if (node->type == ARKUI_NODE_SCROLL) {
5154 fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollScrollBarWidth(node->uiNodeHandle);
5155 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5156 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterFlowScrollBarWidth(node->uiNodeHandle);
5157 }
5158 }
5159
GetScrollScrollBarColor(ArkUI_NodeHandle node)5160 const ArkUI_AttributeItem* GetScrollScrollBarColor(ArkUI_NodeHandle node)
5161 {
5162 if (node->type == ARKUI_NODE_LIST) {
5163 g_numberValues[0].u32 =
5164 GetFullImpl()->getNodeModifiers()->getListModifier()->getListScrollBarColor(node->uiNodeHandle);
5165 } else if (node->type == ARKUI_NODE_SCROLL) {
5166 g_numberValues[0].u32 =
5167 GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollScrollBarColor(node->uiNodeHandle);
5168 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5169 g_numberValues[0].u32 =
5170 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowScrollBarColor(node->uiNodeHandle);
5171 }
5172 return &g_attributeItem;
5173 }
5174
SetScrollScrollBarColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5175 int32_t SetScrollScrollBarColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5176 {
5177 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5178 if (actualSize < 0) {
5179 return ERROR_CODE_PARAM_INVALID;
5180 }
5181 auto fullImpl = GetFullImpl();
5182 auto color = item->value[NUM_0].u32;
5183 if (node->type == ARKUI_NODE_LIST) {
5184 auto value = Color(color).ColorToString();
5185 fullImpl->getNodeModifiers()->getListModifier()->setListScrollBarColor(node->uiNodeHandle, value.c_str());
5186 } else if (node->type == ARKUI_NODE_SCROLL) {
5187 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollScrollBarColor(node->uiNodeHandle, color);
5188 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5189 auto value = Color(color).ColorToString();
5190 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowScrollBarColor(
5191 node->uiNodeHandle, value.c_str());
5192 }
5193 return ERROR_CODE_NO_ERROR;
5194 }
5195
ResetScrollScrollBarColor(ArkUI_NodeHandle node)5196 void ResetScrollScrollBarColor(ArkUI_NodeHandle node)
5197 {
5198 // already check in entry point.
5199 auto* fullImpl = GetFullImpl();
5200
5201 if (node->type == ARKUI_NODE_LIST) {
5202 fullImpl->getNodeModifiers()->getListModifier()->resetListScrollBarColor(node->uiNodeHandle);
5203 } else if (node->type == ARKUI_NODE_SCROLL) {
5204 fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollScrollBarColor(node->uiNodeHandle);
5205 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5206 fullImpl->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowScrollBarColor(node->uiNodeHandle);
5207 }
5208 }
5209
GetScrollScrollable(ArkUI_NodeHandle node)5210 const ArkUI_AttributeItem* GetScrollScrollable(ArkUI_NodeHandle node)
5211 {
5212 auto value = GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollScrollable(node->uiNodeHandle);
5213 g_numberValues[0].i32 = value;
5214 return &g_attributeItem;
5215 }
5216
SetScrollScrollable(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5217 int32_t SetScrollScrollable(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5218 {
5219 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5220 if (actualSize < 0 || !InRegion(NUM_0, NUM_3, item->value[0].i32)) {
5221 return ERROR_CODE_PARAM_INVALID;
5222 }
5223 auto fullImpl = GetFullImpl();
5224 auto attrVal = item->value[NUM_0].i32;
5225 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollScrollable(node->uiNodeHandle, attrVal);
5226 return ERROR_CODE_NO_ERROR;
5227 }
5228
ResetScrollScrollable(ArkUI_NodeHandle node)5229 void ResetScrollScrollable(ArkUI_NodeHandle node)
5230 {
5231 // already check in entry point.
5232 auto* fullImpl = GetFullImpl();
5233
5234 fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollScrollable(node->uiNodeHandle);
5235 }
5236
GetScrollEdgeEffect(ArkUI_NodeHandle node)5237 const ArkUI_AttributeItem* GetScrollEdgeEffect(ArkUI_NodeHandle node)
5238 {
5239 ArkUI_Int32 values[2];
5240 if (node->type == ARKUI_NODE_LIST) {
5241 auto valueSize =
5242 GetFullImpl()->getNodeModifiers()->getListModifier()->getListEdgeEffect(node->uiNodeHandle, &values);
5243 for (int i = 0; i < valueSize; i++) {
5244 g_numberValues[i].i32 = values[i];
5245 }
5246 g_attributeItem.size = valueSize;
5247 } else if (node->type == ARKUI_NODE_SCROLL) {
5248 auto valueSize =
5249 GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollEdgeEffect(node->uiNodeHandle, &values);
5250 for (int i = 0; i < valueSize; i++) {
5251 g_numberValues[i].i32 = values[i];
5252 }
5253 g_attributeItem.size = valueSize;
5254 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5255 auto valueSize =
5256 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getEdgeEffect(node->uiNodeHandle, &values);
5257 for (int i = 0; i < valueSize; i++) {
5258 g_numberValues[i].i32 = values[i];
5259 }
5260 g_attributeItem.size = valueSize;
5261 }
5262 return &g_attributeItem;
5263 }
5264
SetScrollEdgeEffect(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5265 int32_t SetScrollEdgeEffect(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5266 {
5267 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5268 if (actualSize < 0 || !InRegion(NUM_0, NUM_2, item->value[0].i32) ||
5269 (item->size > NUM_1 && !InRegion(NUM_0, NUM_1, item->value[1].i32))) {
5270 return ERROR_CODE_PARAM_INVALID;
5271 }
5272 auto fullImpl = GetFullImpl();
5273 auto attrVal = item->value[NUM_0].i32;
5274 bool alwaysEnabled = false;
5275 if (item->size > NUM_1) {
5276 alwaysEnabled = item->value[NUM_1].i32;
5277 } else if (node->type == ARKUI_NODE_SCROLL) {
5278 alwaysEnabled = true;
5279 }
5280 if (node->type == ARKUI_NODE_LIST) {
5281 fullImpl->getNodeModifiers()->getListModifier()->setListEdgeEffect(node->uiNodeHandle, attrVal, alwaysEnabled);
5282 } else if (node->type == ARKUI_NODE_SCROLL) {
5283 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollEdgeEffect(
5284 node->uiNodeHandle, attrVal, alwaysEnabled);
5285 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5286 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setEdgeEffect(
5287 node->uiNodeHandle, attrVal, alwaysEnabled);
5288 }
5289 return ERROR_CODE_NO_ERROR;
5290 }
5291
ResetScrollEdgeEffect(ArkUI_NodeHandle node)5292 void ResetScrollEdgeEffect(ArkUI_NodeHandle node)
5293 {
5294 // already check in entry point.
5295 auto* fullImpl = GetFullImpl();
5296
5297 if (node->type == ARKUI_NODE_LIST) {
5298 fullImpl->getNodeModifiers()->getListModifier()->resetListEdgeEffect(node->uiNodeHandle);
5299 } else if (node->type == ARKUI_NODE_SCROLL) {
5300 fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollEdgeEffect(node->uiNodeHandle);
5301 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5302 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetEdgeEffect(node->uiNodeHandle);
5303 }
5304 }
5305
GetScrollEnableScrollInteraction(ArkUI_NodeHandle node)5306 const ArkUI_AttributeItem* GetScrollEnableScrollInteraction(ArkUI_NodeHandle node)
5307 {
5308 if (node->type == ARKUI_NODE_LIST) {
5309 g_numberValues[0].i32 =
5310 GetFullImpl()->getNodeModifiers()->getListModifier()->getEnableScrollInteraction(node->uiNodeHandle);
5311 } else if (node->type == ARKUI_NODE_SCROLL) {
5312 g_numberValues[0].i32 =
5313 GetFullImpl()->getNodeModifiers()->getScrollModifier()->getEnableScrollInteraction(node->uiNodeHandle);
5314 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5315 g_numberValues[0].i32 =
5316 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowEnableScrollInteraction(
5317 node->uiNodeHandle);
5318 }
5319 return &g_attributeItem;
5320 }
5321
SetScrollEnableScrollInteraction(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5322 int32_t SetScrollEnableScrollInteraction(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5323 {
5324 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5325 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
5326 return ERROR_CODE_PARAM_INVALID;
5327 }
5328 auto fullImpl = GetFullImpl();
5329 bool enableScrollInteraction = item->value[NUM_0].i32;
5330 if (node->type == ARKUI_NODE_LIST) {
5331 fullImpl->getNodeModifiers()->getListModifier()->setEnableScrollInteraction(
5332 node->uiNodeHandle, enableScrollInteraction);
5333 } else if (node->type == ARKUI_NODE_SCROLL) {
5334 fullImpl->getNodeModifiers()->getScrollModifier()->setEnableScrollInteraction(
5335 node->uiNodeHandle, enableScrollInteraction);
5336 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5337 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowEnableScrollInteraction(
5338 node->uiNodeHandle, enableScrollInteraction);
5339 }
5340 return ERROR_CODE_NO_ERROR;
5341 }
5342
ResetScrollEnableScrollInteraction(ArkUI_NodeHandle node)5343 void ResetScrollEnableScrollInteraction(ArkUI_NodeHandle node)
5344 {
5345 // already check in entry point.
5346 auto* fullImpl = GetFullImpl();
5347
5348 if (node->type == ARKUI_NODE_LIST) {
5349 fullImpl->getNodeModifiers()->getListModifier()->resetEnableScrollInteraction(node->uiNodeHandle);
5350 } else if (node->type == ARKUI_NODE_SCROLL) {
5351 fullImpl->getNodeModifiers()->getScrollModifier()->resetEnableScrollInteraction(node->uiNodeHandle);
5352 } else if (node->type == ARKUI_NODE_WATER_FLOW) {
5353 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterFlowEnableScrollInteraction(node->uiNodeHandle);
5354 }
5355 }
5356
SetScrollNestedScroll(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5357 int32_t SetScrollNestedScroll(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5358 {
5359 // The size must be greater than 2 and check value is Nested Mode
5360 auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
5361 if (actualSize < 0 || !CheckAttributeIsScrollNestedMode(item->value[0].i32) ||
5362 !CheckAttributeIsScrollNestedMode(item->value[1].i32)) {
5363 return ERROR_CODE_PARAM_INVALID;
5364 }
5365 auto* fullImpl = GetFullImpl();
5366 int first = item->value[NUM_0].i32;
5367 int second = item->value[NUM_1].i32;
5368 if (node->type == ARKUI_NODE_WATER_FLOW) {
5369 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterFlowNestedScroll(
5370 node->uiNodeHandle, first, second);
5371 } else if (node->type == ARKUI_NODE_LIST) {
5372 fullImpl->getNodeModifiers()->getListModifier()->setListNestedScroll(node->uiNodeHandle, first, second);
5373 } else {
5374 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollNestedScroll(node->uiNodeHandle, first, second);
5375 }
5376 return ERROR_CODE_NO_ERROR;
5377 }
5378
GetScrollNestedScroll(ArkUI_NodeHandle node)5379 const ArkUI_AttributeItem* GetScrollNestedScroll(ArkUI_NodeHandle node)
5380 {
5381 ArkUI_Int32 values[2];
5382 if (node->type == ARKUI_NODE_WATER_FLOW) {
5383 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getWaterFlowNestedScroll(
5384 node->uiNodeHandle, &values);
5385 } else if (node->type == ARKUI_NODE_LIST) {
5386 GetFullImpl()->getNodeModifiers()->getListModifier()->getListNestedScroll(node->uiNodeHandle, &values);
5387 } else {
5388 GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollNestedScroll(node->uiNodeHandle, &values);
5389 }
5390 //size index
5391 g_numberValues[0].i32 = values[0];
5392 g_numberValues[1].i32 = values[1];
5393 g_attributeItem.size = ALLOW_SIZE_2;
5394 return &g_attributeItem;
5395 }
5396
ResetScrollNestedScroll(ArkUI_NodeHandle node)5397 void ResetScrollNestedScroll(ArkUI_NodeHandle node)
5398 {
5399 auto* fullImpl = GetFullImpl();
5400 if (node->type == ARKUI_NODE_WATER_FLOW) {
5401 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterFlowNestedScroll(node->uiNodeHandle);
5402 } else if (node->type == ARKUI_NODE_LIST) {
5403 GetFullImpl()->getNodeModifiers()->getListModifier()->resetListNestedScroll(node->uiNodeHandle);
5404 } else {
5405 fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollNestedScroll(node->uiNodeHandle);
5406 }
5407 }
5408
SetScrollTo(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5409 int32_t SetScrollTo(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5410 {
5411 auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
5412 if (actualSize < 0) {
5413 return ERROR_CODE_PARAM_INVALID;
5414 }
5415 auto* fullImpl = GetFullImpl();
5416 int32_t defaultUnit = GetDefaultUnit(node, UNIT_VP);
5417 ArkUI_Float32 values[ALLOW_SIZE_8] = { 0.0, defaultUnit, 0.0, defaultUnit, DEFAULT_DURATION, 1, 0.0, 0.0 };
5418 values[0] = item->value[0].f32;
5419 values[1] = defaultUnit;
5420 values[2] = item->value[1].f32;
5421 values[NUM_3] = defaultUnit;
5422 if (item->size > 2) {
5423 values[NUM_4] = static_cast<ArkUI_Float32>(item->value[NUM_2].i32);
5424 }
5425 // check size
5426 if (item->size > NUM_3 && CheckAttributeIsAnimationCurve(item->value[NUM_3].i32)) {
5427 values[NUM_5] = static_cast<ArkUI_Float32>(item->value[NUM_3].i32);
5428 }
5429 if (item->size > 4) {
5430 values[NUM_6] = static_cast<ArkUI_Float32>(item->value[NUM_4].i32);
5431 }
5432 if (item->size > NUM_5) {
5433 values[NUM_7] = static_cast<ArkUI_Float32>(item->value[NUM_5].i32);
5434 }
5435 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollTo(node->uiNodeHandle, &values);
5436 return ERROR_CODE_NO_ERROR;
5437 }
5438
GetScrollOffset(ArkUI_NodeHandle node)5439 const ArkUI_AttributeItem* GetScrollOffset(ArkUI_NodeHandle node)
5440 {
5441 ArkUI_Float32 values[2];
5442 GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollOffset(node->uiNodeHandle, &values);
5443 //size index
5444 g_numberValues[0].f32 = values[0];
5445 g_numberValues[1].f32 = values[1];
5446 g_attributeItem.size = ALLOW_SIZE_2;
5447 return &g_attributeItem;
5448 }
5449
ResetScrollTo(ArkUI_NodeHandle node)5450 void ResetScrollTo(ArkUI_NodeHandle node)
5451 {
5452 auto* fullImpl = GetFullImpl();
5453 fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollTo(node->uiNodeHandle);
5454 }
5455
SetScrollEdge(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5456 int32_t SetScrollEdge(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5457 {
5458 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5459 if (actualSize < 0) {
5460 return ERROR_CODE_PARAM_INVALID;
5461 }
5462 auto* fullImpl = GetFullImpl();
5463 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollEdge(node->uiNodeHandle, item->value[0].i32);
5464 return ERROR_CODE_NO_ERROR;
5465 }
5466
GetScrollEdge(ArkUI_NodeHandle node)5467 const ArkUI_AttributeItem* GetScrollEdge(ArkUI_NodeHandle node)
5468 {
5469 auto resultValue = GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollEdge(node->uiNodeHandle);
5470 //size index
5471 g_numberValues[0].i32 = resultValue;
5472 return &g_attributeItem;
5473 }
5474
ResetScrollEdge(ArkUI_NodeHandle node)5475 void ResetScrollEdge(ArkUI_NodeHandle node)
5476 {
5477 auto* fullImpl = GetFullImpl();
5478 fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollEdge(node->uiNodeHandle);
5479 }
5480
GetScrollEnablePaging(ArkUI_NodeHandle node)5481 const ArkUI_AttributeItem* GetScrollEnablePaging(ArkUI_NodeHandle node)
5482 {
5483 auto value = GetFullImpl()->getNodeModifiers()->getScrollModifier()->getScrollEnablePaging(node->uiNodeHandle);
5484 //ScrollPagingStatus::VALID is true and VALID value is 2, others is false
5485 g_numberValues[0].i32 = value == NUM_2 ? true : false;
5486 return &g_attributeItem;
5487 }
5488
SetScrollEnablePaging(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5489 int32_t SetScrollEnablePaging(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5490 {
5491 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5492 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
5493 return ERROR_CODE_PARAM_INVALID;
5494 }
5495 auto fullImpl = GetFullImpl();
5496 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollEnablePaging(
5497 node->uiNodeHandle, item->value[NUM_0].i32);
5498 return ERROR_CODE_NO_ERROR;
5499 }
5500
ResetScrollEnablePaging(ArkUI_NodeHandle node)5501 void ResetScrollEnablePaging(ArkUI_NodeHandle node)
5502 {
5503 // already check in entry point.
5504 auto* fullImpl = GetFullImpl();
5505
5506 fullImpl->getNodeModifiers()->getScrollModifier()->resetScrollEnablePaging(node->uiNodeHandle);
5507 }
5508
SetScrollPage(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5509 int32_t SetScrollPage(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5510 {
5511 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5512 if (actualSize < NUM_0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
5513 return ERROR_CODE_PARAM_INVALID;
5514 }
5515 ArkUI_Int32 values[ALLOW_SIZE_2] = { NUM_0, DEFAULT_FALSE };
5516 values[NUM_0] = item->value[NUM_0].i32;
5517 if (item->size > NUM_1 && InRegion(NUM_0, NUM_1, item->value[NUM_1].i32)) {
5518 values[NUM_1] = item->value[NUM_1].i32;
5519 }
5520 auto* fullImpl = GetFullImpl();
5521 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollPage(node->uiNodeHandle, values[NUM_0], values[NUM_1]);
5522 return ERROR_CODE_NO_ERROR;
5523 }
5524
SetScrollBy(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5525 int32_t SetScrollBy(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5526 {
5527 auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
5528 if (actualSize < NUM_0) {
5529 return ERROR_CODE_PARAM_INVALID;
5530 }
5531 DimensionUnit unit = static_cast<DimensionUnit>(GetDefaultUnit(node, UNIT_VP));
5532 if (unit != DimensionUnit::VP && unit != DimensionUnit::PX) {
5533 return ERROR_CODE_PARAM_INVALID;
5534 }
5535 double x = item->value[NUM_0].f32;
5536 double y = item->value[NUM_1].f32;
5537 if (unit == DimensionUnit::VP) {
5538 x = OHOS::Ace::NodeModel::GetFullImpl()->getBasicAPI()->convertLengthMetricsUnit(
5539 x, static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_VP), static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_PX));
5540 y = OHOS::Ace::NodeModel::GetFullImpl()->getBasicAPI()->convertLengthMetricsUnit(
5541 y, static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_VP), static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_PX));
5542 }
5543 auto* fullImpl = GetFullImpl();
5544 if (node->type == ARKUI_NODE_SCROLL || node->type == ARKUI_NODE_WATER_FLOW) {
5545 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollBy(node->uiNodeHandle, x, y);
5546 } else if (node->type == ARKUI_NODE_LIST) {
5547 fullImpl->getNodeModifiers()->getListModifier()->setScrollBy(node->uiNodeHandle, x, y);
5548 } else {
5549 return ERROR_CODE_PARAM_INVALID;
5550 }
5551 return ERROR_CODE_NO_ERROR;
5552 }
5553
SetScrollFling(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5554 int32_t SetScrollFling(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5555 {
5556 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5557 if (actualSize < NUM_0) {
5558 return ERROR_CODE_PARAM_INVALID;
5559 }
5560 DimensionUnit unit = static_cast<DimensionUnit>(GetDefaultUnit(node, UNIT_VP));
5561 if (unit != DimensionUnit::VP && unit != DimensionUnit::PX) {
5562 return ERROR_CODE_PARAM_INVALID;
5563 }
5564 double value = item->value[NUM_0].f32;
5565 if (unit == DimensionUnit::VP) {
5566 value = OHOS::Ace::NodeModel::GetFullImpl()->getBasicAPI()->convertLengthMetricsUnit(value,
5567 static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_VP), static_cast<int32_t>(ARKUI_LENGTH_METRIC_UNIT_PX));
5568 }
5569 auto* fullImpl = GetFullImpl();
5570 fullImpl->getNodeModifiers()->getScrollModifier()->setScrollFling(node->uiNodeHandle, value);
5571 return ERROR_CODE_NO_ERROR;
5572 }
5573
GetListDirection(ArkUI_NodeHandle node)5574 const ArkUI_AttributeItem* GetListDirection(ArkUI_NodeHandle node)
5575 {
5576 auto value = GetFullImpl()->getNodeModifiers()->getListModifier()->getListDirection(node->uiNodeHandle);
5577 g_numberValues[0].i32 = value;
5578 return &g_attributeItem;
5579 }
5580
SetListDirection(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5581 int32_t SetListDirection(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5582 {
5583 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5584 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
5585 return ERROR_CODE_PARAM_INVALID;
5586 }
5587 auto fullImpl = GetFullImpl();
5588 auto attrVal = item->value[0].i32;
5589 fullImpl->getNodeModifiers()->getListModifier()->setListDirection(node->uiNodeHandle, attrVal);
5590 return ERROR_CODE_NO_ERROR;
5591 }
5592
ResetListDirection(ArkUI_NodeHandle node)5593 void ResetListDirection(ArkUI_NodeHandle node)
5594 {
5595 // already check in entry point.
5596 auto* fullImpl = GetFullImpl();
5597
5598 fullImpl->getNodeModifiers()->getListModifier()->resetListDirection(node->uiNodeHandle);
5599 }
5600
GetListSticky(ArkUI_NodeHandle node)5601 const ArkUI_AttributeItem* GetListSticky(ArkUI_NodeHandle node)
5602 {
5603 auto value = GetFullImpl()->getNodeModifiers()->getListModifier()->getSticky(node->uiNodeHandle);
5604 g_numberValues[0].i32 = value;
5605 return &g_attributeItem;
5606 }
5607
SetListSticky(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5608 int32_t SetListSticky(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5609 {
5610 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5611 if (actualSize < 0 || !InRegion(NUM_0, NUM_3, item->value[0].i32)) {
5612 return ERROR_CODE_PARAM_INVALID;
5613 }
5614 auto fullImpl = GetFullImpl();
5615 auto attrVal = item->value[0].i32;
5616 fullImpl->getNodeModifiers()->getListModifier()->setSticky(node->uiNodeHandle, attrVal);
5617 return ERROR_CODE_NO_ERROR;
5618 }
5619
ResetListSticky(ArkUI_NodeHandle node)5620 void ResetListSticky(ArkUI_NodeHandle node)
5621 {
5622 // already check in entry point.
5623 auto* fullImpl = GetFullImpl();
5624
5625 fullImpl->getNodeModifiers()->getListModifier()->resetSticky(node->uiNodeHandle);
5626 }
5627
GetListSpace(ArkUI_NodeHandle node)5628 const ArkUI_AttributeItem* GetListSpace(ArkUI_NodeHandle node)
5629 {
5630 auto value = GetFullImpl()->getNodeModifiers()->getListModifier()->getListSpace(node->uiNodeHandle);
5631 g_numberValues[0].f32 = value;
5632 return &g_attributeItem;
5633 }
5634
SetListSpace(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5635 int32_t SetListSpace(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5636 {
5637 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5638 if (actualSize < 0 || LessNotEqual(item->value[0].i32, NUM_0)) {
5639 return ERROR_CODE_PARAM_INVALID;
5640 }
5641 auto fullImpl = GetFullImpl();
5642
5643 fullImpl->getNodeModifiers()->getListModifier()->setListSpace(node->uiNodeHandle, item->value[NUM_0].f32);
5644 return ERROR_CODE_NO_ERROR;
5645 }
5646
ResetListSpace(ArkUI_NodeHandle node)5647 void ResetListSpace(ArkUI_NodeHandle node)
5648 {
5649 // already check in entry point.
5650 auto* fullImpl = GetFullImpl();
5651
5652 fullImpl->getNodeModifiers()->getListModifier()->resetListSpace(node->uiNodeHandle);
5653 }
5654
SetListNodeAdapter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5655 int32_t SetListNodeAdapter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5656 {
5657 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
5658 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
5659 auto* nodeAdapter = reinterpret_cast<ArkUINodeAdapterHandle>(item->object);
5660 return GetFullImpl()->getNodeModifiers()->getListModifier()->setNodeAdapter(node->uiNodeHandle, nodeAdapter);
5661 }
5662
ResetListNodeAdapter(ArkUI_NodeHandle node)5663 void ResetListNodeAdapter(ArkUI_NodeHandle node)
5664 {
5665 // already check in entry point.
5666 auto* fullImpl = GetFullImpl();
5667
5668 fullImpl->getNodeModifiers()->getListModifier()->resetNodeAdapter(node->uiNodeHandle);
5669 }
5670
GetListNodeAdapter(ArkUI_NodeHandle node)5671 const ArkUI_AttributeItem* GetListNodeAdapter(ArkUI_NodeHandle node)
5672 {
5673 ArkUINodeAdapterHandle adapter =
5674 GetFullImpl()->getNodeModifiers()->getListModifier()->getNodeAdapter(node->uiNodeHandle);
5675 g_attributeItem.object = reinterpret_cast<void*>(adapter);
5676 return &g_attributeItem;
5677 }
5678
SetListCachedCount(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5679 int32_t SetListCachedCount(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5680 {
5681 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
5682 if (item->size != 1) {
5683 return ERROR_CODE_PARAM_INVALID;
5684 }
5685 if (LessNotEqual(item->value[0].i32, NUM_0)) {
5686 return ERROR_CODE_PARAM_INVALID;
5687 }
5688 GetFullImpl()->getNodeModifiers()->getListModifier()->setCachedCount(node->uiNodeHandle, item->value[0].i32);
5689 return ERROR_CODE_NO_ERROR;
5690 }
5691
ResetListCachedCount(ArkUI_NodeHandle node)5692 void ResetListCachedCount(ArkUI_NodeHandle node)
5693 {
5694 // already check in entry point.
5695 auto* fullImpl = GetFullImpl();
5696
5697 fullImpl->getNodeModifiers()->getListModifier()->resetCachedCount(node->uiNodeHandle);
5698 }
5699
GetListCachedCount(ArkUI_NodeHandle node)5700 const ArkUI_AttributeItem* GetListCachedCount(ArkUI_NodeHandle node)
5701 {
5702 ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getListModifier()->getCachedCount(node->uiNodeHandle);
5703 g_numberValues[0].i32 = value;
5704 return &g_attributeItem;
5705 }
5706
SetListAlignListItem(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5707 int32_t SetListAlignListItem(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5708 {
5709 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
5710 if (item->size != 1 || !CheckAttributeIsListItemAlign(item->value[0].i32)) {
5711 return ERROR_CODE_PARAM_INVALID;
5712 }
5713 GetFullImpl()->getNodeModifiers()->getListModifier()->setAlignListItem(node->uiNodeHandle, item->value[0].i32);
5714 return ERROR_CODE_NO_ERROR;
5715 }
5716
ResetListAlignListItem(ArkUI_NodeHandle node)5717 void ResetListAlignListItem(ArkUI_NodeHandle node)
5718 {
5719 auto* fullImpl = GetFullImpl();
5720 fullImpl->getNodeModifiers()->getListModifier()->resetAlignListItem(node->uiNodeHandle);
5721 }
5722
GetListAlignListItem(ArkUI_NodeHandle node)5723 const ArkUI_AttributeItem* GetListAlignListItem(ArkUI_NodeHandle node)
5724 {
5725 ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getListModifier()->getAlignListItem(node->uiNodeHandle);
5726 g_numberValues[0].i32 = value;
5727 return &g_attributeItem;
5728 }
5729
SetListChildrenMainSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5730 int32_t SetListChildrenMainSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5731 {
5732 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
5733 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
5734 auto* listChildrenMainSize = reinterpret_cast<ArkUIListChildrenMainSize>(item->object);
5735 int32_t unit = GetDefaultUnit(node, UNIT_VP);
5736 GetFullImpl()->getNodeModifiers()->getListModifier()->setListChildrenMainSize(
5737 node->uiNodeHandle, listChildrenMainSize, unit);
5738 return ERROR_CODE_NO_ERROR;
5739 }
5740
ResetListChildrenMainSize(ArkUI_NodeHandle node)5741 void ResetListChildrenMainSize(ArkUI_NodeHandle node)
5742 {
5743 auto* fullImpl = GetFullImpl();
5744 fullImpl->getNodeModifiers()->getListModifier()->resetListChildrenMainSize(node->uiNodeHandle);
5745 }
5746
SetListScrollToIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5747 int32_t SetListScrollToIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5748 {
5749 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5750 if (actualSize < NUM_0) {
5751 return ERROR_CODE_PARAM_INVALID;
5752 }
5753 ArkUI_Int32 values[ALLOW_SIZE_3] = { NUM_0, DEFAULT_FALSE, ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_NONE };
5754 values[NUM_0] = item->value[NUM_0].i32;
5755 if (item->size > NUM_1 && InRegion(NUM_0, NUM_1, item->value[NUM_1].i32)) {
5756 values[NUM_1] = item->value[NUM_1].i32;
5757 }
5758 if (item->size > NUM_2 && InRegion(NUM_0, NUM_3, item->value[NUM_2].i32)) {
5759 values[NUM_2] = item->value[NUM_2].i32;
5760 }
5761 if (values[NUM_2] == ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_NONE) {
5762 values[NUM_2] = ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_START;
5763 }
5764 auto* fullImpl = GetFullImpl();
5765 fullImpl->getNodeModifiers()->getListModifier()->setScrollToIndex(
5766 node->uiNodeHandle, values[NUM_0], values[NUM_1], values[NUM_2]);
5767 return ERROR_CODE_NO_ERROR;
5768 }
5769
SetListInitialIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5770 int32_t SetListInitialIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5771 {
5772 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
5773 if (item->size != 1) {
5774 return ERROR_CODE_PARAM_INVALID;
5775 }
5776 if (item->value[0].i32 < 0) {
5777 return ERROR_CODE_PARAM_INVALID;
5778 }
5779 GetFullImpl()->getNodeModifiers()->getListModifier()->setInitialIndex(node->uiNodeHandle, item->value[0].i32);
5780 return ERROR_CODE_NO_ERROR;
5781 }
5782
ResetListInitialIndex(ArkUI_NodeHandle node)5783 void ResetListInitialIndex(ArkUI_NodeHandle node)
5784 {
5785 // already check in entry point.
5786 auto* fullImpl = GetFullImpl();
5787
5788 fullImpl->getNodeModifiers()->getListModifier()->resetInitialIndex(node->uiNodeHandle);
5789 }
5790
GetListInitialIndex(ArkUI_NodeHandle node)5791 const ArkUI_AttributeItem* GetListInitialIndex(ArkUI_NodeHandle node)
5792 {
5793 ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getListModifier()->getInitialIndex(node->uiNodeHandle);
5794 g_numberValues[0].i32 = value;
5795 return &g_attributeItem;
5796 }
5797
SetListDivider(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5798 int32_t SetListDivider(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5799 {
5800 auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
5801 if (actualSize < 0 || LessNotEqual(item->value[NUM_1].f32, NUM_0) ||
5802 LessNotEqual(item->value[NUM_2].f32, NUM_0) || LessNotEqual(item->value[NUM_3].f32, NUM_0)) {
5803 return ERROR_CODE_PARAM_INVALID;
5804 }
5805 auto fullImpl = GetFullImpl();
5806 auto color = item->value[NUM_0].u32;
5807 int32_t unit = GetDefaultUnit(node, UNIT_VP);
5808 ArkUI_Float32 values[NUM_3] = { item->value[NUM_1].f32, item->value[NUM_2].f32, item->value[NUM_3].f32 };
5809 ArkUI_Int32 units[NUM_3] = { unit, unit, unit };
5810
5811 fullImpl->getNodeModifiers()->getListModifier()->listSetDivider(node->uiNodeHandle, color, values, units, NUM_3);
5812 return ERROR_CODE_NO_ERROR;
5813 }
5814
ResetListDivider(ArkUI_NodeHandle node)5815 void ResetListDivider(ArkUI_NodeHandle node)
5816 {
5817 // already check in entry point.
5818 auto* fullImpl = GetFullImpl();
5819 fullImpl->getNodeModifiers()->getListModifier()->listResetDivider(node->uiNodeHandle);
5820 }
5821
GetListDivider(ArkUI_NodeHandle node)5822 const ArkUI_AttributeItem* GetListDivider(ArkUI_NodeHandle node)
5823 {
5824 ArkUIdividerOptions option;
5825 GetFullImpl()->getNodeModifiers()->getListModifier()->getlistDivider(
5826 node->uiNodeHandle, &option, GetDefaultUnit(node, UNIT_VP));
5827 //size index
5828 g_numberValues[NUM_0].u32 = option.color;
5829 g_numberValues[NUM_1].f32 = option.strokeWidth;
5830 g_numberValues[NUM_2].f32 = option.startMargin;
5831 g_numberValues[NUM_3].f32 = option.endMargin;
5832 g_attributeItem.size = ALLOW_SIZE_4;
5833 return &g_attributeItem;
5834 }
5835
5836 // TextArea
SetTextAreaPlaceholderFont(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5837 int32_t SetTextAreaPlaceholderFont(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5838 {
5839 if (item == nullptr) {
5840 return ERROR_CODE_PARAM_INVALID;
5841 }
5842 auto* fullImpl = GetFullImpl();
5843 struct ArkUIResourceLength size = { 16.0, GetDefaultUnit(node, UNIT_FP) };
5844 int weight = ARKUI_FONT_WEIGHT_NORMAL;
5845 int style = ARKUI_FONT_STYLE_NORMAL;
5846 if (item->size > NUM_0) {
5847 if (LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
5848 return ERROR_CODE_PARAM_INVALID;
5849 }
5850 size.value = item->value[NUM_0].f32;
5851 }
5852 if (item->size > NUM_1) {
5853 if (item->value[NUM_1].i32 < 0 || item->value[NUM_1].i32 > static_cast<int32_t>(ARKUI_FONT_STYLE_ITALIC)) {
5854 return ERROR_CODE_PARAM_INVALID;
5855 }
5856 style = item->value[NUM_1].i32;
5857 }
5858 if (item->size > NUM_2) {
5859 if (item->value[NUM_2].i32 < 0 || item->value[NUM_2].i32 > static_cast<int32_t>(ARKUI_FONT_WEIGHT_REGULAR)) {
5860 return ERROR_CODE_PARAM_INVALID;
5861 }
5862 weight = item->value[NUM_2].i32;
5863 }
5864 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaPlaceholderFontEnum(
5865 node->uiNodeHandle, &size, weight, item->string, style);
5866 return ERROR_CODE_NO_ERROR;
5867 }
5868
GetTextAreaPlaceholderFont(ArkUI_NodeHandle node)5869 const ArkUI_AttributeItem* GetTextAreaPlaceholderFont(ArkUI_NodeHandle node)
5870 {
5871 ArkUITextFont font;
5872 font.fontSizeUnit = GetDefaultUnit(node, UNIT_FP);
5873 GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaPlaceholderFont(
5874 node->uiNodeHandle, &font);
5875 int index = 0;
5876 g_numberValues[index++].f32 = font.fontSize;
5877 g_numberValues[index++].i32 = font.fontStyle;
5878 g_numberValues[index++].i32 = font.fontWeight;
5879 g_attributeItem.size = index;
5880 g_attributeItem.string = font.fontFamilies;
5881 return &g_attributeItem;
5882 }
5883
ResetTextAreaPlaceholderFont(ArkUI_NodeHandle node)5884 void ResetTextAreaPlaceholderFont(ArkUI_NodeHandle node)
5885 {
5886 auto* fullImpl = GetFullImpl();
5887 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaPlaceholderFont(node->uiNodeHandle);
5888 }
5889
SetTextAreaPlaceholder(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5890 int32_t SetTextAreaPlaceholder(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5891 {
5892 // already check in entry point.
5893 auto* fullImpl = GetFullImpl();
5894 ArkUI_CharPtr itemString = item->string;
5895 if (!itemString) {
5896 itemString = "";
5897 }
5898 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaPlaceholderString(
5899 node->uiNodeHandle, itemString);
5900 return ERROR_CODE_NO_ERROR;
5901 }
5902
GetTextAreaPlaceholder(ArkUI_NodeHandle node)5903 const ArkUI_AttributeItem* GetTextAreaPlaceholder(ArkUI_NodeHandle node)
5904 {
5905 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaPlaceholder(
5906 node->uiNodeHandle);
5907 g_attributeItem.string = resultValue;
5908 return &g_attributeItem;
5909 }
5910
ResetTextAreaPlaceholder(ArkUI_NodeHandle node)5911 void ResetTextAreaPlaceholder(ArkUI_NodeHandle node)
5912 {
5913 auto* fullImpl = GetFullImpl();
5914 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaPlaceholderString(node->uiNodeHandle, "");
5915 }
5916
SetTextAreaText(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5917 int32_t SetTextAreaText(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5918 {
5919 // already check in entry point.
5920 auto* fullImpl = GetFullImpl();
5921 ArkUI_CharPtr itemString = item->string;
5922 if (!itemString) {
5923 itemString = "";
5924 }
5925 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaTextString(
5926 node->uiNodeHandle, itemString);
5927 return ERROR_CODE_NO_ERROR;
5928 }
5929
GetTextAreaText(ArkUI_NodeHandle node)5930 const ArkUI_AttributeItem* GetTextAreaText(ArkUI_NodeHandle node)
5931 {
5932 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaText(
5933 node->uiNodeHandle);
5934 g_attributeItem.string = resultValue;
5935 return &g_attributeItem;
5936 }
5937
ResetTextAreaText(ArkUI_NodeHandle node)5938 void ResetTextAreaText(ArkUI_NodeHandle node)
5939 {
5940 auto* fullImpl = GetFullImpl();
5941 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaTextString(node->uiNodeHandle, "");
5942 }
5943
StopTextAreaEditing(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5944 int32_t StopTextAreaEditing(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5945 {
5946 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5947 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
5948 return ERROR_CODE_PARAM_INVALID;
5949 }
5950 // already check in entry point.
5951 auto* fullImpl = GetFullImpl();
5952 if (item->value[NUM_0].i32 == 0) {
5953 fullImpl->getNodeModifiers()->getTextAreaModifier()->stopTextAreaTextEditing(node->uiNodeHandle);
5954 }
5955 return ERROR_CODE_NO_ERROR;
5956 }
5957
GetTextAreaEditing(ArkUI_NodeHandle node)5958 const ArkUI_AttributeItem* GetTextAreaEditing(ArkUI_NodeHandle node)
5959 {
5960 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaEditing(
5961 node->uiNodeHandle);
5962 g_numberValues[0].i32 = resultValue;
5963 return &g_attributeItem;
5964 }
5965
SetTextAreaType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5966 int32_t SetTextAreaType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5967 {
5968 // already check in entry point.
5969 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
5970 if (actualSize < 0 || !InRegion(NUM_0, NUM_5, item->value[0].i32)) {
5971 return ERROR_CODE_PARAM_INVALID;
5972 }
5973 auto* fullImpl = GetFullImpl();
5974 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaType(node->uiNodeHandle, item->value[0].i32);
5975 return ERROR_CODE_NO_ERROR;
5976 }
5977
GetTextAreaType(ArkUI_NodeHandle node)5978 const ArkUI_AttributeItem* GetTextAreaType(ArkUI_NodeHandle node)
5979 {
5980 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaType(
5981 node->uiNodeHandle);
5982 g_numberValues[0].i32 = resultValue;
5983 return &g_attributeItem;
5984 }
5985
ResetTextAreaType(ArkUI_NodeHandle node)5986 void ResetTextAreaType(ArkUI_NodeHandle node)
5987 {
5988 auto* fullImpl = GetFullImpl();
5989 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaType(node->uiNodeHandle);
5990 }
5991
SetTextAreaShowCounter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)5992 int32_t SetTextAreaShowCounter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
5993 {
5994 if (item->size == 0) {
5995 return ERROR_CODE_PARAM_INVALID;
5996 }
5997 auto* fullImpl = GetFullImpl();
5998 ArkUI_Bool open = false;
5999 ArkUI_Int32 thresholdPercentage = -1;
6000 ArkUI_Bool highlightBorder = true;
6001 if (item->size > NUM_0) {
6002 if (!InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
6003 return ERROR_CODE_PARAM_INVALID;
6004 }
6005 open = item->value[NUM_0].i32;
6006 }
6007 if (item->size > NUM_1) {
6008 if (!InRegion(NUM_1, NUM_100, static_cast<ArkUI_Int32>(item->value[NUM_1].f32))) {
6009 return ERROR_CODE_PARAM_INVALID;
6010 }
6011 thresholdPercentage = static_cast<ArkUI_Int32>(item->value[NUM_1].f32);
6012 }
6013 if (item->size > NUM_2) {
6014 if (!InRegion(NUM_0, NUM_1, item->value[NUM_2].i32)) {
6015 return ERROR_CODE_PARAM_INVALID;
6016 }
6017 highlightBorder = item->value[NUM_2].i32;
6018 }
6019
6020 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaShowCounterOptions(
6021 node->uiNodeHandle, open, thresholdPercentage, highlightBorder);
6022 return ERROR_CODE_NO_ERROR;
6023 }
6024
ResetTextAreaShowCounter(ArkUI_NodeHandle node)6025 void ResetTextAreaShowCounter(ArkUI_NodeHandle node)
6026 {
6027 auto* fullImpl = GetFullImpl();
6028 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaShowCounterOptions(node->uiNodeHandle);
6029 }
6030
GetTextAreaShowCounter(ArkUI_NodeHandle node)6031 const ArkUI_AttributeItem* GetTextAreaShowCounter(ArkUI_NodeHandle node)
6032 {
6033 ArkUIShowCountOptions options;
6034 auto modifier = GetFullImpl()->getNodeModifiers()->getTextAreaModifier();
6035 modifier->getTextAreaShowCounterOptions(node->uiNodeHandle, &options);
6036 // open
6037 g_numberValues[NUM_0].i32 = options.open;
6038 // thresholdPercentage
6039 g_numberValues[NUM_1].f32 = options.thresholdPercentage;
6040 // highlightBorder
6041 g_numberValues[NUM_2].i32 = options.highlightBorder;
6042 return &g_attributeItem;
6043 }
6044
SetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6045 int32_t SetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6046 {
6047 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
6048 return ERROR_CODE_PARAM_INVALID;
6049 }
6050 auto* fullImpl = GetFullImpl();
6051 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaSelectionMenuHidden(
6052 node->uiNodeHandle, item->value[NUM_0].i32);
6053 return ERROR_CODE_NO_ERROR;
6054 }
6055
GetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node)6056 const ArkUI_AttributeItem* GetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node)
6057 {
6058 g_numberValues[0].i32 =
6059 GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaSelectionMenuHidden(node->uiNodeHandle);
6060 return &g_attributeItem;
6061 }
6062
ResetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node)6063 void ResetTextAreaSelectionMenuHidden(ArkUI_NodeHandle node)
6064 {
6065 auto* fullImpl = GetFullImpl();
6066 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaSelectionMenuHidden(node->uiNodeHandle);
6067 }
6068
6069 // button
SetButtonLabel(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6070 int32_t SetButtonLabel(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6071 {
6072 if (item == nullptr || item->string == nullptr) {
6073 return ERROR_CODE_PARAM_INVALID;
6074 }
6075 auto* fullImpl = GetFullImpl();
6076 fullImpl->getNodeModifiers()->getButtonModifier()->setButtonLabel(node->uiNodeHandle, item->string);
6077 return ERROR_CODE_NO_ERROR;
6078 }
6079
GetButtonLabel(ArkUI_NodeHandle node)6080 const ArkUI_AttributeItem* GetButtonLabel(ArkUI_NodeHandle node)
6081 {
6082 auto resultValue = GetFullImpl()->getNodeModifiers()->getButtonModifier()->getButtonLabel(
6083 node->uiNodeHandle);
6084 g_attributeItem.string = resultValue;
6085 return &g_attributeItem;
6086 }
6087
ResetButtonLabel(ArkUI_NodeHandle node)6088 void ResetButtonLabel(ArkUI_NodeHandle node)
6089 {
6090 auto* fullImpl = GetFullImpl();
6091 fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonLabel(node->uiNodeHandle);
6092 }
6093
SetButtonType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6094 int32_t SetButtonType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6095 {
6096 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6097 if (LessNotEqual(actualSize, 0) ||
6098 !InRegion(ARKUI_BUTTON_TYPE_NORMAL, ARKUI_BUTTON_TYPE_CIRCLE, item->value[NUM_0].i32)) {
6099 return ERROR_CODE_PARAM_INVALID;
6100 }
6101
6102 auto* fullImpl = GetFullImpl();
6103 fullImpl->getNodeModifiers()->getButtonModifier()->setButtonType(node->uiNodeHandle, item->value[NUM_0].i32);
6104 return ERROR_CODE_NO_ERROR;
6105 }
6106
GetButtonType(ArkUI_NodeHandle node)6107 const ArkUI_AttributeItem* GetButtonType(ArkUI_NodeHandle node)
6108 {
6109 auto resultValue = GetFullImpl()->getNodeModifiers()->getButtonModifier()->getButtonType(node->uiNodeHandle);
6110 g_numberValues[0].i32 = resultValue;
6111 return &g_attributeItem;
6112 }
6113
ResetButtonType(ArkUI_NodeHandle node)6114 void ResetButtonType(ArkUI_NodeHandle node)
6115 {
6116 auto* fullImpl = GetFullImpl();
6117 fullImpl->getNodeModifiers()->getButtonModifier()->resetButtonType(node->uiNodeHandle);
6118 }
6119
SetProgressValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6120 int32_t SetProgressValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6121 {
6122 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6123 if (actualSize < 0 || LessNotEqual(item->value[0].f32, 0.0f)) {
6124 return ERROR_CODE_PARAM_INVALID;
6125 }
6126 auto* fullImpl = GetFullImpl();
6127 fullImpl->getNodeModifiers()->getProgressModifier()->setProgressValue(node->uiNodeHandle, item->value[0].f32);
6128 return ERROR_CODE_NO_ERROR;
6129 }
6130
GetProgressValue(ArkUI_NodeHandle node)6131 const ArkUI_AttributeItem* GetProgressValue(ArkUI_NodeHandle node)
6132 {
6133 auto resultValue = GetFullImpl()->getNodeModifiers()->getProgressModifier()->getProgressValue(
6134 node->uiNodeHandle);
6135 g_numberValues[0].f32 = resultValue;
6136 return &g_attributeItem;
6137 }
6138
ResetProgressValue(ArkUI_NodeHandle node)6139 void ResetProgressValue(ArkUI_NodeHandle node)
6140 {
6141 auto* fullImpl = GetFullImpl();
6142 fullImpl->getNodeModifiers()->getProgressModifier()->resetProgressValue(node->uiNodeHandle);
6143 }
6144
SetProgressTotal(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6145 int32_t SetProgressTotal(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6146 {
6147 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6148 if (actualSize < 0 || LessNotEqual(item->value[0].f32, 0.0f)) {
6149 return ERROR_CODE_PARAM_INVALID;
6150 }
6151 auto* fullImpl = GetFullImpl();
6152 fullImpl->getNodeModifiers()->getProgressModifier()->setProgressTotal(node->uiNodeHandle, item->value[0].f32);
6153 return ERROR_CODE_NO_ERROR;
6154 }
6155
GetProgressTotal(ArkUI_NodeHandle node)6156 const ArkUI_AttributeItem* GetProgressTotal(ArkUI_NodeHandle node)
6157 {
6158 auto resultValue = GetFullImpl()->getNodeModifiers()->getProgressModifier()->getProgressTotal(
6159 node->uiNodeHandle);
6160 g_numberValues[0].f32 = resultValue;
6161 return &g_attributeItem;
6162 }
6163
ResetProgressTotal(ArkUI_NodeHandle node)6164 void ResetProgressTotal(ArkUI_NodeHandle node)
6165 {
6166 auto* fullImpl = GetFullImpl();
6167 fullImpl->getNodeModifiers()->getProgressModifier()->resetProgressValue(node->uiNodeHandle);
6168 }
6169
SetProgressColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6170 int32_t SetProgressColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6171 {
6172 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6173 if (actualSize < 0) {
6174 return ERROR_CODE_PARAM_INVALID;
6175 }
6176 auto* fullImpl = GetFullImpl();
6177 fullImpl->getNodeModifiers()->getProgressModifier()->setProgressColor(node->uiNodeHandle, item->value[0].u32);
6178 return ERROR_CODE_NO_ERROR;
6179 }
6180
GetProgressColor(ArkUI_NodeHandle node)6181 const ArkUI_AttributeItem* GetProgressColor(ArkUI_NodeHandle node)
6182 {
6183 auto resultValue = GetFullImpl()->getNodeModifiers()->getProgressModifier()->getProgressColor(
6184 node->uiNodeHandle);
6185 g_numberValues[0].u32 = resultValue;
6186 return &g_attributeItem;
6187 }
6188
ResetProgressColor(ArkUI_NodeHandle node)6189 void ResetProgressColor(ArkUI_NodeHandle node)
6190 {
6191 auto* fullImpl = GetFullImpl();
6192 fullImpl->getNodeModifiers()->getProgressModifier()->resetProgressColor(node->uiNodeHandle);
6193 }
6194
SetProgressType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6195 int32_t SetProgressType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6196 {
6197 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6198 if (actualSize < 0 || !InRegion(static_cast<int32_t>(ARKUI_PROGRESS_TYPE_LINEAR),
6199 static_cast<int32_t>(ARKUI_PROGRESS_TYPE_CAPSULE), item->value[NUM_0].i32)) {
6200 return ERROR_CODE_PARAM_INVALID;
6201 }
6202 auto* fullImpl = GetFullImpl();
6203 fullImpl->getNodeModifiers()->getProgressModifier()->setProgressType(node->uiNodeHandle,
6204 PROGRESS_TYPE_ARRAY[item->value[NUM_0].i32]);
6205 return ERROR_CODE_NO_ERROR;
6206 }
6207
GetProgressType(ArkUI_NodeHandle node)6208 const ArkUI_AttributeItem* GetProgressType(ArkUI_NodeHandle node)
6209 {
6210 auto resultValue = GetFullImpl()->getNodeModifiers()->getProgressModifier()->getProgressType(
6211 node->uiNodeHandle);
6212 auto it = std::find(PROGRESS_TYPE_ARRAY.begin(), PROGRESS_TYPE_ARRAY.end(), resultValue);
6213 if (it != PROGRESS_TYPE_ARRAY.end()) {
6214 g_numberValues[0].i32 = std::distance(PROGRESS_TYPE_ARRAY.begin(), it);
6215 }
6216 return &g_attributeItem;
6217 }
6218
ResetProgressType(ArkUI_NodeHandle node)6219 void ResetProgressType(ArkUI_NodeHandle node)
6220 {
6221 auto* fullImpl = GetFullImpl();
6222 fullImpl->getNodeModifiers()->getProgressModifier()->resetProgressType(node->uiNodeHandle);
6223 }
6224
SetXComponentId(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6225 int32_t SetXComponentId(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6226 {
6227 // already check in entry point.
6228 auto* fullImpl = GetFullImpl();
6229 if (item == nullptr || !item->string) {
6230 return ERROR_CODE_PARAM_INVALID;
6231 }
6232 fullImpl->getNodeModifiers()->getXComponentModifier()->setXComponentId(node->uiNodeHandle, item->string);
6233 return ERROR_CODE_NO_ERROR;
6234 }
6235
GetXComponentId(ArkUI_NodeHandle node)6236 const ArkUI_AttributeItem* GetXComponentId(ArkUI_NodeHandle node)
6237 {
6238 auto resultValue = GetFullImpl()->getNodeModifiers()->getXComponentModifier()->getXComponentId(
6239 node->uiNodeHandle);
6240 g_attributeItem.string = resultValue;
6241 return &g_attributeItem;
6242 }
6243
SetXComponentType(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6244 int32_t SetXComponentType(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6245 {
6246 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6247 if (actualSize < 0 || (item->value[NUM_0].i32 != static_cast<int32_t>(ARKUI_XCOMPONENT_TYPE_SURFACE) &&
6248 item->value[NUM_0].i32 != static_cast<int32_t>(ARKUI_XCOMPONENT_TYPE_TEXTURE))) {
6249 return ERROR_CODE_PARAM_INVALID;
6250 }
6251 // already check in entry point.
6252 auto* fullImpl = GetFullImpl();
6253 fullImpl->getNodeModifiers()->getXComponentModifier()->setXComponentType(
6254 node->uiNodeHandle, item->value[NUM_0].i32);
6255 return ERROR_CODE_NO_ERROR;
6256 }
6257
GetXComponentType(ArkUI_NodeHandle node)6258 const ArkUI_AttributeItem* GetXComponentType(ArkUI_NodeHandle node)
6259 {
6260 auto resultValue = GetFullImpl()->getNodeModifiers()->getXComponentModifier()->getXComponentType(
6261 node->uiNodeHandle);
6262 g_numberValues[0].i32 = resultValue;
6263 return &g_attributeItem;
6264 }
6265
ResetXComponentType(ArkUI_NodeHandle node)6266 void ResetXComponentType(ArkUI_NodeHandle node)
6267 {
6268 auto* fullImpl = GetFullImpl();
6269 fullImpl->getNodeModifiers()->getXComponentModifier()->setXComponentType(
6270 node->uiNodeHandle, ARKUI_XCOMPONENT_TYPE_SURFACE);
6271 }
6272
SetXComponentSurfaceSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6273 int32_t SetXComponentSurfaceSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6274 {
6275 auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
6276 if (actualSize < 0) {
6277 return ERROR_CODE_PARAM_INVALID;
6278 }
6279 // already check in entry point.
6280 auto* fullImpl = GetFullImpl();
6281 fullImpl->getNodeModifiers()->getXComponentModifier()->setXComponentSurfaceSize(
6282 node->uiNodeHandle, item->value[0].u32, item->value[1].u32);
6283 return ERROR_CODE_NO_ERROR;
6284 }
6285
GetXComponentSurfaceSize(ArkUI_NodeHandle node)6286 const ArkUI_AttributeItem* GetXComponentSurfaceSize(ArkUI_NodeHandle node)
6287 {
6288 int index = 0;
6289 g_numberValues[index++].u32 =
6290 GetFullImpl()->getNodeModifiers()->getXComponentModifier()->getXComponentSurfaceWidth(node->uiNodeHandle);
6291 g_numberValues[index++].u32 =
6292 GetFullImpl()->getNodeModifiers()->getXComponentModifier()->getXComponentSurfaceHeight(node->uiNodeHandle);
6293 g_attributeItem.size = index;
6294 return &g_attributeItem;
6295 }
6296
ResetXComponentSurfaceSize(ArkUI_NodeHandle node)6297 void ResetXComponentSurfaceSize(ArkUI_NodeHandle node)
6298 {
6299 auto* fullImpl = GetFullImpl();
6300 fullImpl->getNodeModifiers()->getXComponentModifier()->setXComponentSurfaceSize(node->uiNodeHandle, 0, 0);
6301 }
6302
SetBaseLineOffset(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6303 int32_t SetBaseLineOffset(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6304 {
6305 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6306 if (actualSize < 0) {
6307 return ERROR_CODE_PARAM_INVALID;
6308 }
6309 // already check in entry point.
6310 auto* fullImpl = GetFullImpl();
6311 if (node->type == ARKUI_NODE_SPAN) {
6312 fullImpl->getNodeModifiers()->getSpanModifier()->setSpanBaselineOffset(node->uiNodeHandle,
6313 item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6314 } else {
6315 fullImpl->getNodeModifiers()->getTextModifier()->setTextBaselineOffset(node->uiNodeHandle,
6316 item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6317 }
6318 return ERROR_CODE_NO_ERROR;
6319 }
6320
ResetBaselineOffset(ArkUI_NodeHandle node)6321 void ResetBaselineOffset(ArkUI_NodeHandle node)
6322 {
6323 auto* fullImpl = GetFullImpl();
6324 if (node->type == ARKUI_NODE_SPAN) {
6325 fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanBaselineOffset(node->uiNodeHandle);
6326 } else {
6327 fullImpl->getNodeModifiers()->getTextModifier()->resetTextBaselineOffset(node->uiNodeHandle);
6328 }
6329 }
6330
SetTextShadow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6331 int32_t SetTextShadow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6332 {
6333 if (item->size < NUM_5) {
6334 return ERROR_CODE_PARAM_INVALID;
6335 }
6336 // already check in entry point.
6337 auto* fullImpl = GetFullImpl();
6338
6339 std::vector<struct ArkUITextShadowStruct> shadows;
6340 struct ArkUITextShadowStruct shadow = { item->value[0].f32, item->value[1].i32, item->value[2].u32,
6341 item->value[3].f32, item->value[4].f32 };
6342 shadows.emplace_back(shadow);
6343 if (node->type == ARKUI_NODE_TEXT) {
6344 fullImpl->getNodeModifiers()->getTextModifier()->setTextShadow(node->uiNodeHandle, &shadows[0], shadows.size());
6345 } else if (node->type == ARKUI_NODE_SPAN) {
6346 fullImpl->getNodeModifiers()->getSpanModifier()->setTextShadow(node->uiNodeHandle, &shadows[0], shadows.size());
6347 }
6348 return ERROR_CODE_NO_ERROR;
6349 }
6350
ResetTextShadow(ArkUI_NodeHandle node)6351 void ResetTextShadow(ArkUI_NodeHandle node)
6352 {
6353 auto* fullImpl = GetFullImpl();
6354 if (node->type == ARKUI_NODE_TEXT) {
6355 fullImpl->getNodeModifiers()->getTextModifier()->resetTextShadow(node->uiNodeHandle);
6356 } else if (node->type == ARKUI_NODE_SPAN) {
6357 fullImpl->getNodeModifiers()->getSpanModifier()->resetTextShadow(node->uiNodeHandle);
6358 }
6359 }
6360
SetTextMinFontSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6361 int32_t SetTextMinFontSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6362 {
6363 if (item->size == 0) {
6364 return ERROR_CODE_PARAM_INVALID;
6365 }
6366 auto fullImpl = GetFullImpl();
6367 if (node->type == ARKUI_NODE_TEXT) {
6368 fullImpl->getNodeModifiers()->getTextModifier()->setTextMinFontSize(
6369 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6370 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6371 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputAdaptMinFontSize(
6372 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6373 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6374 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaAdaptMinFontSize(
6375 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6376 }
6377 return ERROR_CODE_NO_ERROR;
6378 }
6379
GetTextMinFontSize(ArkUI_NodeHandle node)6380 const ArkUI_AttributeItem* GetTextMinFontSize(ArkUI_NodeHandle node)
6381 {
6382 if (node->type == ARKUI_NODE_TEXT) {
6383 g_numberValues[0].f32 =
6384 GetFullImpl()->getNodeModifiers()->getTextModifier()->getTextMinFontSize(node->uiNodeHandle);
6385 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6386 g_numberValues[0].f32 =
6387 GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputAdaptMinFontSize(node->uiNodeHandle);
6388 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6389 g_numberValues[0].f32 =
6390 GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaAdaptMinFontSize(node->uiNodeHandle);
6391 }
6392 return &g_attributeItem;
6393 }
6394
ResetTextMinFontSize(ArkUI_NodeHandle node)6395 void ResetTextMinFontSize(ArkUI_NodeHandle node)
6396 {
6397 auto fullImpl = GetFullImpl();
6398 if (node->type == ARKUI_NODE_TEXT) {
6399 fullImpl->getNodeModifiers()->getTextModifier()->resetTextMinFontSize(node->uiNodeHandle);
6400 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6401 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputAdaptMinFontSize(node->uiNodeHandle);
6402 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6403 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaAdaptMinFontSize(node->uiNodeHandle);
6404 }
6405 }
6406
SetTextMaxFontSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6407 int32_t SetTextMaxFontSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6408 {
6409 if (item->size == 0) {
6410 return ERROR_CODE_PARAM_INVALID;
6411 }
6412 auto fullImpl = GetFullImpl();
6413 if (node->type == ARKUI_NODE_TEXT) {
6414 fullImpl->getNodeModifiers()->getTextModifier()->setTextMaxFontSize(
6415 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6416 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6417 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputAdaptMaxFontSize(
6418 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6419 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6420 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaAdaptMaxFontSize(
6421 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
6422 }
6423 return ERROR_CODE_NO_ERROR;
6424 }
6425
GetTextMaxFontSize(ArkUI_NodeHandle node)6426 const ArkUI_AttributeItem* GetTextMaxFontSize(ArkUI_NodeHandle node)
6427 {
6428 if (node->type == ARKUI_NODE_TEXT) {
6429 g_numberValues[0].f32 =
6430 GetFullImpl()->getNodeModifiers()->getTextModifier()->getTextMaxFontSize(node->uiNodeHandle);
6431 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6432 g_numberValues[0].f32 =
6433 GetFullImpl()->getNodeModifiers()->getTextInputModifier()->getTextInputAdaptMaxFontSize(node->uiNodeHandle);
6434 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6435 g_numberValues[0].f32 =
6436 GetFullImpl()->getNodeModifiers()->getTextAreaModifier()->getTextAreaAdaptMaxFontSize(node->uiNodeHandle);
6437 }
6438 return &g_attributeItem;
6439 }
6440
ResetTextMaxFontSize(ArkUI_NodeHandle node)6441 void ResetTextMaxFontSize(ArkUI_NodeHandle node)
6442 {
6443 auto fullImpl = GetFullImpl();
6444 if (node->type == ARKUI_NODE_TEXT) {
6445 fullImpl->getNodeModifiers()->getTextModifier()->resetTextMaxFontSize(node->uiNodeHandle);
6446 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
6447 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputAdaptMaxFontSize(node->uiNodeHandle);
6448 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
6449 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaAdaptMaxFontSize(node->uiNodeHandle);
6450 }
6451 }
6452
SetTextFont(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6453 int32_t SetTextFont(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6454 {
6455 if (item->size == 0) {
6456 return ERROR_CODE_PARAM_INVALID;
6457 }
6458 auto fullImpl = GetFullImpl();
6459 // size
6460 double size = item->value[0].f32;
6461 // weight
6462 int weight = 10; // default
6463 if (item->size > 1) {
6464 if (!CheckAttributeIsFontWeight(item->value[1].i32)) {
6465 return ERROR_CODE_PARAM_INVALID;
6466 }
6467 weight = item->value[1].i32;
6468 }
6469 // style
6470 int style = 0;
6471 if (item->size > 2) {
6472 // get value 2 is font style
6473 if (!CheckAttributeIsFontStyle(item->value[2].i32)) {
6474 return ERROR_CODE_PARAM_INVALID;
6475 }
6476 style = item->value[NUM_2].i32;
6477 }
6478 // family
6479 std::vector<std::string> familyArray;
6480 if (item->string != nullptr) {
6481 std::string value(item->string);
6482 StringUtils::StringSplitter(value, ',', familyArray);
6483 }
6484
6485 ArkUIFontWithOptionsStruct fontStruct;
6486 fontStruct.fontSizeNumber = size;
6487 fontStruct.fontSizeUnit = GetDefaultUnit(node, UNIT_FP);
6488 fontStruct.fontWeight = weight;
6489 if (familyArray.size() > 0) {
6490 std::vector<const char*> fontFamilies;
6491 for (const auto& element : familyArray) {
6492 fontFamilies.push_back(element.c_str());
6493 }
6494 fontStruct.fontFamilies = fontFamilies.data();
6495 }
6496 fontStruct.fontStyle = style;
6497 ArkUIFontWithOptionsStruct* fontInfo = &fontStruct;
6498 fullImpl->getNodeModifiers()->getTextModifier()->setTextFont(node->uiNodeHandle, fontInfo);
6499 return ERROR_CODE_NO_ERROR;
6500 }
6501
GetTextFont(ArkUI_NodeHandle node)6502 const ArkUI_AttributeItem* GetTextFont(ArkUI_NodeHandle node)
6503 {
6504 ArkUITextFont font;
6505 font.fontSizeUnit = GetDefaultUnit(node, UNIT_FP);
6506 GetFullImpl()->getNodeModifiers()->getTextModifier()->getFont(node->uiNodeHandle, &font);
6507 int index = 0;
6508 g_numberValues[index++].f32 = font.fontSize;
6509 g_numberValues[index++].i32 = font.fontWeight;
6510 g_numberValues[index++].i32 = font.fontStyle;
6511 g_attributeItem.size = index;
6512 g_attributeItem.string = font.fontFamilies;
6513 return &g_attributeItem;
6514 }
6515
ResetTextFont(ArkUI_NodeHandle node)6516 void ResetTextFont(ArkUI_NodeHandle node)
6517 {
6518 auto fullImpl = GetFullImpl();
6519 fullImpl->getNodeModifiers()->getTextModifier()->resetTextFont(node->uiNodeHandle);
6520 }
6521
SetTextHeightAdaptivePolicy(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6522 int32_t SetTextHeightAdaptivePolicy(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6523 {
6524 if (item->size == 0 || !CheckAttributeIsTextHeightAdaptivePolicy(item->value[0].i32)) {
6525 return ERROR_CODE_PARAM_INVALID;
6526 }
6527 auto fullImpl = GetFullImpl();
6528 fullImpl->getNodeModifiers()->getTextModifier()->setTextHeightAdaptivePolicy(
6529 node->uiNodeHandle, item->value[0].i32);
6530 return ERROR_CODE_NO_ERROR;
6531 }
6532
GetTextHeightAdaptivePolicy(ArkUI_NodeHandle node)6533 const ArkUI_AttributeItem* GetTextHeightAdaptivePolicy(ArkUI_NodeHandle node)
6534 {
6535 auto resultValue =
6536 GetFullImpl()->getNodeModifiers()->getTextModifier()->getHeightAdaptivePolicy(node->uiNodeHandle);
6537 g_numberValues[0].i32 = resultValue;
6538 return &g_attributeItem;
6539 }
6540
ResetTextHeightAdaptivePolicy(ArkUI_NodeHandle node)6541 void ResetTextHeightAdaptivePolicy(ArkUI_NodeHandle node)
6542 {
6543 auto fullImpl = GetFullImpl();
6544 fullImpl->getNodeModifiers()->getTextModifier()->resetTextHeightAdaptivePolicy(node->uiNodeHandle);
6545 }
6546
6547 // Toggle Attributes functions
SetToggleSelectedColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6548 int32_t SetToggleSelectedColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6549 {
6550 if (item->size == 0) {
6551 return ERROR_CODE_PARAM_INVALID;
6552 }
6553 auto* fullImpl = GetFullImpl();
6554
6555 fullImpl->getNodeModifiers()->getToggleModifier()->setToggleSelectedColor(node->uiNodeHandle, item->value[0].u32);
6556 return ERROR_CODE_NO_ERROR;
6557 }
6558
GetToggleSelectedColor(ArkUI_NodeHandle node)6559 const ArkUI_AttributeItem* GetToggleSelectedColor(ArkUI_NodeHandle node)
6560 {
6561 auto resultValue =
6562 GetFullImpl()->getNodeModifiers()->getToggleModifier()->getToggleSelectedColor(node->uiNodeHandle);
6563 g_numberValues[0].u32 = resultValue;
6564 return &g_attributeItem;
6565 }
6566
ResetToggleSelectedColor(ArkUI_NodeHandle node)6567 void ResetToggleSelectedColor(ArkUI_NodeHandle node)
6568 {
6569 auto* fullImpl = GetFullImpl();
6570
6571 fullImpl->getNodeModifiers()->getToggleModifier()->resetToggleSelectedColor(node->uiNodeHandle);
6572 }
6573
SetToggleSwitchPointColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6574 int32_t SetToggleSwitchPointColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6575 {
6576 if (item->size == 0) {
6577 return ERROR_CODE_PARAM_INVALID;
6578 }
6579 auto* fullImpl = GetFullImpl();
6580
6581 fullImpl->getNodeModifiers()->getToggleModifier()->setToggleSwitchPointColor(
6582 node->uiNodeHandle, item->value[0].u32);
6583 return ERROR_CODE_NO_ERROR;
6584 }
6585
GetToggleSwitchPointColor(ArkUI_NodeHandle node)6586 const ArkUI_AttributeItem* GetToggleSwitchPointColor(ArkUI_NodeHandle node)
6587 {
6588 auto resultValue =
6589 GetFullImpl()->getNodeModifiers()->getToggleModifier()->getToggleSwitchPointColor(node->uiNodeHandle);
6590 g_numberValues[0].u32 = resultValue;
6591 return &g_attributeItem;
6592 }
6593
ResetToggleSwitchPointColor(ArkUI_NodeHandle node)6594 void ResetToggleSwitchPointColor(ArkUI_NodeHandle node)
6595 {
6596 auto* fullImpl = GetFullImpl();
6597
6598 fullImpl->getNodeModifiers()->getToggleModifier()->resetToggleSwitchPointColor(node->uiNodeHandle);
6599 }
6600
SetToggleValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6601 int32_t SetToggleValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6602 {
6603 if (item->size == 0) {
6604 return ERROR_CODE_PARAM_INVALID;
6605 }
6606 auto* fullImpl = GetFullImpl();
6607 fullImpl->getNodeModifiers()->getToggleModifier()->setToggleIsOn(
6608 node->uiNodeHandle, item->value[0].i32);
6609 return ERROR_CODE_NO_ERROR;
6610 }
6611
GetToggleValue(ArkUI_NodeHandle node)6612 const ArkUI_AttributeItem* GetToggleValue(ArkUI_NodeHandle node)
6613 {
6614 auto resultValue =
6615 GetFullImpl()->getNodeModifiers()->getToggleModifier()->getToggleIsOn(node->uiNodeHandle);
6616 g_numberValues[0].i32 = resultValue;
6617 return &g_attributeItem;
6618 }
6619
ResetToggleValue(ArkUI_NodeHandle node)6620 void ResetToggleValue(ArkUI_NodeHandle node)
6621 {
6622 auto* fullImpl = GetFullImpl();
6623 fullImpl->getNodeModifiers()->getToggleModifier()->resetToggleIsOn(node->uiNodeHandle);
6624 }
6625
SetToggleUnselectedColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6626 int32_t SetToggleUnselectedColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6627 {
6628 if (item->size == 0) {
6629 return ERROR_CODE_PARAM_INVALID;
6630 }
6631 auto* fullImpl = GetFullImpl();
6632
6633 fullImpl->getNodeModifiers()->getToggleModifier()->setToggleUnselectedColor(node->uiNodeHandle, item->value[0].u32);
6634 return ERROR_CODE_NO_ERROR;
6635 }
6636
GetToggleUnselectedColor(ArkUI_NodeHandle node)6637 const ArkUI_AttributeItem* GetToggleUnselectedColor(ArkUI_NodeHandle node)
6638 {
6639 auto resultValue =
6640 GetFullImpl()->getNodeModifiers()->getToggleModifier()->getToggleUnselectedColor(node->uiNodeHandle);
6641 g_numberValues[0].u32 = resultValue;
6642 return &g_attributeItem;
6643 }
6644
ResetToggleUnselectedColor(ArkUI_NodeHandle node)6645 void ResetToggleUnselectedColor(ArkUI_NodeHandle node)
6646 {
6647 auto* fullImpl = GetFullImpl();
6648 fullImpl->getNodeModifiers()->getToggleModifier()->resetToggleUnselectedColor(node->uiNodeHandle);
6649 }
6650
6651 // LoadingProgress Attributes functions
GetLoadingProgressColor(ArkUI_NodeHandle node)6652 const ArkUI_AttributeItem* GetLoadingProgressColor(ArkUI_NodeHandle node)
6653 {
6654 auto modifier = GetFullImpl()->getNodeModifiers()->getLoadingProgressModifier();
6655
6656 g_numberValues[0].u32 = modifier->getColor(node->uiNodeHandle);
6657 return &g_attributeItem;
6658 }
6659
SetLoadingProgressColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6660 int32_t SetLoadingProgressColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6661 {
6662 // already check in entry point.
6663 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6664 if (actualSize < 0) {
6665 return ERROR_CODE_PARAM_INVALID;
6666 }
6667 auto fullImpl = GetFullImpl();
6668
6669 fullImpl->getNodeModifiers()->getLoadingProgressModifier()->setColor(node->uiNodeHandle, item->value[NUM_0].u32);
6670 return ERROR_CODE_NO_ERROR;
6671 }
6672
ResetLoadingProgressColor(ArkUI_NodeHandle node)6673 void ResetLoadingProgressColor(ArkUI_NodeHandle node)
6674 {
6675 auto fullImpl = GetFullImpl();
6676
6677 fullImpl->getNodeModifiers()->getLoadingProgressModifier()->resetColor(node->uiNodeHandle);
6678 }
6679
GetLoadingProgressEnableLoading(ArkUI_NodeHandle node)6680 const ArkUI_AttributeItem* GetLoadingProgressEnableLoading(ArkUI_NodeHandle node)
6681 {
6682 auto modifier = GetFullImpl()->getNodeModifiers()->getLoadingProgressModifier();
6683
6684 g_numberValues[0].i32 = modifier->getEnableLoading(node->uiNodeHandle);
6685 return &g_attributeItem;
6686 }
6687
SetLoadingProgressEnableLoading(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6688 int32_t SetLoadingProgressEnableLoading(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6689 {
6690 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
6691 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
6692 return ERROR_CODE_PARAM_INVALID;
6693 }
6694 auto fullImpl = GetFullImpl();
6695
6696 fullImpl->getNodeModifiers()->getLoadingProgressModifier()->setEnableLoading(
6697 node->uiNodeHandle, item->value[NUM_0].i32);
6698 return ERROR_CODE_NO_ERROR;
6699 }
6700
ResetLoadingProgressEnableLoading(ArkUI_NodeHandle node)6701 void ResetLoadingProgressEnableLoading(ArkUI_NodeHandle node)
6702 {
6703 auto fullImpl = GetFullImpl();
6704
6705 fullImpl->getNodeModifiers()->getLoadingProgressModifier()->resetEnableLoading(node->uiNodeHandle);
6706 }
6707
6708 // Swiper Attributes functions
SetSwiperLoop(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6709 int32_t SetSwiperLoop(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6710 {
6711 if (item->size == 0) {
6712 return ERROR_CODE_PARAM_INVALID;
6713 }
6714 if (!InRegion(NUM_0, NUM_1, item->value[0].i32)) {
6715 return ERROR_CODE_PARAM_INVALID;
6716 }
6717 auto* fullImpl = GetFullImpl();
6718 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperLoop(
6719 node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
6720 return ERROR_CODE_NO_ERROR;
6721 }
6722
ResetSwiperLoop(ArkUI_NodeHandle node)6723 void ResetSwiperLoop(ArkUI_NodeHandle node)
6724 {
6725 auto* fullImpl = GetFullImpl();
6726 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperLoop(node->uiNodeHandle);
6727 }
6728
GetSwiperLoop(ArkUI_NodeHandle node)6729 const ArkUI_AttributeItem* GetSwiperLoop(ArkUI_NodeHandle node)
6730 {
6731 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6732 g_numberValues[0].i32 = modifier->getSwiperLoop(node->uiNodeHandle);
6733 return &g_attributeItem;
6734 }
6735
SetSwiperAutoPlay(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6736 int32_t SetSwiperAutoPlay(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6737 {
6738 if (item->size == 0) {
6739 return ERROR_CODE_PARAM_INVALID;
6740 }
6741 if (!InRegion(NUM_0, NUM_1, item->value[0].i32)) {
6742 return ERROR_CODE_PARAM_INVALID;
6743 }
6744 auto* fullImpl = GetFullImpl();
6745 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperAutoPlay(node->uiNodeHandle, item->value[0].i32);
6746 return ERROR_CODE_NO_ERROR;
6747 }
6748
ResetSwiperAutoPlay(ArkUI_NodeHandle node)6749 void ResetSwiperAutoPlay(ArkUI_NodeHandle node)
6750 {
6751 auto* fullImpl = GetFullImpl();
6752 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperAutoPlay(node->uiNodeHandle);
6753 }
6754
GetSwiperAutoPlay(ArkUI_NodeHandle node)6755 const ArkUI_AttributeItem* GetSwiperAutoPlay(ArkUI_NodeHandle node)
6756 {
6757 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6758 g_numberValues[0].i32 = modifier->getSwiperAutoPlay(node->uiNodeHandle);
6759 return &g_attributeItem;
6760 }
6761
SetSwiperShowIndicator(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6762 int32_t SetSwiperShowIndicator(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6763 {
6764 if (item->size == 0) {
6765 return ERROR_CODE_PARAM_INVALID;
6766 }
6767 if (!InRegion(NUM_0, NUM_1, item->value[0].i32)) {
6768 return ERROR_CODE_PARAM_INVALID;
6769 }
6770 auto* fullImpl = GetFullImpl();
6771 std::vector<std::string> IndicatorProps = { "boolean", "true" };
6772 IndicatorProps[NUM_1] = std::to_string(item->value[0].i32);
6773 std::stringstream ss;
6774 for (const auto& str : IndicatorProps) {
6775 ss << str << "|";
6776 }
6777 std::string result;
6778 ss >> result;
6779 if (!result.empty()) {
6780 result.pop_back(); // 删除最后一个字符
6781 }
6782 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperIndicator(node->uiNodeHandle, result.c_str());
6783 return ERROR_CODE_NO_ERROR;
6784 }
6785
ResetSwiperShowIndicator(ArkUI_NodeHandle node)6786 void ResetSwiperShowIndicator(ArkUI_NodeHandle node)
6787 {
6788 auto* fullImpl = GetFullImpl();
6789 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperIndicator(node->uiNodeHandle);
6790 }
6791
GetSwiperShowIndicator(ArkUI_NodeHandle node)6792 const ArkUI_AttributeItem* GetSwiperShowIndicator(ArkUI_NodeHandle node)
6793 {
6794 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6795 g_numberValues[0].i32 = modifier->getSwiperShowIndicator(node->uiNodeHandle);
6796 return &g_attributeItem;
6797 }
6798
SetSwiperInterval(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6799 int32_t SetSwiperInterval(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6800 {
6801 if (item->size == 0) {
6802 return ERROR_CODE_PARAM_INVALID;
6803 }
6804 if (LessNotEqual(item->value[0].f32, 0.0f)) {
6805 return ERROR_CODE_PARAM_INVALID;
6806 }
6807 auto* fullImpl = GetFullImpl();
6808 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperInterval(
6809 node->uiNodeHandle, static_cast<uint32_t>(item->value[0].f32));
6810 return ERROR_CODE_NO_ERROR;
6811 }
6812
ResetSwiperInterval(ArkUI_NodeHandle node)6813 void ResetSwiperInterval(ArkUI_NodeHandle node)
6814 {
6815 auto* fullImpl = GetFullImpl();
6816 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperInterval(node->uiNodeHandle);
6817 }
6818
GetSwiperInterval(ArkUI_NodeHandle node)6819 const ArkUI_AttributeItem* GetSwiperInterval(ArkUI_NodeHandle node)
6820 {
6821 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6822 g_numberValues[0].f32 = modifier->getSwiperInterval(node->uiNodeHandle);
6823 return &g_attributeItem;
6824 }
6825
SetSwiperVertical(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6826 int32_t SetSwiperVertical(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6827 {
6828 if (item->size == 0) {
6829 return ERROR_CODE_PARAM_INVALID;
6830 }
6831 if (!InRegion(NUM_0, NUM_1, item->value[0].i32)) {
6832 return ERROR_CODE_PARAM_INVALID;
6833 }
6834 auto* fullImpl = GetFullImpl();
6835 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperVertical(
6836 node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
6837 return ERROR_CODE_NO_ERROR;
6838 }
6839
ResetSwiperVertical(ArkUI_NodeHandle node)6840 void ResetSwiperVertical(ArkUI_NodeHandle node)
6841 {
6842 auto* fullImpl = GetFullImpl();
6843 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperVertical(node->uiNodeHandle);
6844 }
6845
GetSwiperVertical(ArkUI_NodeHandle node)6846 const ArkUI_AttributeItem* GetSwiperVertical(ArkUI_NodeHandle node)
6847 {
6848 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6849 g_numberValues[0].i32 = modifier->getSwiperVertical(node->uiNodeHandle);
6850 return &g_attributeItem;
6851 }
6852
SetSwiperDuration(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6853 int32_t SetSwiperDuration(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6854 {
6855 if (item->size == 0) {
6856 return ERROR_CODE_PARAM_INVALID;
6857 }
6858 if (LessNotEqual(item->value[0].f32, 0.0f)) {
6859 return ERROR_CODE_PARAM_INVALID;
6860 }
6861 auto* fullImpl = GetFullImpl();
6862 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperDuration(node->uiNodeHandle, item->value[0].f32);
6863 return ERROR_CODE_NO_ERROR;
6864 }
6865
ResetSwiperDuration(ArkUI_NodeHandle node)6866 void ResetSwiperDuration(ArkUI_NodeHandle node)
6867 {
6868 auto* fullImpl = GetFullImpl();
6869 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperDuration(node->uiNodeHandle);
6870 }
6871
GetSwiperDuration(ArkUI_NodeHandle node)6872 const ArkUI_AttributeItem* GetSwiperDuration(ArkUI_NodeHandle node)
6873 {
6874 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6875 g_numberValues[0].f32 = modifier->getSwiperDuration(node->uiNodeHandle);
6876 return &g_attributeItem;
6877 }
6878
SetSwiperCurve(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6879 int32_t SetSwiperCurve(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6880 {
6881 if (item->size == 0) {
6882 return ERROR_CODE_PARAM_INVALID;
6883 }
6884 if (item->value[0].i32 < ArkUI_AnimationCurve::ARKUI_CURVE_LINEAR ||
6885 item->value[0].i32 > ArkUI_AnimationCurve::ARKUI_CURVE_FRICTION) {
6886 return ERROR_CODE_PARAM_INVALID;
6887 }
6888 auto* fullImpl = GetFullImpl();
6889 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperCurve(
6890 node->uiNodeHandle, CurveToString(item->value[0].i32).c_str());
6891 return ERROR_CODE_NO_ERROR;
6892 }
6893
ResetSwiperCurve(ArkUI_NodeHandle node)6894 void ResetSwiperCurve(ArkUI_NodeHandle node)
6895 {
6896 auto* fullImpl = GetFullImpl();
6897 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperCurve(node->uiNodeHandle);
6898 }
6899
GetSwiperCurve(ArkUI_NodeHandle node)6900 const ArkUI_AttributeItem* GetSwiperCurve(ArkUI_NodeHandle node)
6901 {
6902 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6903 g_numberValues[0].i32 = modifier->getSwiperCurve(node->uiNodeHandle);
6904 return &g_attributeItem;
6905 }
6906
SetSwiperItemSpace(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6907 int32_t SetSwiperItemSpace(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6908 {
6909 if (item->size == 0) {
6910 return ERROR_CODE_PARAM_INVALID;
6911 }
6912 if (LessNotEqual(item->value[0].f32, 0.0f)) {
6913 return ERROR_CODE_PARAM_INVALID;
6914 }
6915 auto* fullImpl = GetFullImpl();
6916 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperItemSpace(
6917 node->uiNodeHandle, item->value[0].f32, NUM_1);
6918 return ERROR_CODE_NO_ERROR;
6919 }
6920
ResetSwiperItemSpace(ArkUI_NodeHandle node)6921 void ResetSwiperItemSpace(ArkUI_NodeHandle node)
6922 {
6923 auto* fullImpl = GetFullImpl();
6924 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperItemSpace(node->uiNodeHandle);
6925 }
6926
GetSwiperItemSpace(ArkUI_NodeHandle node)6927 const ArkUI_AttributeItem* GetSwiperItemSpace(ArkUI_NodeHandle node)
6928 {
6929 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6930 g_numberValues[0].f32 = modifier->getSwiperItemSpace(node->uiNodeHandle);
6931 return &g_attributeItem;
6932 }
6933
SetSwiperIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6934 int32_t SetSwiperIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6935 {
6936 if (item->size == 0) {
6937 return ERROR_CODE_PARAM_INVALID;
6938 }
6939 if (item->value[0].i32 < 0) {
6940 return ERROR_CODE_PARAM_INVALID;
6941 }
6942 auto* fullImpl = GetFullImpl();
6943 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperIndex(node->uiNodeHandle, item->value[0].i32);
6944 return ERROR_CODE_NO_ERROR;
6945 }
6946
ResetSwiperIndex(ArkUI_NodeHandle node)6947 void ResetSwiperIndex(ArkUI_NodeHandle node)
6948 {
6949 auto* fullImpl = GetFullImpl();
6950 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperIndex(node->uiNodeHandle);
6951 }
6952
GetSwiperIndex(ArkUI_NodeHandle node)6953 const ArkUI_AttributeItem* GetSwiperIndex(ArkUI_NodeHandle node)
6954 {
6955 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6956 g_numberValues[0].i32 = modifier->getSwiperIndex(node->uiNodeHandle);
6957 return &g_attributeItem;
6958 }
6959
SetSwiperDisplayCount(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6960 int32_t SetSwiperDisplayCount(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6961 {
6962 if (item->size == 0) {
6963 return ERROR_CODE_PARAM_INVALID;
6964 }
6965 if (LessNotEqual(item->value[0].f32, 0.0f)) {
6966 return ERROR_CODE_PARAM_INVALID;
6967 }
6968 auto* fullImpl = GetFullImpl();
6969 std::string type = "number";
6970 std::string displayCount = std::to_string(item->value[0].i32);
6971 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperDisplayCount(
6972 node->uiNodeHandle, displayCount.c_str(), type.c_str());
6973 return ERROR_CODE_NO_ERROR;
6974 }
6975
ResetSwiperDisplayCount(ArkUI_NodeHandle node)6976 void ResetSwiperDisplayCount(ArkUI_NodeHandle node)
6977 {
6978 auto* fullImpl = GetFullImpl();
6979 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperDisplayCount(node->uiNodeHandle);
6980 }
6981
GetSwiperDisplayCount(ArkUI_NodeHandle node)6982 const ArkUI_AttributeItem* GetSwiperDisplayCount(ArkUI_NodeHandle node)
6983 {
6984 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
6985 g_numberValues[0].i32 = modifier->getSwiperDisplayCount(node->uiNodeHandle);
6986 return &g_attributeItem;
6987 }
6988
SetSwiperDisableSwipe(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)6989 int32_t SetSwiperDisableSwipe(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
6990 {
6991 if (item->size == 0) {
6992 return ERROR_CODE_PARAM_INVALID;
6993 }
6994 if (!InRegion(NUM_0, NUM_1, item->value[0].i32)) {
6995 return ERROR_CODE_PARAM_INVALID;
6996 }
6997 auto* fullImpl = GetFullImpl();
6998 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperDisableSwipe(
6999 node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
7000 return ERROR_CODE_NO_ERROR;
7001 }
7002
ResetSwiperDisableSwipe(ArkUI_NodeHandle node)7003 void ResetSwiperDisableSwipe(ArkUI_NodeHandle node)
7004 {
7005 auto* fullImpl = GetFullImpl();
7006 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperDisableSwipe(node->uiNodeHandle);
7007 }
7008
GetSwiperDisableSwipe(ArkUI_NodeHandle node)7009 const ArkUI_AttributeItem* GetSwiperDisableSwipe(ArkUI_NodeHandle node)
7010 {
7011 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
7012 g_numberValues[0].i32 = modifier->getSwiperDisableSwipe(node->uiNodeHandle);
7013 return &g_attributeItem;
7014 }
7015
SetSwiperShowDisplayArrow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7016 int32_t SetSwiperShowDisplayArrow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7017 {
7018 if (item->size == 0) {
7019 return ERROR_CODE_PARAM_INVALID;
7020 }
7021 if (!InRegion(NUM_0, NUM_2, item->value[NUM_0].i32)) {
7022 return ERROR_CODE_PARAM_INVALID;
7023 }
7024 auto* fullImpl = GetFullImpl();
7025 double defaultBackgroundColor = StringToColorInt("#00000000", 0);
7026 double defaultArrowColor = StringToColorInt("#FF182431", 0);
7027 double displayArrow[ALLOW_SIZE_8] = { 1, 0, 0, DEFAULT_SIZE_24, defaultBackgroundColor, DEFAULT_SIZE_18,
7028 defaultArrowColor, 0 };
7029 if (item->value[0].i32 == ArkUI_SwiperArrow::ARKUI_SWIPER_ARROW_SHOW_ON_HOVER) {
7030 displayArrow[NUM_0] = DISPLAY_ARROW_TRUE;
7031 displayArrow[NUM_7] = DISPLAY_ARROW_TRUE;
7032 } else {
7033 displayArrow[NUM_0] = item->value[0].i32;
7034 displayArrow[NUM_7] = DISPLAY_ARROW_FALSE;
7035 }
7036 std::stringstream ss;
7037 for (const auto& str : displayArrow) {
7038 ss << str << "|";
7039 }
7040 std::string result;
7041 ss >> result;
7042 if (!result.empty()) {
7043 result.pop_back(); // 删除最后一个字符
7044 }
7045 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperDisplayArrow(node->uiNodeHandle, result.c_str());
7046 return ERROR_CODE_NO_ERROR;
7047 }
7048
ResetSwiperShowDisplayArrow(ArkUI_NodeHandle node)7049 void ResetSwiperShowDisplayArrow(ArkUI_NodeHandle node)
7050 {
7051 auto* fullImpl = GetFullImpl();
7052 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperDisplayArrow(node->uiNodeHandle);
7053 }
7054
GetSwiperShowDisplayArrow(ArkUI_NodeHandle node)7055 const ArkUI_AttributeItem* GetSwiperShowDisplayArrow(ArkUI_NodeHandle node)
7056 {
7057 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
7058 g_numberValues[0].i32 = modifier->getSwiperShowDisplayArrow(node->uiNodeHandle);
7059 return &g_attributeItem;
7060 }
7061
SetSwiperEffectMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7062 int32_t SetSwiperEffectMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7063 {
7064 if (item->size == 0) {
7065 return ERROR_CODE_PARAM_INVALID;
7066 }
7067 if (item->value[0].i32 < ArkUI_EdgeEffect::ARKUI_EDGE_EFFECT_SPRING ||
7068 item->value[0].i32 > ArkUI_EdgeEffect::ARKUI_EDGE_EFFECT_NONE) {
7069 return ERROR_CODE_PARAM_INVALID;
7070 }
7071 auto* fullImpl = GetFullImpl();
7072 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperEffectMode(
7073 node->uiNodeHandle, static_cast<ArkUI_Int32>(item->value[0].i32));
7074 return ERROR_CODE_NO_ERROR;
7075 }
7076
ResetSwiperEffectMode(ArkUI_NodeHandle node)7077 void ResetSwiperEffectMode(ArkUI_NodeHandle node)
7078 {
7079 auto* fullImpl = GetFullImpl();
7080 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperEffectMode(node->uiNodeHandle);
7081 }
7082
GetSwiperEffectMode(ArkUI_NodeHandle node)7083 const ArkUI_AttributeItem* GetSwiperEffectMode(ArkUI_NodeHandle node)
7084 {
7085 auto modifier = GetFullImpl()->getNodeModifiers()->getSwiperModifier();
7086 g_numberValues[0].i32 = modifier->getSwiperEffectMode(node->uiNodeHandle);
7087 return &g_attributeItem;
7088 }
7089
SetSwiperNodeAdapter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7090 int32_t SetSwiperNodeAdapter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7091 {
7092 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
7093 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
7094 auto* nodeAdapter = reinterpret_cast<ArkUINodeAdapterHandle>(item->object);
7095 return GetFullImpl()->getNodeModifiers()->getSwiperModifier()->setNodeAdapter(node->uiNodeHandle, nodeAdapter);
7096 }
7097
ResetSwiperNodeAdapter(ArkUI_NodeHandle node)7098 void ResetSwiperNodeAdapter(ArkUI_NodeHandle node)
7099 {
7100 // already check in entry point.
7101 auto* fullImpl = GetFullImpl();
7102
7103 fullImpl->getNodeModifiers()->getSwiperModifier()->resetNodeAdapter(node->uiNodeHandle);
7104 }
7105
GetSwiperNodeAdapter(ArkUI_NodeHandle node)7106 const ArkUI_AttributeItem* GetSwiperNodeAdapter(ArkUI_NodeHandle node)
7107 {
7108 ArkUINodeAdapterHandle adapter =
7109 GetFullImpl()->getNodeModifiers()->getSwiperModifier()->getNodeAdapter(node->uiNodeHandle);
7110 g_attributeItem.object = reinterpret_cast<void*>(adapter);
7111 return &g_attributeItem;
7112 }
7113
SetSwiperCachedCount(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7114 int32_t SetSwiperCachedCount(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7115 {
7116 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
7117 if (item->size != 1) {
7118 return ERROR_CODE_PARAM_INVALID;
7119 }
7120 if (LessNotEqual(item->value[0].i32, NUM_0)) {
7121 return ERROR_CODE_PARAM_INVALID;
7122 }
7123 GetFullImpl()->getNodeModifiers()->getSwiperModifier()->setSwiperCachedCount(
7124 node->uiNodeHandle, item->value[0].i32);
7125 return ERROR_CODE_NO_ERROR;
7126 }
7127
ResetSwiperCachedCount(ArkUI_NodeHandle node)7128 void ResetSwiperCachedCount(ArkUI_NodeHandle node)
7129 {
7130 // already check in entry point.
7131 auto* fullImpl = GetFullImpl();
7132
7133 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperCachedCount(node->uiNodeHandle);
7134 }
7135
GetSwiperCachedCount(ArkUI_NodeHandle node)7136 const ArkUI_AttributeItem* GetSwiperCachedCount(ArkUI_NodeHandle node)
7137 {
7138 ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getSwiperModifier()->getCachedCount(node->uiNodeHandle);
7139 g_numberValues[0].i32 = value;
7140 return &g_attributeItem;
7141 }
7142
SetSwiperNestedScroll(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7143 int32_t SetSwiperNestedScroll(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7144 {
7145 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7146 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
7147 return ERROR_CODE_PARAM_INVALID;
7148 }
7149 ArkUI_Int32 values[ALLOW_SIZE_1] = {0};
7150 values[0] = item->value[0].i32;
7151
7152 auto* fullImpl = GetFullImpl();
7153 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperNestedScroll(node->uiNodeHandle, &values);
7154 return ERROR_CODE_NO_ERROR;
7155 }
7156
ResetSwiperNestedScroll(ArkUI_NodeHandle node)7157 void ResetSwiperNestedScroll(ArkUI_NodeHandle node)
7158 {
7159 auto* fullImpl = GetFullImpl();
7160 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperNestedScroll(node->uiNodeHandle);
7161 }
7162
GetSwiperNestedScroll(ArkUI_NodeHandle node)7163 const ArkUI_AttributeItem* GetSwiperNestedScroll(ArkUI_NodeHandle node)
7164 {
7165 auto* fullImpl = GetFullImpl();
7166 ArkUI_Int32 value = fullImpl->getNodeModifiers()->getSwiperModifier()->getSwiperNestedScroll(node->uiNodeHandle);
7167 g_numberValues[0].i32 = value;
7168 return &g_attributeItem;
7169 }
7170
SetSwiperToIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7171 int32_t SetSwiperToIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7172 {
7173 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7174 if (actualSize < 0) {
7175 return ERROR_CODE_PARAM_INVALID;
7176 }
7177 ArkUI_Int32 values[ALLOW_SIZE_2] = { 0, DEFAULT_FALSE };
7178 values[0] = item->value[0].i32;
7179 if (item->size > 1 && InRegion(NUM_0, NUM_1, item->value[1].i32)) {
7180 values[1] = item->value[1].i32;
7181 }
7182 auto* fullImpl = GetFullImpl();
7183 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperToIndex(node->uiNodeHandle, &values);
7184 return ERROR_CODE_NO_ERROR;
7185 }
7186
SetSwiperPrevMargin(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7187 int32_t SetSwiperPrevMargin(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7188 {
7189 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7190 if (actualSize < NUM_0) {
7191 return ERROR_CODE_PARAM_INVALID;
7192 }
7193 if (LessNotEqual(item->value[0].f32, 0.0f)) {
7194 return ERROR_CODE_PARAM_INVALID;
7195 }
7196 ArkUI_Bool ignoreBlank = DEFAULT_FALSE;
7197 if (actualSize > NUM_1 && InRegion(DEFAULT_FALSE, DEFAULT_TRUE, item->value[1].i32)) {
7198 ignoreBlank = item->value[1].i32;
7199 }
7200 // already check in entry point.
7201 auto* fullImpl = GetFullImpl();
7202 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperPrevMargin(
7203 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_VP), ignoreBlank);
7204 return ERROR_CODE_NO_ERROR;
7205 }
7206
ResetSwiperPrevMargin(ArkUI_NodeHandle node)7207 void ResetSwiperPrevMargin(ArkUI_NodeHandle node)
7208 {
7209 // already check in entry point.
7210 auto* fullImpl = GetFullImpl();
7211 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperPrevMargin(node->uiNodeHandle);
7212 }
7213
GetSwiperPrevMargin(ArkUI_NodeHandle node)7214 const ArkUI_AttributeItem* GetSwiperPrevMargin(ArkUI_NodeHandle node)
7215 {
7216 // already check in entry point.
7217 auto* fullImpl = GetFullImpl();
7218 int32_t unit = GetDefaultUnit(node, UNIT_VP);
7219 ArkUISwiperMarginOptions options;
7220 fullImpl->getNodeModifiers()->getSwiperModifier()->getSwiperPrevMargin(node->uiNodeHandle, unit, &options);
7221 g_numberValues[0].f32 = options.margin;
7222 g_numberValues[1].i32 = options.ignoreBlank;
7223 g_attributeItem.size = REQUIRED_TWO_PARAM;
7224 return &g_attributeItem;
7225 }
7226
SetSwiperNextMargin(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7227 int32_t SetSwiperNextMargin(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7228 {
7229 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7230 if (actualSize < NUM_0) {
7231 return ERROR_CODE_PARAM_INVALID;
7232 }
7233 if (LessNotEqual(item->value[0].f32, 0.0f)) {
7234 return ERROR_CODE_PARAM_INVALID;
7235 }
7236 ArkUI_Bool ignoreBlank = DEFAULT_FALSE;
7237 if (actualSize > NUM_1 && InRegion(DEFAULT_FALSE, DEFAULT_TRUE, item->value[1].i32)) {
7238 ignoreBlank = item->value[1].i32;
7239 }
7240 // already check in entry point.
7241 auto* fullImpl = GetFullImpl();
7242 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperNextMargin(
7243 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_VP), ignoreBlank);
7244 return ERROR_CODE_NO_ERROR;
7245 }
7246
ResetSwiperNextMargin(ArkUI_NodeHandle node)7247 void ResetSwiperNextMargin(ArkUI_NodeHandle node)
7248 {
7249 // already check in entry point.
7250 auto* fullImpl = GetFullImpl();
7251 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperNextMargin(node->uiNodeHandle);
7252 }
7253
GetSwiperNextMargin(ArkUI_NodeHandle node)7254 const ArkUI_AttributeItem* GetSwiperNextMargin(ArkUI_NodeHandle node)
7255 {
7256 // already check in entry point.
7257 auto* fullImpl = GetFullImpl();
7258 int32_t unit = GetDefaultUnit(node, UNIT_VP);
7259 ArkUISwiperMarginOptions options;
7260 fullImpl->getNodeModifiers()->getSwiperModifier()->getSwiperNextMargin(node->uiNodeHandle, unit, &options);
7261 g_numberValues[0].f32 = options.margin;
7262 g_numberValues[1].i32 = options.ignoreBlank;
7263 g_attributeItem.size = REQUIRED_TWO_PARAM;
7264 return &g_attributeItem;
7265 }
7266
SetSwiperIndicator(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7267 int32_t SetSwiperIndicator(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7268 {
7269 if (item->size == 0) {
7270 return ERROR_CODE_PARAM_INVALID;
7271 }
7272 if (!CheckAttributeIndicator(item)) {
7273 return ERROR_CODE_PARAM_INVALID;
7274 }
7275
7276 ArkUI_SwiperIndicator* indicator = reinterpret_cast<ArkUI_SwiperIndicator*>(item->object);
7277 CHECK_NULL_RETURN(indicator, ERROR_CODE_PARAM_INVALID);
7278 node->swiperIndicator = indicator;
7279 ArkUISwiperIndicator indicatorProp;
7280 indicatorProp.dimUnit = GetDefaultUnit(node, UNIT_VP);
7281 indicatorProp.dimLeft = ArkUIOptionalFloat { indicator->dimLeft.isSet, indicator->dimLeft.value };
7282 indicatorProp.dimTop = ArkUIOptionalFloat { indicator->dimTop.isSet, indicator->dimTop.value };
7283 indicatorProp.dimRight = ArkUIOptionalFloat { indicator->dimRight.isSet, indicator->dimRight.value };
7284 indicatorProp.dimBottom = ArkUIOptionalFloat { indicator->dimBottom.isSet, indicator->dimBottom.value };
7285 if (indicator->type == ARKUI_SWIPER_INDICATOR_TYPE_DOT) {
7286 indicatorProp.type = ArkUISwiperIndicatorType::DOT;
7287 indicatorProp.itemWidth = ArkUIOptionalFloat { indicator->itemWidth.isSet, indicator->itemWidth.value };
7288 indicatorProp.itemHeight = ArkUIOptionalFloat { indicator->itemHeight.isSet, indicator->itemHeight.value };
7289 indicatorProp.selectedItemWidth =
7290 ArkUIOptionalFloat { indicator->selectedItemWidth.isSet, indicator->selectedItemWidth.value };
7291 indicatorProp.selectedItemHeight =
7292 ArkUIOptionalFloat { indicator->selectedItemHeight.isSet, indicator->selectedItemHeight.value };
7293 indicatorProp.maskValue = ArkUIOptionalInt { indicator->maskValue.isSet, indicator->maskValue.value };
7294 indicatorProp.colorValue = ArkUIOptionalUint { indicator->colorValue.isSet, indicator->colorValue.value };
7295 indicatorProp.selectedColorValue =
7296 ArkUIOptionalUint { indicator->selectedColorValue.isSet, indicator->selectedColorValue.value };
7297 indicatorProp.maxDisplayCount =
7298 ArkUIOptionalInt { indicator->maxDisplayCount.isSet, indicator->maxDisplayCount.value };
7299 } else {
7300 return ERROR_CODE_PARAM_INVALID;
7301 }
7302
7303 auto* fullImpl = GetFullImpl();
7304 fullImpl->getNodeModifiers()->getSwiperModifier()->setSwiperIndicatorStyle(node->uiNodeHandle, &indicatorProp);
7305 return ERROR_CODE_NO_ERROR;
7306 }
7307
ResetSwiperIndicator(ArkUI_NodeHandle node)7308 void ResetSwiperIndicator(ArkUI_NodeHandle node)
7309 {
7310 auto* fullImpl = GetFullImpl();
7311 fullImpl->getNodeModifiers()->getSwiperModifier()->resetSwiperIndicator(node->uiNodeHandle);
7312 node->swiperIndicator = nullptr;
7313 }
7314
GetSwiperIndicator(ArkUI_NodeHandle node)7315 const ArkUI_AttributeItem* GetSwiperIndicator(ArkUI_NodeHandle node)
7316 {
7317 ArkUI_SwiperIndicator* indicator = reinterpret_cast<ArkUI_SwiperIndicator*>(node->swiperIndicator);
7318 if (!indicator) {
7319 return &g_attributeItem;
7320 }
7321 auto* fullImpl = GetFullImpl();
7322 ArkUISwiperIndicator props;
7323 fullImpl->getNodeModifiers()->getSwiperModifier()->getSwiperIndicator(node->uiNodeHandle, &props);
7324 indicator->dimLeft.value = props.dimLeft.value;
7325 indicator->dimTop.value = props.dimTop.value;
7326 indicator->dimRight.value = props.dimRight.value;
7327 indicator->dimBottom.value = props.dimBottom.value;
7328 if (props.type == ArkUISwiperIndicatorType::DOT) {
7329 indicator->itemWidth.value = props.itemWidth.value;
7330 indicator->itemHeight.value = props.itemHeight.value;
7331 indicator->selectedItemWidth.value = props.selectedItemWidth.value;
7332 indicator->selectedItemHeight.value = props.selectedItemHeight.value;
7333 indicator->maskValue.value = props.maskValue.value;
7334 indicator->colorValue.value = props.colorValue.value;
7335 indicator->selectedColorValue.value = props.selectedColorValue.value;
7336 indicator->maxDisplayCount.value = props.maxDisplayCount.value;
7337 } else {
7338 indicator = nullptr;
7339 }
7340
7341 g_numberValues[0].i32 = static_cast<int32_t>(props.type);
7342 g_attributeItem.size = REQUIRED_ONE_PARAM;
7343 g_attributeItem.object = indicator;
7344 return &g_attributeItem;
7345 }
7346
SetSwiperIndicatorInteractive(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7347 int32_t SetSwiperIndicatorInteractive(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7348 {
7349 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7350 if (actualSize < 0) {
7351 return ERROR_CODE_PARAM_INVALID;
7352 }
7353 auto* fullImpl = GetFullImpl();
7354 fullImpl->getNodeModifiers()->getSwiperModifier()->setIndicatorInteractive(node->uiNodeHandle,
7355 static_cast<bool>(item->value[0].i32));
7356 return ERROR_CODE_NO_ERROR;
7357 }
7358
ResetSwiperIndicatorInteractive(ArkUI_NodeHandle node)7359 void ResetSwiperIndicatorInteractive(ArkUI_NodeHandle node)
7360 {
7361 auto* fullImpl = GetFullImpl();
7362 fullImpl->getNodeModifiers()->getSwiperModifier()->resetIndicatorInteractive(node->uiNodeHandle);
7363 }
7364
GetSwiperIndicatorInteractive(ArkUI_NodeHandle node)7365 const ArkUI_AttributeItem* GetSwiperIndicatorInteractive(ArkUI_NodeHandle node)
7366 {
7367 ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getSwiperModifier()->
7368 getIndicatorInteractive(node->uiNodeHandle);
7369 g_numberValues[0].i32 = value;
7370 return &g_attributeItem;
7371 }
7372
SetTextFontFamily(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7373 int32_t SetTextFontFamily(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7374 {
7375 if (item->string == nullptr) {
7376 return ERROR_CODE_PARAM_INVALID;
7377 }
7378 auto* fullImpl = GetFullImpl();
7379 std::string value(item->string);
7380 std::vector<std::string> fontFamilies;
7381 StringUtils::StringSplitter(value, ',', fontFamilies);
7382 auto families = std::make_unique<char*[]>(fontFamilies.size());
7383 for (uint32_t i = 0; i < fontFamilies.size(); i++) {
7384 families[i] = const_cast<char*>(fontFamilies.at(i).c_str());
7385 }
7386
7387 if (node->type == ARKUI_NODE_TEXT_INPUT) {
7388 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontFamily(
7389 node->uiNodeHandle, const_cast<const char**>(families.get()), fontFamilies.size());
7390 } else if (node->type == ARKUI_NODE_TEXT) {
7391 fullImpl->getNodeModifiers()->getTextModifier()->setTextFontFamily(
7392 node->uiNodeHandle, const_cast<const char**>(families.get()), fontFamilies.size());
7393 } else if (node->type == ARKUI_NODE_SPAN) {
7394 fullImpl->getNodeModifiers()->getSpanModifier()->setSpanFontFamily(
7395 node->uiNodeHandle, const_cast<const char**>(families.get()), fontFamilies.size());
7396 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
7397 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontFamily(node->uiNodeHandle, item->string);
7398 }
7399 return ERROR_CODE_NO_ERROR;
7400 }
7401
GetTextFontFamily(ArkUI_NodeHandle node)7402 const ArkUI_AttributeItem* GetTextFontFamily(ArkUI_NodeHandle node)
7403 {
7404 if (node->type == ARKUI_NODE_SPAN) {
7405 auto resultValue = GetFullImpl()->getNodeModifiers()->getSpanModifier()->getSpanFontFamily(node->uiNodeHandle);
7406 g_attributeItem.string = resultValue;
7407 } else {
7408 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextModifier()->getFontFamily(node->uiNodeHandle);
7409 g_attributeItem.string = resultValue;
7410 }
7411 g_attributeItem.size = 0;
7412 return &g_attributeItem;
7413 }
7414
ResetTextFontFamily(ArkUI_NodeHandle node)7415 void ResetTextFontFamily(ArkUI_NodeHandle node)
7416 {
7417 auto* fullImpl = GetFullImpl();
7418 if (node->type == ARKUI_NODE_TEXT_INPUT) {
7419 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontFamily(node->uiNodeHandle);
7420 } else if (node->type == ARKUI_NODE_TEXT) {
7421 fullImpl->getNodeModifiers()->getTextModifier()->resetTextFontFamily(node->uiNodeHandle);
7422 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
7423 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontFamily(node->uiNodeHandle);
7424 }
7425 }
7426
ResetTextCopyOption(ArkUI_NodeHandle node)7427 void ResetTextCopyOption(ArkUI_NodeHandle node)
7428 {
7429 auto* fullImpl = GetFullImpl();
7430 if (node->type == ARKUI_NODE_TEXT) {
7431 fullImpl->getNodeModifiers()->getTextModifier()->resetTextCopyOption(node->uiNodeHandle);
7432 }
7433 }
7434
SetTextCopyOption(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7435 int32_t SetTextCopyOption(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7436 {
7437 if (item->size == NUM_0 || !CheckAttributeIsCopyOptions(item->value[0].i32)) {
7438 return ERROR_CODE_PARAM_INVALID;
7439 }
7440 // already check in entry point.
7441 auto* fullImpl = GetFullImpl();
7442 if (node->type == ARKUI_NODE_TEXT) {
7443 fullImpl->getNodeModifiers()->getTextModifier()->setTextCopyOption(node->uiNodeHandle, item->value[0].i32);
7444 } else {
7445 return ERROR_CODE_PARAM_INVALID;
7446 }
7447 return ERROR_CODE_NO_ERROR;
7448 }
7449
GetTextCopyOption(ArkUI_NodeHandle node)7450 const ArkUI_AttributeItem* GetTextCopyOption(ArkUI_NodeHandle node)
7451 {
7452 auto resultValue = GetFullImpl()->getNodeModifiers()->getTextModifier()->getCopyOption(node->uiNodeHandle);
7453 g_numberValues[0].i32 = resultValue;
7454 return &g_attributeItem;
7455 }
7456
GetBaseLineOffset(ArkUI_NodeHandle node)7457 const ArkUI_AttributeItem* GetBaseLineOffset(ArkUI_NodeHandle node)
7458 {
7459 auto* fullImpl = GetFullImpl();
7460 if (node->type == ARKUI_NODE_SPAN) {
7461 g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getSpanModifier()->getSpanBaselineOffset(
7462 node->uiNodeHandle);
7463 } else {
7464 g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextBaselineOffset(
7465 node->uiNodeHandle);
7466 }
7467 g_attributeItem.size = REQUIRED_ONE_PARAM;
7468 return &g_attributeItem;
7469 }
7470
GetTextShadow(ArkUI_NodeHandle node)7471 const ArkUI_AttributeItem* GetTextShadow(ArkUI_NodeHandle node)
7472 {
7473 auto* fullImpl = GetFullImpl();
7474 ArkUITextShadowStruct shadowArray[NUM_1];
7475 if (node->type == ARKUI_NODE_TEXT) {
7476 fullImpl->getNodeModifiers()->getTextModifier()->getTextShadows(node->uiNodeHandle, &shadowArray[0], NUM_1);
7477 } else if (node->type == ARKUI_NODE_SPAN) {
7478 fullImpl->getNodeModifiers()->getSpanModifier()->getTextShadows(node->uiNodeHandle, &shadowArray[0], NUM_1);
7479 }
7480 g_numberValues[NUM_0].f32 = shadowArray[0].radius;
7481 g_numberValues[NUM_1].i32 = static_cast<int32_t>(shadowArray[0].type);
7482 g_numberValues[NUM_2].u32 = shadowArray[0].color;
7483 g_numberValues[NUM_3].f32 = shadowArray[0].offsetX;
7484 g_numberValues[NUM_4].f32 = shadowArray[0].offsetY;
7485 g_attributeItem.size = REQUIRED_FIVE_PARAM;
7486 return &g_attributeItem;
7487 }
7488
7489 // ListItemGroup
SetListItemGroupHeader(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7490 int32_t SetListItemGroupHeader(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7491 {
7492 if (!item->object) {
7493 return ERROR_CODE_PARAM_INVALID;
7494 }
7495 auto fullImpl = GetFullImpl();
7496 auto headerNodeHandle = reinterpret_cast<ArkUI_NodeHandle>(item->object);
7497 fullImpl->getNodeModifiers()->getListItemGroupModifier()->listItemGroupSetHeader(
7498 node->uiNodeHandle, headerNodeHandle->uiNodeHandle);
7499 return ERROR_CODE_NO_ERROR;
7500 }
7501
SetListItemGroupFooter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7502 int32_t SetListItemGroupFooter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7503 {
7504 if (!item->object) {
7505 return ERROR_CODE_PARAM_INVALID;
7506 }
7507 auto fullImpl = GetFullImpl();
7508 auto footerNodeHandle = reinterpret_cast<ArkUI_NodeHandle>(item->object);
7509 fullImpl->getNodeModifiers()->getListItemGroupModifier()->listItemGroupSetFooter(
7510 node->uiNodeHandle, footerNodeHandle->uiNodeHandle);
7511 return ERROR_CODE_NO_ERROR;
7512 }
7513
SetListItemGroupDivider(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7514 int32_t SetListItemGroupDivider(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7515 {
7516 auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
7517 if (actualSize < 0 || LessNotEqual(item->value[NUM_1].f32, NUM_0) || LessNotEqual(item->value[NUM_2].f32, NUM_0) ||
7518 LessNotEqual(item->value[NUM_3].f32, NUM_0)) {
7519 return ERROR_CODE_PARAM_INVALID;
7520 }
7521 auto fullImpl = GetFullImpl();
7522 auto color = item->value[NUM_0].u32;
7523 int32_t unit = GetDefaultUnit(node, UNIT_VP);
7524 ArkUI_Float32 values[NUM_3] = { item->value[NUM_1].f32, item->value[NUM_2].f32, item->value[NUM_3].f32 };
7525 ArkUI_Int32 units[NUM_3] = { unit, unit, unit };
7526
7527 fullImpl->getNodeModifiers()->getListItemGroupModifier()->listItemGroupSetDivider(
7528 node->uiNodeHandle, color, values, units, NUM_3);
7529 return ERROR_CODE_NO_ERROR;
7530 }
7531
ResetListItemGroupDivider(ArkUI_NodeHandle node)7532 void ResetListItemGroupDivider(ArkUI_NodeHandle node)
7533 {
7534 // already check in entry point.
7535 auto* fullImpl = GetFullImpl();
7536 fullImpl->getNodeModifiers()->getListItemGroupModifier()->listItemGroupResetDivider(node->uiNodeHandle);
7537 }
7538
GetListItemGroupDivider(ArkUI_NodeHandle node)7539 const ArkUI_AttributeItem* GetListItemGroupDivider(ArkUI_NodeHandle node)
7540 {
7541 ArkUIdividerOptions option;
7542 GetFullImpl()->getNodeModifiers()->getListItemGroupModifier()->getlistItemGroupDivider(
7543 node->uiNodeHandle, &option, GetDefaultUnit(node, UNIT_VP));
7544 g_numberValues[NUM_0].u32 = option.color;
7545 g_numberValues[NUM_1].f32 = option.strokeWidth;
7546 g_numberValues[NUM_2].f32 = option.startMargin;
7547 g_numberValues[NUM_3].f32 = option.endMargin;
7548 g_attributeItem.size = ALLOW_SIZE_4;
7549 return &g_attributeItem;
7550 }
7551
SetListItemGroupChildrenMainSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7552 int32_t SetListItemGroupChildrenMainSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7553 {
7554 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
7555 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
7556 auto* listChildrenMainSize = reinterpret_cast<ArkUIListChildrenMainSize>(item->object);
7557 int32_t unit = GetDefaultUnit(node, UNIT_VP);
7558 GetFullImpl()->getNodeModifiers()->getListItemGroupModifier()->setListItemGroupChildrenMainSize(
7559 node->uiNodeHandle, listChildrenMainSize, unit);
7560 return ERROR_CODE_NO_ERROR;
7561 }
7562
ResetListItemGroupChildrenMainSize(ArkUI_NodeHandle node)7563 void ResetListItemGroupChildrenMainSize(ArkUI_NodeHandle node)
7564 {
7565 auto* fullImpl = GetFullImpl();
7566 fullImpl->getNodeModifiers()->getListItemGroupModifier()->resetListItemGroupChildrenMainSize(node->uiNodeHandle);
7567 }
7568
SetListItemSwiperAction(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7569 int32_t SetListItemSwiperAction(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7570 {
7571 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
7572 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
7573 auto* listItemSwipeActionOption = reinterpret_cast<ArkUIListItemSwipeActionOptionHandle>(item->object);
7574 GetFullImpl()->getNodeModifiers()->getListItemModifier()->setListItemSwipeAction(
7575 node->uiNodeHandle, listItemSwipeActionOption);
7576 return ERROR_CODE_NO_ERROR;
7577 }
7578
ResetListItemSwiperAction(ArkUI_NodeHandle node)7579 void ResetListItemSwiperAction(ArkUI_NodeHandle node)
7580 {
7581 auto* fullImpl = GetFullImpl();
7582 fullImpl->getNodeModifiers()->getListItemModifier()->resetListItemSwipeAction(node->uiNodeHandle);
7583 }
7584 // datepicker
7585
GetDatePickerLunar(ArkUI_NodeHandle node)7586 const ArkUI_AttributeItem* GetDatePickerLunar(ArkUI_NodeHandle node)
7587 {
7588 auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getLunar(node->uiNodeHandle);
7589 g_numberValues[0].i32 = value;
7590 return &g_attributeItem;
7591 }
7592
SetDatePickerLunar(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7593 int32_t SetDatePickerLunar(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7594 {
7595 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7596 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
7597 return ERROR_CODE_PARAM_INVALID;
7598 }
7599 auto fullImpl = GetFullImpl();
7600 fullImpl->getNodeModifiers()->getDatePickerModifier()->setLunar(node->uiNodeHandle, item->value[NUM_0].i32);
7601 return ERROR_CODE_NO_ERROR;
7602 }
7603
ResetDatePickerLunar(ArkUI_NodeHandle node)7604 void ResetDatePickerLunar(ArkUI_NodeHandle node)
7605 {
7606 auto fullImpl = GetFullImpl();
7607
7608 fullImpl->getNodeModifiers()->getDatePickerModifier()->resetLunar(node->uiNodeHandle);
7609 }
7610
GetDatePickerStart(ArkUI_NodeHandle node)7611 const ArkUI_AttributeItem* GetDatePickerStart(ArkUI_NodeHandle node)
7612 {
7613 auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getStartDate(node->uiNodeHandle);
7614 g_attributeItem.string = value;
7615 return &g_attributeItem;
7616 }
7617
SetDatePickerStart(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7618 int32_t SetDatePickerStart(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7619 {
7620 if (!item->string) {
7621 return ERROR_CODE_PARAM_INVALID;
7622 }
7623 auto fullImpl = GetFullImpl();
7624 std::vector<std::string> date;
7625 StringUtils::StringSplitter(item->string, '-', date);
7626 if (date.size() != NUM_3) {
7627 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "date is invalid");
7628 return ERROR_CODE_PARAM_INVALID;
7629 }
7630
7631 auto year = StringToInt(date[NUM_0].c_str(), DATEPICKER_START_TIME);
7632 auto month = StringToInt(date[NUM_1].c_str(), NUM_1);
7633 auto day = StringToInt(date[NUM_2].c_str(), NUM_1);
7634 fullImpl->getNodeModifiers()->getDatePickerModifier()->setStartDate(node->uiNodeHandle, year, month, day);
7635
7636 return ERROR_CODE_NO_ERROR;
7637 }
7638
ResetDatePickerStart(ArkUI_NodeHandle node)7639 void ResetDatePickerStart(ArkUI_NodeHandle node)
7640 {
7641 auto fullImpl = GetFullImpl();
7642
7643 fullImpl->getNodeModifiers()->getDatePickerModifier()->resetStartDate(node->uiNodeHandle);
7644 }
7645
GetDatePickerEnd(ArkUI_NodeHandle node)7646 const ArkUI_AttributeItem* GetDatePickerEnd(ArkUI_NodeHandle node)
7647 {
7648 auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getEndDate(node->uiNodeHandle);
7649 g_attributeItem.string = value;
7650 return &g_attributeItem;
7651 }
7652
SetDatePickerEnd(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7653 int32_t SetDatePickerEnd(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7654 {
7655 if (!item->string) {
7656 return ERROR_CODE_PARAM_INVALID;
7657 }
7658 auto fullImpl = GetFullImpl();
7659 std::vector<std::string> date;
7660 StringUtils::StringSplitter(item->string, '-', date);
7661 if (date.size() != NUM_3) {
7662 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "date is invalid");
7663 return ERROR_CODE_PARAM_INVALID;
7664 }
7665
7666 auto year = StringToInt(date[NUM_0].c_str(), DATEPICKER_END_TIME);
7667 auto month = StringToInt(date[NUM_1].c_str(), NUM_12);
7668 auto day = StringToInt(date[NUM_2].c_str(), NUM_31);
7669 fullImpl->getNodeModifiers()->getDatePickerModifier()->setEndDate(node->uiNodeHandle, year, month, day);
7670
7671 return ERROR_CODE_NO_ERROR;
7672 }
7673
ResetDatePickerEnd(ArkUI_NodeHandle node)7674 void ResetDatePickerEnd(ArkUI_NodeHandle node)
7675 {
7676 auto fullImpl = GetFullImpl();
7677
7678 fullImpl->getNodeModifiers()->getDatePickerModifier()->resetEndDate(node->uiNodeHandle);
7679 }
7680
GetDatePickerSelected(ArkUI_NodeHandle node)7681 const ArkUI_AttributeItem* GetDatePickerSelected(ArkUI_NodeHandle node)
7682 {
7683 auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getSelectedDate(node->uiNodeHandle);
7684 g_attributeItem.string = value;
7685 return &g_attributeItem;
7686 }
7687
SetDatePickerSelected(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7688 int32_t SetDatePickerSelected(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7689 {
7690 if (!item->string) {
7691 return ERROR_CODE_PARAM_INVALID;
7692 }
7693 auto fullImpl = GetFullImpl();
7694 std::vector<std::string> date;
7695 StringUtils::StringSplitter(item->string, '-', date);
7696 if (date.size() != NUM_3) {
7697 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "date is invalid");
7698 return ERROR_CODE_PARAM_INVALID;
7699 }
7700
7701 auto year = StringToInt(date[NUM_0].c_str());
7702 auto month = StringToInt(date[NUM_1].c_str());
7703 auto day = StringToInt(date[NUM_2].c_str());
7704 fullImpl->getNodeModifiers()->getDatePickerModifier()->setSelectedDate(node->uiNodeHandle, year, month, day);
7705
7706 return ERROR_CODE_NO_ERROR;
7707 }
7708
ResetDatePickerSelected(ArkUI_NodeHandle node)7709 void ResetDatePickerSelected(ArkUI_NodeHandle node)
7710 {
7711 auto fullImpl = GetFullImpl();
7712
7713 fullImpl->getNodeModifiers()->getDatePickerModifier()->resetSelectedDate(node->uiNodeHandle);
7714 }
7715
GetDatePickerDisappearTextStyle(ArkUI_NodeHandle node)7716 const ArkUI_AttributeItem* GetDatePickerDisappearTextStyle(ArkUI_NodeHandle node)
7717 {
7718 auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getDisappearTextStyle(node->uiNodeHandle);
7719 g_attributeItem.string = value;
7720 return &g_attributeItem;
7721 }
7722
SetDatePickerDisappearTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7723 int32_t SetDatePickerDisappearTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7724 {
7725 if (!item->string) {
7726 return ERROR_CODE_PARAM_INVALID;
7727 }
7728 auto fullImpl = GetFullImpl();
7729 std::vector<std::string> params;
7730 StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
7731 if (params.size() != NUM_5) {
7732 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
7733 return ERROR_CODE_PARAM_INVALID;
7734 }
7735
7736 ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
7737 int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
7738 if (size == ERROR_CODE) {
7739 return ERROR_CODE_PARAM_INVALID;
7740 }
7741 auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
7742 std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
7743
7744 fullImpl->getNodeModifiers()->getDatePickerModifier()->setDisappearTextStyle(
7745 node->uiNodeHandle, fontInfo.c_str(), color, style);
7746
7747 return ERROR_CODE_NO_ERROR;
7748 }
7749
ResetDatePickerDisappearTextStyle(ArkUI_NodeHandle node)7750 void ResetDatePickerDisappearTextStyle(ArkUI_NodeHandle node)
7751 {
7752 auto fullImpl = GetFullImpl();
7753
7754 fullImpl->getNodeModifiers()->getDatePickerModifier()->resetDisappearTextStyle(node->uiNodeHandle);
7755 }
7756
GetDatePickerTextStyle(ArkUI_NodeHandle node)7757 const ArkUI_AttributeItem* GetDatePickerTextStyle(ArkUI_NodeHandle node)
7758 {
7759 auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getDatePickerTextStyle(node->uiNodeHandle);
7760 g_attributeItem.string = value;
7761 return &g_attributeItem;
7762 }
7763
SetDatePickerTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7764 int32_t SetDatePickerTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7765 {
7766 if (!item->string) {
7767 return ERROR_CODE_PARAM_INVALID;
7768 }
7769 auto fullImpl = GetFullImpl();
7770 std::vector<std::string> params;
7771 StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
7772 if (params.size() != NUM_5) {
7773 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
7774 return ERROR_CODE_PARAM_INVALID;
7775 }
7776
7777 ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
7778 int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
7779 if (size == ERROR_CODE) {
7780 return ERROR_CODE_PARAM_INVALID;
7781 }
7782 auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
7783 std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
7784
7785 fullImpl->getNodeModifiers()->getDatePickerModifier()->setDatePickerTextStyle(
7786 node->uiNodeHandle, fontInfo.c_str(), color, style);
7787
7788 return ERROR_CODE_NO_ERROR;
7789 }
7790
ResetDatePickerTextStyle(ArkUI_NodeHandle node)7791 void ResetDatePickerTextStyle(ArkUI_NodeHandle node)
7792 {
7793 auto fullImpl = GetFullImpl();
7794
7795 fullImpl->getNodeModifiers()->getDatePickerModifier()->resetDatePickerTextStyle(node->uiNodeHandle);
7796 }
7797
GetDatePickerSelectedTextStyle(ArkUI_NodeHandle node)7798 const ArkUI_AttributeItem* GetDatePickerSelectedTextStyle(ArkUI_NodeHandle node)
7799 {
7800 auto value = GetFullImpl()->getNodeModifiers()->getDatePickerModifier()->getSelectedTextStyle(node->uiNodeHandle);
7801 g_attributeItem.string = value;
7802 return &g_attributeItem;
7803 }
7804
SetDatePickerSelectedTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7805 int32_t SetDatePickerSelectedTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7806 {
7807 if (!item->string) {
7808 return ERROR_CODE_PARAM_INVALID;
7809 }
7810 auto fullImpl = GetFullImpl();
7811 std::vector<std::string> params;
7812 StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
7813 if (params.size() != NUM_5) {
7814 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
7815 return ERROR_CODE_PARAM_INVALID;
7816 }
7817
7818 ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_SELECTED_COLOR);
7819 int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
7820 if (size == ERROR_CODE) {
7821 return ERROR_CODE_PARAM_INVALID;
7822 }
7823 auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
7824 std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
7825
7826 fullImpl->getNodeModifiers()->getDatePickerModifier()->setSelectedTextStyle(
7827 node->uiNodeHandle, fontInfo.c_str(), color, style);
7828
7829 return ERROR_CODE_NO_ERROR;
7830 }
7831
ResetDatePickerSelectedTextStyle(ArkUI_NodeHandle node)7832 void ResetDatePickerSelectedTextStyle(ArkUI_NodeHandle node)
7833 {
7834 auto fullImpl = GetFullImpl();
7835
7836 fullImpl->getNodeModifiers()->getDatePickerModifier()->resetSelectedTextStyle(node->uiNodeHandle);
7837 }
7838
7839 // timepicker
GetTimePickerSelected(ArkUI_NodeHandle node)7840 const ArkUI_AttributeItem* GetTimePickerSelected(ArkUI_NodeHandle node)
7841 {
7842 auto value = GetFullImpl()->getNodeModifiers()->getTimepickerModifier()->getTimepickerSelected(node->uiNodeHandle);
7843 g_attributeItem.string = value;
7844 return &g_attributeItem;
7845 }
7846
SetTimePickerSelected(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7847 int32_t SetTimePickerSelected(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7848 {
7849 if (!item->string) {
7850 return ERROR_CODE_PARAM_INVALID;
7851 }
7852 auto fullImpl = GetFullImpl();
7853 std::vector<std::string> time;
7854 StringUtils::StringSplitter(item->string, '-', time);
7855 if (time.size() != NUM_2) {
7856 return ERROR_CODE_PARAM_INVALID;
7857 }
7858
7859 auto hour = StringToInt(time[NUM_0].c_str());
7860 auto minute = StringToInt(time[NUM_1].c_str());
7861 if (!InRegion(NUM_0, NUM_23, hour) || !InRegion(NUM_0, NUM_59, minute)) {
7862 return ERROR_CODE_PARAM_INVALID;
7863 }
7864 fullImpl->getNodeModifiers()->getTimepickerModifier()->setTimepickerSelected(node->uiNodeHandle, hour, minute);
7865
7866 return ERROR_CODE_NO_ERROR;
7867 }
7868
ResetTimePickerSelected(ArkUI_NodeHandle node)7869 void ResetTimePickerSelected(ArkUI_NodeHandle node)
7870 {
7871 auto fullImpl = GetFullImpl();
7872
7873 fullImpl->getNodeModifiers()->getTimepickerModifier()->resetTimepickerSelected(node->uiNodeHandle);
7874 }
7875
GetTimePickerUseMilitaryTime(ArkUI_NodeHandle node)7876 const ArkUI_AttributeItem* GetTimePickerUseMilitaryTime(ArkUI_NodeHandle node)
7877 {
7878 auto value =
7879 GetFullImpl()->getNodeModifiers()->getTimepickerModifier()->getTimepickerUseMilitaryTime(node->uiNodeHandle);
7880 g_numberValues[0].i32 = value;
7881 return &g_attributeItem;
7882 }
7883
SetTimePickerUseMilitaryTime(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7884 int32_t SetTimePickerUseMilitaryTime(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7885 {
7886 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
7887 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
7888 return ERROR_CODE_PARAM_INVALID;
7889 }
7890 auto fullImpl = GetFullImpl();
7891 fullImpl->getNodeModifiers()->getTimepickerModifier()->setTimepickerUseMilitaryTime(
7892 node->uiNodeHandle, item->value[NUM_0].i32);
7893
7894 return ERROR_CODE_NO_ERROR;
7895 }
7896
ResetTimePickerUseMilitaryTime(ArkUI_NodeHandle node)7897 void ResetTimePickerUseMilitaryTime(ArkUI_NodeHandle node)
7898 {
7899 auto fullImpl = GetFullImpl();
7900
7901 fullImpl->getNodeModifiers()->getTimepickerModifier()->resetTimepickerUseMilitaryTime(node->uiNodeHandle);
7902 }
7903
GetTimePickerDisappearTextStyle(ArkUI_NodeHandle node)7904 const ArkUI_AttributeItem* GetTimePickerDisappearTextStyle(ArkUI_NodeHandle node)
7905 {
7906 auto value =
7907 GetFullImpl()->getNodeModifiers()->getTimepickerModifier()->getTimepickerDisappearTextStyle(node->uiNodeHandle);
7908 g_attributeItem.string = value;
7909 return &g_attributeItem;
7910 }
7911
SetTimePickerDisappearTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7912 int32_t SetTimePickerDisappearTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7913 {
7914 if (!item->string) {
7915 return ERROR_CODE_PARAM_INVALID;
7916 }
7917 auto fullImpl = GetFullImpl();
7918 std::vector<std::string> params;
7919 StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
7920 if (params.size() != NUM_5) {
7921 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
7922 return ERROR_CODE_PARAM_INVALID;
7923 }
7924
7925 ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
7926 int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
7927 if (size == ERROR_CODE) {
7928 return ERROR_CODE_PARAM_INVALID;
7929 }
7930 auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
7931 std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
7932
7933 fullImpl->getNodeModifiers()->getTimepickerModifier()->setTimepickerDisappearTextStyle(
7934 node->uiNodeHandle, color, fontInfo.c_str(), style);
7935
7936 return ERROR_CODE_NO_ERROR;
7937 }
7938
ResetTimePickerDisappearTextStyle(ArkUI_NodeHandle node)7939 void ResetTimePickerDisappearTextStyle(ArkUI_NodeHandle node)
7940 {
7941 auto fullImpl = GetFullImpl();
7942
7943 fullImpl->getNodeModifiers()->getTimepickerModifier()->resetTimepickerDisappearTextStyle(node->uiNodeHandle);
7944 }
7945
GetTimePickerTextStyle(ArkUI_NodeHandle node)7946 const ArkUI_AttributeItem* GetTimePickerTextStyle(ArkUI_NodeHandle node)
7947 {
7948 auto value =
7949 GetFullImpl()->getNodeModifiers()->getTimepickerModifier()->getTimepickerTextStyle(node->uiNodeHandle);
7950 g_attributeItem.string = value;
7951 return &g_attributeItem;
7952 }
7953
SetTimePickerTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7954 int32_t SetTimePickerTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7955 {
7956 if (!item->string) {
7957 return ERROR_CODE_PARAM_INVALID;
7958 }
7959 auto fullImpl = GetFullImpl();
7960 std::vector<std::string> params;
7961 StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
7962 if (params.size() != NUM_5) {
7963 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
7964 return ERROR_CODE_PARAM_INVALID;
7965 }
7966 ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
7967 int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
7968 if (size == ERROR_CODE) {
7969 return ERROR_CODE_PARAM_INVALID;
7970 }
7971 auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
7972 std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
7973
7974 fullImpl->getNodeModifiers()->getTimepickerModifier()->setTimepickerTextStyle(
7975 node->uiNodeHandle, color, fontInfo.c_str(), style);
7976
7977 return ERROR_CODE_NO_ERROR;
7978 }
7979
ResetTimePickerTextStyle(ArkUI_NodeHandle node)7980 void ResetTimePickerTextStyle(ArkUI_NodeHandle node)
7981 {
7982 auto fullImpl = GetFullImpl();
7983
7984 fullImpl->getNodeModifiers()->getTimepickerModifier()->resetTimepickerTextStyle(node->uiNodeHandle);
7985 }
7986
GetTimePickerSelectedTextStyle(ArkUI_NodeHandle node)7987 const ArkUI_AttributeItem* GetTimePickerSelectedTextStyle(ArkUI_NodeHandle node)
7988 {
7989 auto value =
7990 GetFullImpl()->getNodeModifiers()->getTimepickerModifier()->getTimepickerSelectedTextStyle(node->uiNodeHandle);
7991 g_attributeItem.string = value;
7992 return &g_attributeItem;
7993 }
7994
SetTimePickerSelectedTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)7995 int32_t SetTimePickerSelectedTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
7996 {
7997 if (!item->string) {
7998 return ERROR_CODE_PARAM_INVALID;
7999 }
8000 auto fullImpl = GetFullImpl();
8001 std::vector<std::string> params;
8002 StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
8003 if (params.size() != NUM_5) {
8004 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
8005 return ERROR_CODE_PARAM_INVALID;
8006 }
8007
8008 ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_SELECTED_COLOR);
8009 int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
8010 if (size == ERROR_CODE) {
8011 return ERROR_CODE_PARAM_INVALID;
8012 }
8013 auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
8014 std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
8015 fullImpl->getNodeModifiers()->getTimepickerModifier()->setTimepickerSelectedTextStyle(
8016 node->uiNodeHandle, color, fontInfo.c_str(), style);
8017
8018 return ERROR_CODE_NO_ERROR;
8019 }
8020
ResetTimePickerSelectedTextStyle(ArkUI_NodeHandle node)8021 void ResetTimePickerSelectedTextStyle(ArkUI_NodeHandle node)
8022 {
8023 auto fullImpl = GetFullImpl();
8024
8025 fullImpl->getNodeModifiers()->getTimepickerModifier()->resetTimepickerSelectedTextStyle(node->uiNodeHandle);
8026 }
8027
8028 // TextPicker
GetTextPickerDisappearTextStyle(ArkUI_NodeHandle node)8029 const ArkUI_AttributeItem* GetTextPickerDisappearTextStyle(ArkUI_NodeHandle node)
8030 {
8031 auto value =
8032 GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerDisappearTextStyle(node->uiNodeHandle);
8033 g_attributeItem.string = value;
8034 return &g_attributeItem;
8035 }
8036
SetTextPickerDisappearTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8037 int32_t SetTextPickerDisappearTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8038 {
8039 if (!item->string) {
8040 return ERROR_CODE_PARAM_INVALID;
8041 }
8042 auto fullImpl = GetFullImpl();
8043 std::vector<std::string> params;
8044 StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
8045 if (params.size() != NUM_5) {
8046 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
8047 return ERROR_CODE_PARAM_INVALID;
8048 }
8049
8050 ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
8051 int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
8052 if (size == ERROR_CODE) {
8053 return ERROR_CODE_PARAM_INVALID;
8054 }
8055 auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
8056 std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
8057
8058 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerDisappearTextStyle(
8059 node->uiNodeHandle, color, fontInfo.c_str(), style);
8060
8061 return ERROR_CODE_NO_ERROR;
8062 }
8063
ResetTextPickerDisappearTextStyle(ArkUI_NodeHandle node)8064 void ResetTextPickerDisappearTextStyle(ArkUI_NodeHandle node)
8065 {
8066 auto fullImpl = GetFullImpl();
8067
8068 fullImpl->getNodeModifiers()->getTextPickerModifier()->resetTextPickerDisappearTextStyle(node->uiNodeHandle);
8069 }
8070
GetTextPickerTextStyle(ArkUI_NodeHandle node)8071 const ArkUI_AttributeItem* GetTextPickerTextStyle(ArkUI_NodeHandle node)
8072 {
8073 auto value =
8074 GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerTextStyle(node->uiNodeHandle);
8075 g_attributeItem.string = value;
8076 return &g_attributeItem;
8077 }
8078
SetTextPickerTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8079 int32_t SetTextPickerTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8080 {
8081 if (!item->string) {
8082 return ERROR_CODE_PARAM_INVALID;
8083 }
8084 auto fullImpl = GetFullImpl();
8085 std::vector<std::string> params;
8086 StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
8087 if (params.size() != NUM_5) {
8088 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
8089 return ERROR_CODE_PARAM_INVALID;
8090 }
8091
8092 ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_STYLE_COLOR);
8093 int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
8094 if (size == ERROR_CODE) {
8095 return ERROR_CODE_PARAM_INVALID;
8096 }
8097 auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
8098 std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
8099
8100 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerTextStyle(
8101 node->uiNodeHandle, color, fontInfo.c_str(), style);
8102
8103 return ERROR_CODE_NO_ERROR;
8104 }
8105
ResetTextPickerTextStyle(ArkUI_NodeHandle node)8106 void ResetTextPickerTextStyle(ArkUI_NodeHandle node)
8107 {
8108 auto fullImpl = GetFullImpl();
8109
8110 fullImpl->getNodeModifiers()->getTextPickerModifier()->resetTextPickerTextStyle(node->uiNodeHandle);
8111 }
8112
GetTextPickerSelectedTextStyle(ArkUI_NodeHandle node)8113 const ArkUI_AttributeItem* GetTextPickerSelectedTextStyle(ArkUI_NodeHandle node)
8114 {
8115 auto value =
8116 GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerSelectedTextStyle(node->uiNodeHandle);
8117 g_attributeItem.string = value;
8118 return &g_attributeItem;
8119 }
8120
SetTextPickerSelectedTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8121 int32_t SetTextPickerSelectedTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8122 {
8123 if (!item->string) {
8124 return ERROR_CODE_PARAM_INVALID;
8125 }
8126 auto fullImpl = GetFullImpl();
8127 std::vector<std::string> params;
8128 StringUtils::StringSplitter(item->string, PARAMS_SEPARATOR_LEVEL1, params);
8129 if (params.size() != NUM_5) {
8130 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "params are invalid");
8131 return ERROR_CODE_PARAM_INVALID;
8132 }
8133
8134 ArkUI_Uint32 color = StringToColorInt(params[NUM_0].c_str(), DEFAULT_PICKER_SELECTED_COLOR);
8135 int size = StringToInt(params[NUM_1].c_str(), ERROR_CODE);
8136 if (size == ERROR_CODE) {
8137 return ERROR_CODE_PARAM_INVALID;
8138 }
8139 auto style = StringToEnumInt(params[NUM_4].c_str(), FONT_STYLES, NUM_0);
8140 std::string fontInfo = params[NUM_1] + '|' + params[NUM_2] + '|' + params[NUM_3];
8141
8142 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerSelectedTextStyle(
8143 node->uiNodeHandle, color, fontInfo.c_str(), style);
8144
8145 return ERROR_CODE_NO_ERROR;
8146 }
8147
ResetTextPickerSelectedTextStyle(ArkUI_NodeHandle node)8148 void ResetTextPickerSelectedTextStyle(ArkUI_NodeHandle node)
8149 {
8150 auto fullImpl = GetFullImpl();
8151
8152 fullImpl->getNodeModifiers()->getTextPickerModifier()->resetTextPickerSelectedTextStyle(node->uiNodeHandle);
8153 }
8154
GetTextPickerSelectedIndex(ArkUI_NodeHandle node)8155 const ArkUI_AttributeItem* GetTextPickerSelectedIndex(ArkUI_NodeHandle node)
8156 {
8157 int32_t size = GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerSelectedSize(
8158 node->uiNodeHandle);
8159 ArkUI_Uint32 values[size];
8160 GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerSelectedIndex(
8161 node->uiNodeHandle, values, size);
8162 for (int i = 0; i < size; ++i) {
8163 g_numberValues[i].i32 = static_cast<int32_t>(values[i]);
8164 }
8165 return &g_attributeItem;
8166 }
8167
SetTextPickerSelectedIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8168 int32_t SetTextPickerSelectedIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8169 {
8170 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8171 if (actualSize < 0 || LessNotEqual(item->value[0].i32, NUM_0)) {
8172 return ERROR_CODE_PARAM_INVALID;
8173 }
8174 auto fullImpl = GetFullImpl();
8175 ArkUI_Uint32 values[item->size];
8176 for (int i = 0; i < item->size; ++i) {
8177 values[i] = item->value[i].i32;
8178 }
8179 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerSelectedIndex(
8180 node->uiNodeHandle, values, item->size);
8181 return ERROR_CODE_NO_ERROR;
8182 }
8183
ResetTextPickerSelectedIndex(ArkUI_NodeHandle node)8184 void ResetTextPickerSelectedIndex(ArkUI_NodeHandle node)
8185 {
8186 auto fullImpl = GetFullImpl();
8187
8188 fullImpl->getNodeModifiers()->getTextPickerModifier()->resetTextPickerSelectedIndex(node->uiNodeHandle);
8189 }
8190
SetTextPickerRange(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8191 int32_t SetTextPickerRange(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8192 {
8193 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8194 if (actualSize < 0 || !InRegion(static_cast<int32_t>(ARKUI_TEXTPICKER_RANGETYPE_SINGLE),
8195 static_cast<int32_t>(ARKUI_TEXTPICKER_RANGETYPE_MULTI), item->value[NUM_0].i32)) {
8196 return ERROR_CODE_PARAM_INVALID;
8197 }
8198 bool isSingleRange = false;
8199 auto fullImpl = GetFullImpl();
8200 if (!item->string) {
8201 return ERROR_CODE_PARAM_INVALID;
8202 }
8203 isSingleRange = item->value[NUM_0].i32 == static_cast<int32_t>(ARKUI_TEXTPICKER_RANGETYPE_SINGLE);
8204 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerRangeStr(
8205 node->uiNodeHandle, item->string, isSingleRange, item->value[NUM_0].i32);
8206 return ERROR_CODE_NO_ERROR;
8207 }
8208
ResetTextPickerRange(ArkUI_NodeHandle node)8209 void ResetTextPickerRange(ArkUI_NodeHandle node)
8210 {
8211 auto fullImpl = GetFullImpl();
8212 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerRangeStr(node->uiNodeHandle, "", true, NUM_0);
8213 }
8214
GetTextPickerRange(ArkUI_NodeHandle node)8215 const ArkUI_AttributeItem* GetTextPickerRange(ArkUI_NodeHandle node)
8216 {
8217 auto fullImpl = GetFullImpl();
8218 auto value =
8219 fullImpl->getNodeModifiers()->getTextPickerModifier()->getTextPickerRangeStr(node->uiNodeHandle);
8220 g_numberValues[0].i32 =
8221 fullImpl->getNodeModifiers()->getTextPickerModifier()->getTextPickerSingleRange(node->uiNodeHandle);
8222 g_attributeItem.string = value;
8223 return &g_attributeItem;
8224 }
8225
SetTextPickerValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8226 int32_t SetTextPickerValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8227 {
8228 if (!item->string) {
8229 return ERROR_CODE_PARAM_INVALID;
8230 }
8231 auto fullImpl = GetFullImpl();
8232 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerValue(
8233 node->uiNodeHandle, item->string);
8234
8235 return ERROR_CODE_NO_ERROR;
8236 }
8237
ResetTextPickerValue(ArkUI_NodeHandle node)8238 void ResetTextPickerValue(ArkUI_NodeHandle node)
8239 {
8240 auto fullImpl = GetFullImpl();
8241
8242 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerValue(node->uiNodeHandle, "");
8243 }
8244
GetTextPickerValue(ArkUI_NodeHandle node)8245 const ArkUI_AttributeItem* GetTextPickerValue(ArkUI_NodeHandle node)
8246 {
8247 auto value =
8248 GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerValue(node->uiNodeHandle);
8249 g_attributeItem.string = value;
8250 return &g_attributeItem;
8251 }
8252
GetTextPickerSelected(ArkUI_NodeHandle node)8253 const ArkUI_AttributeItem* GetTextPickerSelected(ArkUI_NodeHandle node)
8254 {
8255 int32_t size = GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerSelectedSize(
8256 node->uiNodeHandle);
8257 ArkUI_Uint32 values[size];
8258 GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerSelectedIndex(
8259 node->uiNodeHandle, values, size);
8260 for (int i = 0; i < size; ++i) {
8261 g_numberValues[i].u32 = values[i];
8262 }
8263 return &g_attributeItem;
8264 }
8265
SetTextPickerSelected(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8266 int32_t SetTextPickerSelected(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8267 {
8268 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8269 if (actualSize < 0 || LessNotEqual(item->value[0].u32, NUM_0)) {
8270 return ERROR_CODE_PARAM_INVALID;
8271 }
8272 auto fullImpl = GetFullImpl();
8273 ArkUI_Uint32 values[item->size];
8274 for (int i = 0; i < item->size; ++i) {
8275 values[i] = item->value[i].u32;
8276 }
8277 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerSelectedIndex(
8278 node->uiNodeHandle, values, item->size);
8279 return ERROR_CODE_NO_ERROR;
8280 }
8281
SetTextPickerCanLoop(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8282 int32_t SetTextPickerCanLoop(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8283 {
8284 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8285 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[0].i32)) {
8286 return ERROR_CODE_PARAM_INVALID;
8287 }
8288 auto fullImpl = GetFullImpl();
8289 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerCanLoop(
8290 node->uiNodeHandle, item->value[0].i32);
8291 return ERROR_CODE_NO_ERROR;
8292 }
8293
GetTextPickerCanLoop(ArkUI_NodeHandle node)8294 const ArkUI_AttributeItem* GetTextPickerCanLoop(ArkUI_NodeHandle node)
8295 {
8296 int32_t result = GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerCanLoop(
8297 node->uiNodeHandle);
8298 g_numberValues[0].i32 = result;
8299 return &g_attributeItem;
8300 }
8301
ResetTextPickerCanLoop(ArkUI_NodeHandle node)8302 void ResetTextPickerCanLoop(ArkUI_NodeHandle node)
8303 {
8304 auto fullImpl = GetFullImpl();
8305 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerCanLoop(
8306 node->uiNodeHandle, true);
8307 }
8308
SetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8309 int32_t SetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8310 {
8311 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8312 if (actualSize < 0 || LessNotEqual(item->value[0].f32, NUM_0)) {
8313 return ERROR_CODE_PARAM_INVALID;
8314 }
8315 auto fullImpl = GetFullImpl();
8316 int32_t unit = GetDefaultUnit(node, UNIT_VP);
8317 fullImpl->getNodeModifiers()->getTextPickerModifier()->setTextPickerDefaultPickerItemHeight(
8318 node->uiNodeHandle, item->value[0].f32, unit);
8319 return ERROR_CODE_NO_ERROR;
8320 }
8321
GetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node)8322 const ArkUI_AttributeItem* GetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node)
8323 {
8324 int32_t unit = GetDefaultUnit(node, UNIT_VP);
8325 float result = GetFullImpl()->getNodeModifiers()->getTextPickerModifier()->getTextPickerDefaultPickerItemHeight(
8326 node->uiNodeHandle, unit);
8327 g_numberValues[0].f32 = result;
8328 return &g_attributeItem;
8329 }
8330
ResetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node)8331 void ResetTextPickerDefaultPickerItemHeight(ArkUI_NodeHandle node)
8332 {
8333 auto fullImpl = GetFullImpl();
8334 fullImpl->getNodeModifiers()->getTextPickerModifier()->resetTextPickerDefaultPickerItemHeight(node->uiNodeHandle);
8335 }
8336
8337 // Row&Column
SetAlignItems(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8338 int32_t SetAlignItems(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8339 {
8340 if (item->size == 0 || !InRegion(NUM_0, NUM_2, item->value[0].i32)) {
8341 return ERROR_CODE_PARAM_INVALID;
8342 }
8343 auto* fullImpl = GetFullImpl();
8344 switch (node->type) {
8345 case ARKUI_NODE_COLUMN:
8346 fullImpl->getNodeModifiers()->getColumnModifier()->setColumnAlignItems(
8347 node->uiNodeHandle, item->value[0].i32 + NUM_1);
8348 break;
8349 case ARKUI_NODE_ROW:
8350 fullImpl->getNodeModifiers()->getRowModifier()->setRowAlignItems(
8351 node->uiNodeHandle, item->value[0].i32 + NUM_1);
8352 break;
8353 default:
8354 break;
8355 }
8356 return ERROR_CODE_NO_ERROR;
8357 }
8358
ResetAlignItems(ArkUI_NodeHandle node)8359 void ResetAlignItems(ArkUI_NodeHandle node)
8360 {
8361 auto* fullImpl = GetFullImpl();
8362 switch (node->type) {
8363 case ARKUI_NODE_COLUMN:
8364 fullImpl->getNodeModifiers()->getColumnModifier()->resetColumnAlignItems(node->uiNodeHandle);
8365 break;
8366 case ARKUI_NODE_ROW:
8367 fullImpl->getNodeModifiers()->getRowModifier()->resetRowAlignItems(node->uiNodeHandle);
8368 break;
8369 default:
8370 break;
8371 }
8372 }
8373
GetAlignItems(ArkUI_NodeHandle node)8374 const ArkUI_AttributeItem* GetAlignItems(ArkUI_NodeHandle node)
8375 {
8376 auto fullImpl = GetFullImpl();
8377 switch (node->type) {
8378 case ARKUI_NODE_COLUMN:
8379 g_numberValues[0].i32 =
8380 fullImpl->getNodeModifiers()->getColumnModifier()->getColumnAlignItems(node->uiNodeHandle) - NUM_1;
8381 break;
8382 case ARKUI_NODE_ROW:
8383 g_numberValues[0].i32 =
8384 fullImpl->getNodeModifiers()->getRowModifier()->getRowAlignItems(node->uiNodeHandle) - NUM_1;
8385 break;
8386 default:
8387 break;
8388 }
8389 return &g_attributeItem;
8390 }
8391
SetJustifyContent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8392 int32_t SetJustifyContent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8393 {
8394 if (item->size == 0 || !InRegion(NUM_1, NUM_8, item->value[0].i32)) {
8395 return ERROR_CODE_PARAM_INVALID;
8396 }
8397 auto* fullImpl = GetFullImpl();
8398 switch (node->type) {
8399 case ARKUI_NODE_COLUMN:
8400 fullImpl->getNodeModifiers()->getColumnModifier()->setColumnJustifyContent(
8401 node->uiNodeHandle, item->value[0].i32);
8402 break;
8403 case ARKUI_NODE_ROW:
8404 fullImpl->getNodeModifiers()->getRowModifier()->setRowJustifyContent(
8405 node->uiNodeHandle, item->value[0].i32);
8406 break;
8407 default:
8408 break;
8409 }
8410 return ERROR_CODE_NO_ERROR;
8411 }
8412
ResetJustifyContent(ArkUI_NodeHandle node)8413 void ResetJustifyContent(ArkUI_NodeHandle node)
8414 {
8415 auto* fullImpl = GetFullImpl();
8416 switch (node->type) {
8417 case ARKUI_NODE_COLUMN:
8418 fullImpl->getNodeModifiers()->getColumnModifier()->resetColumnJustifyContent(node->uiNodeHandle);
8419 break;
8420 case ARKUI_NODE_ROW:
8421 fullImpl->getNodeModifiers()->getRowModifier()->resetRowJustifyContent(node->uiNodeHandle);
8422 break;
8423 default:
8424 break;
8425 }
8426 }
8427
GetJustifyContent(ArkUI_NodeHandle node)8428 const ArkUI_AttributeItem* GetJustifyContent(ArkUI_NodeHandle node)
8429 {
8430 auto* fullImpl = GetFullImpl();
8431 switch (node->type) {
8432 case ARKUI_NODE_COLUMN:
8433 g_numberValues[0].i32 =
8434 fullImpl->getNodeModifiers()->getColumnModifier()->getColumnJustifyContent(node->uiNodeHandle);
8435 break;
8436 case ARKUI_NODE_ROW:
8437 g_numberValues[0].i32 =
8438 fullImpl->getNodeModifiers()->getRowModifier()->getRowJustifyContent(node->uiNodeHandle);
8439 break;
8440 default:
8441 break;
8442 }
8443 return &g_attributeItem;
8444 }
8445
8446 // Flex
SetFlexOptions(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8447 int32_t SetFlexOptions(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8448 {
8449 if (item->size == 0) {
8450 return ERROR_CODE_PARAM_INVALID;
8451 }
8452 auto* fullImpl = GetFullImpl();
8453 int options[NUM_5] = { 0, 0, 0, 1, 0 };
8454 if (item->size > NUM_0) {
8455 if (!InRegion(NUM_0, NUM_3, item->value[NUM_0].i32)) {
8456 return ERROR_CODE_PARAM_INVALID;
8457 }
8458 options[NUM_0] = item->value[NUM_0].i32;
8459 }
8460 if (item->size > NUM_1) {
8461 if (!InRegion(NUM_0, NUM_2, item->value[NUM_1].i32)) {
8462 return ERROR_CODE_PARAM_INVALID;
8463 }
8464 options[NUM_1] = item->value[NUM_1].i32;
8465 }
8466 if (item->size > NUM_2) {
8467 if (!InRegion(NUM_1, NUM_8, item->value[NUM_2].i32)) {
8468 return ERROR_CODE_PARAM_INVALID;
8469 }
8470 options[NUM_2] = item->value[NUM_2].i32;
8471 }
8472 if (item->size > NUM_3) {
8473 if (!InRegion(NUM_0, NUM_5, item->value[NUM_3].i32)) {
8474 return ERROR_CODE_PARAM_INVALID;
8475 }
8476 options[NUM_3] = item->value[NUM_3].i32;
8477 }
8478 if (item->size > NUM_4) {
8479 if (!InRegion(NUM_1, NUM_8, item->value[NUM_4].i32)) {
8480 return ERROR_CODE_PARAM_INVALID;
8481 }
8482 options[NUM_4] = item->value[NUM_4].i32;
8483 }
8484 fullImpl->getNodeModifiers()->getFlexModifier()->setFlexOptions(node->uiNodeHandle, options, NUM_5);
8485 return ERROR_CODE_NO_ERROR;
8486 }
8487
ResetFlexOptions(ArkUI_NodeHandle node)8488 void ResetFlexOptions(ArkUI_NodeHandle node)
8489 {
8490 auto* fullImpl = GetFullImpl();
8491 fullImpl->getNodeModifiers()->getFlexModifier()->resetFlexOptions(node->uiNodeHandle);
8492 }
8493
GetFlexOptions(ArkUI_NodeHandle node)8494 const ArkUI_AttributeItem* GetFlexOptions(ArkUI_NodeHandle node)
8495 {
8496 ArkUIFlexOptions options;
8497 GetFullImpl()->getNodeModifiers()->getFlexModifier()->getFlexOptions(node->uiNodeHandle, &options);
8498 g_numberValues[NUM_0].i32 = options.direction;
8499 g_numberValues[NUM_1].i32 = options.wrap;
8500 g_numberValues[NUM_2].i32 = options.justifyContent;
8501 g_numberValues[NUM_3].i32 = options.alignItems;
8502 g_numberValues[NUM_4].i32 = options.alignContent;
8503 return &g_attributeItem;
8504 }
8505
SetBackgroundImageSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8506 int32_t SetBackgroundImageSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8507 {
8508 auto* fullImpl = GetFullImpl();
8509 auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
8510 if (actualSize < 0) {
8511 return ERROR_CODE_PARAM_INVALID;
8512 }
8513 if (LessNotEqual(item->value[BACKGROUND_IMAGE_WIDTH_INDEX].f32, 0.0f) ||
8514 LessNotEqual(item->value[BACKGROUND_IMAGE_HEIGHT_INDEX].f32, 0.0f)) {
8515 return ERROR_CODE_PARAM_INVALID;
8516 }
8517 fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundImageSizeWithUnit(node->uiNodeHandle,
8518 item->value[BACKGROUND_IMAGE_WIDTH_INDEX].f32, item->value[BACKGROUND_IMAGE_HEIGHT_INDEX].f32,
8519 GetDefaultUnit(node, UNIT_VP));
8520 return ERROR_CODE_NO_ERROR;
8521 }
8522
GetBackgroundImageSizeType(ArkUI_ImageSize nativeImageSizeType)8523 int32_t GetBackgroundImageSizeType(ArkUI_ImageSize nativeImageSizeType)
8524 {
8525 switch (nativeImageSizeType) {
8526 case ARKUI_IMAGE_SIZE_AUTO:
8527 return IMAGE_SIZE_TYPE_AUTO_INDEX;
8528 case ARKUI_IMAGE_SIZE_COVER:
8529 return IMAGE_SIZE_TYPE_COVER_INDEX;
8530 case ARKUI_IMAGE_SIZE_CONTAIN:
8531 return IMAGE_SIZE_TYPE_CONTAIN_INDEX;
8532 default:
8533 break;
8534 }
8535 return IMAGE_SIZE_TYPE_AUTO_INDEX;
8536 }
8537
SetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8538 int32_t SetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8539 {
8540 auto* fullImpl = GetFullImpl();
8541 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8542 if (actualSize < 0 || item->value[0].i32 < 0 ||
8543 item->value[0].i32 > static_cast<int32_t>(ARKUI_IMAGE_SIZE_CONTAIN)) {
8544 return ERROR_CODE_PARAM_INVALID;
8545 }
8546 auto imageSizeType = GetBackgroundImageSizeType(static_cast<ArkUI_ImageSize>(item->value[0].i32));
8547 fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundImageSize(
8548 node->uiNodeHandle, 0.0f, 0.0f, imageSizeType, imageSizeType);
8549 return ERROR_CODE_NO_ERROR;
8550 }
8551
CheckBackgroundBlurStyleInput(const ArkUI_AttributeItem * item,int32_t size)8552 bool CheckBackgroundBlurStyleInput(const ArkUI_AttributeItem* item, int32_t size)
8553 {
8554 CHECK_NULL_RETURN(item, false);
8555 if (BLUR_STYLE_INDEX < size &&
8556 (item->value[BLUR_STYLE_INDEX].i32 < 0 ||
8557 item->value[BLUR_STYLE_INDEX].i32 > static_cast<int32_t>(ARKUI_BLUR_STYLE_COMPONENT_ULTRA_THICK))) {
8558 return false;
8559 }
8560 if (COLOR_MODE_INDEX < size &&
8561 (item->value[COLOR_MODE_INDEX].i32 < 0 ||
8562 item->value[COLOR_MODE_INDEX].i32 > static_cast<int32_t>(ARKUI_COLOR_MODE_DARK))) {
8563 return false;
8564 }
8565 if (ADAPTIVE_COLOR_INDEX < size &&
8566 (item->value[ADAPTIVE_COLOR_INDEX].i32 < 0 ||
8567 item->value[ADAPTIVE_COLOR_INDEX].i32 > static_cast<int32_t>(ARKUI_ADAPTIVE_COLOR_AVERAGE))) {
8568 return false;
8569 }
8570 if (SCALE_INDEX < size &&
8571 (LessNotEqual(item->value[SCALE_INDEX].f32, 0.0f) || GreatNotEqual(item->value[SCALE_INDEX].f32, 1.0f))) {
8572 return false;
8573 }
8574 if (GRAY_SCALE_START < size &&
8575 (LessNotEqual(item->value[GRAY_SCALE_START].f32, 0.0f) ||
8576 GreatNotEqual(item->value[GRAY_SCALE_START].f32, MAX_GRAYSCALE))) {
8577 return false;
8578 }
8579 if (GRAY_SCALE_END < size &&
8580 (LessNotEqual(item->value[GRAY_SCALE_END].f32, 0.0f) ||
8581 GreatNotEqual(item->value[GRAY_SCALE_END].f32, MAX_GRAYSCALE))) {
8582 return false;
8583 }
8584 return true;
8585 }
8586
SetBackgroundBlurStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8587 int32_t SetBackgroundBlurStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8588 {
8589 auto* fullImpl = GetFullImpl();
8590 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8591 if (actualSize < 0) {
8592 return ERROR_CODE_PARAM_INVALID;
8593 }
8594 auto isInputValid = CheckBackgroundBlurStyleInput(item, actualSize);
8595 if (!isInputValid) {
8596 return ERROR_CODE_PARAM_INVALID;
8597 }
8598 int32_t blurStyle = ARKUI_BLUR_STYLE_THIN;
8599 if (BLUR_STYLE_INDEX < actualSize) {
8600 blurStyle = ConvertBlurStyle(item->value[BLUR_STYLE_INDEX].i32);
8601 }
8602 int32_t colorMode = ARKUI_COLOR_MODE_SYSTEM;
8603 if (COLOR_MODE_INDEX < actualSize) {
8604 colorMode = item->value[COLOR_MODE_INDEX].i32;
8605 }
8606 int32_t adaptiveColor = ARKUI_ADAPTIVE_COLOR_DEFAULT;
8607 if (ADAPTIVE_COLOR_INDEX < actualSize) {
8608 adaptiveColor = item->value[ADAPTIVE_COLOR_INDEX].i32;
8609 }
8610 float scale = 1.0f;
8611 if (SCALE_INDEX < actualSize) {
8612 scale = item->value[SCALE_INDEX].f32;
8613 }
8614 uint32_t grayScaleStart = 0;
8615 if (GRAY_SCALE_START < actualSize) {
8616 if (GreatOrEqual(item->value[GRAY_SCALE_START].f32, 0.0f)) {
8617 grayScaleStart = static_cast<uint32_t>(item->value[GRAY_SCALE_START].f32);
8618 } else {
8619 return ERROR_CODE_PARAM_INVALID;
8620 }
8621 }
8622 uint32_t grayScaleEnd = 0;
8623 if (GRAY_SCALE_END < actualSize) {
8624 if (GreatOrEqual(item->value[GRAY_SCALE_END].f32, 0.0f)
8625 && GreatOrEqual(item->value[GRAY_SCALE_END].f32, item->value[GRAY_SCALE_START].f32)) {
8626 grayScaleEnd = static_cast<uint32_t>(item->value[GRAY_SCALE_END].f32);
8627 } else {
8628 return ERROR_CODE_PARAM_INVALID;
8629 }
8630 }
8631 int32_t intArray[NUM_3];
8632 intArray[NUM_0] = blurStyle;
8633 intArray[NUM_1] = colorMode;
8634 intArray[NUM_2] = adaptiveColor;
8635 std::vector<float> greyVector(NUM_2);
8636 greyVector[NUM_0] = grayScaleStart;
8637 greyVector[NUM_1] = grayScaleEnd;
8638 fullImpl->getNodeModifiers()->getCommonModifier()->setBackgroundBlurStyle(
8639 node->uiNodeHandle, &intArray, scale, &greyVector[0], NUM_2);
8640 return ERROR_CODE_NO_ERROR;
8641 }
8642
SetForegroundBlurStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8643 int32_t SetForegroundBlurStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8644 {
8645 auto* fullImpl = GetFullImpl();
8646 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8647 if (actualSize < 0 || !CheckBackgroundBlurStyleInput(item, actualSize)) {
8648 return ERROR_CODE_PARAM_INVALID;
8649 }
8650 int32_t blurStyle = ARKUI_BLUR_STYLE_THIN;
8651 if (BLUR_STYLE_INDEX < actualSize) {
8652 blurStyle = ConvertBlurStyle(item->value[BLUR_STYLE_INDEX].i32);
8653 }
8654 int32_t colorMode = ARKUI_COLOR_MODE_SYSTEM;
8655 if (COLOR_MODE_INDEX < actualSize) {
8656 colorMode = item->value[COLOR_MODE_INDEX].i32;
8657 }
8658 int32_t adaptiveColor = ARKUI_ADAPTIVE_COLOR_DEFAULT;
8659 if (ADAPTIVE_COLOR_INDEX < actualSize) {
8660 adaptiveColor = item->value[ADAPTIVE_COLOR_INDEX].i32;
8661 }
8662 float scale = 1.0f;
8663 if (SCALE_INDEX < actualSize) {
8664 scale = item->value[SCALE_INDEX].f32;
8665 }
8666 float grayScaleStart = 0;
8667 if (GRAY_SCALE_START < actualSize) {
8668 grayScaleStart = item->value[GRAY_SCALE_START].f32;
8669 }
8670 float grayScaleEnd = 0;
8671 if (GRAY_SCALE_END < actualSize) {
8672 grayScaleEnd = item->value[GRAY_SCALE_END].f32;
8673 }
8674 int32_t intArray[NUM_3];
8675 intArray[NUM_0] = blurStyle;
8676 intArray[NUM_1] = colorMode;
8677 intArray[NUM_2] = adaptiveColor;
8678 BlurOption blurOption = {{grayScaleStart, grayScaleEnd}};
8679
8680 fullImpl->getNodeModifiers()->getCommonModifier()->setForegroundBlurStyle(
8681 node->uiNodeHandle, &intArray, scale, blurOption.grayscale.data(), blurOption.grayscale.size());
8682 return ERROR_CODE_NO_ERROR;
8683 }
8684
ResetForegroundBlurStyle(ArkUI_NodeHandle node)8685 void ResetForegroundBlurStyle(ArkUI_NodeHandle node)
8686 {
8687 auto* fullImpl = GetFullImpl();
8688 fullImpl->getNodeModifiers()->getCommonModifier()->resetForegroundBlurStyle(node->uiNodeHandle);
8689 }
8690
GetForegroundBlurStyle(ArkUI_NodeHandle node)8691 const ArkUI_AttributeItem* GetForegroundBlurStyle(ArkUI_NodeHandle node)
8692 {
8693 auto fullImpl = GetFullImpl();
8694 auto foregroundBlurStyle =
8695 fullImpl->getNodeModifiers()->getCommonModifier()->getForegroundBlurStyle(node->uiNodeHandle);
8696 g_numberValues[BLUR_STYLE_INDEX].i32 = UnConvertBlurStyle(foregroundBlurStyle.blurStyle);
8697 g_numberValues[COLOR_MODE_INDEX].i32 = foregroundBlurStyle.colorMode;
8698 g_numberValues[ADAPTIVE_COLOR_INDEX].i32 = foregroundBlurStyle.adaptiveColor;
8699 g_numberValues[SCALE_INDEX].f32 = foregroundBlurStyle.scale;
8700 g_numberValues[GRAY_SCALE_START].f32 = foregroundBlurStyle.grayScaleStart;
8701 g_numberValues[GRAY_SCALE_END].f32 = foregroundBlurStyle.grayScaleEnd;
8702 g_attributeItem.size = NUM_6;
8703 return &g_attributeItem;
8704 }
8705
SetLayoutRect(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8706 int32_t SetLayoutRect(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8707 {
8708 auto* fullImpl = GetFullImpl();
8709 auto actualSize = CheckAttributeItemArray(item, REQUIRED_FOUR_PARAM);
8710 if (actualSize < 0) {
8711 return ERROR_CODE_PARAM_INVALID;
8712 }
8713 if (item->value[2].i32 < 0) { // 2:index of width
8714 return ERROR_CODE_PARAM_INVALID;
8715 }
8716 if (item->value[3].i32 < 0) { // 3:index of height
8717 return ERROR_CODE_PARAM_INVALID;
8718 }
8719 ArkUI_Int32 intArray[NUM_4];
8720 intArray[0] = item->value[0].i32;
8721 intArray[1] = item->value[1].i32;
8722 intArray[2] = item->value[2].i32; // 2:index of width
8723 intArray[3] = item->value[3].i32; // 3:index of height
8724 fullImpl->getNodeModifiers()->getCommonModifier()->setLayoutRect(node->uiNodeHandle, &intArray);
8725 return ERROR_CODE_NO_ERROR;
8726 }
8727
GetLayoutRect(ArkUI_NodeHandle node)8728 const ArkUI_AttributeItem* GetLayoutRect(ArkUI_NodeHandle node)
8729 {
8730 auto fullImpl = GetFullImpl();
8731 ArkUI_Int32 intArray[NUM_4];
8732 fullImpl->getNodeModifiers()->getCommonModifier()->getLayoutRect(node->uiNodeHandle, &intArray);
8733 g_numberValues[0].i32 = intArray[0];
8734 g_numberValues[1].i32 = intArray[1];
8735 g_numberValues[2].i32 = intArray[2]; // 2:index of width
8736 g_numberValues[3].i32 = intArray[3]; // 3:index of height
8737 g_attributeItem.size = NUM_4;
8738 return &g_attributeItem;
8739 }
8740
ResetLayoutRect(ArkUI_NodeHandle node)8741 void ResetLayoutRect(ArkUI_NodeHandle node)
8742 {
8743 auto fullImpl = GetFullImpl();
8744 fullImpl->getNodeModifiers()->getCommonModifier()->resetLayoutRect(node->uiNodeHandle);
8745 }
8746
SetFocusOnTouch(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8747 int32_t SetFocusOnTouch(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8748 {
8749 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
8750 return ERROR_CODE_PARAM_INVALID;
8751 }
8752 auto* fullImpl = GetFullImpl();
8753 fullImpl->getNodeModifiers()->getCommonModifier()->setFocusOnTouch(
8754 node->uiNodeHandle, item->value[NUM_0].i32);
8755 return ERROR_CODE_NO_ERROR;
8756 }
8757
ResetFocusOnTouch(ArkUI_NodeHandle node)8758 void ResetFocusOnTouch(ArkUI_NodeHandle node)
8759 {
8760 auto* fullImpl = GetFullImpl();
8761 fullImpl->getNodeModifiers()->getCommonModifier()->resetFocusOnTouch(node->uiNodeHandle);
8762 }
8763
GetFocusOnTouch(ArkUI_NodeHandle node)8764 const ArkUI_AttributeItem* GetFocusOnTouch(ArkUI_NodeHandle node)
8765 {
8766 auto resultValue = GetFullImpl()->getNodeModifiers()->getCommonModifier()->getFocusOnTouch(node->uiNodeHandle);
8767 g_numberValues[0].i32 = resultValue;
8768 return &g_attributeItem;
8769 }
8770
GetAccessibilityID(ArkUI_NodeHandle node)8771 const ArkUI_AttributeItem* GetAccessibilityID(ArkUI_NodeHandle node)
8772 {
8773 auto fullImpl = GetFullImpl();
8774 ArkUI_Int32 value = fullImpl->getNodeModifiers()->getCommonModifier()->getAccessibilityID(node->uiNodeHandle);
8775 g_numberValues[0].i32 = value;
8776 g_attributeItem.size = NUM_1;
8777 return &g_attributeItem;
8778 }
8779
SetAccessibilityState(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8780 int32_t SetAccessibilityState(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8781 {
8782 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
8783 ArkUI_AccessibilityState* statePtr = reinterpret_cast<ArkUI_AccessibilityState*>(item->object);
8784 CHECK_NULL_RETURN(statePtr, ERROR_CODE_PARAM_INVALID);
8785 if (statePtr->isDisabled.isSet && !InRegion(NUM_0, NUM_1, statePtr->isDisabled.value)) {
8786 return ERROR_CODE_PARAM_INVALID;
8787 }
8788 if (statePtr->isSelected.isSet && !InRegion(NUM_0, NUM_1, statePtr->isSelected.value)) {
8789 return ERROR_CODE_PARAM_INVALID;
8790 }
8791 if (statePtr->checkedType.isSet && !InRegion(NUM_0, NUM_1, statePtr->checkedType.value)) {
8792 return ERROR_CODE_PARAM_INVALID;
8793 }
8794 ArkUIAccessibilityState uiState;
8795 uiState.isDisabled = ArkUIOptionalInt { statePtr->isDisabled.isSet, statePtr->isDisabled.value };
8796 uiState.isSelected = ArkUIOptionalInt { statePtr->isSelected.isSet, statePtr->isSelected.value };
8797 uiState.checkedType = ArkUIOptionalInt { statePtr->checkedType.isSet, statePtr->checkedType.value };
8798 auto* fullImpl = GetFullImpl();
8799 fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityState(node->uiNodeHandle, uiState);
8800 return ERROR_CODE_NO_ERROR;
8801 }
8802
GetAccessibilityState(ArkUI_NodeHandle node)8803 const ArkUI_AttributeItem* GetAccessibilityState(ArkUI_NodeHandle node)
8804 {
8805 static ArkUI_AccessibilityState state;
8806 ArkUIAccessibilityState uiState;
8807 auto* fullImpl = GetFullImpl();
8808 fullImpl->getNodeModifiers()->getCommonModifier()->getAccessibilityState(node->uiNodeHandle, uiState);
8809 state.isDisabled = ArkUI_OptionalInt { uiState.isDisabled.isSet, uiState.isDisabled.value };
8810 state.isSelected = ArkUI_OptionalInt { uiState.isSelected.isSet, uiState.isSelected.value };
8811 state.checkedType = ArkUI_OptionalInt { uiState.checkedType.isSet, uiState.checkedType.value };
8812 g_attributeItem.object = &state;
8813 g_attributeItem.size = NUM_0;
8814 return &g_attributeItem;
8815 }
8816
ResetAccessibilityState(ArkUI_NodeHandle node)8817 void ResetAccessibilityState(ArkUI_NodeHandle node)
8818 {
8819 auto fullImpl = GetFullImpl();
8820 fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityState(node->uiNodeHandle);
8821 }
8822
SetAccessibilityValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8823 int32_t SetAccessibilityValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8824 {
8825 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
8826 ArkUI_AccessibilityValue* valuePtr = reinterpret_cast<ArkUI_AccessibilityValue*>(item->object);
8827 CHECK_NULL_RETURN(valuePtr, ERROR_CODE_PARAM_INVALID);
8828 if (valuePtr->current.isSet && ((!valuePtr->min.isSet) || (!valuePtr->max.isSet))) {
8829 return ERROR_CODE_PARAM_INVALID;
8830 }
8831 if (valuePtr->max.value < valuePtr->min.value) {
8832 return ERROR_CODE_PARAM_INVALID;
8833 }
8834 if ((valuePtr->current.value < valuePtr->min.value) || (valuePtr->current.value > valuePtr->max.value)) {
8835 return ERROR_CODE_PARAM_INVALID;
8836 }
8837 ArkUIAccessibilityValue uiValue;
8838 uiValue.min = ArkUIOptionalInt { valuePtr->min.isSet, valuePtr->min.value };
8839 uiValue.max = ArkUIOptionalInt { valuePtr->max.isSet, valuePtr->max.value };
8840 uiValue.current = ArkUIOptionalInt { valuePtr->current.isSet, valuePtr->current.value };
8841 uiValue.text = ArkUIOptionalCharPtr { valuePtr->text.isSet, valuePtr->text.value };
8842 auto* fullImpl = GetFullImpl();
8843 fullImpl->getNodeModifiers()->getCommonModifier()->setAccessibilityValue(node->uiNodeHandle, uiValue);
8844 return ERROR_CODE_NO_ERROR;
8845 }
8846
GetAccessibilityValue(ArkUI_NodeHandle node)8847 const ArkUI_AttributeItem* GetAccessibilityValue(ArkUI_NodeHandle node)
8848 {
8849 static ArkUI_AccessibilityValue value;
8850 ArkUIAccessibilityValue uiValue;
8851 auto* fullImpl = GetFullImpl();
8852 fullImpl->getNodeModifiers()->getCommonModifier()->getAccessibilityValue(node->uiNodeHandle, uiValue);
8853 value.min = ArkUI_OptionalInt { uiValue.min.isSet, uiValue.min.value };
8854 value.max = ArkUI_OptionalInt { uiValue.max.isSet, uiValue.max.value };
8855 value.current = ArkUI_OptionalInt { uiValue.current.isSet, uiValue.current.value };
8856 value.text = ArkUI_OptionalCharPtr { uiValue.text.isSet, uiValue.text.value };
8857 g_attributeItem.object = &value;
8858 g_attributeItem.size = NUM_0;
8859 return &g_attributeItem;
8860 }
8861
ResetAccessibilityValue(ArkUI_NodeHandle node)8862 void ResetAccessibilityValue(ArkUI_NodeHandle node)
8863 {
8864 auto fullImpl = GetFullImpl();
8865 fullImpl->getNodeModifiers()->getCommonModifier()->resetAccessibilityValue(node->uiNodeHandle);
8866 }
8867
ResetAreaChangeRatio(ArkUI_NodeHandle node)8868 void ResetAreaChangeRatio(ArkUI_NodeHandle node)
8869 {
8870 if (node->areaChangeRadio) {
8871 delete[] node->areaChangeRadio->value;
8872 delete node->areaChangeRadio;
8873 }
8874 node->areaChangeRadio = nullptr;
8875 }
8876
SetAreaChangeRatio(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8877 int32_t SetAreaChangeRatio(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8878 {
8879 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
8880 if (actualSize < 0) {
8881 return ERROR_CODE_PARAM_INVALID;
8882 }
8883 ArkUI_Int32 radioLength = item->size;
8884 ArkUI_NumberValue* radioList = new ArkUI_NumberValue[radioLength];
8885 for (int i = 0; i < radioLength; ++i) {
8886 if (LessNotEqual(item->value[i].f32, 0.0f) || GreatNotEqual(item->value[i].f32, 1.0f)) {
8887 delete[] radioList;
8888 return ERROR_CODE_PARAM_INVALID;
8889 }
8890 radioList[i].f32 = item->value[i].f32;
8891 }
8892 if (node->areaChangeRadio) {
8893 ResetAreaChangeRatio(node);
8894 }
8895 node->areaChangeRadio = new ArkUI_AttributeItem { .value = radioList, .size = radioLength};
8896 return ERROR_CODE_NO_ERROR;
8897 }
8898
GetAreaChangeRatio(ArkUI_NodeHandle node)8899 const ArkUI_AttributeItem* GetAreaChangeRatio(ArkUI_NodeHandle node)
8900 {
8901 return node->areaChangeRadio;
8902 }
8903
CheckTransformCenter(const ArkUI_AttributeItem * item,int32_t size)8904 bool CheckTransformCenter(const ArkUI_AttributeItem* item, int32_t size)
8905 {
8906 CHECK_NULL_RETURN(item, false);
8907 if (CENTER_X_PERCENT_INDEX < size && (LessNotEqual(item->value[CENTER_X_PERCENT_INDEX].f32, 0.0f) ||
8908 GreatNotEqual(item->value[CENTER_X_PERCENT_INDEX].f32, 1.0f))) {
8909 return false;
8910 }
8911 if (CENTER_Y_PERCENT_INDEX < size && (LessNotEqual(item->value[CENTER_Y_PERCENT_INDEX].f32, 0.0f) ||
8912 GreatNotEqual(item->value[CENTER_Y_PERCENT_INDEX].f32, 1.0f))) {
8913 return false;
8914 }
8915 if (CENTER_Z_PERCENT_INDEX < size && (LessNotEqual(item->value[CENTER_Z_PERCENT_INDEX].f32, 0.0f) ||
8916 GreatNotEqual(item->value[CENTER_Z_PERCENT_INDEX].f32, 1.0f))) {
8917 return false;
8918 }
8919 return true;
8920 }
8921
SetTransformCenter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8922 int32_t SetTransformCenter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8923 {
8924 auto* fullImpl = GetFullImpl();
8925 auto actualSize = CheckAttributeItemArray(item, 0);
8926 if (actualSize < 0) {
8927 return ERROR_CODE_PARAM_INVALID;
8928 }
8929 auto isTransformCenterValid = CheckTransformCenter(item, actualSize);
8930 if (!isTransformCenterValid) {
8931 return ERROR_CODE_PARAM_INVALID;
8932 }
8933 int32_t unit = GetDefaultUnit(node, UNIT_VP);
8934 CalcDimension centerX(HALF, DimensionUnit::PERCENT);
8935 if (CENTER_X_INDEX < actualSize) {
8936 centerX.SetValue(item->value[CENTER_X_INDEX].f32);
8937 centerX.SetUnit(static_cast<DimensionUnit>(unit));
8938 }
8939 CalcDimension centerY(HALF, DimensionUnit::PERCENT);
8940 if (CENTER_Y_INDEX < actualSize) {
8941 centerY.SetValue(item->value[CENTER_Y_INDEX].f32);
8942 centerY.SetUnit(static_cast<DimensionUnit>(unit));
8943 }
8944 CalcDimension centerZ(0, static_cast<DimensionUnit>(unit));
8945 if (CENTER_Z_INDEX < actualSize) {
8946 centerZ.SetValue(item->value[CENTER_Z_INDEX].f32);
8947 }
8948 if (CENTER_X_PERCENT_INDEX < actualSize) {
8949 centerX.SetValue(item->value[CENTER_X_PERCENT_INDEX].f32);
8950 centerX.SetUnit(DimensionUnit::PERCENT);
8951 }
8952 if (CENTER_Y_PERCENT_INDEX < actualSize) {
8953 centerY.SetValue(item->value[CENTER_Y_PERCENT_INDEX].f32);
8954 centerY.SetUnit(DimensionUnit::PERCENT);
8955 }
8956 if (CENTER_Z_PERCENT_INDEX < actualSize) {
8957 centerZ.SetValue(item->value[CENTER_Z_PERCENT_INDEX].f32);
8958 centerZ.SetUnit(DimensionUnit::PERCENT);
8959 }
8960 fullImpl->getNodeModifiers()->getCommonModifier()->setTransitionCenter(node->uiNodeHandle, centerX.Value(),
8961 static_cast<int32_t>(centerX.Unit()), centerY.Value(), static_cast<int32_t>(centerY.Unit()), centerZ.Value(),
8962 static_cast<int32_t>(centerZ.Unit()));
8963 return ERROR_CODE_NO_ERROR;
8964 }
8965
SetOpacityTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8966 int32_t SetOpacityTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8967 {
8968 auto* fullImpl = GetFullImpl();
8969 auto actualSize = CheckAttributeItemArray(item, REQUIRED_THREE_PARAM);
8970 if (actualSize < 0) {
8971 return ERROR_CODE_PARAM_INVALID;
8972 }
8973 if (!CheckAnimation(item, actualSize, OPACITY_ANIMATION_BASE)) {
8974 return ERROR_CODE_PARAM_INVALID;
8975 }
8976 float opacity = DEFAULT_OPACITY;
8977 if (actualSize > 0) {
8978 opacity = item->value[0].f32;
8979 }
8980 ArkUIAnimationOptionType animationOption;
8981 ParseAnimation(item, actualSize, animationOption, OPACITY_ANIMATION_BASE);
8982 fullImpl->getNodeModifiers()->getCommonModifier()->setOpacityTransition(
8983 node->uiNodeHandle, opacity, &animationOption);
8984 return ERROR_CODE_NO_ERROR;
8985 }
8986
SetRotateTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)8987 int32_t SetRotateTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
8988 {
8989 auto* fullImpl = GetFullImpl();
8990 auto actualSize = CheckAttributeItemArray(item, REQUIRED_SEVEN_PARAM);
8991 if (actualSize < 0) {
8992 return ERROR_CODE_PARAM_INVALID;
8993 }
8994 if (!CheckAnimation(item, actualSize, ROTATE_ANIMATION_BASE)) {
8995 return ERROR_CODE_PARAM_INVALID;
8996 }
8997 std::array<float, ARRAY_SIZE> rotateArray;
8998 for (int32_t i = 0; i < actualSize && i < static_cast<int32_t>(rotateArray.size()); i++) {
8999 rotateArray[i] = item->value[i].f32;
9000 }
9001 float angle = 0.0f;
9002 if (ROTATE_ANGLE_INDEX < actualSize) {
9003 angle = item->value[ROTATE_ANGLE_INDEX].f32;
9004 }
9005 float perspective = 0.0f;
9006 if (ROTATE_PERSPECTIVE_INDEX < actualSize) {
9007 perspective = item->value[ROTATE_PERSPECTIVE_INDEX].f32;
9008 }
9009 ArkUIAnimationOptionType animationOption;
9010 ParseAnimation(item, actualSize, animationOption, ROTATE_ANIMATION_BASE);
9011 fullImpl->getNodeModifiers()->getCommonModifier()->setRotateTransition(
9012 node->uiNodeHandle, &rotateArray[0], ARRAY_SIZE, perspective, angle, &animationOption);
9013 return ERROR_CODE_NO_ERROR;
9014 }
9015
SetScaleTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9016 int32_t SetScaleTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9017 {
9018 auto* fullImpl = GetFullImpl();
9019 auto actualSize = CheckAttributeItemArray(item, REQUIRED_FIVE_PARAM);
9020 if (actualSize < 0) {
9021 return ERROR_CODE_PARAM_INVALID;
9022 }
9023 if (!CheckAnimation(item, actualSize, SCALE_ANIMATION_BASE)) {
9024 return ERROR_CODE_PARAM_INVALID;
9025 }
9026 std::array<float, ARRAY_SIZE> scaleFloatArray;
9027 for (size_t i = 0; i < static_cast<uint32_t>(actualSize) && i < scaleFloatArray.size(); i++) {
9028 scaleFloatArray[i] = item->value[i].f32;
9029 }
9030 ArkUIAnimationOptionType animationOption;
9031 ParseAnimation(item, actualSize, animationOption, SCALE_ANIMATION_BASE);
9032 fullImpl->getNodeModifiers()->getCommonModifier()->setScaleTransition(
9033 node->uiNodeHandle, &scaleFloatArray[0], scaleFloatArray.size(), &animationOption);
9034 return ERROR_CODE_NO_ERROR;
9035 }
9036
SetTranslateTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9037 int32_t SetTranslateTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9038 {
9039 auto* fullImpl = GetFullImpl();
9040 auto actualSize = CheckAttributeItemArray(item, REQUIRED_FIVE_PARAM);
9041 if (actualSize < 0) {
9042 return ERROR_CODE_PARAM_INVALID;
9043 }
9044 if (!CheckAnimation(item, actualSize, TRANSLATE_ANIMATION_BASE)) {
9045 return ERROR_CODE_PARAM_INVALID;
9046 }
9047 int32_t unit = GetDefaultUnit(node, UNIT_VP);
9048 CalcDimension xDimension(0, static_cast<DimensionUnit>(unit));
9049 if (X_INDEX < actualSize) {
9050 xDimension.SetValue(item->value[X_INDEX].f32);
9051 }
9052 CalcDimension yDimension(0, static_cast<DimensionUnit>(unit));
9053 if (Y_INDEX < actualSize) {
9054 yDimension.SetValue(item->value[Y_INDEX].f32);
9055 }
9056 CalcDimension zDimension(0, static_cast<DimensionUnit>(unit));
9057 if (Z_INDEX < actualSize) {
9058 zDimension.SetValue(item->value[Z_INDEX].f32);
9059 }
9060 ArkUIAnimationOptionType animationOption;
9061 ParseAnimation(item, actualSize, animationOption, TRANSLATE_ANIMATION_BASE);
9062 fullImpl->getNodeModifiers()->getCommonModifier()->setTranslateTransition(node->uiNodeHandle, xDimension.Value(),
9063 static_cast<int32_t>(xDimension.Unit()), yDimension.Value(), static_cast<int32_t>(yDimension.Unit()),
9064 zDimension.Value(), static_cast<int32_t>(zDimension.Unit()), &animationOption);
9065 return ERROR_CODE_NO_ERROR;
9066 }
9067
SetMoveTransition(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9068 int32_t SetMoveTransition(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9069 {
9070 auto* fullImpl = GetFullImpl();
9071 auto actualSize = CheckAttributeItemArray(item, REQUIRED_THREE_PARAM);
9072 if (actualSize < 0) {
9073 return ERROR_CODE_PARAM_INVALID;
9074 }
9075 if (!CheckAnimation(item, actualSize, MOVE_ANIMATION_BASE)) {
9076 return ERROR_CODE_PARAM_INVALID;
9077 }
9078 int edgeType = ArkUI_TransitionEdge::ARKUI_TRANSITION_EDGE_START;
9079 if (!InRegion(NUM_0, NUM_3, item->value[NUM_0].i32)) {
9080 return ERROR_CODE_PARAM_INVALID;
9081 }
9082 edgeType = item->value[NUM_0].i32;
9083 ArkUIAnimationOptionType animationOption;
9084 ParseAnimation(item, actualSize, animationOption, MOVE_ANIMATION_BASE);
9085 fullImpl->getNodeModifiers()->getCommonModifier()->setMoveTransition(
9086 node->uiNodeHandle, edgeType, &animationOption);
9087 return ERROR_CODE_NO_ERROR;
9088 }
9089
SetOffset(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9090 int32_t SetOffset(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9091 {
9092 auto* fullImpl = GetFullImpl();
9093 auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
9094 if (actualSize < 0) {
9095 return ERROR_CODE_PARAM_INVALID;
9096 }
9097 int32_t unit = GetDefaultUnit(node, UNIT_VP);
9098 CalcDimension xDimension(0, static_cast<DimensionUnit>(unit));
9099 xDimension.SetValue(item->value[NUM_0].f32);
9100 CalcDimension yDimension(0, static_cast<DimensionUnit>(unit));
9101 yDimension.SetValue(item->value[NUM_1].f32);
9102 std::array<float, TWO> offsetValue = { xDimension.Value(), yDimension.Value() };
9103 std::array<int32_t, TWO> offsetUnit = { static_cast<int32_t>(xDimension.Unit()),
9104 static_cast<int32_t>(yDimension.Unit()) };
9105 fullImpl->getNodeModifiers()->getCommonModifier()->setOffset(node->uiNodeHandle, &offsetValue[0], &offsetUnit[0]);
9106 return ERROR_CODE_NO_ERROR;
9107 }
9108
SetMarkAnchor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9109 int32_t SetMarkAnchor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9110 {
9111 auto* fullImpl = GetFullImpl();
9112 auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWO_PARAM);
9113 if (actualSize < 0) {
9114 return ERROR_CODE_PARAM_INVALID;
9115 }
9116 int32_t unit = GetDefaultUnit(node, UNIT_VP);
9117 CalcDimension xDimension(0, static_cast<DimensionUnit>(unit));
9118 xDimension.SetValue(item->value[NUM_0].f32);
9119 CalcDimension yDimension(0, static_cast<DimensionUnit>(unit));
9120 yDimension.SetValue(item->value[NUM_1].f32);
9121 fullImpl->getNodeModifiers()->getCommonModifier()->setMarkAnchor(node->uiNodeHandle, xDimension.Value(),
9122 unit, yDimension.Value(), unit);
9123 return ERROR_CODE_NO_ERROR;
9124 }
9125
SetAlignRules(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9126 int32_t SetAlignRules(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9127 {
9128 node->alignRuleOption = item->object;
9129
9130 if (item->size < 0 || item->object == nullptr) {
9131 return ERROR_CODE_PARAM_INVALID;
9132 }
9133 auto* fullImpl = GetFullImpl();
9134 auto* option = reinterpret_cast<ArkUI_AlignmentRuleOption*>(item->object);
9135 char* anchors[NUM_6];
9136 ArkUI_Int32 aligns[NUM_6];
9137 if (option->left.hasValue) {
9138 // 0 -> left
9139 anchors[0] = const_cast<char*>(option->left.anchor.c_str());
9140 aligns[0] = option->left.align + NUM_1;
9141 }
9142 if (option->middle.hasValue) {
9143 // 1 -> middle
9144 anchors[1] = const_cast<char*>(option->middle.anchor.c_str());
9145 aligns[1] = option->middle.align + NUM_1;
9146 }
9147 if (option->right.hasValue) {
9148 // 2 -> right
9149 anchors[2] = const_cast<char*>(option->right.anchor.c_str());
9150 aligns[2] = option->right.align + NUM_1;
9151 }
9152 if (option->top.hasValue) {
9153 // 3 -> top
9154 anchors[3] = const_cast<char*>(option->top.anchor.c_str());
9155 aligns[3] = option->top.align + NUM_1;
9156 }
9157 if (option->center.hasValue) {
9158 // 4 -> center
9159 anchors[4] = const_cast<char*>(option->center.anchor.c_str());
9160 aligns[4] = option->center.align + NUM_1;
9161 }
9162 if (option->bottom.hasValue) {
9163 // 5 -> bottom
9164 anchors[5] = const_cast<char*>(option->bottom.anchor.c_str());
9165 aligns[5] = option->bottom.align + NUM_1;
9166 }
9167 fullImpl->getNodeModifiers()->getCommonModifier()->setAlignRules(node->uiNodeHandle, anchors, aligns, NUM_6);
9168 fullImpl->getNodeModifiers()->getCommonModifier()->setBias(
9169 node->uiNodeHandle, option->biasHorizontal, option->biasVertical);
9170 return ERROR_CODE_NO_ERROR;
9171 }
9172
ResetAlignRules(ArkUI_NodeHandle node)9173 void ResetAlignRules(ArkUI_NodeHandle node)
9174 {
9175 auto* fullImpl = GetFullImpl();
9176 fullImpl->getNodeModifiers()->getCommonModifier()->resetAlignRules(node->uiNodeHandle);
9177 node->alignRuleOption = nullptr;
9178 }
9179
SetTextContent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9180 int32_t SetTextContent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9181 {
9182 auto* fullImpl = GetFullImpl();
9183 if (!CheckAttributeString(item)) {
9184 return ERROR_CODE_PARAM_INVALID;
9185 }
9186 fullImpl->getNodeModifiers()->getTextModifier()->setContent(node->uiNodeHandle, item->string);
9187 return ERROR_CODE_NO_ERROR;
9188 }
9189
SetLineHeight(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9190 int32_t SetLineHeight(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9191 {
9192 auto* fullImpl = GetFullImpl();
9193 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9194 if (actualSize < 0) {
9195 return ERROR_CODE_PARAM_INVALID;
9196 }
9197 int32_t unit = GetDefaultUnit(node, UNIT_FP);
9198 switch (node->type) {
9199 case ARKUI_NODE_TEXT:
9200 fullImpl->getNodeModifiers()->getTextModifier()->setTextLineHeight(
9201 node->uiNodeHandle, item->value[0].f32, unit);
9202 break;
9203 case ARKUI_NODE_SPAN:
9204 fullImpl->getNodeModifiers()->getSpanModifier()->setSpanLineHeight(
9205 node->uiNodeHandle, item->value[0].f32, unit);
9206 break;
9207 case ARKUI_NODE_TEXT_INPUT:
9208 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputLineHeight(
9209 node->uiNodeHandle, item->value[0].f32, unit);
9210 break;
9211 case ARKUI_NODE_TEXT_AREA:
9212 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaLineHeight(
9213 node->uiNodeHandle, item->value[0].f32, unit);
9214 break;
9215 default:
9216 break;
9217 }
9218 return ERROR_CODE_NO_ERROR;
9219 }
9220
SetDecoration(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9221 int32_t SetDecoration(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9222 {
9223 auto* fullImpl = GetFullImpl();
9224 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9225 if (actualSize < 0) {
9226 return ERROR_CODE_PARAM_INVALID;
9227 }
9228 if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_TEXT_DECORATION_TYPE_LINE_THROUGH)) {
9229 return ERROR_CODE_PARAM_INVALID;
9230 }
9231 if (DECORATION_STYLE_INDEX < actualSize && (item->value[DECORATION_STYLE_INDEX].i32 < 0 ||
9232 item->value[DECORATION_STYLE_INDEX].i32 > static_cast<int32_t>(ARKUI_TEXT_DECORATION_STYLE_WAVY))) {
9233 return ERROR_CODE_PARAM_INVALID;
9234 }
9235 int32_t decoration = item->value[0].i32;
9236 auto decorationColor = Color::BLACK.GetValue();
9237 if (DECORATION_COLOR_INDEX < actualSize) {
9238 decorationColor = item->value[DECORATION_COLOR_INDEX].u32;
9239 }
9240 int32_t decorationStyle = 0;
9241 if (DECORATION_STYLE_INDEX < actualSize) {
9242 decorationStyle = item->value[DECORATION_STYLE_INDEX].i32;
9243 }
9244 switch (node->type) {
9245 case ARKUI_NODE_SPAN:
9246 fullImpl->getNodeModifiers()->getSpanModifier()->setSpanDecoration(
9247 node->uiNodeHandle, decoration, decorationColor, decorationStyle);
9248 break;
9249 case ARKUI_NODE_TEXT:
9250 fullImpl->getNodeModifiers()->getTextModifier()->setTextDecoration(
9251 node->uiNodeHandle, decoration, decorationColor, decorationStyle);
9252 break;
9253 default:
9254 break;
9255 }
9256 return ERROR_CODE_NO_ERROR;
9257 }
9258
SetTextCase(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9259 int32_t SetTextCase(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9260 {
9261 auto* fullImpl = GetFullImpl();
9262 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9263 if (actualSize < 0) {
9264 return ERROR_CODE_PARAM_INVALID;
9265 }
9266 if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_TEXT_CASE_UPPER)) {
9267 return ERROR_CODE_PARAM_INVALID;
9268 }
9269 switch (node->type) {
9270 case ARKUI_NODE_SPAN:
9271 fullImpl->getNodeModifiers()->getSpanModifier()->setSpanTextCase(node->uiNodeHandle, item->value[0].i32);
9272 break;
9273 case ARKUI_NODE_TEXT:
9274 fullImpl->getNodeModifiers()->getTextModifier()->setTextCase(node->uiNodeHandle, item->value[0].i32);
9275 break;
9276 default:
9277 break;
9278 }
9279 return ERROR_CODE_NO_ERROR;
9280 }
9281
SetLetterSpacing(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9282 int32_t SetLetterSpacing(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9283 {
9284 auto* fullImpl = GetFullImpl();
9285 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9286 if (actualSize < 0) {
9287 return ERROR_CODE_PARAM_INVALID;
9288 }
9289 ArkUIStringAndFloat letterSpacingValue = { item->value[0].f32, nullptr };
9290 switch (node->type) {
9291 case ARKUI_NODE_SPAN:
9292 fullImpl->getNodeModifiers()->getSpanModifier()->setSpanLetterSpacing(
9293 node->uiNodeHandle, &letterSpacingValue);
9294 break;
9295 case ARKUI_NODE_TEXT:
9296 fullImpl->getNodeModifiers()->getTextModifier()->setTextLetterSpacing(
9297 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
9298 break;
9299 default:
9300 break;
9301 }
9302 return ERROR_CODE_NO_ERROR;
9303 }
9304
SetMaxLines(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9305 int32_t SetMaxLines(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9306 {
9307 auto* fullImpl = GetFullImpl();
9308 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9309 if (actualSize < 0) {
9310 return ERROR_CODE_PARAM_INVALID;
9311 }
9312 switch (node->type) {
9313 case ARKUI_NODE_TEXT:
9314 fullImpl->getNodeModifiers()->getTextModifier()->setTextMaxLines(node->uiNodeHandle, item->value[0].i32);
9315 break;
9316 case ARKUI_NODE_TEXT_INPUT:
9317 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputMaxLines(
9318 node->uiNodeHandle, item->value[0].i32);
9319 break;
9320 case ARKUI_NODE_TEXT_AREA:
9321 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaMaxLines(
9322 node->uiNodeHandle, item->value[0].i32);
9323 break;
9324 default:
9325 break;
9326 }
9327 return ERROR_CODE_NO_ERROR;
9328 }
9329
SetTextAlign(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9330 int32_t SetTextAlign(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9331 {
9332 auto* fullImpl = GetFullImpl();
9333 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9334 if (actualSize < 0) {
9335 return ERROR_CODE_PARAM_INVALID;
9336 }
9337 if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_TEXT_ALIGNMENT_JUSTIFY)) {
9338 return ERROR_CODE_PARAM_INVALID;
9339 }
9340 switch (node->type) {
9341 case ARKUI_NODE_TEXT_INPUT:
9342 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputTextAlign(
9343 node->uiNodeHandle, item->value[0].i32);
9344 break;
9345 case ARKUI_NODE_TEXT:
9346 fullImpl->getNodeModifiers()->getTextModifier()->setTextAlign(node->uiNodeHandle, item->value[0].i32);
9347 break;
9348 case ARKUI_NODE_TEXT_AREA:
9349 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaTextAlign(
9350 node->uiNodeHandle, item->value[0].i32);
9351 break;
9352 default:
9353 break;
9354 }
9355 return ERROR_CODE_NO_ERROR;
9356 }
9357
SetTextOverflow(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9358 int32_t SetTextOverflow(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9359 {
9360 auto* fullImpl = GetFullImpl();
9361 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9362 if (actualSize < 0) {
9363 return ERROR_CODE_PARAM_INVALID;
9364 }
9365 if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_TEXT_OVERFLOW_MARQUEE)) {
9366 return ERROR_CODE_PARAM_INVALID;
9367 }
9368 fullImpl->getNodeModifiers()->getTextModifier()->setTextOverflow(node->uiNodeHandle, item->value[0].i32);
9369 return ERROR_CODE_NO_ERROR;
9370 }
9371
SetTextIndent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9372 int32_t SetTextIndent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9373 {
9374 auto* fullImpl = GetFullImpl();
9375 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9376 if (actualSize < 0) {
9377 return ERROR_CODE_PARAM_INVALID;
9378 }
9379 fullImpl->getNodeModifiers()->getTextModifier()->setTextIndent(node->uiNodeHandle,
9380 item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
9381 return ERROR_CODE_NO_ERROR;
9382 }
9383
ResetTextIndent(ArkUI_NodeHandle node)9384 void ResetTextIndent(ArkUI_NodeHandle node)
9385 {
9386 auto* fullImpl = GetFullImpl();
9387 fullImpl->getNodeModifiers()->getTextModifier()->setTextIndent(node->uiNodeHandle,
9388 0.0f, UNIT_FP);
9389 }
9390
SetTextWordBreak(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9391 int32_t SetTextWordBreak(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9392 {
9393 auto* fullImpl = GetFullImpl();
9394 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9395 if (actualSize < 0) {
9396 return ERROR_CODE_PARAM_INVALID;
9397 }
9398 fullImpl->getNodeModifiers()->getTextModifier()->setWordBreak(
9399 node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
9400 return ERROR_CODE_NO_ERROR;
9401 }
9402
GetTextWordBreak(ArkUI_NodeHandle node)9403 const ArkUI_AttributeItem* GetTextWordBreak(ArkUI_NodeHandle node)
9404 {
9405 auto fullImpl = GetFullImpl();
9406 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextWordBreak(node->uiNodeHandle);
9407 g_attributeItem.size = REQUIRED_ONE_PARAM;
9408 return &g_attributeItem;
9409 }
9410
ResetTextWordBreak(ArkUI_NodeHandle node)9411 void ResetTextWordBreak(ArkUI_NodeHandle node)
9412 {
9413 auto* fullImpl = GetFullImpl();
9414 fullImpl->getNodeModifiers()->getTextModifier()->resetWordBreak(node->uiNodeHandle);
9415 }
9416
SetTextSelectedBackgroundColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9417 int32_t SetTextSelectedBackgroundColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9418 {
9419 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9420 if (actualSize < 0) {
9421 return ERROR_CODE_PARAM_INVALID;
9422 }
9423 auto* fullImpl = GetFullImpl();
9424 fullImpl->getNodeModifiers()->getTextModifier()->setTextSelectedBackgroundColor(
9425 node->uiNodeHandle, item->value[0].u32);
9426 return ERROR_CODE_NO_ERROR;
9427 }
9428
GetTextSelectedBackgroundColor(ArkUI_NodeHandle node)9429 const ArkUI_AttributeItem* GetTextSelectedBackgroundColor(ArkUI_NodeHandle node)
9430 {
9431 g_numberValues[0].u32 = GetFullImpl()->getNodeModifiers()->getTextModifier()->getTextSelectedBackgroundColor(
9432 node->uiNodeHandle);
9433 return &g_attributeItem;
9434 }
9435
ResetTextSelectedBackgroundColor(ArkUI_NodeHandle node)9436 void ResetTextSelectedBackgroundColor(ArkUI_NodeHandle node)
9437 {
9438 auto* fullImpl = GetFullImpl();
9439 fullImpl->getNodeModifiers()->getTextModifier()->resetTextSelectedBackgroundColor(node->uiNodeHandle);
9440 }
9441
SetTextEllipsisMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9442 int32_t SetTextEllipsisMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9443 {
9444 auto* fullImpl = GetFullImpl();
9445 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9446 if (actualSize < 0) {
9447 return ERROR_CODE_PARAM_INVALID;
9448 }
9449 fullImpl->getNodeModifiers()->getTextModifier()->setEllipsisMode(
9450 node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
9451 return ERROR_CODE_NO_ERROR;
9452 }
9453
SetLineSpacing(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9454 int32_t SetLineSpacing(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9455 {
9456 auto* fullImpl = GetFullImpl();
9457 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9458 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
9459 return ERROR_CODE_PARAM_INVALID;
9460 }
9461 if (node->type == ARKUI_NODE_TEXT) {
9462 fullImpl->getNodeModifiers()->getTextModifier()->setTextLineSpacing(
9463 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
9464 }
9465 return ERROR_CODE_NO_ERROR;
9466 }
9467
SetTextContentWithStyledString(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9468 int32_t SetTextContentWithStyledString(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9469 {
9470 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
9471 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
9472 auto* fullImpl = GetFullImpl();
9473 auto* styledString = reinterpret_cast<ArkUI_StyledString*>(item->object);
9474 fullImpl->getNodeModifiers()->getTextModifier()->setTextContentWithStyledString(node->uiNodeHandle, styledString);
9475 return ERROR_CODE_NO_ERROR;
9476 }
9477
ResetTextContentWithStyledString(ArkUI_NodeHandle node)9478 void ResetTextContentWithStyledString(ArkUI_NodeHandle node)
9479 {
9480 auto* fullImpl = GetFullImpl();
9481 fullImpl->getNodeModifiers()->getTextModifier()->resetTextContentWithStyledString(node->uiNodeHandle);
9482 }
9483
SetHalfLeading(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9484 int32_t SetHalfLeading(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9485 {
9486 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9487 if (actualSize < 0 || !InRegion(NUM_0, NUM_1, item->value[NUM_0].i32)) {
9488 return ERROR_CODE_PARAM_INVALID;
9489 }
9490 // already check in entry point.
9491 auto* fullImpl = GetFullImpl();
9492 fullImpl->getNodeModifiers()->getTextModifier()->setTextHalfLeading(
9493 node->uiNodeHandle, item->value[NUM_0].i32);
9494 return ERROR_CODE_NO_ERROR;
9495 }
9496
GetHalfLeading(ArkUI_NodeHandle node)9497 const ArkUI_AttributeItem* GetHalfLeading(ArkUI_NodeHandle node)
9498 {
9499 auto fullImpl = GetFullImpl();
9500 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextHalfLeading(node->uiNodeHandle);
9501 g_attributeItem.size = REQUIRED_ONE_PARAM;
9502 return &g_attributeItem;
9503 }
9504
ResetHalfLeading(ArkUI_NodeHandle node)9505 void ResetHalfLeading(ArkUI_NodeHandle node)
9506 {
9507 auto* fullImpl = GetFullImpl();
9508 fullImpl->getNodeModifiers()->getTextModifier()->resetTextHalfLeading(node->uiNodeHandle);
9509 }
9510
GetTextEllipsisMode(ArkUI_NodeHandle node)9511 const ArkUI_AttributeItem* GetTextEllipsisMode(ArkUI_NodeHandle node)
9512 {
9513 auto fullImpl = GetFullImpl();
9514 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextEllipsisMode(node->uiNodeHandle);
9515 g_attributeItem.size = REQUIRED_ONE_PARAM;
9516 return &g_attributeItem;
9517 }
9518
GetLineSpacing(ArkUI_NodeHandle node)9519 const ArkUI_AttributeItem* GetLineSpacing(ArkUI_NodeHandle node)
9520 {
9521 auto fullImpl = GetFullImpl();
9522 if (node->type == ARKUI_NODE_TEXT) {
9523 g_numberValues[NUM_0].f32 =
9524 fullImpl->getNodeModifiers()->getTextModifier()->getTextLineSpacing(node->uiNodeHandle);
9525 g_numberValues[NUM_0].i32 = static_cast<int32_t>(node->lengthMetricUnit);
9526 g_attributeItem.size = REQUIRED_ONE_PARAM;
9527 }
9528 return &g_attributeItem;
9529 }
9530
ResetTextEllipsisMode(ArkUI_NodeHandle node)9531 void ResetTextEllipsisMode(ArkUI_NodeHandle node)
9532 {
9533 auto* fullImpl = GetFullImpl();
9534 fullImpl->getNodeModifiers()->getTextModifier()->resetEllipsisMode(node->uiNodeHandle);
9535 }
9536
SetTextEnableDateDetector(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9537 int32_t SetTextEnableDateDetector(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9538 {
9539 auto* fullImpl = GetFullImpl();
9540 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9541 if (actualSize < 0) {
9542 return ERROR_CODE_PARAM_INVALID;
9543 }
9544 fullImpl->getNodeModifiers()->getTextModifier()->setEnableDataDetector(
9545 node->uiNodeHandle, static_cast<uint32_t>(item->value[0].i32));
9546 return ERROR_CODE_NO_ERROR;
9547 }
9548
GetTextEnableDateDetector(ArkUI_NodeHandle node)9549 const ArkUI_AttributeItem* GetTextEnableDateDetector(ArkUI_NodeHandle node)
9550 {
9551 auto fullImpl = GetFullImpl();
9552 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getEnableDataDetector(node->uiNodeHandle);
9553 g_attributeItem.size = REQUIRED_ONE_PARAM;
9554 return &g_attributeItem;
9555 }
9556
ResetTextEnableDateDetector(ArkUI_NodeHandle node)9557 void ResetTextEnableDateDetector(ArkUI_NodeHandle node)
9558 {
9559 auto* fullImpl = GetFullImpl();
9560 fullImpl->getNodeModifiers()->getTextModifier()->resetEnableDataDetector(node->uiNodeHandle);
9561 }
9562
SetTextDataDetectorConfig(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9563 int32_t SetTextDataDetectorConfig(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9564 {
9565 auto* fullImpl = GetFullImpl();
9566 ArkUI_Uint32 values[item->size];
9567 for (int i = 0; i < item->size; i++) {
9568 values[i] = item->value[i].i32;
9569 }
9570 fullImpl->getNodeModifiers()->getTextModifier()->setTextDataDetectorConfig(
9571 node->uiNodeHandle, values, item->size);
9572 return ERROR_CODE_NO_ERROR;
9573 }
9574
GetTextDataDetectorConfig(ArkUI_NodeHandle node)9575 const ArkUI_AttributeItem* GetTextDataDetectorConfig(ArkUI_NodeHandle node)
9576 {
9577 ArkUI_Int32 values[32];
9578 auto* fullImpl = GetFullImpl();
9579 auto size = fullImpl->getNodeModifiers()->getTextModifier()->getTextDataDetectorConfig(
9580 node->uiNodeHandle, &values);
9581 for (auto i = 0; i < size; i++) {
9582 g_numberValues[i].i32 = values[i];
9583 }
9584 g_attributeItem.size = size;
9585 return &g_attributeItem;
9586 }
9587
ResetTextDataDetectorConfig(ArkUI_NodeHandle node)9588 void ResetTextDataDetectorConfig(ArkUI_NodeHandle node)
9589 {
9590 auto* fullImpl = GetFullImpl();
9591 fullImpl->getNodeModifiers()->getTextModifier()->resetTextDataDetectorConfig(node->uiNodeHandle);
9592 }
9593
SetFontFeature(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9594 int32_t SetFontFeature(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9595 {
9596 if (item->string == nullptr) {
9597 return ERROR_CODE_PARAM_INVALID;
9598 }
9599 auto* fullImpl = GetFullImpl();
9600 switch (node->type) {
9601 case ARKUI_NODE_TEXT_INPUT:
9602 fullImpl->getNodeModifiers()->getTextInputModifier()->setTextInputFontFeature(
9603 node->uiNodeHandle, item->string);
9604 break;
9605 case ARKUI_NODE_TEXT:
9606 fullImpl->getNodeModifiers()->getTextModifier()->setTextFontFeature(node->uiNodeHandle, item->string);
9607 break;
9608 case ARKUI_NODE_TEXT_AREA:
9609 fullImpl->getNodeModifiers()->getTextAreaModifier()->setTextAreaFontFeature(
9610 node->uiNodeHandle, item->string);
9611 break;
9612 default:
9613 break;
9614 }
9615 return ERROR_CODE_NO_ERROR;
9616 }
9617
GetFontFeature(ArkUI_NodeHandle node)9618 const ArkUI_AttributeItem* GetFontFeature(ArkUI_NodeHandle node)
9619 {
9620 auto fullImpl = GetFullImpl();
9621 ArkUI_CharPtr feature = nullptr;
9622 switch (node->type) {
9623 case ARKUI_NODE_TEXT_INPUT:
9624 feature = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputFontFeature(node->uiNodeHandle);
9625 g_attributeItem.string = (feature != nullptr ? feature : EMPTY_STR.c_str());
9626 break;
9627 case ARKUI_NODE_TEXT:
9628 feature = fullImpl->getNodeModifiers()->getTextModifier()->getTextFontFeature(node->uiNodeHandle);
9629 g_attributeItem.string = (feature != nullptr ? feature : EMPTY_STR.c_str());
9630 break;
9631 case ARKUI_NODE_TEXT_AREA:
9632 feature = fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaFontFeature(node->uiNodeHandle);
9633 g_attributeItem.string = (feature != nullptr ? feature : EMPTY_STR.c_str());
9634 break;
9635 default:
9636 break;
9637 }
9638 return &g_attributeItem;
9639 }
9640
ResetFontFeature(ArkUI_NodeHandle node)9641 void ResetFontFeature(ArkUI_NodeHandle node)
9642 {
9643 auto* fullImpl = GetFullImpl();
9644 switch (node->type) {
9645 case ARKUI_NODE_TEXT_INPUT:
9646 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputFontFeature(node->uiNodeHandle);
9647 break;
9648 case ARKUI_NODE_TEXT:
9649 fullImpl->getNodeModifiers()->getTextModifier()->resetTextFontFeature(node->uiNodeHandle);
9650 break;
9651 case ARKUI_NODE_TEXT_AREA:
9652 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaFontFeature(node->uiNodeHandle);
9653 break;
9654 default:
9655 break;
9656 }
9657 }
ResetLineSpacing(ArkUI_NodeHandle node)9658 void ResetLineSpacing(ArkUI_NodeHandle node)
9659 {
9660 auto fullImpl = GetFullImpl();
9661 switch (node->type) {
9662 case ARKUI_NODE_TEXT:
9663 fullImpl->getNodeModifiers()->getTextModifier()->resetTextLineSpacing(node->uiNodeHandle);
9664 break;
9665 default:
9666 break;
9667 }
9668 }
9669
SetSpanContent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9670 int32_t SetSpanContent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9671 {
9672 auto* fullImpl = GetFullImpl();
9673 if (!CheckAttributeString(item)) {
9674 return ERROR_CODE_PARAM_INVALID;
9675 }
9676 fullImpl->getNodeModifiers()->getSpanModifier()->setContent(node->uiNodeHandle, item->string);
9677 return ERROR_CODE_NO_ERROR;
9678 }
9679
SetSpanTextBackgroundStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9680 int32_t SetSpanTextBackgroundStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9681 {
9682 auto* fullImpl = GetFullImpl();
9683 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9684 if (actualSize < 0) {
9685 return ERROR_CODE_PARAM_INVALID;
9686 }
9687 float radiusVals[ALLOW_SIZE_4] = { 0, 0, 0, 0 };
9688 int32_t unit = GetDefaultUnit(node, UNIT_VP);
9689 int radiusUnits[ALLOW_SIZE_4] = { unit, unit, unit, unit };
9690
9691 if (item->size == ALLOW_SIZE_2) {
9692 if (LessNotEqual(item->value[NUM_1].f32, 0.0f)) {
9693 return ERROR_CODE_PARAM_INVALID;
9694 }
9695 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
9696 radiusVals[i] = item->value[1].f32;
9697 }
9698 } else if (item->size == ALLOW_SIZE_5) {
9699 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
9700 if (LessNotEqual(item->value[i + NUM_1].f32, 0.0f)) {
9701 return ERROR_CODE_PARAM_INVALID;
9702 } else {
9703 radiusVals[i] = item->value[i + NUM_1].f32;
9704 }
9705 }
9706 } else {
9707 return ERROR_CODE_PARAM_INVALID;
9708 }
9709
9710 fullImpl->getNodeModifiers()->getSpanModifier()->setSpanTextBackgroundStyle(
9711 node->uiNodeHandle, item->value[NUM_0].u32, radiusVals, radiusUnits, NUM_4);
9712 return ERROR_CODE_NO_ERROR;
9713 }
9714
SetVerticalAlign(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9715 int32_t SetVerticalAlign(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9716 {
9717 auto* fullImpl = GetFullImpl();
9718 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9719 if (actualSize < 0) {
9720 return ERROR_CODE_PARAM_INVALID;
9721 }
9722 if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_IMAGE_SPAN_ALIGNMENT_TOP)) {
9723 return ERROR_CODE_PARAM_INVALID;
9724 }
9725 fullImpl->getNodeModifiers()->getImageSpanModifier()->setImageSpanVerticalAlign(
9726 node->uiNodeHandle, IMAGE_SPAN_ALIGNMENT_ARRAY[item->value[0].i32]);
9727 return ERROR_CODE_NO_ERROR;
9728 }
9729
SetPixelMapSrc(ArkUI_NodeHandle node,const std::shared_ptr<Napi::DrawableDescriptor> & descriptor)9730 int32_t SetPixelMapSrc(ArkUI_NodeHandle node, const std::shared_ptr<Napi::DrawableDescriptor>& descriptor)
9731 {
9732 auto* fullImpl = GetFullImpl();
9733 fullImpl->getNodeModifiers()->getImageModifier()->setPixelMap(node->uiNodeHandle, descriptor.get());
9734 return ERROR_CODE_NO_ERROR;
9735 }
9736
SetPixelMapArraySrc(ArkUI_NodeHandle node,const std::shared_ptr<Napi::AnimatedDrawableDescriptor> & descriptor)9737 int32_t SetPixelMapArraySrc(ArkUI_NodeHandle node, const std::shared_ptr<Napi::AnimatedDrawableDescriptor>& descriptor)
9738 {
9739 auto* fullImpl = GetFullImpl();
9740 fullImpl->getNodeModifiers()->getImageModifier()->setPixelMapArray(node->uiNodeHandle, descriptor.get());
9741 return ERROR_CODE_NO_ERROR;
9742 }
9743
SetResourceSrc(ArkUI_NodeHandle node,const std::shared_ptr<ArkUI_Resource> & resource)9744 int32_t SetResourceSrc(ArkUI_NodeHandle node, const std::shared_ptr<ArkUI_Resource>& resource)
9745 {
9746 auto* fullImpl = GetFullImpl();
9747 fullImpl->getNodeModifiers()->getImageModifier()->setResourceSrc(node->uiNodeHandle, resource.get());
9748 return ERROR_CODE_NO_ERROR;
9749 }
9750
SetImageSrc(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9751 int32_t SetImageSrc(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9752 {
9753 bool isString = CheckAttributeString(item);
9754 bool isObject = CheckAttributeObject(item);
9755 if ((isString && isObject) || (!isString && !isObject)) {
9756 return ERROR_CODE_PARAM_INVALID;
9757 }
9758 if (isString) {
9759 auto* fullImpl = GetFullImpl();
9760 fullImpl->getNodeModifiers()->getImageModifier()->setSrc(node->uiNodeHandle, item->string);
9761 return ERROR_CODE_NO_ERROR;
9762 }
9763
9764 auto drawableDescriptor = reinterpret_cast<ArkUI_DrawableDescriptor*>(item->object);
9765 if (!drawableDescriptor) {
9766 return ERROR_CODE_PARAM_INVALID;
9767 }
9768 node->drawableDescriptor = drawableDescriptor;
9769 if (!drawableDescriptor->drawableDescriptor && !drawableDescriptor->resource &&
9770 !drawableDescriptor->animatedDrawableDescriptor) {
9771 return ERROR_CODE_PARAM_INVALID;
9772 }
9773 if (drawableDescriptor->drawableDescriptor) {
9774 return SetPixelMapSrc(node, drawableDescriptor->drawableDescriptor);
9775 } else if (drawableDescriptor->animatedDrawableDescriptor) {
9776 return SetPixelMapArraySrc(node, drawableDescriptor->animatedDrawableDescriptor);
9777 } else {
9778 return SetResourceSrc(node, drawableDescriptor->resource);
9779 }
9780 }
9781
SetImageSpanSrc(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9782 int32_t SetImageSpanSrc(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9783 {
9784 auto* fullImpl = GetFullImpl();
9785 if (CheckAttributeString(item)) {
9786 fullImpl->getNodeModifiers()->getImageModifier()->setSrc(node->uiNodeHandle, item->string);
9787 return ERROR_CODE_NO_ERROR;
9788 } else {
9789 return SetImageSrc(node, item);
9790 }
9791 }
9792
SetImageSpanBaselineOffset(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9793 int32_t SetImageSpanBaselineOffset(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9794 {
9795 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9796 if (actualSize < 0) {
9797 return ERROR_CODE_PARAM_INVALID;
9798 }
9799 // already check in entry point.
9800 auto* fullImpl = GetFullImpl();
9801 fullImpl->getNodeModifiers()->getImageSpanModifier()->setImageSpanBaselineOffset(
9802 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_FP));
9803 return ERROR_CODE_NO_ERROR;
9804 }
9805
ResetImageSpanBaselineOffset(ArkUI_NodeHandle node)9806 void ResetImageSpanBaselineOffset(ArkUI_NodeHandle node)
9807 {
9808 // already check in entry point.
9809 auto* fullImpl = GetFullImpl();
9810 fullImpl->getNodeModifiers()->getImageSpanModifier()->
9811 resetImageSpanBaselineOffset(node->uiNodeHandle);
9812 }
9813
GetImageSpanBaselineOffset(ArkUI_NodeHandle node)9814 const ArkUI_AttributeItem* GetImageSpanBaselineOffset(ArkUI_NodeHandle node)
9815 {
9816 // already check in entry point.
9817 auto* fullImpl = GetFullImpl();
9818 int32_t unit = GetDefaultUnit(node, UNIT_FP);
9819 g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getImageSpanModifier()->
9820 getImageSpanBaselineOffset(node->uiNodeHandle, unit);
9821 g_attributeItem.size = REQUIRED_ONE_PARAM;
9822 return &g_attributeItem;
9823 }
9824
SetObjectFit(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9825 int32_t SetObjectFit(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9826 {
9827 auto* fullImpl = GetFullImpl();
9828 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9829 if (actualSize < 0) {
9830 return ERROR_CODE_PARAM_INVALID;
9831 }
9832 if (item->value[0].i32 < 0 || item->value[0].i32 >
9833 static_cast<int32_t>(ARKUI_OBJECT_FIT_NONE_AND_ALIGN_BOTTOM_END)) {
9834 return ERROR_CODE_PARAM_INVALID;
9835 }
9836 fullImpl->getNodeModifiers()->getImageModifier()->setObjectFit(
9837 node->uiNodeHandle, OBJECT_FIT_ARRAY[item->value[0].i32]);
9838 return ERROR_CODE_NO_ERROR;
9839 }
9840
SetInterpolation(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9841 int32_t SetInterpolation(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9842 {
9843 auto* fullImpl = GetFullImpl();
9844 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9845 if (actualSize < 0) {
9846 return ERROR_CODE_PARAM_INVALID;
9847 }
9848 if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_IMAGE_INTERPOLATION_HIGH)) {
9849 return ERROR_CODE_PARAM_INVALID;
9850 }
9851 fullImpl->getNodeModifiers()->getImageModifier()->setImageInterpolation(node->uiNodeHandle, item->value[0].i32);
9852 return ERROR_CODE_NO_ERROR;
9853 }
9854
SetObjectRepeat(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9855 int32_t SetObjectRepeat(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9856 {
9857 auto* fullImpl = GetFullImpl();
9858 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9859 if (actualSize < 0) {
9860 return ERROR_CODE_PARAM_INVALID;
9861 }
9862 if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_IMAGE_REPEAT_XY)) {
9863 return ERROR_CODE_PARAM_INVALID;
9864 }
9865 fullImpl->getNodeModifiers()->getImageModifier()->setObjectRepeat(node->uiNodeHandle, item->value[0].i32);
9866 return ERROR_CODE_NO_ERROR;
9867 }
9868
SetColorFilter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9869 int32_t SetColorFilter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9870 {
9871 auto* fullImpl = GetFullImpl();
9872 auto actualSize = CheckAttributeItemArray(item, REQUIRED_TWENTY_PARAM);
9873 bool isObject = CheckAttributeObject(item);
9874 if ((actualSize < 0 && !isObject) || (actualSize > 0 && isObject)) {
9875 return ERROR_CODE_PARAM_INVALID;
9876 }
9877 if (isObject) {
9878 fullImpl->getNodeModifiers()->getImageModifier()->setDrawingColorFilter(node->uiNodeHandle, item->object);
9879 return ERROR_CODE_NO_ERROR;
9880 }
9881 std::vector<float> colorFloatArray;
9882 for (size_t i = 0; i < static_cast<uint32_t>(actualSize) && i < REQUIRED_TWENTY_PARAM; i++) {
9883 colorFloatArray.emplace_back(item->value[i].f32);
9884 }
9885 fullImpl->getNodeModifiers()->getImageModifier()->setColorFilter(
9886 node->uiNodeHandle, &colorFloatArray[0], colorFloatArray.size());
9887 return ERROR_CODE_NO_ERROR;
9888 }
9889
SetAutoResize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9890 int32_t SetAutoResize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9891 {
9892 auto* fullImpl = GetFullImpl();
9893 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9894 if (actualSize < 0) {
9895 return ERROR_CODE_PARAM_INVALID;
9896 }
9897 fullImpl->getNodeModifiers()->getImageModifier()->setAutoResize(
9898 node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
9899 return ERROR_CODE_NO_ERROR;
9900 }
9901
SetAlt(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9902 int32_t SetAlt(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9903 {
9904 if (!item || (!item->string && !item->object)) {
9905 return ERROR_CODE_PARAM_INVALID;
9906 }
9907 auto* fullImpl = GetFullImpl();
9908 auto drawableDescriptor = reinterpret_cast<ArkUI_DrawableDescriptor*>(item->object);
9909 ArkUIImageSourceInfo imageInfo;
9910 imageInfo.url = item->string;
9911 node->altDrawableDescriptor = drawableDescriptor;
9912 if (drawableDescriptor && drawableDescriptor->resource) {
9913 imageInfo.resource = drawableDescriptor->resource.get();
9914 } else if (drawableDescriptor && drawableDescriptor->drawableDescriptor) {
9915 imageInfo.pixelMap = drawableDescriptor->drawableDescriptor.get();
9916 } else {
9917 node->altDrawableDescriptor = nullptr;
9918 if (!item->string) {
9919 return ERROR_CODE_PARAM_INVALID;
9920 }
9921 }
9922 imageInfo.pixelMapArray = nullptr;
9923 fullImpl->getNodeModifiers()->getImageModifier()->setAltSourceInfo(node->uiNodeHandle, &imageInfo);
9924 return ERROR_CODE_NO_ERROR;
9925 }
9926
SetResizable(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9927 int32_t SetResizable(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9928 {
9929 auto actualSize = CheckAttributeItemArray(item, NUM_4);
9930 if (actualSize < 0) {
9931 return ERROR_CODE_PARAM_INVALID;
9932 }
9933 auto* fullImpl = GetFullImpl();
9934 fullImpl->getNodeModifiers()->getImageModifier()->setImageResizable(
9935 node->uiNodeHandle, item->value[NUM_0].f32, item->value[NUM_1].f32,
9936 item->value[NUM_2].f32, item->value[NUM_3].f32);
9937 return ERROR_CODE_NO_ERROR;
9938 }
9939
ResetResizable(ArkUI_NodeHandle node)9940 void ResetResizable(ArkUI_NodeHandle node)
9941 {
9942 auto* fullImpl = GetFullImpl();
9943 fullImpl->getNodeModifiers()->getImageModifier()->setImageResizable(
9944 node->uiNodeHandle, 0.0f, 0.0f,
9945 0.0f, 0.0f);
9946 }
9947
GetResizable(ArkUI_NodeHandle node)9948 const ArkUI_AttributeItem* GetResizable(ArkUI_NodeHandle node)
9949 {
9950 auto fullImpl = GetFullImpl();
9951 std::array<float, NUM_4> resizableArray;
9952 fullImpl->getNodeModifiers()->getImageModifier()->getImageResizable(
9953 node->uiNodeHandle, &resizableArray[0], NUM_4);
9954 g_numberValues[NUM_0].f32 = resizableArray[NUM_0];
9955 g_numberValues[NUM_1].f32 = resizableArray[NUM_1];
9956 g_numberValues[NUM_2].f32 = resizableArray[NUM_2];
9957 g_numberValues[NUM_3].f32 = resizableArray[NUM_3];
9958 g_attributeItem.size = NUM_4;
9959 return &g_attributeItem;
9960 }
9961
SetImageDraggable(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9962 int32_t SetImageDraggable(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9963 {
9964 auto* fullImpl = GetFullImpl();
9965 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9966 if (actualSize < 0) {
9967 return ERROR_CODE_PARAM_INVALID;
9968 }
9969 fullImpl->getNodeModifiers()->getImageModifier()->setImageDraggable(
9970 node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
9971 return ERROR_CODE_NO_ERROR;
9972 }
9973
SetRenderMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)9974 int32_t SetRenderMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
9975 {
9976 auto* fullImpl = GetFullImpl();
9977 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
9978 if (actualSize < 0) {
9979 return ERROR_CODE_PARAM_INVALID;
9980 }
9981 if (item->value[0].i32 < 0 || item->value[0].i32 > static_cast<int32_t>(ARKUI_IMAGE_RENDER_MODE_TEMPLATE)) {
9982 return ERROR_CODE_PARAM_INVALID;
9983 }
9984 fullImpl->getNodeModifiers()->getImageModifier()->setRenderMode(node->uiNodeHandle, item->value[0].i32);
9985 return ERROR_CODE_NO_ERROR;
9986 }
9987
ResetRenderMode(ArkUI_NodeHandle node)9988 void ResetRenderMode(ArkUI_NodeHandle node)
9989 {
9990 auto* fullImpl = GetFullImpl();
9991 fullImpl->getNodeModifiers()->getImageModifier()->resetRenderMode(node->uiNodeHandle);
9992 }
9993
GetRenderMode(ArkUI_NodeHandle node)9994 const ArkUI_AttributeItem* GetRenderMode(ArkUI_NodeHandle node)
9995 {
9996 auto fullImpl = GetFullImpl();
9997 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getImageModifier()->getRenderMode(node->uiNodeHandle);
9998 g_attributeItem.size = REQUIRED_ONE_PARAM;
9999 return &g_attributeItem;
10000 }
10001
SetFitOriginalSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10002 int32_t SetFitOriginalSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10003 {
10004 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
10005 if (actualSize < 0) {
10006 return ERROR_CODE_PARAM_INVALID;
10007 }
10008 if (item->value[0].i32 < DEFAULT_FALSE || item->value[0].i32 > DEFAULT_TRUE) {
10009 return ERROR_CODE_PARAM_INVALID;
10010 }
10011 auto* fullImpl = GetFullImpl();
10012 fullImpl->getNodeModifiers()->getImageModifier()->setFitOriginalSize(
10013 node->uiNodeHandle, static_cast<bool>(item->value[0].i32));
10014 return ERROR_CODE_NO_ERROR;
10015 }
10016
ResetFitOriginalSize(ArkUI_NodeHandle node)10017 void ResetFitOriginalSize(ArkUI_NodeHandle node)
10018 {
10019 auto* fullImpl = GetFullImpl();
10020 fullImpl->getNodeModifiers()->getImageModifier()->resetFitOriginalSize(node->uiNodeHandle);
10021 }
10022
GetFitOriginalSize(ArkUI_NodeHandle node)10023 const ArkUI_AttributeItem* GetFitOriginalSize(ArkUI_NodeHandle node)
10024 {
10025 auto* fullImpl = GetFullImpl();
10026 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getImageModifier()->getFitOriginalSize(node->uiNodeHandle);
10027 g_attributeItem.size = REQUIRED_ONE_PARAM;
10028 return &g_attributeItem;
10029 }
10030
SetFillColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10031 int32_t SetFillColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10032 {
10033 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
10034 if (actualSize < 0) {
10035 return ERROR_CODE_PARAM_INVALID;
10036 }
10037 auto* fullImpl = GetFullImpl();
10038 fullImpl->getNodeModifiers()->getImageModifier()->setFillColor(
10039 node->uiNodeHandle, static_cast<ArkUI_Uint32>(item->value[0].u32));
10040 return ERROR_CODE_NO_ERROR;
10041 }
10042
ResetFillColor(ArkUI_NodeHandle node)10043 void ResetFillColor(ArkUI_NodeHandle node)
10044 {
10045 auto* fullImpl = GetFullImpl();
10046 fullImpl->getNodeModifiers()->getImageModifier()->resetFillColor(node->uiNodeHandle);
10047 }
10048
GetFillColor(ArkUI_NodeHandle node)10049 const ArkUI_AttributeItem* GetFillColor(ArkUI_NodeHandle node)
10050 {
10051 auto* fullImpl = GetFullImpl();
10052 g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getImageModifier()->getFillColor(node->uiNodeHandle);
10053 g_attributeItem.size = REQUIRED_ONE_PARAM;
10054 return &g_attributeItem;
10055 }
10056
SetHintRadius(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10057 int32_t SetHintRadius(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10058 {
10059 auto* fullImpl = GetFullImpl();
10060 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
10061 if (actualSize < 0) {
10062 return ERROR_CODE_PARAM_INVALID;
10063 }
10064 if (LessNotEqual(item->value[0].f32, 0.0f)) {
10065 return ERROR_CODE_PARAM_INVALID;
10066 }
10067 fullImpl->getNodeModifiers()->getCalendarPickerModifier()->setHintRadius(
10068 node->uiNodeHandle, item->value[0].f32, GetDefaultUnit(node, UNIT_VP));
10069 return ERROR_CODE_NO_ERROR;
10070 }
10071
GetHintRadius(ArkUI_NodeHandle node)10072 const ArkUI_AttributeItem* GetHintRadius(ArkUI_NodeHandle node)
10073 {
10074 auto fullImpl = GetFullImpl();
10075 g_numberValues[0].f32 =
10076 fullImpl->getNodeModifiers()->getCalendarPickerModifier()->getHintRadius(node->uiNodeHandle);
10077 g_attributeItem.size = REQUIRED_ONE_PARAM;
10078 return &g_attributeItem;
10079 }
10080
SetSelectedDate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10081 int32_t SetSelectedDate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10082 {
10083 auto* fullImpl = GetFullImpl();
10084 auto actualSize = CheckAttributeItemArray(item, REQUIRED_THREE_PARAM);
10085 if (actualSize < 0) {
10086 return ERROR_CODE_PARAM_INVALID;
10087 }
10088 if (!IsValidDate(item->value[SELECTED_YEAR_INDEX].u32,
10089 item->value[SELECTED_MONTH_INDEX].u32, item->value[SELECTED_DAY_INDEX].u32)) {
10090 return ERROR_CODE_PARAM_INVALID;
10091 }
10092 uint32_t selectedYear = item->value[SELECTED_YEAR_INDEX].u32;
10093 uint32_t selectedMonth = item->value[SELECTED_MONTH_INDEX].u32;
10094 uint32_t selectedDay = item->value[SELECTED_DAY_INDEX].u32;
10095 fullImpl->getNodeModifiers()->getCalendarPickerModifier()->setSelectDate(
10096 node->uiNodeHandle, selectedYear, selectedMonth, selectedDay);
10097 return ERROR_CODE_NO_ERROR;
10098 }
10099
GetSelectedDate(ArkUI_NodeHandle node)10100 const ArkUI_AttributeItem* GetSelectedDate(ArkUI_NodeHandle node)
10101 {
10102 auto fullImpl = GetFullImpl();
10103 auto selectedDate = fullImpl->getNodeModifiers()->getCalendarPickerModifier()->getSelectedDate(node->uiNodeHandle);
10104 g_numberValues[SELECTED_YEAR_INDEX].u32 = selectedDate.year;
10105 g_numberValues[SELECTED_MONTH_INDEX].u32 = selectedDate.month;
10106 g_numberValues[SELECTED_DAY_INDEX].u32 = selectedDate.day;
10107 g_attributeItem.size = REQUIRED_THREE_PARAM;
10108 return &g_attributeItem;
10109 }
10110
SetEdgeAlignment(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10111 int32_t SetEdgeAlignment(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10112 {
10113 auto* fullImpl = GetFullImpl();
10114 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
10115 if (actualSize < 0) {
10116 return ERROR_CODE_PARAM_INVALID;
10117 }
10118 if (EDGE_TYPE_INDEX < actualSize &&
10119 (item->value[EDGE_TYPE_INDEX].i32 < static_cast<int32_t>(ARKUI_CALENDAR_ALIGNMENT_START) ||
10120 item->value[EDGE_TYPE_INDEX].i32 > static_cast<int32_t>(ARKUI_CALENDAR_ALIGNMENT_END))) {
10121 return ERROR_CODE_PARAM_INVALID;
10122 }
10123 int32_t defaultAlignment = 0;
10124 if (EDGE_TYPE_INDEX < actualSize) {
10125 defaultAlignment = item->value[EDGE_TYPE_INDEX].i32;
10126 }
10127 std::vector<float> sizeArray;
10128 float xOffset = 0.0f;
10129 if (EDGE_OFFSET_X_INDEX < actualSize) {
10130 xOffset = item->value[EDGE_OFFSET_X_INDEX].f32;
10131 }
10132 sizeArray.emplace_back(xOffset);
10133 float yOffset = 0.0f;
10134 if (EDGE_OFFSET_Y_INDEX < actualSize) {
10135 yOffset = item->value[EDGE_OFFSET_Y_INDEX].f32;
10136 }
10137 sizeArray.emplace_back(yOffset);
10138 int32_t unit = GetDefaultUnit(node, UNIT_VP);
10139 std::vector<int32_t> unitArray = { unit, unit };
10140 fullImpl->getNodeModifiers()->getCalendarPickerModifier()->setEdgeAlign(
10141 node->uiNodeHandle, &sizeArray[0], &unitArray[0], static_cast<int32_t>(sizeArray.size()), defaultAlignment);
10142 return ERROR_CODE_NO_ERROR;
10143 }
10144
GetEdgeAlignment(ArkUI_NodeHandle node)10145 const ArkUI_AttributeItem* GetEdgeAlignment(ArkUI_NodeHandle node)
10146 {
10147 auto fullImpl = GetFullImpl();
10148 auto edgeAlign = fullImpl->getNodeModifiers()->getCalendarPickerModifier()->getEdgeAlign(node->uiNodeHandle);
10149 g_numberValues[EDGE_TYPE_INDEX].i32 = edgeAlign.alignType;
10150 g_numberValues[EDGE_OFFSET_X_INDEX].f32 = edgeAlign.offsetX;
10151 g_numberValues[EDGE_OFFSET_Y_INDEX].f32 = edgeAlign.offsetY;
10152 g_attributeItem.size = REQUIRED_THREE_PARAM;
10153 return &g_attributeItem;
10154 }
10155
SetCalendarPickerTextStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)10156 int32_t SetCalendarPickerTextStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
10157 {
10158 auto* fullImpl = GetFullImpl();
10159 auto actualSize = CheckAttributeItemArray(item, 0);
10160 if (actualSize < 0) {
10161 return ERROR_CODE_PARAM_INVALID;
10162 }
10163 if (CALENDAR_PICKER_FONT_SIZE_INDEX < actualSize &&
10164 LessNotEqual(item->value[CALENDAR_PICKER_FONT_SIZE_INDEX].f32, 0.0f)) {
10165 return ERROR_CODE_PARAM_INVALID;
10166 }
10167 if (CALENDAR_PICKER_FONT_WEIGHT_INDEX < actualSize &&
10168 (item->value[CALENDAR_PICKER_FONT_WEIGHT_INDEX].i32 < 0 ||
10169 item->value[CALENDAR_PICKER_FONT_WEIGHT_INDEX].i32 > static_cast<int32_t>(ARKUI_FONT_WEIGHT_REGULAR))) {
10170 return ERROR_CODE_PARAM_INVALID;
10171 }
10172 uint32_t fontColor = Color::BLACK.GetValue();
10173 if (CALENDAR_PICKER_FONT_COLOR_INDEX < actualSize) {
10174 fontColor = item->value[CALENDAR_PICKER_FONT_COLOR_INDEX].u32;
10175 }
10176 float fontSize = 0.0f;
10177 std::vector<float> fontSizeArray;
10178 if (CALENDAR_PICKER_FONT_SIZE_INDEX < actualSize) {
10179 fontSize = item->value[CALENDAR_PICKER_FONT_SIZE_INDEX].f32;
10180 }
10181 int32_t unit = GetDefaultUnit(node, UNIT_VP);
10182 fontSizeArray.emplace_back(fontSize);
10183 fontSizeArray.emplace_back(static_cast<float>(unit));
10184 int32_t fontWeight = 0;
10185 if (CALENDAR_PICKER_FONT_WEIGHT_INDEX < actualSize) {
10186 fontWeight = item->value[CALENDAR_PICKER_FONT_WEIGHT_INDEX].i32;
10187 }
10188 fullImpl->getNodeModifiers()->getCalendarPickerModifier()->setTextStyleWithWeightEnum(
10189 node->uiNodeHandle, fontColor, fontSize, unit, fontWeight);
10190 return ERROR_CODE_NO_ERROR;
10191 }
10192
GetCalendarPickerTextStyle(ArkUI_NodeHandle node)10193 const ArkUI_AttributeItem* GetCalendarPickerTextStyle(ArkUI_NodeHandle node)
10194 {
10195 auto fullImpl = GetFullImpl();
10196 auto textStyle =
10197 fullImpl->getNodeModifiers()->getCalendarPickerModifier()->getCalendarPickerTextStyle(node->uiNodeHandle);
10198 g_numberValues[CALENDAR_PICKER_FONT_COLOR_INDEX].u32 = textStyle.fontColor;
10199 g_numberValues[CALENDAR_PICKER_FONT_SIZE_INDEX].f32 = textStyle.fontSize;
10200 g_numberValues[CALENDAR_PICKER_FONT_WEIGHT_INDEX].i32 = textStyle.fontWeight;
10201 g_attributeItem.size = REQUIRED_THREE_PARAM;
10202 return &g_attributeItem;
10203 }
10204
ResetHintRadius(ArkUI_NodeHandle node)10205 void ResetHintRadius(ArkUI_NodeHandle node)
10206 {
10207 auto* fullImpl = GetFullImpl();
10208 fullImpl->getNodeModifiers()->getCalendarPickerModifier()->setHintRadius(
10209 node->uiNodeHandle, DEFAULT_HINT_RADIUS, UNIT_VP);
10210 }
10211
ResetSelectedDate(ArkUI_NodeHandle node)10212 void ResetSelectedDate(ArkUI_NodeHandle node)
10213 {
10214 auto* fullImpl = GetFullImpl();
10215 fullImpl->getNodeModifiers()->getCalendarPickerModifier()->resetSelectDate(node->uiNodeHandle);
10216 }
10217
ResetEdgeAlignment(ArkUI_NodeHandle node)10218 void ResetEdgeAlignment(ArkUI_NodeHandle node)
10219 {
10220 auto* fullImpl = GetFullImpl();
10221 fullImpl->getNodeModifiers()->getCalendarPickerModifier()->resetEdgeAlign(node->uiNodeHandle);
10222 }
10223
ResetCalendarPickerTextStyle(ArkUI_NodeHandle node)10224 void ResetCalendarPickerTextStyle(ArkUI_NodeHandle node)
10225 {
10226 auto* fullImpl = GetFullImpl();
10227 fullImpl->getNodeModifiers()->getCalendarPickerModifier()->resetTextStyle(node->uiNodeHandle);
10228 }
10229
ResetBackgroundImageSize(ArkUI_NodeHandle node)10230 void ResetBackgroundImageSize(ArkUI_NodeHandle node)
10231 {
10232 auto* fullImpl = GetFullImpl();
10233 fullImpl->getNodeModifiers()->getCommonModifier()->resetBackgroundImageSize(node->uiNodeHandle);
10234 }
10235
ResetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node)10236 void ResetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node)
10237 {
10238 ResetBackgroundImageSize(node);
10239 }
10240
ResetBackgroundBlurStyle(ArkUI_NodeHandle node)10241 void ResetBackgroundBlurStyle(ArkUI_NodeHandle node)
10242 {
10243 auto* fullImpl = GetFullImpl();
10244 fullImpl->getNodeModifiers()->getCommonModifier()->resetBackgroundBlurStyle(node->uiNodeHandle);
10245 }
10246
ResetTransformCenter(ArkUI_NodeHandle node)10247 void ResetTransformCenter(ArkUI_NodeHandle node)
10248 {
10249 auto* fullImpl = GetFullImpl();
10250 CalcDimension centerX(HALF, DimensionUnit::PERCENT);
10251 CalcDimension centerY(HALF, DimensionUnit::PERCENT);
10252 CalcDimension centerZ(0, DimensionUnit::VP);
10253 fullImpl->getNodeModifiers()->getCommonModifier()->setTransitionCenter(node->uiNodeHandle, centerX.Value(),
10254 static_cast<int32_t>(centerX.Unit()), centerY.Value(), static_cast<int32_t>(centerY.Unit()), centerZ.Value(),
10255 static_cast<int32_t>(centerZ.Unit()));
10256 }
10257
ResetOpacityTransition(ArkUI_NodeHandle node)10258 void ResetOpacityTransition(ArkUI_NodeHandle node)
10259 {
10260 auto* fullImpl = GetFullImpl();
10261 ArkUIAnimationOptionType animationOption;
10262 ResetAnimation(animationOption);
10263 fullImpl->getNodeModifiers()->getCommonModifier()->setOpacityTransition(
10264 node->uiNodeHandle, DEFAULT_OPACITY, &animationOption);
10265 }
10266
ResetRotateTransition(ArkUI_NodeHandle node)10267 void ResetRotateTransition(ArkUI_NodeHandle node)
10268 {
10269 auto* fullImpl = GetFullImpl();
10270 std::array<float, ARRAY_SIZE> rotateArray;
10271 ArkUIAnimationOptionType animationOption;
10272 ResetAnimation(animationOption);
10273 fullImpl->getNodeModifiers()->getCommonModifier()->setRotateTransition(
10274 node->uiNodeHandle, &rotateArray[0], ARRAY_SIZE, 0.0f, 0.0f, &animationOption);
10275 }
10276
ResetScaleTransition(ArkUI_NodeHandle node)10277 void ResetScaleTransition(ArkUI_NodeHandle node)
10278 {
10279 auto* fullImpl = GetFullImpl();
10280 std::array<float, ARRAY_SIZE> scaleFloatArray;
10281 ArkUIAnimationOptionType animationOption;
10282 ResetAnimation(animationOption);
10283 fullImpl->getNodeModifiers()->getCommonModifier()->setScaleTransition(
10284 node->uiNodeHandle, &scaleFloatArray[0], scaleFloatArray.size(), &animationOption);
10285 }
10286
ResetTranslateTransition(ArkUI_NodeHandle node)10287 void ResetTranslateTransition(ArkUI_NodeHandle node)
10288 {
10289 auto* fullImpl = GetFullImpl();
10290 std::array<float, ARRAY_SIZE> scaleFloatArray;
10291 ArkUIAnimationOptionType animationOption;
10292 ResetAnimation(animationOption);
10293 fullImpl->getNodeModifiers()->getCommonModifier()->setScaleTransition(
10294 node->uiNodeHandle, &scaleFloatArray[0], scaleFloatArray.size(), &animationOption);
10295 fullImpl->getNodeModifiers()->getCommonModifier()->setTranslateTransition(node->uiNodeHandle, 0.0f,
10296 UNIT_VP, 0.0f, UNIT_VP, 0.0f,
10297 UNIT_VP, &animationOption);
10298 }
10299
ResetMoveTransition(ArkUI_NodeHandle node)10300 void ResetMoveTransition(ArkUI_NodeHandle node)
10301 {
10302 auto* fullImpl = GetFullImpl();
10303 ArkUIAnimationOptionType animationOption;
10304 ResetAnimation(animationOption);
10305 fullImpl->getNodeModifiers()->getCommonModifier()->setMoveTransition(
10306 node->uiNodeHandle, ARKUI_TRANSITION_EDGE_TOP, &animationOption);
10307 }
10308
ResetOffset(ArkUI_NodeHandle node)10309 void ResetOffset(ArkUI_NodeHandle node)
10310 {
10311 auto* fullImpl = GetFullImpl();
10312 fullImpl->getNodeModifiers()->getCommonModifier()->resetOffset(node->uiNodeHandle);
10313 }
10314
ResetMarkAnchor(ArkUI_NodeHandle node)10315 void ResetMarkAnchor(ArkUI_NodeHandle node)
10316 {
10317 auto* fullImpl = GetFullImpl();
10318 fullImpl->getNodeModifiers()->getCommonModifier()->resetMarkAnchor(node->uiNodeHandle);
10319 }
10320
ResetTextContent(ArkUI_NodeHandle node)10321 void ResetTextContent(ArkUI_NodeHandle node)
10322 {
10323 auto* fullImpl = GetFullImpl();
10324 fullImpl->getNodeModifiers()->getTextModifier()->setContent(node->uiNodeHandle, "");
10325 }
10326
ResetLineHeight(ArkUI_NodeHandle node)10327 void ResetLineHeight(ArkUI_NodeHandle node)
10328 {
10329 auto fullImpl = GetFullImpl();
10330 switch (node->type) {
10331 case ARKUI_NODE_TEXT:
10332 fullImpl->getNodeModifiers()->getTextModifier()->resetTextLineHeight(node->uiNodeHandle);
10333 break;
10334 case ARKUI_NODE_SPAN:
10335 fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanLineHeight(node->uiNodeHandle);
10336 break;
10337 case ARKUI_NODE_TEXT_INPUT:
10338 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputLineHeight(node->uiNodeHandle);
10339 break;
10340 case ARKUI_NODE_TEXT_AREA:
10341 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaLineHeight(node->uiNodeHandle);
10342 break;
10343 default:
10344 break;
10345 }
10346 }
10347
ResetDecoration(ArkUI_NodeHandle node)10348 void ResetDecoration(ArkUI_NodeHandle node)
10349 {
10350 auto fullImpl = GetFullImpl();
10351 switch (node->type) {
10352 case ARKUI_NODE_SPAN:
10353 fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanDecoration(node->uiNodeHandle);
10354 break;
10355 case ARKUI_NODE_TEXT:
10356 fullImpl->getNodeModifiers()->getTextModifier()->resetTextDecoration(node->uiNodeHandle);
10357 break;
10358 default:
10359 break;
10360 }
10361 }
10362
ResetTextCase(ArkUI_NodeHandle node)10363 void ResetTextCase(ArkUI_NodeHandle node)
10364 {
10365 auto fullImpl = GetFullImpl();
10366 switch (node->type) {
10367 case ARKUI_NODE_SPAN:
10368 fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanTextCase(node->uiNodeHandle);
10369 break;
10370 case ARKUI_NODE_TEXT:
10371 fullImpl->getNodeModifiers()->getTextModifier()->resetTextCase(node->uiNodeHandle);
10372 break;
10373 default:
10374 break;
10375 }
10376 }
10377
ResetLetterSpacing(ArkUI_NodeHandle node)10378 void ResetLetterSpacing(ArkUI_NodeHandle node)
10379 {
10380 auto fullImpl = GetFullImpl();
10381 switch (node->type) {
10382 case ARKUI_NODE_SPAN:
10383 fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanLetterSpacing(node->uiNodeHandle);
10384 break;
10385 case ARKUI_NODE_TEXT:
10386 fullImpl->getNodeModifiers()->getTextModifier()->resetTextLetterSpacing(node->uiNodeHandle);
10387 break;
10388 default:
10389 break;
10390 }
10391 }
10392
ResetMaxLines(ArkUI_NodeHandle node)10393 void ResetMaxLines(ArkUI_NodeHandle node)
10394 {
10395 auto fullImpl = GetFullImpl();
10396 switch (node->type) {
10397 case ARKUI_NODE_TEXT:
10398 fullImpl->getNodeModifiers()->getTextModifier()->resetTextMaxLines(node->uiNodeHandle);
10399 break;
10400 case ARKUI_NODE_TEXT_INPUT:
10401 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputMaxLines(node->uiNodeHandle);
10402 break;
10403 case ARKUI_NODE_TEXT_AREA:
10404 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaMaxLines(node->uiNodeHandle);
10405 break;
10406 default:
10407 break;
10408 }
10409 }
10410
ResetTextAlign(ArkUI_NodeHandle node)10411 void ResetTextAlign(ArkUI_NodeHandle node)
10412 {
10413 auto fullImpl = GetFullImpl();
10414 switch (node->type) {
10415 case ARKUI_NODE_TEXT_INPUT:
10416 fullImpl->getNodeModifiers()->getTextInputModifier()->resetTextInputTextAlign(node->uiNodeHandle);
10417 break;
10418 case ARKUI_NODE_TEXT:
10419 fullImpl->getNodeModifiers()->getTextModifier()->resetTextAlign(node->uiNodeHandle);
10420 break;
10421 case ARKUI_NODE_TEXT_AREA:
10422 fullImpl->getNodeModifiers()->getTextAreaModifier()->resetTextAreaTextAlign(node->uiNodeHandle);
10423 break;
10424 default:
10425 break;
10426 }
10427 }
10428
ResetTextOverflow(ArkUI_NodeHandle node)10429 void ResetTextOverflow(ArkUI_NodeHandle node)
10430 {
10431 auto fullImpl = GetFullImpl();
10432 fullImpl->getNodeModifiers()->getTextModifier()->resetTextOverflow(node->uiNodeHandle);
10433 }
10434
ResetSpanContent(ArkUI_NodeHandle node)10435 void ResetSpanContent(ArkUI_NodeHandle node)
10436 {
10437 auto fullImpl = GetFullImpl();
10438 fullImpl->getNodeModifiers()->getSpanModifier()->setContent(node->uiNodeHandle, "");
10439 }
10440
ResetSpanTextBackgroundStyle(ArkUI_NodeHandle node)10441 void ResetSpanTextBackgroundStyle(ArkUI_NodeHandle node)
10442 {
10443 auto fullImpl = GetFullImpl();
10444 fullImpl->getNodeModifiers()->getSpanModifier()->resetSpanTextBackgroundStyle(node->uiNodeHandle);
10445 }
10446
ResetImageSpanSrc(ArkUI_NodeHandle node)10447 void ResetImageSpanSrc(ArkUI_NodeHandle node)
10448 {
10449 auto fullImpl = GetFullImpl();
10450 fullImpl->getNodeModifiers()->getImageModifier()->setSrc(node->uiNodeHandle, "");
10451 }
10452
ResetVerticalAlign(ArkUI_NodeHandle node)10453 void ResetVerticalAlign(ArkUI_NodeHandle node)
10454 {
10455 auto fullImpl = GetFullImpl();
10456 fullImpl->getNodeModifiers()->getImageSpanModifier()->resetImageSpanVerticalAlign(
10457 node->uiNodeHandle);
10458 }
10459
ResetImageSrc(ArkUI_NodeHandle node)10460 void ResetImageSrc(ArkUI_NodeHandle node)
10461 {
10462 auto fullImpl = GetFullImpl();
10463 fullImpl->getNodeModifiers()->getImageModifier()->resetImageSrc(node->uiNodeHandle);
10464 }
10465
ResetObjectFit(ArkUI_NodeHandle node)10466 void ResetObjectFit(ArkUI_NodeHandle node)
10467 {
10468 auto fullImpl = GetFullImpl();
10469 fullImpl->getNodeModifiers()->getImageModifier()->resetObjectFit(node->uiNodeHandle);
10470 }
10471
ResetInterpolation(ArkUI_NodeHandle node)10472 void ResetInterpolation(ArkUI_NodeHandle node)
10473 {
10474 auto fullImpl = GetFullImpl();
10475 fullImpl->getNodeModifiers()->getImageModifier()->resetImageInterpolation(node->uiNodeHandle);
10476 }
10477
ResetObjectRepeat(ArkUI_NodeHandle node)10478 void ResetObjectRepeat(ArkUI_NodeHandle node)
10479 {
10480 auto fullImpl = GetFullImpl();
10481 fullImpl->getNodeModifiers()->getImageModifier()->resetObjectRepeat(node->uiNodeHandle);
10482 }
10483
ResetColorFilter(ArkUI_NodeHandle node)10484 void ResetColorFilter(ArkUI_NodeHandle node)
10485 {
10486 auto fullImpl = GetFullImpl();
10487 fullImpl->getNodeModifiers()->getImageModifier()->resetColorFilter(node->uiNodeHandle);
10488 }
10489
ResetAutoResize(ArkUI_NodeHandle node)10490 void ResetAutoResize(ArkUI_NodeHandle node)
10491 {
10492 auto fullImpl = GetFullImpl();
10493 fullImpl->getNodeModifiers()->getImageModifier()->resetAutoResize(node->uiNodeHandle);
10494 }
10495
ResetAlt(ArkUI_NodeHandle node)10496 void ResetAlt(ArkUI_NodeHandle node)
10497 {
10498 auto fullImpl = GetFullImpl();
10499 fullImpl->getNodeModifiers()->getImageModifier()->resetAlt(node->uiNodeHandle);
10500 }
10501
ResetImageDraggable(ArkUI_NodeHandle node)10502 void ResetImageDraggable(ArkUI_NodeHandle node)
10503 {
10504 auto fullImpl = GetFullImpl();
10505 fullImpl->getNodeModifiers()->getImageModifier()->resetImageDraggable(node->uiNodeHandle);
10506 }
10507
GetBackgroundImageSize(ArkUI_NodeHandle node)10508 const ArkUI_AttributeItem* GetBackgroundImageSize(ArkUI_NodeHandle node)
10509 {
10510 auto fullImpl = GetFullImpl();
10511 auto backGroundImageSize =
10512 fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundImageSize(
10513 node->uiNodeHandle, GetDefaultUnit(node, UNIT_VP));
10514 g_numberValues[BACKGROUND_IMAGE_WIDTH_INDEX].f32 = backGroundImageSize.xValue;
10515 g_numberValues[BACKGROUND_IMAGE_HEIGHT_INDEX].f32 = backGroundImageSize.yValue;
10516 g_attributeItem.size = REQUIRED_TWO_PARAM;
10517 return &g_attributeItem;
10518 }
10519
GetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node)10520 const ArkUI_AttributeItem* GetBackgroundImageSizeWithStyle(ArkUI_NodeHandle node)
10521 {
10522 auto fullImpl = GetFullImpl();
10523 g_numberValues[0].i32 =
10524 fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundImageSizeWithStyle(node->uiNodeHandle);
10525 g_attributeItem.size = REQUIRED_ONE_PARAM;
10526 return &g_attributeItem;
10527 }
10528
GetBackgroundBlurStyle(ArkUI_NodeHandle node)10529 const ArkUI_AttributeItem* GetBackgroundBlurStyle(ArkUI_NodeHandle node)
10530 {
10531 auto fullImpl = GetFullImpl();
10532 auto backGroundBlurStyle =
10533 fullImpl->getNodeModifiers()->getCommonModifier()->getBackgroundBlurStyle(node->uiNodeHandle);
10534 g_numberValues[BLUR_STYLE_INDEX].i32 = UnConvertBlurStyle(backGroundBlurStyle.blurStyle);
10535 g_numberValues[COLOR_MODE_INDEX].i32 = backGroundBlurStyle.colorMode;
10536 g_numberValues[ADAPTIVE_COLOR_INDEX].i32 = backGroundBlurStyle.adaptiveColor;
10537 g_numberValues[SCALE_INDEX].f32 = backGroundBlurStyle.scale;
10538 g_numberValues[GRAY_SCALE_START].f32 = backGroundBlurStyle.grayScaleStart;
10539 g_numberValues[GRAY_SCALE_END].f32 = backGroundBlurStyle.grayScaleEnd;
10540 g_attributeItem.size = NUM_6;
10541 return &g_attributeItem;
10542 }
10543
GetTransformCenter(ArkUI_NodeHandle node)10544 const ArkUI_AttributeItem* GetTransformCenter(ArkUI_NodeHandle node)
10545 {
10546 auto fullImpl = GetFullImpl();
10547 auto transformCenter = fullImpl->getNodeModifiers()->getCommonModifier()->getTransformCenter(node->uiNodeHandle);
10548 g_numberValues[CENTER_X_INDEX].f32 = transformCenter.centerX;
10549 g_numberValues[CENTER_Y_INDEX].f32 = transformCenter.centerY;
10550 g_numberValues[CENTER_Z_INDEX].f32 = transformCenter.centerZ;
10551 g_attributeItem.size = REQUIRED_THREE_PARAM;
10552 return &g_attributeItem;
10553 }
10554
GetOpacityTransition(ArkUI_NodeHandle node)10555 const ArkUI_AttributeItem* GetOpacityTransition(ArkUI_NodeHandle node)
10556 {
10557 auto fullImpl = GetFullImpl();
10558 auto opacityTransition =
10559 fullImpl->getNodeModifiers()->getCommonModifier()->getOpacityTransition(node->uiNodeHandle);
10560 const int32_t animationDurationIndex = OPACITY_ANIMATION_BASE + ANIMATION_DURATION_INDEX;
10561 const int32_t animationCurveIndex = OPACITY_ANIMATION_BASE + ANIMATION_CURVE_INDEX;
10562 const int32_t animationDelayIndex = OPACITY_ANIMATION_BASE + ANIMATION_DELAY_INDEX;
10563 const int32_t animationIterationsIndex = OPACITY_ANIMATION_BASE + ANIMATION_INTERATION_INDEX;
10564 const int32_t animationPlayModeIndex = OPACITY_ANIMATION_BASE + ANIMATION_PLAY_MODE_INDEX;
10565 const int32_t animationTempoIndex = OPACITY_ANIMATION_BASE + ANIMATION_TEMPO_INDEX;
10566 g_numberValues[0].f32 = opacityTransition.opacity;
10567 g_numberValues[animationDurationIndex].i32 = opacityTransition.animation.duration;
10568 g_numberValues[animationCurveIndex].i32 = opacityTransition.animation.curve;
10569 g_numberValues[animationDelayIndex].i32 = opacityTransition.animation.delay;
10570 g_numberValues[animationIterationsIndex].i32 = opacityTransition.animation.iteration;
10571 g_numberValues[animationPlayModeIndex].i32 =UnConvertAnimationDirection(opacityTransition.animation.playMode);
10572 g_numberValues[animationTempoIndex].f32 = opacityTransition.animation.tempo;
10573 g_attributeItem.size = REQUIRED_SEVEN_PARAM;
10574 return &g_attributeItem;
10575 }
10576
GetRotateTransition(ArkUI_NodeHandle node)10577 const ArkUI_AttributeItem* GetRotateTransition(ArkUI_NodeHandle node)
10578 {
10579 auto fullImpl = GetFullImpl();
10580 auto rotateTransition = fullImpl->getNodeModifiers()->getCommonModifier()->getRotateTransition(node->uiNodeHandle);
10581 const int32_t animationDurationIndex = ROTATE_ANIMATION_BASE + ANIMATION_DURATION_INDEX;
10582 const int32_t animationCurveIndex = ROTATE_ANIMATION_BASE + ANIMATION_CURVE_INDEX;
10583 const int32_t animationDelayIndex = ROTATE_ANIMATION_BASE + ANIMATION_DELAY_INDEX;
10584 const int32_t animationIterationsIndex = ROTATE_ANIMATION_BASE + ANIMATION_INTERATION_INDEX;
10585 const int32_t animationPlayModeIndex = ROTATE_ANIMATION_BASE + ANIMATION_PLAY_MODE_INDEX;
10586 const int32_t animationTempoIndex = ROTATE_ANIMATION_BASE + ANIMATION_TEMPO_INDEX;
10587 g_numberValues[X_INDEX].f32 = rotateTransition.xRotation;
10588 g_numberValues[Y_INDEX].f32 = rotateTransition.yRotation;
10589 g_numberValues[Z_INDEX].f32 = rotateTransition.zRotation;
10590 g_numberValues[ROTATE_ANGLE_INDEX].f32 = rotateTransition.angle;
10591 g_numberValues[ROTATE_PERSPECTIVE_INDEX].f32 = rotateTransition.perspective;
10592 g_numberValues[animationDurationIndex].i32 = rotateTransition.animation.duration;
10593 g_numberValues[animationCurveIndex].i32 = rotateTransition.animation.curve;
10594 g_numberValues[animationDelayIndex].i32 = rotateTransition.animation.delay;
10595 g_numberValues[animationIterationsIndex].i32 = rotateTransition.animation.iteration;
10596 g_numberValues[animationPlayModeIndex].i32 = UnConvertAnimationDirection(rotateTransition.animation.playMode);
10597 g_numberValues[animationTempoIndex].f32 = rotateTransition.animation.tempo;
10598 g_attributeItem.size = NUM_11;
10599 return &g_attributeItem;
10600 }
10601
GetScaleTransition(ArkUI_NodeHandle node)10602 const ArkUI_AttributeItem* GetScaleTransition(ArkUI_NodeHandle node)
10603 {
10604 auto fullImpl = GetFullImpl();
10605 auto scaleTransition = fullImpl->getNodeModifiers()->getCommonModifier()->getScaleTransition(node->uiNodeHandle);
10606 const int32_t animationDurationIndex = SCALE_ANIMATION_BASE + ANIMATION_DURATION_INDEX;
10607 const int32_t animationCurveIndex = SCALE_ANIMATION_BASE + ANIMATION_CURVE_INDEX;
10608 const int32_t animationDelayIndex = SCALE_ANIMATION_BASE + ANIMATION_DELAY_INDEX;
10609 const int32_t animationIterationsIndex = SCALE_ANIMATION_BASE + ANIMATION_INTERATION_INDEX;
10610 const int32_t animationPlayModeIndex = SCALE_ANIMATION_BASE + ANIMATION_PLAY_MODE_INDEX;
10611 const int32_t animationTempoIndex = SCALE_ANIMATION_BASE + ANIMATION_TEMPO_INDEX;
10612 g_numberValues[X_INDEX].f32 = scaleTransition.xScale;
10613 g_numberValues[Y_INDEX].f32 = scaleTransition.yScale;
10614 g_numberValues[Z_INDEX].f32 = scaleTransition.zScale;
10615 g_numberValues[animationDurationIndex].i32 = scaleTransition.animation.duration;
10616 g_numberValues[animationCurveIndex].i32 = scaleTransition.animation.curve;
10617 g_numberValues[animationDelayIndex].i32 = scaleTransition.animation.delay;
10618 g_numberValues[animationIterationsIndex].i32 = scaleTransition.animation.iteration;
10619 g_numberValues[animationPlayModeIndex].i32 = UnConvertAnimationDirection(scaleTransition.animation.playMode);
10620 g_numberValues[animationTempoIndex].f32 = scaleTransition.animation.tempo;
10621 g_attributeItem.size = NUM_9;
10622 return &g_attributeItem;
10623 }
10624
GetTranslateTransition(ArkUI_NodeHandle node)10625 const ArkUI_AttributeItem* GetTranslateTransition(ArkUI_NodeHandle node)
10626 {
10627 auto fullImpl = GetFullImpl();
10628 auto translateTransition =
10629 fullImpl->getNodeModifiers()->getCommonModifier()->getTranslateTransition(node->uiNodeHandle);
10630 const int32_t animationDurationIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_DURATION_INDEX;
10631 const int32_t animationCurveIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_CURVE_INDEX;
10632 const int32_t animationDelayIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_DELAY_INDEX;
10633 const int32_t animationIterationsIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_INTERATION_INDEX;
10634 const int32_t animationPlayModeIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_PLAY_MODE_INDEX;
10635 const int32_t animationTempoIndex = TRANSLATE_ANIMATION_BASE + ANIMATION_TEMPO_INDEX;
10636 g_numberValues[X_INDEX].f32 = translateTransition.xTransition;
10637 g_numberValues[Y_INDEX].f32 = translateTransition.yTransition;
10638 g_numberValues[Z_INDEX].f32 = translateTransition.zTransition;
10639 g_numberValues[animationDurationIndex].i32 = translateTransition.animation.duration;
10640 g_numberValues[animationCurveIndex].i32 = translateTransition.animation.curve;
10641 g_numberValues[animationDelayIndex].i32 = translateTransition.animation.delay;
10642 g_numberValues[animationIterationsIndex].i32 = translateTransition.animation.iteration;
10643 g_numberValues[animationPlayModeIndex].i32 = UnConvertAnimationDirection(translateTransition.animation.playMode);
10644 g_numberValues[animationTempoIndex].f32 = translateTransition.animation.tempo;
10645 return &g_attributeItem;
10646 }
10647
GetMoveTransition(ArkUI_NodeHandle node)10648 const ArkUI_AttributeItem* GetMoveTransition(ArkUI_NodeHandle node)
10649 {
10650 auto fullImpl = GetFullImpl();
10651 auto moveTransition =
10652 fullImpl->getNodeModifiers()->getCommonModifier()->getMoveTransition(node->uiNodeHandle);
10653 const int32_t animationDurationIndex = MOVE_ANIMATION_BASE + ANIMATION_DURATION_INDEX;
10654 const int32_t animationCurveIndex = MOVE_ANIMATION_BASE + ANIMATION_CURVE_INDEX;
10655 const int32_t animationDelayIndex = MOVE_ANIMATION_BASE + ANIMATION_DELAY_INDEX;
10656 const int32_t animationIterationsIndex = MOVE_ANIMATION_BASE + ANIMATION_INTERATION_INDEX;
10657 const int32_t animationPlayModeIndex = MOVE_ANIMATION_BASE + ANIMATION_PLAY_MODE_INDEX;
10658 const int32_t animationTempoIndex = MOVE_ANIMATION_BASE + ANIMATION_TEMPO_INDEX;
10659 g_numberValues[0].i32 = moveTransition.edgeType;
10660 g_numberValues[animationDurationIndex].i32 = moveTransition.animation.duration;
10661 g_numberValues[animationCurveIndex].i32 = moveTransition.animation.curve;
10662 g_numberValues[animationDelayIndex].i32 = moveTransition.animation.delay;
10663 g_numberValues[animationIterationsIndex].i32 = moveTransition.animation.iteration;
10664 g_numberValues[animationPlayModeIndex].i32 = moveTransition.animation.playMode;
10665 g_numberValues[animationTempoIndex].f32 = moveTransition.animation.tempo;
10666 g_attributeItem.size = REQUIRED_SEVEN_PARAM;
10667 return &g_attributeItem;
10668 }
10669
10670
GetOffset(ArkUI_NodeHandle node)10671 const ArkUI_AttributeItem* GetOffset(ArkUI_NodeHandle node)
10672 {
10673 auto fullImpl = GetFullImpl();
10674 auto offset = fullImpl->getNodeModifiers()->getCommonModifier()->getOffset(node->uiNodeHandle);
10675 g_numberValues[NUM_0].f32 = offset.xComponent;
10676 g_numberValues[NUM_1].f32 = offset.yComponent;
10677 g_attributeItem.size = REQUIRED_TWO_PARAM;
10678 return &g_attributeItem;
10679 }
10680
GetMarkAnchor(ArkUI_NodeHandle node)10681 const ArkUI_AttributeItem* GetMarkAnchor(ArkUI_NodeHandle node)
10682 {
10683 auto fullImpl = GetFullImpl();
10684 auto markAnchor = fullImpl->getNodeModifiers()->getCommonModifier()->getMarkAnchor(node->uiNodeHandle);
10685 g_numberValues[NUM_0].f32 = markAnchor.xCoordinate;
10686 g_numberValues[NUM_1].f32 = markAnchor.yCoordinate;
10687 g_attributeItem.size = REQUIRED_TWO_PARAM;
10688 return &g_attributeItem;
10689 }
10690
GetAlignRules(ArkUI_NodeHandle node)10691 const ArkUI_AttributeItem* GetAlignRules(ArkUI_NodeHandle node)
10692 {
10693 g_attributeItem.object = node->alignRuleOption;
10694 return &g_attributeItem;
10695 }
10696
GetTextContent(ArkUI_NodeHandle node)10697 const ArkUI_AttributeItem* GetTextContent(ArkUI_NodeHandle node)
10698 {
10699 auto fullImpl = GetFullImpl();
10700 auto textContent = fullImpl->getNodeModifiers()->getTextModifier()->getTextContent(node->uiNodeHandle);
10701 g_attributeItem.string = (textContent != nullptr ? textContent : EMPTY_STR.c_str());
10702 return &g_attributeItem;
10703 }
10704
GetFontColor(ArkUI_NodeHandle node)10705 const ArkUI_AttributeItem* GetFontColor(ArkUI_NodeHandle node)
10706 {
10707 auto fullImpl = GetFullImpl();
10708 switch (node->type) {
10709 case ARKUI_NODE_TEXT:
10710 g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getTextModifier()->
10711 getFontColor(node->uiNodeHandle);
10712 g_attributeItem.size = REQUIRED_ONE_PARAM;
10713 break;
10714 case ARKUI_NODE_SPAN:
10715 g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getSpanModifier()->
10716 getSpanFontColor(node->uiNodeHandle);
10717 g_attributeItem.size = REQUIRED_ONE_PARAM;
10718 break;
10719 case ARKUI_NODE_TEXT_INPUT:
10720 case ARKUI_NODE_TEXT_AREA:
10721 g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
10722 getTextInputFontColor(node->uiNodeHandle);
10723 g_attributeItem.size = REQUIRED_ONE_PARAM;
10724 break;
10725 case ARKUI_NODE_BUTTON:
10726 g_numberValues[0].u32 = fullImpl->getNodeModifiers()->getButtonModifier()->
10727 getButtonFontColor(node->uiNodeHandle);
10728 g_attributeItem.size = REQUIRED_ONE_PARAM;
10729 break;
10730 default:
10731 break;
10732 }
10733 return &g_attributeItem;
10734 }
10735
GetFontSize(ArkUI_NodeHandle node)10736 const ArkUI_AttributeItem* GetFontSize(ArkUI_NodeHandle node)
10737 {
10738 auto fullImpl = GetFullImpl();
10739 auto unit = GetDefaultUnit(node, UNIT_FP);
10740 switch (node->type) {
10741 case ARKUI_NODE_TEXT:
10742 g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getTextModifier()->
10743 getFontSize(node->uiNodeHandle, unit);
10744 g_attributeItem.size = REQUIRED_ONE_PARAM;
10745 break;
10746 case ARKUI_NODE_SPAN:
10747 g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getSpanModifier()->
10748 getSpanFontSize(node->uiNodeHandle, unit);
10749 g_attributeItem.size = REQUIRED_ONE_PARAM;
10750 break;
10751 case ARKUI_NODE_TEXT_INPUT:
10752 case ARKUI_NODE_TEXT_AREA:
10753 g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
10754 getTextInputFontSize(node->uiNodeHandle, unit);
10755 g_attributeItem.size = REQUIRED_ONE_PARAM;
10756 break;
10757 case ARKUI_NODE_BUTTON:
10758 g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getButtonModifier()->
10759 getButtonFontSize(node->uiNodeHandle, unit);
10760 g_attributeItem.size = REQUIRED_ONE_PARAM;
10761 break;
10762 default:
10763 break;
10764 }
10765 return &g_attributeItem;
10766 }
10767
GetFontStyle(ArkUI_NodeHandle node)10768 const ArkUI_AttributeItem* GetFontStyle(ArkUI_NodeHandle node)
10769 {
10770 auto fullImpl = GetFullImpl();
10771 switch (node->type) {
10772 case ARKUI_NODE_TEXT:
10773 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->
10774 getItalicFontStyle(node->uiNodeHandle);
10775 g_attributeItem.size = REQUIRED_ONE_PARAM;
10776 break;
10777 case ARKUI_NODE_SPAN:
10778 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getSpanModifier()->
10779 getSpanFontStyle(node->uiNodeHandle);
10780 g_attributeItem.size = REQUIRED_ONE_PARAM;
10781 break;
10782 case ARKUI_NODE_TEXT_INPUT:
10783 case ARKUI_NODE_TEXT_AREA:
10784 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
10785 getTextInputFontStyle(node->uiNodeHandle);
10786 g_attributeItem.size = REQUIRED_ONE_PARAM;
10787 break;
10788 default:
10789 break;
10790 }
10791 return &g_attributeItem;
10792 }
10793
GetFontWeight(ArkUI_NodeHandle node)10794 const ArkUI_AttributeItem* GetFontWeight(ArkUI_NodeHandle node)
10795 {
10796 auto fullImpl = GetFullImpl();
10797 switch (node->type) {
10798 case ARKUI_NODE_TEXT:
10799 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getFontWeight(node->uiNodeHandle);
10800 g_attributeItem.size = REQUIRED_ONE_PARAM;
10801 break;
10802 case ARKUI_NODE_SPAN:
10803 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getSpanModifier()->
10804 getSpanFontWeight(node->uiNodeHandle);
10805 g_attributeItem.size = REQUIRED_ONE_PARAM;
10806 break;
10807 case ARKUI_NODE_TEXT_INPUT:
10808 case ARKUI_NODE_TEXT_AREA:
10809 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextInputModifier()->
10810 getTextInputFontWeight(node->uiNodeHandle);
10811 g_attributeItem.size = REQUIRED_ONE_PARAM;
10812 break;
10813 case ARKUI_NODE_BUTTON:
10814 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getButtonModifier()->
10815 getButtonFontWeight(node->uiNodeHandle);
10816 g_attributeItem.size = REQUIRED_ONE_PARAM;
10817 break;
10818 default:
10819 break;
10820 }
10821 return &g_attributeItem;
10822 }
10823
GetLineHeight(ArkUI_NodeHandle node)10824 const ArkUI_AttributeItem* GetLineHeight(ArkUI_NodeHandle node)
10825 {
10826 auto fullImpl = GetFullImpl();
10827 switch (node->type) {
10828 case ARKUI_NODE_TEXT:
10829 g_numberValues[NUM_0].f32 =
10830 fullImpl->getNodeModifiers()->getTextModifier()->getTextLineHeight(node->uiNodeHandle);
10831 g_attributeItem.size = REQUIRED_ONE_PARAM;
10832 break;
10833 case ARKUI_NODE_SPAN:
10834 g_numberValues[NUM_0].f32 =
10835 fullImpl->getNodeModifiers()->getSpanModifier()->getSpanLineHeight(node->uiNodeHandle);
10836 g_attributeItem.size = REQUIRED_ONE_PARAM;
10837 break;
10838 case ARKUI_NODE_TEXT_INPUT:
10839 g_numberValues[NUM_0].f32 =
10840 fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputLineHeight(node->uiNodeHandle);
10841 g_attributeItem.size = REQUIRED_ONE_PARAM;
10842 break;
10843 case ARKUI_NODE_TEXT_AREA:
10844 g_numberValues[NUM_0].f32 =
10845 fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaLineHeight(node->uiNodeHandle);
10846 g_attributeItem.size = REQUIRED_ONE_PARAM;
10847 break;
10848 default:
10849 break;
10850 }
10851 return &g_attributeItem;
10852 }
10853
GetDecoration(ArkUI_NodeHandle node)10854 const ArkUI_AttributeItem* GetDecoration(ArkUI_NodeHandle node)
10855 {
10856 auto fullImpl = GetFullImpl();
10857 switch (node->type) {
10858 case ARKUI_NODE_SPAN: {
10859 ArkUITextDecorationType spanDecorationType = { 0, Color::BLACK.GetValue()};
10860 fullImpl->getNodeModifiers()->getSpanModifier()->getSpanDecoration(node->uiNodeHandle, &spanDecorationType);
10861 g_numberValues[0].i32 = spanDecorationType.decorationType;
10862 g_numberValues[DECORATION_COLOR_INDEX].u32 = spanDecorationType.color;
10863 g_numberValues[DECORATION_STYLE_INDEX].i32 = spanDecorationType.style;
10864 g_attributeItem.size = NUM_3;
10865 break;
10866 }
10867 case ARKUI_NODE_TEXT: {
10868 ArkUITextDecorationType textDecorationType = { 0, Color::BLACK.GetValue()};
10869 fullImpl->getNodeModifiers()->getTextModifier()->getTextDecoration(node->uiNodeHandle, &textDecorationType);
10870 g_numberValues[0].i32 = textDecorationType.decorationType;
10871 g_numberValues[DECORATION_COLOR_INDEX].u32 = textDecorationType.color;
10872 g_numberValues[DECORATION_STYLE_INDEX].i32 = textDecorationType.style;
10873 g_attributeItem.size = NUM_3;
10874 break;
10875 }
10876 default:
10877 break;
10878 }
10879
10880 return &g_attributeItem;
10881 }
10882
GetTextCase(ArkUI_NodeHandle node)10883 const ArkUI_AttributeItem* GetTextCase(ArkUI_NodeHandle node)
10884 {
10885 auto fullImpl = GetFullImpl();
10886 switch (node->type) {
10887 case ARKUI_NODE_SPAN:
10888 g_numberValues[NUM_0].i32 =
10889 fullImpl->getNodeModifiers()->getSpanModifier()->getSpanTextCase(node->uiNodeHandle);
10890 g_attributeItem.size = REQUIRED_ONE_PARAM;
10891 break;
10892 case ARKUI_NODE_TEXT:
10893 g_numberValues[NUM_0].i32 =
10894 fullImpl->getNodeModifiers()->getTextModifier()->getTextTextCase(node->uiNodeHandle);
10895 g_attributeItem.size = REQUIRED_ONE_PARAM;
10896 break;
10897 default:
10898 break;
10899 }
10900 return &g_attributeItem;
10901 }
10902
GetLetterSpacing(ArkUI_NodeHandle node)10903 const ArkUI_AttributeItem* GetLetterSpacing(ArkUI_NodeHandle node)
10904 {
10905 auto fullImpl = GetFullImpl();
10906 switch (node->type) {
10907 case ARKUI_NODE_SPAN:
10908 g_numberValues[NUM_0].f32 =
10909 fullImpl->getNodeModifiers()->getSpanModifier()->getSpanLetterSpacing(node->uiNodeHandle);
10910 g_attributeItem.size = REQUIRED_ONE_PARAM;
10911 break;
10912 case ARKUI_NODE_TEXT:
10913 g_numberValues[NUM_0].f32 =
10914 fullImpl->getNodeModifiers()->getTextModifier()->getTextLetterSpacing(node->uiNodeHandle);
10915 g_attributeItem.size = REQUIRED_ONE_PARAM;
10916 break;
10917 default:
10918 break;
10919 }
10920 return &g_attributeItem;
10921 }
10922
GetMaxLines(ArkUI_NodeHandle node)10923 const ArkUI_AttributeItem* GetMaxLines(ArkUI_NodeHandle node)
10924 {
10925 auto fullImpl = GetFullImpl();
10926 switch (node->type) {
10927 case ARKUI_NODE_TEXT:
10928 g_numberValues[NUM_0].i32 =
10929 fullImpl->getNodeModifiers()->getTextModifier()->getTextMaxLines(node->uiNodeHandle);
10930 g_attributeItem.size = REQUIRED_ONE_PARAM;
10931 break;
10932 case ARKUI_NODE_TEXT_INPUT:
10933 g_numberValues[NUM_0].i32 =
10934 fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputMaxLines(node->uiNodeHandle);
10935 g_attributeItem.size = REQUIRED_ONE_PARAM;
10936 break;
10937 case ARKUI_NODE_TEXT_AREA:
10938 g_numberValues[NUM_0].i32 =
10939 fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaMaxLines(node->uiNodeHandle);
10940 g_attributeItem.size = REQUIRED_ONE_PARAM;
10941 break;
10942 default:
10943 break;
10944 }
10945 return &g_attributeItem;
10946 }
10947
GetTextAlign(ArkUI_NodeHandle node)10948 const ArkUI_AttributeItem* GetTextAlign(ArkUI_NodeHandle node)
10949 {
10950 auto fullImpl = GetFullImpl();
10951 int32_t textAlign = NUM_0;
10952 if (node->type == ARKUI_NODE_TEXT) {
10953 textAlign = fullImpl->getNodeModifiers()->getTextModifier()->getTextAlign(node->uiNodeHandle);
10954 } else if (node->type == ARKUI_NODE_TEXT_INPUT) {
10955 textAlign = fullImpl->getNodeModifiers()->getTextInputModifier()->getTextInputTextAlign(node->uiNodeHandle);
10956 } else if (node->type == ARKUI_NODE_TEXT_AREA) {
10957 textAlign = fullImpl->getNodeModifiers()->getTextAreaModifier()->getTextAreaTextAlign(node->uiNodeHandle);
10958 }
10959 g_numberValues[0].i32 = textAlign;
10960 g_attributeItem.size = REQUIRED_ONE_PARAM;
10961 return &g_attributeItem;
10962 }
10963
GetTextOverflow(ArkUI_NodeHandle node)10964 const ArkUI_AttributeItem* GetTextOverflow(ArkUI_NodeHandle node)
10965 {
10966 auto fullImpl = GetFullImpl();
10967 g_numberValues[0].i32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextTextOverflow(node->uiNodeHandle);
10968 g_attributeItem.size = REQUIRED_ONE_PARAM;
10969 return &g_attributeItem;
10970 }
10971
GetTextIndent(ArkUI_NodeHandle node)10972 const ArkUI_AttributeItem* GetTextIndent(ArkUI_NodeHandle node)
10973 {
10974 auto fullImpl = GetFullImpl();
10975 g_numberValues[0].f32 = fullImpl->getNodeModifiers()->getTextModifier()->getTextTextIndent(node->uiNodeHandle);
10976 g_attributeItem.size = REQUIRED_ONE_PARAM;
10977 return &g_attributeItem;
10978 }
10979
GetSpanContent(ArkUI_NodeHandle node)10980 const ArkUI_AttributeItem* GetSpanContent(ArkUI_NodeHandle node)
10981 {
10982 auto fullImpl = GetFullImpl();
10983 auto content = fullImpl->getNodeModifiers()->getSpanModifier()->getSpanContent(node->uiNodeHandle);
10984 g_attributeItem.string = (content != nullptr ? content : EMPTY_STR.c_str());
10985 return &g_attributeItem;
10986 }
10987
GetSpanTextBackgroundStyle(ArkUI_NodeHandle node)10988 const ArkUI_AttributeItem* GetSpanTextBackgroundStyle(ArkUI_NodeHandle node)
10989 {
10990 auto fullImpl = GetFullImpl();
10991 ArkUITextBackgroundStyleOptions options;
10992 fullImpl->getNodeModifiers()->getSpanModifier()->getSpanTextBackgroundStyle(node->uiNodeHandle, &options);
10993 g_numberValues[NUM_0].u32 = options.color;
10994 g_numberValues[NUM_1].f32 = options.topLeft;
10995 g_numberValues[NUM_2].f32 = options.topRight;
10996 g_numberValues[NUM_3].f32 = options.bottomLeft;
10997 g_numberValues[NUM_4].f32 = options.bottomRight;
10998 return &g_attributeItem;
10999 }
11000
GetImageSpanSrc(ArkUI_NodeHandle node)11001 const ArkUI_AttributeItem* GetImageSpanSrc(ArkUI_NodeHandle node)
11002 {
11003 auto fullImpl = GetFullImpl();
11004 auto src = fullImpl->getNodeModifiers()->getImageModifier()->getImageSrc(node->uiNodeHandle);
11005 g_attributeItem.string = (src != nullptr ? src : EMPTY_STR.c_str());
11006 if (node->drawableDescriptor) {
11007 g_attributeItem.object = node->drawableDescriptor;
11008 }
11009 return &g_attributeItem;
11010 }
11011
GetVerticalAlign(ArkUI_NodeHandle node)11012 const ArkUI_AttributeItem* GetVerticalAlign(ArkUI_NodeHandle node)
11013 {
11014 auto fullImpl = GetFullImpl();
11015 auto verticalAlign =
11016 fullImpl->getNodeModifiers()->getImageSpanModifier()->getImageSpanVerticalAlign(node->uiNodeHandle);
11017 auto it = std::find(IMAGE_SPAN_ALIGNMENT_ARRAY.begin(), IMAGE_SPAN_ALIGNMENT_ARRAY.end(), verticalAlign);
11018 if (it != IMAGE_SPAN_ALIGNMENT_ARRAY.end()) {
11019 g_numberValues[0].i32 = std::distance(IMAGE_SPAN_ALIGNMENT_ARRAY.begin(), it);
11020 g_attributeItem.size = REQUIRED_ONE_PARAM;
11021 }
11022 return &g_attributeItem;
11023 }
11024
GetImageSrc(ArkUI_NodeHandle node)11025 const ArkUI_AttributeItem* GetImageSrc(ArkUI_NodeHandle node)
11026 {
11027 auto fullImpl = GetFullImpl();
11028 auto src = fullImpl->getNodeModifiers()->getImageModifier()->getImageSrc(node->uiNodeHandle);
11029 g_attributeItem.string = (src != nullptr ? src : EMPTY_STR.c_str());
11030 if (node->drawableDescriptor) {
11031 g_attributeItem.object = node->drawableDescriptor;
11032 }
11033 return &g_attributeItem;
11034 }
11035
GetObjectFit(ArkUI_NodeHandle node)11036 const ArkUI_AttributeItem* GetObjectFit(ArkUI_NodeHandle node)
11037 {
11038 auto fullImpl = GetFullImpl();
11039 auto resultValue = fullImpl->getNodeModifiers()->getImageModifier()->getObjectFit(node->uiNodeHandle);
11040 auto it = std::find(OBJECT_FIT_ARRAY.begin(), OBJECT_FIT_ARRAY.end(), resultValue);
11041 if (it != OBJECT_FIT_ARRAY.end()) {
11042 g_numberValues[0].i32 = std::distance(OBJECT_FIT_ARRAY.begin(), it);
11043 } else {
11044 g_numberValues[0].i32 = static_cast<int32_t>(ARKUI_OBJECT_FIT_COVER);
11045 }
11046 g_attributeItem.size = REQUIRED_ONE_PARAM;
11047 return &g_attributeItem;
11048 }
11049
GetInterpolation(ArkUI_NodeHandle node)11050 const ArkUI_AttributeItem* GetInterpolation(ArkUI_NodeHandle node)
11051 {
11052 auto fullImpl = GetFullImpl();
11053 auto interpolation = fullImpl->getNodeModifiers()->getImageModifier()->getImageInterpolation(node->uiNodeHandle);
11054 g_numberValues[0].i32 = interpolation;
11055 g_attributeItem.size = REQUIRED_ONE_PARAM;
11056 return &g_attributeItem;
11057 }
11058
GetObjectRepeat(ArkUI_NodeHandle node)11059 const ArkUI_AttributeItem* GetObjectRepeat(ArkUI_NodeHandle node)
11060 {
11061 auto fullImpl = GetFullImpl();
11062 auto objectRepeat = fullImpl->getNodeModifiers()->getImageModifier()->getObjectRepeat(node->uiNodeHandle);
11063 g_numberValues[0].i32 = objectRepeat;
11064 g_attributeItem.size = REQUIRED_ONE_PARAM;
11065 return &g_attributeItem;
11066 }
11067
GetColorFilter(ArkUI_NodeHandle node)11068 const ArkUI_AttributeItem* GetColorFilter(ArkUI_NodeHandle node)
11069 {
11070 auto fullImpl = GetFullImpl();
11071 auto colorFilter = fullImpl->getNodeModifiers()->getImageModifier()->getDrawingColorFilter(node->uiNodeHandle);
11072 if (colorFilter) {
11073 g_attributeItem.object = colorFilter;
11074 g_attributeItem.size = 0;
11075 return &g_attributeItem;
11076 }
11077 g_attributeItem.size = REQUIRED_TWENTY_PARAM;
11078 for (size_t i = 0; i < REQUIRED_TWENTY_PARAM; i++) {
11079 g_numberValues[i].f32 = 0;
11080 }
11081 ArkUIFilterColorType colorFilterType = { .filterArray = &g_numberValues[0].f32,
11082 .filterSize = REQUIRED_TWENTY_PARAM };
11083 fullImpl->getNodeModifiers()->getImageModifier()->getColorFilter(node->uiNodeHandle, &colorFilterType);
11084 return &g_attributeItem;
11085 }
11086
GetAutoResize(ArkUI_NodeHandle node)11087 const ArkUI_AttributeItem* GetAutoResize(ArkUI_NodeHandle node)
11088 {
11089 auto fullImpl = GetFullImpl();
11090 auto autoResize = fullImpl->getNodeModifiers()->getImageModifier()->getAutoResize(node->uiNodeHandle);
11091 g_numberValues[0].i32 = autoResize;
11092 g_attributeItem.size = REQUIRED_ONE_PARAM;
11093 return &g_attributeItem;
11094 }
11095
GetAlt(ArkUI_NodeHandle node)11096 const ArkUI_AttributeItem* GetAlt(ArkUI_NodeHandle node)
11097 {
11098 auto fullImpl = GetFullImpl();
11099 auto src = fullImpl->getNodeModifiers()->getImageModifier()->getAlt(node->uiNodeHandle);
11100 g_attributeItem.string = (src != nullptr ? src : EMPTY_STR.c_str());
11101 if (node->altDrawableDescriptor) {
11102 g_attributeItem.object = node->altDrawableDescriptor;
11103 }
11104 return &g_attributeItem;
11105 }
11106
GetImageDraggable(ArkUI_NodeHandle node)11107 const ArkUI_AttributeItem* GetImageDraggable(ArkUI_NodeHandle node)
11108 {
11109 auto fullImpl = GetFullImpl();
11110 auto draggable = fullImpl->getNodeModifiers()->getImageModifier()->getImageDraggable(node->uiNodeHandle);
11111 g_numberValues[0].i32 = draggable;
11112 g_attributeItem.size = REQUIRED_ONE_PARAM;
11113 return &g_attributeItem;
11114 }
11115
SetCheckboxSelect(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11116 int32_t SetCheckboxSelect(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11117 {
11118 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
11119 return ERROR_CODE_PARAM_INVALID;
11120 }
11121 GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->setSelect(node->uiNodeHandle, item->value[0].i32);
11122 return ERROR_CODE_NO_ERROR;
11123 }
11124
GetCheckboxSelect(ArkUI_NodeHandle node)11125 const ArkUI_AttributeItem* GetCheckboxSelect(ArkUI_NodeHandle node)
11126 {
11127 auto resultValue = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getSelect(node->uiNodeHandle);
11128 g_numberValues[0].i32 = resultValue;
11129 return &g_attributeItem;
11130 }
11131
ResetCheckboxSelect(ArkUI_NodeHandle node)11132 void ResetCheckboxSelect(ArkUI_NodeHandle node)
11133 {
11134 GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->resetSelect(node->uiNodeHandle);
11135 }
11136
SetCheckboxSelectedColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11137 int32_t SetCheckboxSelectedColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11138 {
11139 if (item->size == 0) {
11140 return ERROR_CODE_PARAM_INVALID;
11141 }
11142 GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->setSelectedColor(node->uiNodeHandle, item->value[0].u32);
11143 return ERROR_CODE_NO_ERROR;
11144 }
11145
GetCheckboxSelectedColor(ArkUI_NodeHandle node)11146 const ArkUI_AttributeItem* GetCheckboxSelectedColor(ArkUI_NodeHandle node)
11147 {
11148 auto resultValue = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getSelectedColor(node->uiNodeHandle);
11149 g_numberValues[0].u32 = resultValue;
11150 return &g_attributeItem;
11151 }
11152
ResetCheckboxSelectedColor(ArkUI_NodeHandle node)11153 void ResetCheckboxSelectedColor(ArkUI_NodeHandle node)
11154 {
11155 GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->resetSelectedColor(node->uiNodeHandle);
11156 }
11157
SetCheckboxUnSelectedColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11158 int32_t SetCheckboxUnSelectedColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11159 {
11160 if (item->size == 0) {
11161 return ERROR_CODE_PARAM_INVALID;
11162 }
11163 GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->setUnSelectedColor(
11164 node->uiNodeHandle, item->value[0].u32);
11165 return ERROR_CODE_NO_ERROR;
11166 }
11167
GetCheckboxUnSelectedColor(ArkUI_NodeHandle node)11168 const ArkUI_AttributeItem* GetCheckboxUnSelectedColor(ArkUI_NodeHandle node)
11169 {
11170 auto resultValue = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getUnSelectedColor(node->uiNodeHandle);
11171 g_numberValues[0].u32 = resultValue;
11172 return &g_attributeItem;
11173 }
11174
ResetCheckboxUnSelectedColor(ArkUI_NodeHandle node)11175 void ResetCheckboxUnSelectedColor(ArkUI_NodeHandle node)
11176 {
11177 GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->resetUnSelectedColor(node->uiNodeHandle);
11178 }
11179
SetCheckboxMark(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11180 int32_t SetCheckboxMark(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11181 {
11182 if (item->size == 0) {
11183 return ERROR_CODE_PARAM_INVALID;
11184 }
11185 // defalut white
11186 int strokeColor = item->value[0].u32;
11187 double size = -1;
11188 if (item->size > 1) {
11189 //check 2 for size
11190 if (LessNotEqual(item->value[1].f32, 0.0f)) {
11191 return ERROR_CODE_PARAM_INVALID;
11192 }
11193 //set 2 for size
11194 size = item->value[1].f32;
11195 }
11196 // defalut 2
11197 double strokeWidth = 2;
11198 if (item->size > ALLOW_SIZE_2) {
11199 //check 2 for strokeWidth
11200 if (LessNotEqual(item->value[2].f32, 0.0f)) {
11201 return ERROR_CODE_PARAM_INVALID;
11202 }
11203 //set 2 for strokeWidth
11204 strokeWidth = item->value[2].f32;
11205 }
11206 int32_t unit = GetDefaultUnit(node, UNIT_VP);
11207 GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->setMark(
11208 node->uiNodeHandle, strokeColor, size, unit, strokeWidth, unit);
11209 return ERROR_CODE_NO_ERROR;
11210 }
11211
GetCheckboxMark(ArkUI_NodeHandle node)11212 const ArkUI_AttributeItem* GetCheckboxMark(ArkUI_NodeHandle node)
11213 {
11214 auto strokeColor = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getCheckMarkColor(node->uiNodeHandle);
11215 auto size = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getCheckMarkSize(node->uiNodeHandle);
11216 auto strokeWidth = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getCheckMarkWidth(node->uiNodeHandle);
11217 int index = 0;
11218 g_numberValues[index++].u32 = strokeColor;
11219 g_numberValues[index++].f32 = size;
11220 g_numberValues[index++].f32 = strokeWidth;
11221 g_attributeItem.size = index;
11222 return &g_attributeItem;
11223 }
11224
ResetCheckboxMark(ArkUI_NodeHandle node)11225 void ResetCheckboxMark(ArkUI_NodeHandle node)
11226 {
11227 GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->resetMark(node->uiNodeHandle);
11228 }
11229
SetCheckboxShape(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11230 int32_t SetCheckboxShape(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11231 {
11232 if (item->size == 0 || !CheckAttributeIsCheckboxShape(item->value[0].i32)) {
11233 return ERROR_CODE_PARAM_INVALID;
11234 }
11235 GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->setCheckboxShape(node->uiNodeHandle, item->value[0].i32);
11236 return ERROR_CODE_NO_ERROR;
11237 }
11238
GetCheckboxShape(ArkUI_NodeHandle node)11239 const ArkUI_AttributeItem* GetCheckboxShape(ArkUI_NodeHandle node)
11240 {
11241 auto resultValue = GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->getCheckboxShape(node->uiNodeHandle);
11242 g_numberValues[0].i32 = resultValue;
11243 return &g_attributeItem;
11244 }
11245
ResetCheckboxShape(ArkUI_NodeHandle node)11246 void ResetCheckboxShape(ArkUI_NodeHandle node)
11247 {
11248 GetFullImpl()->getNodeModifiers()->getCheckboxModifier()->resetCheckboxShape(node->uiNodeHandle);
11249 }
11250
SetSliderBlockColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11251 int32_t SetSliderBlockColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11252 {
11253 if (item->size == 0) {
11254 return ERROR_CODE_PARAM_INVALID;
11255 }
11256
11257 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setBlockColor(node->uiNodeHandle, item->value[0].u32);
11258 return ERROR_CODE_NO_ERROR;
11259 }
11260
GetSliderBlockColor(ArkUI_NodeHandle node)11261 const ArkUI_AttributeItem* GetSliderBlockColor(ArkUI_NodeHandle node)
11262 {
11263 auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getBlockColor(node->uiNodeHandle);
11264 g_numberValues[0].u32 = resultValue;
11265 return &g_attributeItem;
11266 }
11267
ResetSliderBlockColor(ArkUI_NodeHandle node)11268 void ResetSliderBlockColor(ArkUI_NodeHandle node)
11269 {
11270 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetBlockColor(node->uiNodeHandle);
11271 }
11272
SetSliderTrackColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11273 int32_t SetSliderTrackColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11274 {
11275 if (item->size == 0) {
11276 return ERROR_CODE_PARAM_INVALID;
11277 }
11278 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setTrackBackgroundColor(
11279 node->uiNodeHandle, item->value[0].u32);
11280 return ERROR_CODE_NO_ERROR;
11281 }
11282
GetSliderTrackColor(ArkUI_NodeHandle node)11283 const ArkUI_AttributeItem* GetSliderTrackColor(ArkUI_NodeHandle node)
11284 {
11285 auto resultValue =
11286 GetFullImpl()->getNodeModifiers()->getSliderModifier()->getTrackBackgroundColor(node->uiNodeHandle);
11287 g_numberValues[0].u32 = resultValue;
11288 return &g_attributeItem;
11289 }
11290
ResetSliderTrackColor(ArkUI_NodeHandle node)11291 void ResetSliderTrackColor(ArkUI_NodeHandle node)
11292 {
11293 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetTrackBackgroundColor(node->uiNodeHandle);
11294 }
11295
SetSliderSelectedColor(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11296 int32_t SetSliderSelectedColor(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11297 {
11298 if (item->size == 0) {
11299 return ERROR_CODE_PARAM_INVALID;
11300 }
11301 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setSelectColor(node->uiNodeHandle, item->value[0].u32);
11302 return ERROR_CODE_NO_ERROR;
11303 }
11304
GetSliderSelectedColor(ArkUI_NodeHandle node)11305 const ArkUI_AttributeItem* GetSliderSelectedColor(ArkUI_NodeHandle node)
11306 {
11307 auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getSelectColor(node->uiNodeHandle);
11308 g_numberValues[0].u32 = resultValue;
11309 return &g_attributeItem;
11310 }
11311
ResetSliderSelectedColor(ArkUI_NodeHandle node)11312 void ResetSliderSelectedColor(ArkUI_NodeHandle node)
11313 {
11314 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSelectColor(node->uiNodeHandle);
11315 }
11316
SetSliderShowSteps(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11317 int32_t SetSliderShowSteps(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11318 {
11319 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
11320 return ERROR_CODE_PARAM_INVALID;
11321 }
11322 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setShowSteps(node->uiNodeHandle, item->value[0].i32);
11323 return ERROR_CODE_NO_ERROR;
11324 }
11325
GetSliderShowSteps(ArkUI_NodeHandle node)11326 const ArkUI_AttributeItem* GetSliderShowSteps(ArkUI_NodeHandle node)
11327 {
11328 auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getShowSteps(node->uiNodeHandle);
11329 g_numberValues[0].i32 = resultValue;
11330 return &g_attributeItem;
11331 }
11332
ResetSliderShowSteps(ArkUI_NodeHandle node)11333 void ResetSliderShowSteps(ArkUI_NodeHandle node)
11334 {
11335 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetShowSteps(node->uiNodeHandle);
11336 }
11337
SetSliderBlockStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11338 int32_t SetSliderBlockStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11339 {
11340 if (item->size == 0 || !CheckAttributeIsSliderBlockStyle(item->value[0].i32)) {
11341 return ERROR_CODE_PARAM_INVALID;
11342 }
11343 int style = item->value[0].i32;
11344
11345 if (style == NUM_1) {
11346 if (item->string == nullptr) {
11347 return ERROR_CODE_PARAM_INVALID;
11348 }
11349 // image
11350 std::string src(item->string);
11351 std::string bundle;
11352 std::string module;
11353 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setSliderBlockImage(
11354 node->uiNodeHandle, src.c_str(), bundle.c_str(), module.c_str());
11355 } else if (style == NUM_2) {
11356 auto* fullImpl = GetFullImpl();
11357 if (item->value[1].i32 == ArkUI_ClipType::ARKUI_CLIP_TYPE_PATH) {
11358 ArkUI_Float32 pathAttributes[NUM_2];
11359 if (LessNotEqual(item->value[NUM_2].f32, 0.0f) || LessNotEqual(item->value[NUM_3].f32, 0.0f)) {
11360 return ERROR_CODE_PARAM_INVALID;
11361 } else {
11362 pathAttributes[NUM_0] = item->value[NUM_2].f32;
11363 pathAttributes[NUM_1] = item->value[NUM_3].f32;
11364 }
11365
11366 fullImpl->getNodeModifiers()->getSliderModifier()->setSliderBlockPath(
11367 node->uiNodeHandle, "path", &pathAttributes, item->string);
11368 } else {
11369 ArkUI_Float32 attributes[item->size - NUM_2];
11370 for (int i = NUM_2; i < item->size; i++) {
11371 if (LessNotEqual(item->value[i].f32, 0.0f)) {
11372 return ERROR_CODE_PARAM_INVALID;
11373 } else {
11374 attributes[i - NUM_2] = item->value[i].f32;
11375 }
11376 }
11377 fullImpl->getNodeModifiers()->getSliderModifier()->setSliderBlockShape(
11378 node->uiNodeHandle, ShapeToString(item->value[1].i32).c_str(), attributes, item->size - NUM_2);
11379 }
11380 }
11381 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setSliderBlockType(node->uiNodeHandle, style);
11382 return ERROR_CODE_NO_ERROR;
11383 }
11384
GetSliderBlockStyle(ArkUI_NodeHandle node)11385 const ArkUI_AttributeItem* GetSliderBlockStyle(ArkUI_NodeHandle node)
11386 {
11387 auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getBlockType(node->uiNodeHandle);
11388 //index 0 style
11389 g_numberValues[0].i32 = resultValue;
11390 switch (resultValue) {
11391 case NUM_1: {
11392 auto imageValue =
11393 GetFullImpl()->getNodeModifiers()->getSliderModifier()->getBlockImageValue(node->uiNodeHandle);
11394 g_attributeItem.string = imageValue;
11395 break;
11396 }
11397 case NUM_2: {
11398 ArkUI_Float32 values[NUM_5];
11399 auto pathCommands = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getSliderBlockShape(
11400 node->uiNodeHandle, &values);
11401 //index 1 shapeType
11402 g_numberValues[1].i32 = values[0];
11403 //index 2 width
11404 g_numberValues[2].f32 = values[1];
11405 //index 3 height
11406 g_numberValues[3].f32 = values[2];
11407 g_attributeItem.size = NUM_3;
11408 ArkUI_ShapeType shapeType = static_cast<ArkUI_ShapeType>(values[0]);
11409 if (shapeType == ArkUI_ShapeType::ARKUI_SHAPE_TYPE_RECTANGLE) {
11410 //index 4 width
11411 g_numberValues[4].f32 = values[3];
11412 //index 5 height
11413 g_numberValues[5].f32 = values[4];
11414 g_attributeItem.size = NUM_6;
11415 } else if (shapeType == ArkUI_ShapeType::ARKUI_SHAPE_TYPE_PATH) {
11416 g_attributeItem.string = pathCommands;
11417 }
11418 break;
11419 }
11420 default:
11421 break;
11422 }
11423
11424 return &g_attributeItem;
11425 }
11426
ResetSliderBlockStyle(ArkUI_NodeHandle node)11427 void ResetSliderBlockStyle(ArkUI_NodeHandle node)
11428 {
11429 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSliderBlockImage(node->uiNodeHandle);
11430 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSliderBlockShape(node->uiNodeHandle);
11431 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSliderBlockType(node->uiNodeHandle);
11432 }
11433
SetSliderValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11434 int32_t SetSliderValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11435 {
11436 if (item->size == 0) {
11437 return ERROR_CODE_PARAM_INVALID;
11438 }
11439 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setSliderValue(node->uiNodeHandle, item->value[0].f32);
11440 return ERROR_CODE_NO_ERROR;
11441 }
11442
GetSliderValue(ArkUI_NodeHandle node)11443 const ArkUI_AttributeItem* GetSliderValue(ArkUI_NodeHandle node)
11444 {
11445 auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getSliderValue(node->uiNodeHandle);
11446 g_numberValues[0].f32 = resultValue;
11447 return &g_attributeItem;
11448 }
11449
ResetSliderValue(ArkUI_NodeHandle node)11450 void ResetSliderValue(ArkUI_NodeHandle node)
11451 {
11452 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSliderValue(node->uiNodeHandle);
11453 }
11454
SetSliderMinValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11455 int32_t SetSliderMinValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11456 {
11457 if (item->size == 0) {
11458 return ERROR_CODE_PARAM_INVALID;
11459 }
11460 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setMinLabel(node->uiNodeHandle, item->value[0].f32);
11461 return ERROR_CODE_NO_ERROR;
11462 }
11463
GetSliderMinValue(ArkUI_NodeHandle node)11464 const ArkUI_AttributeItem* GetSliderMinValue(ArkUI_NodeHandle node)
11465 {
11466 auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getMinLabel(node->uiNodeHandle);
11467 g_numberValues[0].f32 = resultValue;
11468 return &g_attributeItem;
11469 }
11470
ResetSliderMinValue(ArkUI_NodeHandle node)11471 void ResetSliderMinValue(ArkUI_NodeHandle node)
11472 {
11473 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetMinLabel(node->uiNodeHandle);
11474 }
11475
SetSliderMaxValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11476 int32_t SetSliderMaxValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11477 {
11478 if (item->size == 0) {
11479 return ERROR_CODE_PARAM_INVALID;
11480 }
11481 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setMaxLabel(node->uiNodeHandle, item->value[0].f32);
11482 return ERROR_CODE_NO_ERROR;
11483 }
11484
GetSliderMaxValue(ArkUI_NodeHandle node)11485 const ArkUI_AttributeItem* GetSliderMaxValue(ArkUI_NodeHandle node)
11486 {
11487 auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getMaxLabel(node->uiNodeHandle);
11488 g_numberValues[0].f32 = resultValue;
11489 return &g_attributeItem;
11490 }
11491
ResetSliderMaxValue(ArkUI_NodeHandle node)11492 void ResetSliderMaxValue(ArkUI_NodeHandle node)
11493 {
11494 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetMaxLabel(node->uiNodeHandle);
11495 }
11496
SetSliderStep(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11497 int32_t SetSliderStep(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11498 {
11499 if (item->size == 0 || LessNotEqual(item->value[0].f32, SLIDER_STEP_MIN_F)) {
11500 return ERROR_CODE_PARAM_INVALID;
11501 }
11502 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setStep(node->uiNodeHandle, item->value[0].f32);
11503 return ERROR_CODE_NO_ERROR;
11504 }
11505
GetSliderStep(ArkUI_NodeHandle node)11506 const ArkUI_AttributeItem* GetSliderStep(ArkUI_NodeHandle node)
11507 {
11508 auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getStep(node->uiNodeHandle);
11509 g_numberValues[0].f32 = resultValue;
11510 return &g_attributeItem;
11511 }
11512
ResetSliderStep(ArkUI_NodeHandle node)11513 void ResetSliderStep(ArkUI_NodeHandle node)
11514 {
11515 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetStep(node->uiNodeHandle);
11516 }
11517
SetSliderDirection(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11518 int32_t SetSliderDirection(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11519 {
11520 if (item->size == 0 || !CheckAttributeIsSliderDirection(item->value[0].i32)) {
11521 return ERROR_CODE_PARAM_INVALID;
11522 }
11523 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setDirection(node->uiNodeHandle, item->value[0].i32);
11524 return ERROR_CODE_NO_ERROR;
11525 }
11526
GetSliderDirection(ArkUI_NodeHandle node)11527 const ArkUI_AttributeItem* GetSliderDirection(ArkUI_NodeHandle node)
11528 {
11529 auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getDirection(node->uiNodeHandle);
11530 g_numberValues[0].i32 = resultValue;
11531 return &g_attributeItem;
11532 }
11533
ResetSliderDirection(ArkUI_NodeHandle node)11534 void ResetSliderDirection(ArkUI_NodeHandle node)
11535 {
11536 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetDirection(node->uiNodeHandle);
11537 }
11538
SetSliderReverse(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11539 int32_t SetSliderReverse(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11540 {
11541 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
11542 return ERROR_CODE_PARAM_INVALID;
11543 }
11544 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setReverse(node->uiNodeHandle, item->value[0].i32);
11545 return ERROR_CODE_NO_ERROR;
11546 }
11547
GetSliderReverse(ArkUI_NodeHandle node)11548 const ArkUI_AttributeItem* GetSliderReverse(ArkUI_NodeHandle node)
11549 {
11550 auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getReverse(node->uiNodeHandle);
11551 g_numberValues[0].i32 = resultValue;
11552 return &g_attributeItem;
11553 }
11554
ResetSliderReverse(ArkUI_NodeHandle node)11555 void ResetSliderReverse(ArkUI_NodeHandle node)
11556 {
11557 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetReverse(node->uiNodeHandle);
11558 }
11559
SetSliderStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11560 int32_t SetSliderStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11561 {
11562 if (item->size == 0 || !CheckAttributeIsSliderStyle(item->value[0].i32)) {
11563 return ERROR_CODE_PARAM_INVALID;
11564 }
11565 GetFullImpl()->getNodeModifiers()->getSliderModifier()->setSliderStyle(node->uiNodeHandle, item->value[0].i32);
11566 return ERROR_CODE_NO_ERROR;
11567 }
11568
GetSliderStyle(ArkUI_NodeHandle node)11569 const ArkUI_AttributeItem* GetSliderStyle(ArkUI_NodeHandle node)
11570 {
11571 auto resultValue = GetFullImpl()->getNodeModifiers()->getSliderModifier()->getSliderStyle(node->uiNodeHandle);
11572 g_numberValues[0].i32 = resultValue;
11573 return &g_attributeItem;
11574 }
11575
ResetSliderStyle(ArkUI_NodeHandle node)11576 void ResetSliderStyle(ArkUI_NodeHandle node)
11577 {
11578 GetFullImpl()->getNodeModifiers()->getSliderModifier()->resetSliderStyle(node->uiNodeHandle);
11579 }
11580
SetSliderTrackThickness(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11581 int32_t SetSliderTrackThickness(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11582 {
11583 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
11584 if (LessNotEqual(actualSize, 0) || LessOrEqual(item->value[NUM_0].f32, 0.0f)) {
11585 return ERROR_CODE_PARAM_INVALID;
11586 }
11587
11588 auto* fullImpl = GetFullImpl();
11589 fullImpl->getNodeModifiers()->getSliderModifier()->setThickness(
11590 node->uiNodeHandle, item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP));
11591 return ERROR_CODE_NO_ERROR;
11592 }
11593
GetSliderTrackThickness(ArkUI_NodeHandle node)11594 const ArkUI_AttributeItem* GetSliderTrackThickness(ArkUI_NodeHandle node)
11595 {
11596 auto modifier = GetFullImpl()->getNodeModifiers()->getSliderModifier();
11597 g_numberValues[0].f32 = modifier->getThickness(node->uiNodeHandle, GetDefaultUnit(node, UNIT_VP));
11598 if (LessOrEqual(g_numberValues[0].f32, 0.0f)) {
11599 return nullptr;
11600 }
11601 return &g_attributeItem;
11602 }
11603
ResetSliderTrackThickness(ArkUI_NodeHandle node)11604 void ResetSliderTrackThickness(ArkUI_NodeHandle node)
11605 {
11606 auto* fullImpl = GetFullImpl();
11607 fullImpl->getNodeModifiers()->getSliderModifier()->resetThickness(node->uiNodeHandle);
11608 }
11609
SetSliderValidSlideRange(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11610 int32_t SetSliderValidSlideRange(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11611 {
11612 if (!item || std::isnan(item->value[NUM_0].f32) || std::isnan(item->value[NUM_1].f32)) {
11613 return ERROR_CODE_PARAM_INVALID;
11614 }
11615
11616 auto* fullImpl = GetFullImpl();
11617 fullImpl->getNodeModifiers()->getSliderModifier()->setSliderValidSlideRange(
11618 node->uiNodeHandle, item->value[NUM_0].f32, item->value[NUM_1].f32);
11619 return ERROR_CODE_NO_ERROR;
11620 }
11621
GetSliderValidSlideRange(ArkUI_NodeHandle node)11622 const ArkUI_AttributeItem* GetSliderValidSlideRange(ArkUI_NodeHandle node)
11623 {
11624 auto modifier = GetFullImpl()->getNodeModifiers()->getSliderModifier();
11625 ArkUISliderValidSlideRange validRange = modifier->getSliderValidSlideRange(node->uiNodeHandle);
11626 if (std::isnan(validRange.from) || std::isnan(validRange.to)) {
11627 return nullptr;
11628 }
11629 g_numberValues[NUM_0].f32 = validRange.from;
11630 g_numberValues[NUM_1].f32 = validRange.to;
11631 return &g_attributeItem;
11632 }
11633
ResetSliderValidSlideRange(ArkUI_NodeHandle node)11634 void ResetSliderValidSlideRange(ArkUI_NodeHandle node)
11635 {
11636 auto* fullImpl = GetFullImpl();
11637 fullImpl->getNodeModifiers()->getSliderModifier()->resetSliderValidSlideRange(node->uiNodeHandle);
11638 }
11639
SetRefreshRefreshing(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11640 int32_t SetRefreshRefreshing(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11641 {
11642 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
11643 return ERROR_CODE_PARAM_INVALID;
11644 }
11645 GetFullImpl()->getNodeModifiers()->getRefreshModifier()->setRefreshing(
11646 node->uiNodeHandle, item->value[0].i32);
11647 return ERROR_CODE_NO_ERROR;
11648 }
11649
GetRefreshRefreshing(ArkUI_NodeHandle node)11650 const ArkUI_AttributeItem* GetRefreshRefreshing(ArkUI_NodeHandle node)
11651 {
11652 auto resultValue = GetFullImpl()->getNodeModifiers()->getRefreshModifier()->getRefreshing(node->uiNodeHandle);
11653 g_numberValues[0].i32 = resultValue;
11654 return &g_attributeItem;
11655 }
11656
SetRefreshContent(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11657 int32_t SetRefreshContent(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11658 {
11659 if (!item->object) {
11660 return ERROR_CODE_PARAM_INVALID;
11661 }
11662 auto fullImpl = GetFullImpl();
11663 auto contentNodeHandle = reinterpret_cast<ArkUI_NodeHandle>(item->object);
11664 fullImpl->getNodeModifiers()->getRefreshModifier()->setRefreshContent(
11665 node->uiNodeHandle, contentNodeHandle->uiNodeHandle);
11666 return ERROR_CODE_NO_ERROR;
11667 }
11668
ResetRefreshContent(ArkUI_NodeHandle node)11669 void ResetRefreshContent(ArkUI_NodeHandle node)
11670 {
11671 GetFullImpl()->getNodeModifiers()->getRefreshModifier()->setRefreshContent(node->uiNodeHandle, nullptr);
11672 }
11673
SetRefreshPullDownRatio(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11674 int32_t SetRefreshPullDownRatio(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11675 {
11676 if (item->size == 0) {
11677 return ERROR_CODE_PARAM_INVALID;
11678 }
11679 if (LessNotEqual(item->value[0].f32, 0.0f) || GreatNotEqual(item->value[0].f32, 1.0f)) {
11680 return ERROR_CODE_PARAM_INVALID;
11681 }
11682 // already check in entry point.
11683 auto* fullImpl = GetFullImpl();
11684 fullImpl->getNodeModifiers()->getRefreshModifier()->setPullDownRatio(node->uiNodeHandle, item->value[0].f32);
11685 return ERROR_CODE_NO_ERROR;
11686 }
11687
ResetRefreshPullDownRatio(ArkUI_NodeHandle node)11688 void ResetRefreshPullDownRatio(ArkUI_NodeHandle node)
11689 {
11690 auto* fullImpl = GetFullImpl();
11691 fullImpl->getNodeModifiers()->getRefreshModifier()->resetPullDownRatio(node->uiNodeHandle);
11692 }
11693
GetRefreshPullDownRatio(ArkUI_NodeHandle node)11694 const ArkUI_AttributeItem* GetRefreshPullDownRatio(ArkUI_NodeHandle node)
11695 {
11696 auto resultValue = GetFullImpl()->getNodeModifiers()->getRefreshModifier()->getPullDownRatio(node->uiNodeHandle);
11697 g_numberValues[0].f32 = resultValue;
11698 return &g_attributeItem;
11699 }
11700
SetRefreshOffset(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11701 int32_t SetRefreshOffset(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11702 {
11703 if (item->size == 0) {
11704 return ERROR_CODE_PARAM_INVALID;
11705 }
11706 if (LessOrEqual(item->value[0].f32, 0.0f)) {
11707 return ERROR_CODE_PARAM_INVALID;
11708 }
11709 // already check in entry point.
11710 auto* fullImpl = GetFullImpl();
11711 int32_t unit = GetDefaultUnit(node, UNIT_VP);
11712 fullImpl->getNodeModifiers()->getRefreshModifier()->setRefreshOffset(node->uiNodeHandle, item->value[0].f32, unit);
11713 return ERROR_CODE_NO_ERROR;
11714 }
11715
ResetRefreshOffset(ArkUI_NodeHandle node)11716 void ResetRefreshOffset(ArkUI_NodeHandle node)
11717 {
11718 auto* fullImpl = GetFullImpl();
11719 fullImpl->getNodeModifiers()->getRefreshModifier()->resetRefreshOffset(node->uiNodeHandle);
11720 }
11721
GetRefreshOffset(ArkUI_NodeHandle node)11722 const ArkUI_AttributeItem* GetRefreshOffset(ArkUI_NodeHandle node)
11723 {
11724 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
11725 auto resultValue =
11726 GetFullImpl()->getNodeModifiers()->getRefreshModifier()->getRefreshOffset(node->uiNodeHandle, unit);
11727 g_numberValues[0].f32 = resultValue;
11728 return &g_attributeItem;
11729 }
11730
SetPullToRefresh(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11731 int32_t SetPullToRefresh(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11732 {
11733 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
11734 return ERROR_CODE_PARAM_INVALID;
11735 }
11736 GetFullImpl()->getNodeModifiers()->getRefreshModifier()->setPullToRefresh(
11737 node->uiNodeHandle, item->value[0].i32);
11738 return ERROR_CODE_NO_ERROR;
11739 }
11740
ResetPullToRefresh(ArkUI_NodeHandle node)11741 void ResetPullToRefresh(ArkUI_NodeHandle node)
11742 {
11743 auto* fullImpl = GetFullImpl();
11744 fullImpl->getNodeModifiers()->getRefreshModifier()->resetPullToRefresh(node->uiNodeHandle);
11745 }
11746
GetPullToRefresh(ArkUI_NodeHandle node)11747 const ArkUI_AttributeItem* GetPullToRefresh(ArkUI_NodeHandle node)
11748 {
11749 auto resultValue = GetFullImpl()->getNodeModifiers()->getRefreshModifier()->getPullToRefresh(node->uiNodeHandle);
11750 g_numberValues[0].i32 = resultValue;
11751 return &g_attributeItem;
11752 }
11753 // waterFlow attribute
SetLayoutDirection(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11754 int32_t SetLayoutDirection(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11755 {
11756 if (item->size == 0) {
11757 return ERROR_CODE_PARAM_INVALID;
11758 }
11759 if (!InRegion(NUM_0, NUM_3, item->value[NUM_0].i32)) {
11760 return ERROR_CODE_PARAM_INVALID;
11761 }
11762 auto* fullImpl = GetFullImpl();
11763 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setLayoutDirection(node->uiNodeHandle, item->value[0].i32);
11764 return ERROR_CODE_NO_ERROR;
11765 }
11766
ResetLayoutDirection(ArkUI_NodeHandle node)11767 void ResetLayoutDirection(ArkUI_NodeHandle node)
11768 {
11769 auto* fullImpl = GetFullImpl();
11770 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetLayoutDirection(node->uiNodeHandle);
11771 }
11772
GetLayoutDirection(ArkUI_NodeHandle node)11773 const ArkUI_AttributeItem* GetLayoutDirection(ArkUI_NodeHandle node)
11774 {
11775 auto modifier = GetFullImpl()->getNodeModifiers()->getWaterFlowModifier();
11776 g_numberValues[0].i32 = modifier->getLayoutDirection(node->uiNodeHandle);
11777 return &g_attributeItem;
11778 }
11779
SetColumnsTemplate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11780 int32_t SetColumnsTemplate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11781 {
11782 auto* fullImpl = GetFullImpl();
11783 if (!CheckAttributeString(item)) {
11784 return ERROR_CODE_PARAM_INVALID;
11785 }
11786 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setColumnsTemplate(node->uiNodeHandle, item->string);
11787 return ERROR_CODE_NO_ERROR;
11788 }
11789
ResetColumnsTemplate(ArkUI_NodeHandle node)11790 void ResetColumnsTemplate(ArkUI_NodeHandle node)
11791 {
11792 auto* fullImpl = GetFullImpl();
11793 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetColumnsTemplate(node->uiNodeHandle);
11794 }
11795
GetColumnsTemplate(ArkUI_NodeHandle node)11796 const ArkUI_AttributeItem* GetColumnsTemplate(ArkUI_NodeHandle node)
11797 {
11798 auto fullImpl = GetFullImpl();
11799 auto columnsTemplate = fullImpl->getNodeModifiers()->getWaterFlowModifier()->getColumnsTemplate(node->uiNodeHandle);
11800 g_attributeItem.string = columnsTemplate;
11801 return &g_attributeItem;
11802 }
11803
SetRowsTemplate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11804 int32_t SetRowsTemplate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11805 {
11806 auto* fullImpl = GetFullImpl();
11807 if (!CheckAttributeString(item)) {
11808 return ERROR_CODE_PARAM_INVALID;
11809 }
11810 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setRowsTemplate(node->uiNodeHandle, item->string);
11811 return ERROR_CODE_NO_ERROR;
11812 }
11813
ResetRowsTemplate(ArkUI_NodeHandle node)11814 void ResetRowsTemplate(ArkUI_NodeHandle node)
11815 {
11816 auto* fullImpl = GetFullImpl();
11817 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setRowsTemplate(node->uiNodeHandle, "1fr");
11818 }
11819
GetRowsTemplate(ArkUI_NodeHandle node)11820 const ArkUI_AttributeItem* GetRowsTemplate(ArkUI_NodeHandle node)
11821 {
11822 auto fullImpl = GetFullImpl();
11823 auto rowsTemplate = fullImpl->getNodeModifiers()->getWaterFlowModifier()->getRowsTemplate(node->uiNodeHandle);
11824 g_attributeItem.string = rowsTemplate;
11825 return &g_attributeItem;
11826 }
11827
SetWaterFlowColumnsGap(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11828 int32_t SetWaterFlowColumnsGap(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11829 {
11830 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
11831 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
11832 return ERROR_CODE_PARAM_INVALID;
11833 }
11834 auto* fullImpl = GetFullImpl();
11835
11836 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setColumnsGap(
11837 node->uiNodeHandle, item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr);
11838 return ERROR_CODE_NO_ERROR;
11839 }
11840
ResetWaterFlowColumnsGap(ArkUI_NodeHandle node)11841 void ResetWaterFlowColumnsGap(ArkUI_NodeHandle node)
11842 {
11843 auto* fullImpl = GetFullImpl();
11844 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetColumnsGap(node->uiNodeHandle);
11845 }
11846
GetWaterFlowColumnsGap(ArkUI_NodeHandle node)11847 const ArkUI_AttributeItem* GetWaterFlowColumnsGap(ArkUI_NodeHandle node)
11848 {
11849 auto modifier = GetFullImpl()->getNodeModifiers()->getWaterFlowModifier();
11850 g_numberValues[0].f32 = modifier->getColumnsGap(node->uiNodeHandle);
11851 return &g_attributeItem;
11852 }
11853
SetWaterFlowRowsGap(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11854 int32_t SetWaterFlowRowsGap(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11855 {
11856 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
11857 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
11858 return ERROR_CODE_PARAM_INVALID;
11859 }
11860 auto* fullImpl = GetFullImpl();
11861 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setRowsGap(
11862 node->uiNodeHandle, item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr);
11863 return ERROR_CODE_NO_ERROR;
11864 }
11865
ResetWaterFlowRowsGap(ArkUI_NodeHandle node)11866 void ResetWaterFlowRowsGap(ArkUI_NodeHandle node)
11867 {
11868 auto* fullImpl = GetFullImpl();
11869 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetRowsGap(node->uiNodeHandle);
11870 }
11871
GetWaterFlowRowsGap(ArkUI_NodeHandle node)11872 const ArkUI_AttributeItem* GetWaterFlowRowsGap(ArkUI_NodeHandle node)
11873 {
11874 auto modifier = GetFullImpl()->getNodeModifiers()->getWaterFlowModifier();
11875 g_numberValues[0].f32 = modifier->getRowsGap(node->uiNodeHandle);
11876 return &g_attributeItem;
11877 }
11878
SetWaterFlowNodeAdapter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11879 int32_t SetWaterFlowNodeAdapter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11880 {
11881 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
11882 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
11883 auto* nodeAdapter = reinterpret_cast<ArkUINodeAdapterHandle>(item->object);
11884 return GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->setNodeAdapter(node->uiNodeHandle, nodeAdapter);
11885 }
11886
ResetWaterFlowNodeAdapter(ArkUI_NodeHandle node)11887 void ResetWaterFlowNodeAdapter(ArkUI_NodeHandle node)
11888 {
11889 // already check in entry point.
11890 auto* fullImpl = GetFullImpl();
11891
11892 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetNodeAdapter(node->uiNodeHandle);
11893 }
11894
GetWaterFlowNodeAdapter(ArkUI_NodeHandle node)11895 const ArkUI_AttributeItem* GetWaterFlowNodeAdapter(ArkUI_NodeHandle node)
11896 {
11897 ArkUINodeAdapterHandle adapter =
11898 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getNodeAdapter(node->uiNodeHandle);
11899 g_attributeItem.object = reinterpret_cast<void*>(adapter);
11900 return &g_attributeItem;
11901 }
11902
SetWaterFlowCachedCount(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11903 int32_t SetWaterFlowCachedCount(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11904 {
11905 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
11906 if (item->size != 1) {
11907 return ERROR_CODE_PARAM_INVALID;
11908 }
11909 if (LessNotEqual(item->value[0].i32, NUM_0)) {
11910 return ERROR_CODE_PARAM_INVALID;
11911 }
11912 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->setCachedCount(node->uiNodeHandle, item->value[0].i32);
11913 return ERROR_CODE_NO_ERROR;
11914 }
11915
ResetWaterFlowCachedCount(ArkUI_NodeHandle node)11916 void ResetWaterFlowCachedCount(ArkUI_NodeHandle node)
11917 {
11918 // already check in entry point.
11919 auto* fullImpl = GetFullImpl();
11920
11921 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetCachedCount(node->uiNodeHandle);
11922 }
11923
GetWaterFlowCachedCount(ArkUI_NodeHandle node)11924 const ArkUI_AttributeItem* GetWaterFlowCachedCount(ArkUI_NodeHandle node)
11925 {
11926 ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getCachedCount(node->uiNodeHandle);
11927 g_numberValues[0].i32 = value;
11928 return &g_attributeItem;
11929 }
11930
SetWaterFlowFooter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11931 int32_t SetWaterFlowFooter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11932 {
11933 if (!item->object) {
11934 return ERROR_CODE_PARAM_INVALID;
11935 }
11936 auto fullImpl = GetFullImpl();
11937 auto footerNodeHandle = reinterpret_cast<ArkUI_NodeHandle>(item->object);
11938 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setWaterflowFooter(
11939 node->uiNodeHandle, footerNodeHandle->uiNodeHandle);
11940 return ERROR_CODE_NO_ERROR;
11941 }
11942
ResetWaterFlowFooter(ArkUI_NodeHandle node)11943 void ResetWaterFlowFooter(ArkUI_NodeHandle node)
11944 {
11945 // already check in entry point.
11946 auto* fullImpl = GetFullImpl();
11947 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetWaterflowFooter(node->uiNodeHandle);
11948 }
11949
SetWaterFlowSectionOption(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11950 int32_t SetWaterFlowSectionOption(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11951 {
11952 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
11953 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
11954 if (item->size != 1) {
11955 return ERROR_CODE_PARAM_INVALID;
11956 }
11957 auto* waterFlowSectionOption = reinterpret_cast<ArkUIWaterFlowSectionOption>(item->object);
11958 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->setSectionOption(
11959 node->uiNodeHandle, item->value[0].i32, waterFlowSectionOption);
11960 return ERROR_CODE_NO_ERROR;
11961 }
11962
ResetWaterFlowSectionOption(ArkUI_NodeHandle node)11963 void ResetWaterFlowSectionOption(ArkUI_NodeHandle node)
11964 {
11965 // already check in entry point.
11966 auto* fullImpl = GetFullImpl();
11967
11968 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetSectionOption(node->uiNodeHandle);
11969 }
11970
GetWaterFlowSectionOption(ArkUI_NodeHandle node)11971 const ArkUI_AttributeItem* GetWaterFlowSectionOption(ArkUI_NodeHandle node)
11972 {
11973 static ArkUI_WaterFlowSectionOption options =
11974 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getSectionOption(node->uiNodeHandle);
11975 g_attributeItem.object = &options;
11976 return &g_attributeItem;
11977 }
11978
SetItemConstraintSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)11979 int32_t SetItemConstraintSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
11980 {
11981 if (item->size != ALLOW_SIZE_4) {
11982 return ERROR_CODE_PARAM_INVALID;
11983 }
11984
11985 auto* fullImpl = GetFullImpl();
11986 ArkUI_Float32 constraintSize[ALLOW_SIZE_4] = { 0.0f, FLT_MAX, 0.0f, FLT_MAX };
11987 int32_t unit = GetDefaultUnit(node, UNIT_VP);
11988 ArkUI_Int32 units[ALLOW_SIZE_4] = { unit, unit, unit, unit };
11989
11990 for (int i = 0; i < ALLOW_SIZE_4; ++i) {
11991 if (LessNotEqual(item->value[i].f32, 0.0f)) {
11992 return ERROR_CODE_PARAM_INVALID;
11993 } else {
11994 constraintSize[i] = item->value[i].f32;
11995 }
11996 }
11997 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setItemMinWidth(
11998 node->uiNodeHandle, constraintSize[NUM_0], units[NUM_0], nullptr);
11999 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setItemMaxWidth(
12000 node->uiNodeHandle, constraintSize[NUM_1], units[NUM_1], nullptr);
12001 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setItemMinHeight(
12002 node->uiNodeHandle, constraintSize[NUM_2], units[NUM_2], nullptr);
12003 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setItemMaxHeight(
12004 node->uiNodeHandle, constraintSize[NUM_3], units[NUM_3], nullptr);
12005 return ERROR_CODE_NO_ERROR;
12006 }
12007
ResetItemConstraintSize(ArkUI_NodeHandle node)12008 void ResetItemConstraintSize(ArkUI_NodeHandle node)
12009 {
12010 auto* fullImpl = GetFullImpl();
12011 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetItemMinWidth(node->uiNodeHandle);
12012 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetItemMaxWidth(node->uiNodeHandle);
12013 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetItemMinHeight(node->uiNodeHandle);
12014 fullImpl->getNodeModifiers()->getWaterFlowModifier()->resetItemMaxHeight(node->uiNodeHandle);
12015 }
12016
GetItemConstraintSize(ArkUI_NodeHandle node)12017 const ArkUI_AttributeItem* GetItemConstraintSize(ArkUI_NodeHandle node)
12018 {
12019 ArkUI_Int32 unit = GetDefaultUnit(node, UNIT_VP);
12020 g_numberValues[NUM_0].f32 =
12021 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getItemMinWidth(node->uiNodeHandle, unit);
12022 g_numberValues[NUM_1].f32 =
12023 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getItemMaxWidth(node->uiNodeHandle, unit);
12024 g_numberValues[NUM_2].f32 =
12025 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getItemMinHeight(node->uiNodeHandle, unit);
12026 g_numberValues[NUM_3].f32 =
12027 GetFullImpl()->getNodeModifiers()->getWaterFlowModifier()->getItemMaxHeight(node->uiNodeHandle, unit);
12028 return &g_attributeItem;
12029 }
12030
SetWaterFlowScrollToIndex(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12031 int32_t SetWaterFlowScrollToIndex(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12032 {
12033 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
12034 if (actualSize < NUM_0) {
12035 return ERROR_CODE_PARAM_INVALID;
12036 }
12037 ArkUI_Int32 values[ALLOW_SIZE_3] = { NUM_0, DEFAULT_FALSE, ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_NONE };
12038 values[NUM_0] = item->value[NUM_0].i32;
12039 if (item->size > NUM_1 && InRegion(NUM_0, NUM_1, item->value[NUM_1].i32)) {
12040 values[NUM_1] = item->value[NUM_1].i32;
12041 }
12042 if (item->size > NUM_2 && InRegion(NUM_0, NUM_3, item->value[NUM_2].i32)) {
12043 values[NUM_2] = item->value[NUM_2].i32;
12044 }
12045 if (values[NUM_2] == ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_NONE) {
12046 values[NUM_2] = ArkUI_ScrollAlignment::ARKUI_SCROLL_ALIGNMENT_START;
12047 }
12048 auto* fullImpl = GetFullImpl();
12049 fullImpl->getNodeModifiers()->getWaterFlowModifier()->setScrollToIndex(
12050 node->uiNodeHandle, values[NUM_0], values[NUM_1], values[NUM_2]);
12051 return ERROR_CODE_NO_ERROR;
12052 }
12053 // radio attribute
SetRadioChecked(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12054 int32_t SetRadioChecked(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12055 {
12056 if (item->size == 0 || !CheckAttributeIsBool(item->value[0].i32)) {
12057 return ERROR_CODE_PARAM_INVALID;
12058 }
12059 auto* fullImpl = GetFullImpl();
12060 fullImpl->getNodeModifiers()->getRadioModifier()->setRadioChecked(node->uiNodeHandle, item->value[0].i32);
12061 return ERROR_CODE_NO_ERROR;
12062 }
12063
ResetRadioChecked(ArkUI_NodeHandle node)12064 void ResetRadioChecked(ArkUI_NodeHandle node)
12065 {
12066 auto* fullImpl = GetFullImpl();
12067 fullImpl->getNodeModifiers()->getRadioModifier()->resetRadioChecked(node->uiNodeHandle);
12068 }
12069
GetRadioChecked(ArkUI_NodeHandle node)12070 const ArkUI_AttributeItem* GetRadioChecked(ArkUI_NodeHandle node)
12071 {
12072 auto resultValue = GetFullImpl()->getNodeModifiers()->getRadioModifier()->getRadioChecked(node->uiNodeHandle);
12073 g_numberValues[0].i32 = resultValue;
12074 return &g_attributeItem;
12075 }
12076
SetRadioStyle(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12077 int32_t SetRadioStyle(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12078 {
12079 if (item->size == 0) {
12080 return ERROR_CODE_PARAM_INVALID;
12081 }
12082
12083 auto* fullImpl = GetFullImpl();
12084 ArkUI_Uint32 radioStyle[ALLOW_SIZE_3] = { 0xFF007DFF, 0xFF182431, 0xFFFFFFF };
12085 // checkedBackgroundColor
12086 if (item->size > NUM_0) {
12087 radioStyle[NUM_0] = item->value[NUM_0].u32;
12088 }
12089
12090 // uncheckedBorderColor
12091 if (item->size > NUM_1) {
12092 radioStyle[NUM_1] = item->value[NUM_1].u32;
12093 }
12094
12095 // indicatorColor
12096 if (item->size > NUM_2) {
12097 radioStyle[NUM_2] = item->value[NUM_2].u32;
12098 }
12099 fullImpl->getNodeModifiers()->getRadioModifier()->setRadioStyle(
12100 node->uiNodeHandle, radioStyle[NUM_0], radioStyle[NUM_1], radioStyle[NUM_2]);
12101 return ERROR_CODE_NO_ERROR;
12102 }
12103
ResetRadioStyle(ArkUI_NodeHandle node)12104 void ResetRadioStyle(ArkUI_NodeHandle node)
12105 {
12106 auto* fullImpl = GetFullImpl();
12107 fullImpl->getNodeModifiers()->getRadioModifier()->resetRadioStyle(node->uiNodeHandle);
12108 }
12109
GetRadioStyle(ArkUI_NodeHandle node)12110 const ArkUI_AttributeItem* GetRadioStyle(ArkUI_NodeHandle node)
12111 {
12112 ArkUIRadioStyleOption options;
12113 GetFullImpl()->getNodeModifiers()->getRadioModifier()->getRadioStyle(node->uiNodeHandle, &options);
12114 g_numberValues[NUM_0].u32 = options.checkedBackgroundColor;
12115 g_numberValues[NUM_1].u32 = options.uncheckedBorderColor;
12116 g_numberValues[NUM_2].u32 = options.indicatorColor;
12117 return &g_attributeItem;
12118 }
12119
SetRadioValue(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12120 int32_t SetRadioValue(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12121 {
12122 auto* fullImpl = GetFullImpl();
12123 if (!CheckAttributeString(item)) {
12124 return ERROR_CODE_PARAM_INVALID;
12125 }
12126 fullImpl->getNodeModifiers()->getRadioModifier()->setRadioValue(node->uiNodeHandle, item->string);
12127 return ERROR_CODE_NO_ERROR;
12128 }
12129
ResetRadioValue(ArkUI_NodeHandle node)12130 void ResetRadioValue(ArkUI_NodeHandle node)
12131 {
12132 auto* fullImpl = GetFullImpl();
12133 fullImpl->getNodeModifiers()->getRadioModifier()->resetRadioValue(node->uiNodeHandle);
12134 }
12135
GetRadioValue(ArkUI_NodeHandle node)12136 const ArkUI_AttributeItem* GetRadioValue(ArkUI_NodeHandle node)
12137 {
12138 auto fullImpl = GetFullImpl();
12139 auto value = fullImpl->getNodeModifiers()->getRadioModifier()->getRadioValue(node->uiNodeHandle);
12140 g_attributeItem.string = (value != nullptr ? value : EMPTY_STR.c_str());
12141 return &g_attributeItem;
12142 }
12143
SetRadioGroup(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12144 int32_t SetRadioGroup(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12145 {
12146 auto* fullImpl = GetFullImpl();
12147 if (!CheckAttributeString(item)) {
12148 return ERROR_CODE_PARAM_INVALID;
12149 }
12150 fullImpl->getNodeModifiers()->getRadioModifier()->setRadioGroup(node->uiNodeHandle, item->string);
12151 return ERROR_CODE_NO_ERROR;
12152 }
12153
ResetRadioGroup(ArkUI_NodeHandle node)12154 void ResetRadioGroup(ArkUI_NodeHandle node)
12155 {
12156 auto* fullImpl = GetFullImpl();
12157 fullImpl->getNodeModifiers()->getRadioModifier()->resetRadioGroup(node->uiNodeHandle);
12158 }
12159
GetRadioGroup(ArkUI_NodeHandle node)12160 const ArkUI_AttributeItem* GetRadioGroup(ArkUI_NodeHandle node)
12161 {
12162 auto fullImpl = GetFullImpl();
12163 auto value = fullImpl->getNodeModifiers()->getRadioModifier()->getRadioGroup(node->uiNodeHandle);
12164 g_attributeItem.string = (value != nullptr ? value : EMPTY_STR.c_str());
12165 return &g_attributeItem;
12166 }
12167
12168 // imageAnimator attribute
SetImageAnimatorSrc(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12169 int32_t SetImageAnimatorSrc(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12170 {
12171 if (!CheckAttributeObjectAndSize(item)) {
12172 return ERROR_CODE_PARAM_INVALID;
12173 }
12174 ArkUIImageFrameInfo imageInfos[item->size];
12175 if (!ParseImages(item, imageInfos, node)) {
12176 return ERROR_CODE_PARAM_INVALID;
12177 }
12178
12179 auto* fullImpl = GetFullImpl();
12180 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setImageAnimatorSrc(
12181 node->uiNodeHandle, imageInfos, item->size);
12182 return ERROR_CODE_NO_ERROR;
12183 }
12184
ResetImageAnimatorSrc(ArkUI_NodeHandle node)12185 void ResetImageAnimatorSrc(ArkUI_NodeHandle node)
12186 {
12187 auto* fullImpl = GetFullImpl();
12188 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetImages(node->uiNodeHandle);
12189 }
12190
GetImageAnimatorSrc(ArkUI_NodeHandle node)12191 const ArkUI_AttributeItem* GetImageAnimatorSrc(ArkUI_NodeHandle node)
12192 {
12193 if (!node->imageFrameInfos) {
12194 g_attributeItem.size = 0;
12195 } else {
12196 auto* fullImpl = GetFullImpl();
12197 g_attributeItem.size = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getImagesSize(
12198 node->uiNodeHandle);
12199 g_attributeItem.object = reinterpret_cast<ArkUI_ImageAnimatorFrameInfo**>(node->imageFrameInfos);
12200 }
12201 return &g_attributeItem;
12202 }
12203
SetImageAnimatorState(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12204 int32_t SetImageAnimatorState(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12205 {
12206 if (item->size == 0) {
12207 return ERROR_CODE_PARAM_INVALID;
12208 }
12209 if (item->value[0].i32 < NUM_0 || item->value[0].i32 > NUM_3) {
12210 return ERROR_CODE_PARAM_INVALID;
12211 }
12212
12213 auto* fullImpl = GetFullImpl();
12214 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setState(node->uiNodeHandle, item->value[0].i32);
12215 return ERROR_CODE_NO_ERROR;
12216 }
12217
ResetImageAnimatorState(ArkUI_NodeHandle node)12218 void ResetImageAnimatorState(ArkUI_NodeHandle node)
12219 {
12220 auto* fullImpl = GetFullImpl();
12221 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetState(node->uiNodeHandle);
12222 }
12223
GetImageAnimatorState(ArkUI_NodeHandle node)12224 const ArkUI_AttributeItem* GetImageAnimatorState(ArkUI_NodeHandle node)
12225 {
12226 auto* fullImpl = GetFullImpl();
12227 int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getState(node->uiNodeHandle);
12228 g_numberValues[NUM_0].i32 = value;
12229 g_attributeItem.size = RETURN_SIZE_ONE;
12230 return &g_attributeItem;
12231 }
12232
SetImageAnimatorDuration(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12233 int32_t SetImageAnimatorDuration(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12234 {
12235 if (item->size == 0) {
12236 return ERROR_CODE_PARAM_INVALID;
12237 }
12238
12239 auto* fullImpl = GetFullImpl();
12240 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setDuration(node->uiNodeHandle, item->value[0].i32);
12241 return ERROR_CODE_NO_ERROR;
12242 }
12243
ResetImageAnimatorDuration(ArkUI_NodeHandle node)12244 void ResetImageAnimatorDuration(ArkUI_NodeHandle node)
12245 {
12246 auto* fullImpl = GetFullImpl();
12247 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetDuration(node->uiNodeHandle);
12248 }
12249
GetImageAnimatorDuration(ArkUI_NodeHandle node)12250 const ArkUI_AttributeItem* GetImageAnimatorDuration(ArkUI_NodeHandle node)
12251 {
12252 auto* fullImpl = GetFullImpl();
12253 int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getDuration(node->uiNodeHandle);
12254 g_numberValues[NUM_0].i32 = value;
12255 g_attributeItem.size = RETURN_SIZE_ONE;
12256 return &g_attributeItem;
12257 }
12258
SetImageAnimatorReverse(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12259 int32_t SetImageAnimatorReverse(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12260 {
12261 if (item->size == 0) {
12262 return ERROR_CODE_PARAM_INVALID;
12263 }
12264 if (item->value[0].i32 < DEFAULT_FALSE || item->value[0].i32 > DEFAULT_TRUE) {
12265 return ERROR_CODE_PARAM_INVALID;
12266 }
12267
12268 auto* fullImpl = GetFullImpl();
12269 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setReverse(
12270 node->uiNodeHandle, static_cast<ArkUI_Uint32>(item->value[0].i32));
12271 return ERROR_CODE_NO_ERROR;
12272 }
12273
ResetImageAnimatorReverse(ArkUI_NodeHandle node)12274 void ResetImageAnimatorReverse(ArkUI_NodeHandle node)
12275 {
12276 auto* fullImpl = GetFullImpl();
12277 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetReverse(node->uiNodeHandle);
12278 }
12279
GetImageAnimatorReverse(ArkUI_NodeHandle node)12280 const ArkUI_AttributeItem* GetImageAnimatorReverse(ArkUI_NodeHandle node)
12281 {
12282 auto* fullImpl = GetFullImpl();
12283 int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getIsReverse(node->uiNodeHandle);
12284 g_numberValues[NUM_0].i32 = value;
12285 g_attributeItem.size = RETURN_SIZE_ONE;
12286 return &g_attributeItem;
12287 }
12288
SetImageAnimatorFixedSize(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12289 int32_t SetImageAnimatorFixedSize(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12290 {
12291 if (item->size == 0) {
12292 return ERROR_CODE_PARAM_INVALID;
12293 }
12294 if (item->value[0].i32 < DEFAULT_FALSE || item->value[0].i32 > DEFAULT_TRUE) {
12295 return ERROR_CODE_PARAM_INVALID;
12296 }
12297
12298 auto* fullImpl = GetFullImpl();
12299 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setFixedSize(
12300 node->uiNodeHandle, static_cast<ArkUI_Uint32>(item->value[0].i32));
12301 return ERROR_CODE_NO_ERROR;
12302 }
12303
ResetImageAnimatorFixedSize(ArkUI_NodeHandle node)12304 void ResetImageAnimatorFixedSize(ArkUI_NodeHandle node)
12305 {
12306 auto* fullImpl = GetFullImpl();
12307 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetFixedSize(node->uiNodeHandle);
12308 }
12309
GetImageAnimatorFixedSize(ArkUI_NodeHandle node)12310 const ArkUI_AttributeItem* GetImageAnimatorFixedSize(ArkUI_NodeHandle node)
12311 {
12312 auto* fullImpl = GetFullImpl();
12313 int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getFixedSize(node->uiNodeHandle);
12314 g_numberValues[NUM_0].i32 = value;
12315 g_attributeItem.size = RETURN_SIZE_ONE;
12316 return &g_attributeItem;
12317 }
12318
SetImageAnimatorFillMode(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12319 int32_t SetImageAnimatorFillMode(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12320 {
12321 if (item->size == 0) {
12322 return ERROR_CODE_PARAM_INVALID;
12323 }
12324 if (item->value[0].i32 < NUM_0 || item->value[0].i32 > NUM_3) {
12325 return ERROR_CODE_PARAM_INVALID;
12326 }
12327
12328 auto* fullImpl = GetFullImpl();
12329 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setFillMode(node->uiNodeHandle, item->value[0].i32);
12330 return ERROR_CODE_NO_ERROR;
12331 }
12332
ResetImageAnimatorFillMode(ArkUI_NodeHandle node)12333 void ResetImageAnimatorFillMode(ArkUI_NodeHandle node)
12334 {
12335 auto* fullImpl = GetFullImpl();
12336 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetFillMode(node->uiNodeHandle);
12337 }
12338
GetImageAnimatorFillMode(ArkUI_NodeHandle node)12339 const ArkUI_AttributeItem* GetImageAnimatorFillMode(ArkUI_NodeHandle node)
12340 {
12341 auto* fullImpl = GetFullImpl();
12342 int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getFillMode(node->uiNodeHandle);
12343 g_numberValues[NUM_0].i32 = value;
12344 g_attributeItem.size = RETURN_SIZE_ONE;
12345 return &g_attributeItem;
12346 }
12347
SetImageAnimatorIterations(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12348 int32_t SetImageAnimatorIterations(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12349 {
12350 if (item->size == 0) {
12351 return ERROR_CODE_PARAM_INVALID;
12352 }
12353
12354 auto* fullImpl = GetFullImpl();
12355 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->setImageAnimatorIteration(
12356 node->uiNodeHandle, item->value[0].i32);
12357 return ERROR_CODE_NO_ERROR;
12358 }
12359
ResetImageAnimatorIterations(ArkUI_NodeHandle node)12360 void ResetImageAnimatorIterations(ArkUI_NodeHandle node)
12361 {
12362 auto* fullImpl = GetFullImpl();
12363 fullImpl->getNodeModifiers()->getImageAnimatorModifier()->resetImageAnimatorIteration(node->uiNodeHandle);
12364 }
12365
GetImageAnimatorIterations(ArkUI_NodeHandle node)12366 const ArkUI_AttributeItem* GetImageAnimatorIterations(ArkUI_NodeHandle node)
12367 {
12368 auto* fullImpl = GetFullImpl();
12369 int32_t value = fullImpl->getNodeModifiers()->getImageAnimatorModifier()->getIteration(node->uiNodeHandle);
12370 g_numberValues[NUM_0].i32 = value;
12371 g_attributeItem.size = RETURN_SIZE_ONE;
12372 return &g_attributeItem;
12373 }
12374
12375 // grid attribute
SetGridColumnsTemplate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12376 int32_t SetGridColumnsTemplate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12377 {
12378 auto* fullImpl = GetFullImpl();
12379 if (!CheckAttributeString(item)) {
12380 return ERROR_CODE_PARAM_INVALID;
12381 }
12382 fullImpl->getNodeModifiers()->getGridModifier()->setGridColumnsTemplate(node->uiNodeHandle, item->string);
12383 return ERROR_CODE_NO_ERROR;
12384 }
12385
ResetGridColumnsTemplate(ArkUI_NodeHandle node)12386 void ResetGridColumnsTemplate(ArkUI_NodeHandle node)
12387 {
12388 auto* fullImpl = GetFullImpl();
12389 fullImpl->getNodeModifiers()->getGridModifier()->resetGridColumnsTemplate(node->uiNodeHandle);
12390 }
12391
GetGridColumnsTemplate(ArkUI_NodeHandle node)12392 const ArkUI_AttributeItem* GetGridColumnsTemplate(ArkUI_NodeHandle node)
12393 {
12394 auto fullImpl = GetFullImpl();
12395 auto columnsTemplate = fullImpl->getNodeModifiers()->getGridModifier()->getGridColumnsTemplate(node->uiNodeHandle);
12396 g_attributeItem.string = columnsTemplate;
12397 return &g_attributeItem;
12398 }
12399
SetGridRowsTemplate(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12400 int32_t SetGridRowsTemplate(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12401 {
12402 auto* fullImpl = GetFullImpl();
12403 if (!CheckAttributeString(item)) {
12404 return ERROR_CODE_PARAM_INVALID;
12405 }
12406 fullImpl->getNodeModifiers()->getGridModifier()->setGridRowsTemplate(node->uiNodeHandle, item->string);
12407 return ERROR_CODE_NO_ERROR;
12408 }
12409
ResetGridRowsTemplate(ArkUI_NodeHandle node)12410 void ResetGridRowsTemplate(ArkUI_NodeHandle node)
12411 {
12412 auto* fullImpl = GetFullImpl();
12413 fullImpl->getNodeModifiers()->getGridModifier()->resetGridRowsTemplate(node->uiNodeHandle);
12414 }
12415
GetGridRowsTemplate(ArkUI_NodeHandle node)12416 const ArkUI_AttributeItem* GetGridRowsTemplate(ArkUI_NodeHandle node)
12417 {
12418 auto fullImpl = GetFullImpl();
12419 auto rowsTemplate = fullImpl->getNodeModifiers()->getGridModifier()->getGridRowsTemplate(node->uiNodeHandle);
12420 g_attributeItem.string = rowsTemplate;
12421 return &g_attributeItem;
12422 }
12423
SetGridColumnsGap(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12424 int32_t SetGridColumnsGap(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12425 {
12426 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
12427 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
12428 return ERROR_CODE_PARAM_INVALID;
12429 }
12430 auto* fullImpl = GetFullImpl();
12431 ArkUIResourceLength columnGap = { item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr };
12432 fullImpl->getNodeModifiers()->getGridModifier()->setGridColumnsGap(node->uiNodeHandle, &columnGap);
12433 return ERROR_CODE_NO_ERROR;
12434 }
12435
ResetGridColumnsGap(ArkUI_NodeHandle node)12436 void ResetGridColumnsGap(ArkUI_NodeHandle node)
12437 {
12438 auto* fullImpl = GetFullImpl();
12439 fullImpl->getNodeModifiers()->getGridModifier()->resetGridColumnsGap(node->uiNodeHandle);
12440 }
12441
GetGridColumnsGap(ArkUI_NodeHandle node)12442 const ArkUI_AttributeItem* GetGridColumnsGap(ArkUI_NodeHandle node)
12443 {
12444 auto modifier = GetFullImpl()->getNodeModifiers()->getGridModifier();
12445 g_numberValues[0].f32 = modifier->getGridColumnsGap(node->uiNodeHandle);
12446 return &g_attributeItem;
12447 }
12448
SetGridRowsGap(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12449 int32_t SetGridRowsGap(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12450 {
12451 auto actualSize = CheckAttributeItemArray(item, REQUIRED_ONE_PARAM);
12452 if (actualSize < 0 || LessNotEqual(item->value[NUM_0].f32, 0.0f)) {
12453 return ERROR_CODE_PARAM_INVALID;
12454 }
12455 auto* fullImpl = GetFullImpl();
12456 ArkUIResourceLength rowGap = { item->value[NUM_0].f32, GetDefaultUnit(node, UNIT_VP), nullptr };
12457 fullImpl->getNodeModifiers()->getGridModifier()->setGridRowsGap(node->uiNodeHandle, &rowGap);
12458 return ERROR_CODE_NO_ERROR;
12459 }
12460
ResetGridRowsGap(ArkUI_NodeHandle node)12461 void ResetGridRowsGap(ArkUI_NodeHandle node)
12462 {
12463 auto* fullImpl = GetFullImpl();
12464 fullImpl->getNodeModifiers()->getGridModifier()->resetGridRowsGap(node->uiNodeHandle);
12465 }
12466
GetGridRowsGap(ArkUI_NodeHandle node)12467 const ArkUI_AttributeItem* GetGridRowsGap(ArkUI_NodeHandle node)
12468 {
12469 auto modifier = GetFullImpl()->getNodeModifiers()->getGridModifier();
12470 g_numberValues[0].f32 = modifier->getGridRowsGap(node->uiNodeHandle);
12471 return &g_attributeItem;
12472 }
12473
SetGridNodeAdapter(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12474 int32_t SetGridNodeAdapter(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12475 {
12476 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
12477 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
12478 auto* nodeAdapter = reinterpret_cast<ArkUINodeAdapterHandle>(item->object);
12479 return GetFullImpl()->getNodeModifiers()->getGridModifier()->setNodeAdapter(node->uiNodeHandle, nodeAdapter);
12480 }
12481
ResetGridNodeAdapter(ArkUI_NodeHandle node)12482 void ResetGridNodeAdapter(ArkUI_NodeHandle node)
12483 {
12484 // already check in entry point.
12485 auto* fullImpl = GetFullImpl();
12486
12487 fullImpl->getNodeModifiers()->getGridModifier()->resetNodeAdapter(node->uiNodeHandle);
12488 }
12489
GetGridNodeAdapter(ArkUI_NodeHandle node)12490 const ArkUI_AttributeItem* GetGridNodeAdapter(ArkUI_NodeHandle node)
12491 {
12492 ArkUINodeAdapterHandle adapter =
12493 GetFullImpl()->getNodeModifiers()->getGridModifier()->getNodeAdapter(node->uiNodeHandle);
12494 g_attributeItem.object = reinterpret_cast<void*>(adapter);
12495 return &g_attributeItem;
12496 }
12497
SetGridCachedCount(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12498 int32_t SetGridCachedCount(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12499 {
12500 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
12501 if (item->size != 1) {
12502 return ERROR_CODE_PARAM_INVALID;
12503 }
12504 if (LessNotEqual(item->value[0].i32, NUM_0)) {
12505 return ERROR_CODE_PARAM_INVALID;
12506 }
12507 GetFullImpl()->getNodeModifiers()->getGridModifier()->setCachedCount(node->uiNodeHandle, item->value[0].i32);
12508 return ERROR_CODE_NO_ERROR;
12509 }
12510
ResetGridCachedCount(ArkUI_NodeHandle node)12511 void ResetGridCachedCount(ArkUI_NodeHandle node)
12512 {
12513 // already check in entry point.
12514 auto* fullImpl = GetFullImpl();
12515
12516 fullImpl->getNodeModifiers()->getGridModifier()->resetCachedCount(node->uiNodeHandle);
12517 }
12518
GetGridCachedCount(ArkUI_NodeHandle node)12519 const ArkUI_AttributeItem* GetGridCachedCount(ArkUI_NodeHandle node)
12520 {
12521 ArkUI_Int32 value = GetFullImpl()->getNodeModifiers()->getGridModifier()->getCachedCount(node->uiNodeHandle);
12522 g_numberValues[0].i32 = value;
12523 return &g_attributeItem;
12524 }
12525
SetRelativeContainerGuideLine(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12526 int32_t SetRelativeContainerGuideLine(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12527 {
12528 node->guidelineOption = item->object;
12529 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
12530 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
12531 auto styles = reinterpret_cast<ArkUI_GuidelineOption*>(item->object);
12532 ArkUI_Int32 size = static_cast<ArkUI_Int32>(styles->styles.size());
12533 std::vector<ArkUIGuidelineStyle> guidelineStyle;
12534 for (int i = 0; i < size; ++i) {
12535 ArkUIGuidelineStyle style;
12536 style.id = styles->styles[i].id.c_str();
12537 style.direction = styles->styles[i].direction;
12538 style.hasStart = styles->styles[i].hasStart;
12539 style.start = styles->styles[i].start;
12540 style.end = styles->styles[i].end;
12541 style.hasEnd = styles->styles[i].hasEnd;
12542 guidelineStyle.push_back(style);
12543 }
12544 GetFullImpl()->getNodeModifiers()->getRelativeContainerModifier()->setGuideLine(
12545 node->uiNodeHandle, guidelineStyle.data(), size);
12546 return ERROR_CODE_NO_ERROR;
12547 }
12548
SetRelativeContainerBarrier(ArkUI_NodeHandle node,const ArkUI_AttributeItem * item)12549 int32_t SetRelativeContainerBarrier(ArkUI_NodeHandle node, const ArkUI_AttributeItem* item)
12550 {
12551 node->barrierOption = item->object;
12552 CHECK_NULL_RETURN(item, ERROR_CODE_PARAM_INVALID);
12553 CHECK_NULL_RETURN(item->object, ERROR_CODE_PARAM_INVALID);
12554
12555 auto styles = reinterpret_cast<ArkUI_BarrierOption*>(item->object);
12556 ArkUI_Int32 size = static_cast<ArkUI_Int32>(styles->styles.size());
12557
12558 std::vector<ArkUIBarrierStyle> barrierStyle(size);
12559 for (int i = 0; i < size; ++i) {
12560 barrierStyle[i].id = styles->styles[i].id.c_str();
12561 barrierStyle[i].direction = styles->styles[i].direction;
12562 barrierStyle[i].referencedIdSize = static_cast<ArkUI_Int32>(styles->styles[i].referencedId.size());
12563 barrierStyle[i].referencedId = new ArkUI_CharPtr[barrierStyle[i].referencedIdSize];
12564 for (int j = 0; j < barrierStyle[i].referencedIdSize; ++j) {
12565 barrierStyle[i].referencedId[j] = styles->styles[i].referencedId[j].c_str();
12566 }
12567 }
12568
12569 GetFullImpl()->getNodeModifiers()->getRelativeContainerModifier()->setBarrier(
12570 node->uiNodeHandle, barrierStyle.data(), size);
12571
12572 for (int i = 0; i < size; ++i) {
12573 delete[] barrierStyle[i].referencedId;
12574 }
12575 return ERROR_CODE_NO_ERROR;
12576 }
12577
GetRelativeContainerGuideLine(ArkUI_NodeHandle node)12578 const ArkUI_AttributeItem* GetRelativeContainerGuideLine(ArkUI_NodeHandle node)
12579 {
12580 g_attributeItem.object = node->guidelineOption;
12581 return &g_attributeItem;
12582 }
12583
GetRelativeContainerBarrier(ArkUI_NodeHandle node)12584 const ArkUI_AttributeItem* GetRelativeContainerBarrier(ArkUI_NodeHandle node)
12585 {
12586 g_attributeItem.object = node->barrierOption;
12587 return &g_attributeItem;
12588 }
12589
ResetRelativeContainerGuideLine(ArkUI_NodeHandle node)12590 void ResetRelativeContainerGuideLine(ArkUI_NodeHandle node)
12591 {
12592 auto* fullImpl = GetFullImpl();
12593 fullImpl->getNodeModifiers()->getRelativeContainerModifier()->resetGuideline(node->uiNodeHandle);
12594 node->guidelineOption = nullptr;
12595 }
12596
ResetRelativeContainerBarrier(ArkUI_NodeHandle node)12597 void ResetRelativeContainerBarrier(ArkUI_NodeHandle node)
12598 {
12599 auto* fullImpl = GetFullImpl();
12600 fullImpl->getNodeModifiers()->getRelativeContainerModifier()->resetBarrier(node->uiNodeHandle);
12601 node->barrierOption = nullptr;
12602 }
12603
CheckIfAttributeLegal(ArkUI_NodeHandle node,int32_t type)12604 bool CheckIfAttributeLegal(ArkUI_NodeHandle node, int32_t type)
12605 {
12606 if (node->type == ARKUI_NODE_SPAN) {
12607 auto it = SPAN_ATTRIBUTES_MAP.find(type);
12608 return it != SPAN_ATTRIBUTES_MAP.end();
12609 }
12610 if (node->type == ARKUI_NODE_CUSTOM_SPAN) {
12611 return false;
12612 }
12613 return true;
12614 }
12615
12616 using Setter = int32_t(ArkUI_NodeHandle node, const ArkUI_AttributeItem* value);
12617 using Getter = const ArkUI_AttributeItem*(ArkUI_NodeHandle node);
12618 using Resetter = void(ArkUI_NodeHandle node);
12619
SetCommonAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)12620 int32_t SetCommonAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
12621 {
12622 static Setter* setters[] = {
12623 SetWidth,
12624 SetHeight,
12625 SetBackgroundColor,
12626 SetBackgroundImage,
12627 SetPadding,
12628 SetKey,
12629 SetEnabled,
12630 SetMargin,
12631 SetTranslate,
12632 SetScale,
12633 SetRotate,
12634 SetBrightness,
12635 SetSaturate,
12636 SetBlur,
12637 SetLinearGradient,
12638 SetAlign,
12639 SetOpacity,
12640 SetBorderWidth,
12641 SetBorderRadius,
12642 SetBorderColor,
12643 SetBorderStyle,
12644 SetZIndex,
12645 SetVisibility,
12646 SetClip,
12647 SetClipShape,
12648 SetTransform,
12649 SetHitTestBehavior,
12650 SetPosition,
12651 SetShadow,
12652 SetCustomShadow,
12653 SetBackgroundImageSize,
12654 SetBackgroundImageSizeWithStyle,
12655 SetBackgroundBlurStyle,
12656 SetTransformCenter,
12657 SetOpacityTransition,
12658 SetRotateTransition,
12659 SetScaleTransition,
12660 SetTranslateTransition,
12661 SetMoveTransition,
12662 SetFocusable,
12663 SetDefaultFocus,
12664 SetResponseRegion,
12665 SetOverlay,
12666 SetSweepGradient,
12667 SetRadialGradient,
12668 SetMask,
12669 SetBlendMode,
12670 SetDirection,
12671 SetConstraintSize,
12672 SetGrayscale,
12673 SetInvert,
12674 SetSepia,
12675 SetContrast,
12676 SetForegroundColor,
12677 SetOffset,
12678 SetMarkAnchor,
12679 SetBackgroundImagePosition,
12680 SetAlignRules,
12681 SetAlignSelf,
12682 SetFlexGrow,
12683 SetFlexShrink,
12684 SetFlexBasis,
12685 SetAccessibilityGroup,
12686 SetAccessibilityText,
12687 SetAccessibilityLevel,
12688 SetAccessibilityDescription,
12689 SetNeedFocus,
12690 SetAspectRatio,
12691 SetLayoutWeight,
12692 SetDisplayPriority,
12693 SetOutlineWidth,
12694 SetWidthPercent,
12695 SetHeightPercent,
12696 SetPaddingPercent,
12697 SetMarginPercent,
12698 SetGeometryTransition,
12699 SetChainMode,
12700 SetRenderFit,
12701 SetOutlineColor,
12702 SetSize,
12703 SetRenderGroup,
12704 SetColorBlend,
12705 SetForegroundBlurStyle,
12706 SetLayoutRect,
12707 SetFocusOnTouch,
12708 SetBorderWidthPercent,
12709 SetBorderRadiusPercent,
12710 nullptr,
12711 SetAccessibilityActions,
12712 SetAccessibilityRole,
12713 SetAccessibilityState,
12714 SetAccessibilityValue,
12715 SetExpandSafeArea,
12716 SetAreaChangeRatio,
12717 SetTransition,
12718 nullptr,
12719 SetFocusBox,
12720 };
12721 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
12722 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "common node attribute: %{public}d NOT IMPLEMENT", subTypeId);
12723 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
12724 }
12725 return setters[subTypeId](node, value);
12726 }
12727
GetCommonAttribute(ArkUI_NodeHandle node,int32_t subTypeId)12728 const ArkUI_AttributeItem* GetCommonAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
12729 {
12730 static Getter* getters[] = {
12731 GetWidth,
12732 GetHeight,
12733 GetBackgroundColor,
12734 GetBackgroundImage,
12735 GetPadding,
12736 GetKey,
12737 GetEnabled,
12738 GetMargin,
12739 GetTranslate,
12740 GetScale,
12741 GetRotate,
12742 GetBrightness,
12743 GetSaturate,
12744 GetBlur,
12745 GetLinearGradient,
12746 GetAlign,
12747 GetOpacity,
12748 GetBorderWidth,
12749 GetBorderRadius,
12750 GetBorderColor,
12751 GetBorderStyle,
12752 GetZIndex,
12753 GetVisibility,
12754 GetClip,
12755 GetClipShape,
12756 GetTransform,
12757 GetHitTestBehavior,
12758 GetPosition,
12759 GetShadow,
12760 GetCustomShadow,
12761 GetBackgroundImageSize,
12762 GetBackgroundImageSizeWithStyle,
12763 GetBackgroundBlurStyle,
12764 GetTransformCenter,
12765 GetOpacityTransition,
12766 GetRotateTransition,
12767 GetScaleTransition,
12768 GetTranslateTransition,
12769 GetMoveTransition,
12770 GetFocusable,
12771 GetDefaultFocus,
12772 GetResponseRegion,
12773 GetOverlay,
12774 GetSweepGradient,
12775 GetRadialGradient,
12776 GetMask,
12777 GetBlendMode,
12778 GetDirection,
12779 GetConstraintSize,
12780 GetGrayscale,
12781 GetInvert,
12782 GetSepia,
12783 GetContrast,
12784 GetForegroundColor,
12785 GetOffset,
12786 GetMarkAnchor,
12787 GetBackgroundImagePosition,
12788 GetAlignRules,
12789 GetAlignSelf,
12790 GetFlexGrow,
12791 GetFlexShrink,
12792 GetFlexBasis,
12793 GetAccessibilityGroup,
12794 GetAccessibilityText,
12795 GetAccessibilityLevel,
12796 GetAccessibilityDescription,
12797 GetNeedFocus,
12798 GetAspectRatio,
12799 GetLayoutWeight,
12800 GetDisplayPriority,
12801 GetOutlineWidth,
12802 GetWidthPercent,
12803 GetHeightPercent,
12804 GetPaddingPercent,
12805 GetMarginPercent,
12806 GetGeometryTransition,
12807 GetChainMode,
12808 GetRenderFit,
12809 GetOutlineColor,
12810 GetSize,
12811 GetRenderGroup,
12812 GetColorBlend,
12813 GetForegroundBlurStyle,
12814 GetLayoutRect,
12815 GetFocusOnTouch,
12816 GetBorderWidthPercent,
12817 GetBorderRadiusPercent,
12818 GetAccessibilityID,
12819 GetAccessibilityActions,
12820 GetAccessibilityRole,
12821 GetAccessibilityState,
12822 GetAccessibilityValue,
12823 GetExpandSafeArea,
12824 GetAreaChangeRatio,
12825 GetTransition,
12826 GetUniqueID,
12827 nullptr,
12828 };
12829 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
12830 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "common node attribute: %{public}d NOT IMPLEMENT", subTypeId);
12831 return nullptr;
12832 }
12833 if (!getters[subTypeId]) {
12834 return nullptr;
12835 }
12836 g_attributeItem.size = RETURN_SIZE_ONE;
12837 return getters[subTypeId](node);
12838 }
12839
ResetCommonAttribute(ArkUI_NodeHandle node,int32_t subTypeId)12840 void ResetCommonAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
12841 {
12842 static Resetter* resetters[] = {
12843 ResetWidth,
12844 ResetHeight,
12845 ResetBackgroundColor,
12846 ResetBackgroundImage,
12847 ResetPadding,
12848 ResetKey,
12849 ResetEnabled,
12850 ResetMargin,
12851 ResetTranslate,
12852 ResetScale,
12853 ResetRotate,
12854 ResetBrightness,
12855 ResetSaturate,
12856 ResetBlur,
12857 ResetLinearGradient,
12858 ResetAlign,
12859 ResetOpacity,
12860 ResetBorderWidth,
12861 ResetBorderRadius,
12862 ResetBorderColor,
12863 ResetBorderStyle,
12864 ResetZIndex,
12865 ResetVisibility,
12866 ResetClip,
12867 ResetClipShape,
12868 ResetTransform,
12869 ResetHitTestBehavior,
12870 ResetPosition,
12871 ResetShadow,
12872 ResetCustomShadow,
12873 ResetBackgroundImageSize,
12874 ResetBackgroundImageSizeWithStyle,
12875 ResetBackgroundBlurStyle,
12876 ResetTransformCenter,
12877 ResetOpacityTransition,
12878 ResetRotateTransition,
12879 ResetScaleTransition,
12880 ResetTranslateTransition,
12881 ResetMoveTransition,
12882 ResetFocusable,
12883 ResetDefaultFocus,
12884 ResetResponseRegion,
12885 ResetOverlay,
12886 ResetSweepGradient,
12887 ResetRadialGradient,
12888 ResetMask,
12889 ResetBlendMode,
12890 ResetDirection,
12891 ResetConstraintSize,
12892 ResetGrayscale,
12893 ResetInvert,
12894 ResetSepia,
12895 ResetContrast,
12896 ResetForegroundColor,
12897 ResetOffset,
12898 ResetMarkAnchor,
12899 ResetBackgroundImagePosition,
12900 ResetAlignRules,
12901 ResetAlignSelf,
12902 ResetFlexGrow,
12903 ResetFlexShrink,
12904 ResetFlexBasis,
12905 ResetAccessibilityGroup,
12906 ResetAccessibilityText,
12907 ResetAccessibilityLevel,
12908 ResetAccessibilityDescription,
12909 nullptr,
12910 ResetAspectRatio,
12911 ResetLayoutWeight,
12912 ResetDisplayPriority,
12913 ResetOutlineWidth,
12914 ResetWidthPercent,
12915 ResetHeightPercent,
12916 ResetPaddingPercent,
12917 ResetMarginPercent,
12918 ResetGeometryTransition,
12919 ResetChainMode,
12920 ResetRenderFit,
12921 ResetOutlineColor,
12922 ResetSize,
12923 ResetRenderGroup,
12924 ResetColorBlend,
12925 ResetForegroundBlurStyle,
12926 ResetLayoutRect,
12927 ResetFocusOnTouch,
12928 ResetBorderWidthPercent,
12929 ResetBorderRadiusPercent,
12930 nullptr,
12931 ResetAccessibilityActions,
12932 ResetAccessibilityRole,
12933 ResetAccessibilityState,
12934 ResetAccessibilityValue,
12935 ResetExpandSafeArea,
12936 ResetAreaChangeRatio,
12937 nullptr,
12938 nullptr,
12939 ResetFocusBox,
12940 };
12941 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
12942 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "common node attribute: %{public}d NOT IMPLEMENT", subTypeId);
12943 return;
12944 }
12945 if (resetters[subTypeId]) {
12946 resetters[subTypeId](node);
12947 }
12948 }
12949
SetTextAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)12950 int32_t SetTextAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
12951 {
12952 static Setter* setters[] = { SetTextContent, SetFontColor, SetFontSize, SetFontStyle, SetFontWeight, SetLineHeight,
12953 SetDecoration, SetTextCase, SetLetterSpacing, SetMaxLines, SetTextAlign, SetTextOverflow, SetTextFontFamily,
12954 SetTextCopyOption, SetBaseLineOffset, SetTextShadow, SetTextMinFontSize, SetTextMaxFontSize, SetTextFont,
12955 SetTextHeightAdaptivePolicy, SetTextIndent, SetTextWordBreak, SetTextEllipsisMode, SetLineSpacing,
12956 SetFontFeature, SetTextEnableDateDetector, SetTextDataDetectorConfig, SetTextSelectedBackgroundColor,
12957 SetTextContentWithStyledString, SetHalfLeading };
12958 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
12959 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "text node attribute: %{public}d NOT IMPLEMENT", subTypeId);
12960 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
12961 }
12962 return setters[subTypeId](node, value);
12963 }
12964
GetTextAttribute(ArkUI_NodeHandle node,int32_t subTypeId)12965 const ArkUI_AttributeItem* GetTextAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
12966 {
12967 static Getter* getters[] = { GetTextContent, GetFontColor, GetFontSize, GetFontStyle, GetFontWeight, GetLineHeight,
12968 GetDecoration, GetTextCase, GetLetterSpacing, GetMaxLines, GetTextAlign, GetTextOverflow, GetTextFontFamily,
12969 GetTextCopyOption, GetBaseLineOffset, GetTextShadow, GetTextMinFontSize, GetTextMaxFontSize, GetTextFont,
12970 GetTextHeightAdaptivePolicy, GetTextIndent, GetTextWordBreak, GetTextEllipsisMode, GetLineSpacing,
12971 GetFontFeature, GetTextEnableDateDetector, GetTextDataDetectorConfig, GetTextSelectedBackgroundColor, nullptr,
12972 GetHalfLeading };
12973 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*) || !getters[subTypeId]) {
12974 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "text node attribute: %{public}d NOT IMPLEMENT", subTypeId);
12975 return nullptr;
12976 }
12977 g_attributeItem.size = RETURN_SIZE_ONE;
12978 return getters[subTypeId](node);
12979 }
12980
ResetTextAttribute(ArkUI_NodeHandle node,int32_t subTypeId)12981 void ResetTextAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
12982 {
12983 static Resetter* resetters[] = { ResetTextContent, ResetFontColor, ResetFontSize, ResetFontStyle, ResetFontWeight,
12984 ResetLineHeight, ResetDecoration, ResetTextCase, ResetLetterSpacing, ResetMaxLines, ResetTextAlign,
12985 ResetTextOverflow, ResetTextFontFamily, ResetTextCopyOption, ResetBaselineOffset, ResetTextShadow,
12986 ResetTextMinFontSize, ResetTextMaxFontSize, ResetTextFont, ResetTextHeightAdaptivePolicy, ResetTextIndent,
12987 ResetTextWordBreak, ResetTextEllipsisMode, ResetLineSpacing, ResetFontFeature, ResetTextEnableDateDetector,
12988 ResetTextDataDetectorConfig, ResetTextSelectedBackgroundColor, ResetTextContentWithStyledString,ResetHalfLeading };
12989 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
12990 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "text node attribute: %{public}d NOT IMPLEMENT", subTypeId);
12991 return;
12992 }
12993 resetters[subTypeId](node);
12994 }
12995
SetSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)12996 int32_t SetSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
12997 {
12998 static Setter* setters[] = { SetSpanContent, SetSpanTextBackgroundStyle, SetBaseLineOffset };
12999 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13000 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13001 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13002 }
13003 return setters[subTypeId](node, value);
13004 }
13005
GetSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13006 const ArkUI_AttributeItem* GetSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13007 {
13008 static Getter* getters[] = { GetSpanContent, GetSpanTextBackgroundStyle, GetBaseLineOffset };
13009 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13010 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13011 return nullptr;
13012 }
13013 return getters[subTypeId](node);
13014 }
13015
ResetSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13016 void ResetSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13017 {
13018 static Resetter* resetters[] = { ResetSpanContent, ResetSpanTextBackgroundStyle, ResetBaselineOffset };
13019 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13020 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13021 return;
13022 }
13023 resetters[subTypeId](node);
13024 }
13025
SetImageSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13026 int32_t SetImageSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13027 {
13028 static Setter* setters[] = { SetImageSpanSrc, SetVerticalAlign, SetAlt, SetImageSpanBaselineOffset };
13029 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13030 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13031 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13032 }
13033 return setters[subTypeId](node, value);
13034 }
13035
GetImageSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13036 const ArkUI_AttributeItem* GetImageSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13037 {
13038 static Getter* getters[] = { GetImageSpanSrc, GetVerticalAlign, GetAlt, GetImageSpanBaselineOffset };
13039 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13040 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13041 return nullptr;
13042 }
13043 return getters[subTypeId](node);
13044 }
13045
ResetImageSpanAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13046 void ResetImageSpanAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13047 {
13048 static Resetter* resetters[] = { ResetImageSpanSrc, ResetVerticalAlign, ResetAlt, ResetImageSpanBaselineOffset };
13049 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13050 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13051 return;
13052 }
13053 resetters[subTypeId](node);
13054 }
13055
SetImageAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13056 int32_t SetImageAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13057 {
13058 static Setter* setters[] = { SetImageSrc, SetObjectFit, SetInterpolation, SetObjectRepeat, SetColorFilter,
13059 SetAutoResize, SetAlt, SetImageDraggable, SetRenderMode, SetFitOriginalSize, SetFillColor, SetResizable };
13060 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13061 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13062 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13063 }
13064 return setters[subTypeId](node, value);
13065 }
13066
GetImageAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13067 const ArkUI_AttributeItem* GetImageAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13068 {
13069 static Getter* getters[] = { GetImageSrc, GetObjectFit, GetInterpolation, GetObjectRepeat, GetColorFilter,
13070 GetAutoResize, GetAlt, GetImageDraggable, GetRenderMode, GetFitOriginalSize, GetFillColor, GetResizable };
13071 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13072 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13073 return nullptr;
13074 }
13075 return getters[subTypeId](node);
13076 }
13077
ResetImageAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13078 void ResetImageAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13079 {
13080 static Resetter* resetters[] = { ResetImageSrc, ResetObjectFit, ResetInterpolation, ResetObjectRepeat,
13081 ResetColorFilter, ResetAutoResize, ResetAlt, ResetImageDraggable, ResetRenderMode,
13082 ResetFitOriginalSize, ResetFillColor, ResetResizable };
13083 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13084 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "image node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13085 return;
13086 }
13087 resetters[subTypeId](node);
13088 }
13089
SetToggleAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13090 int32_t SetToggleAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13091 {
13092 static Setter* setters[] = { SetToggleSelectedColor, SetToggleSwitchPointColor, SetToggleValue,
13093 SetToggleUnselectedColor };
13094 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13095 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "toggle node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13096 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13097 }
13098 return setters[subTypeId](node, value);
13099 }
13100
GetToggleAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13101 const ArkUI_AttributeItem* GetToggleAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13102 {
13103 static Getter* getters[] = { GetToggleSelectedColor, GetToggleSwitchPointColor, GetToggleValue,
13104 GetToggleUnselectedColor };
13105 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13106 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "toggle node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13107 return nullptr;
13108 }
13109 g_attributeItem.size = RETURN_SIZE_ONE;
13110 return getters[subTypeId](node);
13111 }
13112
ResetToggleAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13113 void ResetToggleAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13114 {
13115 static Resetter* resetters[] = { ResetToggleSelectedColor, ResetToggleSwitchPointColor, ResetToggleValue,
13116 ResetToggleUnselectedColor };
13117 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13118 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "toggle node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13119 return;
13120 }
13121 resetters[subTypeId](node);
13122 }
13123
SetLoadingProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13124 int32_t SetLoadingProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13125 {
13126 static Setter* setters[] = { SetLoadingProgressColor, SetLoadingProgressEnableLoading };
13127 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13128 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13129 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13130 }
13131 return setters[subTypeId](node, item);
13132 }
13133
ResetLoadingProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13134 void ResetLoadingProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13135 {
13136 static Resetter* resetters[] = { ResetLoadingProgressColor, ResetLoadingProgressEnableLoading };
13137 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13138 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13139 return;
13140 }
13141 return resetters[subTypeId](node);
13142 }
13143
GetLoadingProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13144 const ArkUI_AttributeItem* GetLoadingProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13145 {
13146 static Getter* getters[] = { GetLoadingProgressColor, GetLoadingProgressEnableLoading };
13147 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13148 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13149 return &g_attributeItem;
13150 }
13151 return getters[subTypeId](node);
13152 }
13153
SetTextInputAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13154 int32_t SetTextInputAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13155 {
13156 static Setter* setters[] = { SetTextInputPlaceholder, SetTextInputText, SetCaretColor, SetCaretStyle,
13157 SetShowUnderline, SetMaxLength, SetEnterKeyType, SetPlaceholderColor, SetTextInputPlaceholderFont,
13158 SetEnableKeyboardOnFocus, SetTextInputType, SetSelectedBackgroundColor, SetShowPasswordIcon,
13159 StopTextInputEditing, SetTextInputCancelButton, SetTextInputTextSelection, SetTextInputUnderlineColor,
13160 SetTextInputEnableAutoFill, SetTextInputContentType, SetTextInputPasswordRules, SetTextInputSelectAll,
13161 SetInputFilter, SetTextInputStyle, SetTextInputCaretOffset, nullptr, nullptr,
13162 SetTextInputSelectionMenuHidden, SetBlurOnSubmit, SetInputCustomKeyboard, SetTextInputWordBreak,
13163 SetTextInputShowKeyBoardOnFocus, SetTextInputNumberOfLines };
13164 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13165 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textinput node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13166 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13167 }
13168 return setters[subTypeId](node, value);
13169 }
13170
GetTextInputAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13171 const ArkUI_AttributeItem* GetTextInputAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13172 {
13173 static Getter* getters[] = { GetTextInputPlaceholder, GetTextInputText, GetCaretColor, GetCaretStyle,
13174 GetShowUnderline, GetMaxLength, GetEnterKeyType, GetPlaceholderColor, GetTextInputPlaceholderFont,
13175 GetEnableKeyboardOnFocus, GetTextInputType, GetSelectedBackgroundColor, GetShowPasswordIcon, GetTextInputEditing,
13176 GetTextInputCancelButton, GetTextInputTextSelection, GetTextInputUnderlineColor, GetTextInputEnableAutoFill,
13177 GetTextInputContentType, GetTextInputPasswordRules, GetTextInputSelectAll, GetInputFilter,
13178 GetTextInputStyle, GetTextInputCaretOffset, GetTextInputContentRect, GetTextInputContentLineCount,
13179 GetTextInputSelectionMenuHidden, GetBlurOnSubmit, GetInputCustomKeyboard, GetTextInputWordBreak,
13180 GetTextInputShowKeyBoardOnFocus, GetTextInputNumberOfLines};
13181 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13182 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textinput node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13183 return nullptr;
13184 }
13185 return getters[subTypeId](node);
13186 }
13187
ResetTextInputAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13188 void ResetTextInputAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13189 {
13190 static Resetter* setters[] = { ResetTextInputPlaceholder, ResetTextInputText, ResetCaretColor, ResetCaretStyle,
13191 ResetShowUnderline, ResetMaxLength, ResetEnterKeyType, ResetPlaceholderColor, ResetTextInputPlaceholderFont,
13192 ResetEnableKeyboardOnFocus, ResetTextInputType, ResetSelectedBackgroundColor, ResetShowPasswordIcon, nullptr,
13193 ResetTextInputCancelButton, ResetTextInputTextSelection, ResetTextInputUnderlineColor,
13194 ResetTextInputEnableAutoFill, ResetTextInputContentType, ResetTextInputPasswordRules, ResetTextInputSelectAll,
13195 ResetInputFilter, ResetTextInputStyle, ResetTextInputCaretOffset, nullptr, nullptr,
13196 ResetTextInputSelectionMenuHidden, ResetBlurOnSubmit, ResetInputCustomKeyboard, ResetTextInputWordBreak,
13197 ResetTextInputShowKeyBoardOnFocus, ResetTextInputNumberOfLines };
13198 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Resetter*)) {
13199 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textinput node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13200 return;
13201 }
13202 if (setters[subTypeId]) {
13203 setters[subTypeId](node);
13204 }
13205 }
13206
SetTextAreaAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13207 int32_t SetTextAreaAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13208 {
13209 static Setter* setters[] = { SetTextAreaPlaceholder, SetTextAreaText, SetMaxLength, SetPlaceholderColor,
13210 SetTextAreaPlaceholderFont, SetCaretColor, StopTextAreaEditing, SetTextAreaType, SetTextAreaShowCounter,
13211 SetTextAreaSelectionMenuHidden, SetBlurOnSubmit, SetInputFilter, SetSelectedBackgroundColor,
13212 SetEnterKeyType, SetEnableKeyboardOnFocus, SetTextInputCaretOffset, nullptr, nullptr,
13213 SetTextInputTextSelection, SetTextInputEnableAutoFill, SetTextInputContentType,
13214 SetTextInputShowKeyBoardOnFocus, SetTextInputNumberOfLines};
13215 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13216 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textarea node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13217 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13218 }
13219 return setters[subTypeId](node, value);
13220 }
13221
GetTextAreaAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13222 const ArkUI_AttributeItem* GetTextAreaAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13223 {
13224 static Getter* getters[] = { GetTextAreaPlaceholder, GetTextAreaText, GetMaxLength, GetPlaceholderColor,
13225 GetTextAreaPlaceholderFont, GetCaretColor, GetTextAreaEditing, GetTextAreaType, GetTextAreaShowCounter,
13226 GetTextAreaSelectionMenuHidden, GetBlurOnSubmit, GetInputFilter, GetSelectedBackgroundColor,
13227 GetEnterKeyType, GetEnableKeyboardOnFocus, GetTextInputCaretOffset, GetTextInputContentRect,
13228 GetTextInputContentLineCount, GetTextInputTextSelection, GetTextInputEnableAutoFill, GetTextInputContentType,
13229 GetTextInputShowKeyBoardOnFocus, GetTextInputNumberOfLines};
13230 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13231 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textarea span node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13232 return nullptr;
13233 }
13234 if (!getters[subTypeId]) {
13235 return nullptr;
13236 }
13237 return getters[subTypeId](node);
13238 }
13239
ResetTextAreaAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13240 void ResetTextAreaAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13241 {
13242 static Resetter* setters[] = { ResetTextAreaPlaceholder, ResetTextAreaText, ResetMaxLength, ResetPlaceholderColor,
13243 ResetTextAreaPlaceholderFont, ResetCaretColor, nullptr, ResetTextAreaType, ResetTextAreaShowCounter,
13244 ResetTextAreaSelectionMenuHidden, ResetBlurOnSubmit, ResetInputFilter, ResetSelectedBackgroundColor,
13245 ResetEnterKeyType, ResetEnableKeyboardOnFocus, ResetTextInputCaretOffset, nullptr, nullptr,
13246 ResetTextInputTextSelection, ResetTextInputEnableAutoFill, ResetTextInputContentType,
13247 ResetTextInputShowKeyBoardOnFocus, ResetTextInputNumberOfLines};
13248 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Resetter*)) {
13249 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textarea node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13250 return;
13251 }
13252 if (setters[subTypeId]) {
13253 setters[subTypeId](node);
13254 }
13255 }
13256
SetButtonAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13257 int32_t SetButtonAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13258 {
13259 static Setter* setters[] = { SetButtonLabel, SetButtonType };
13260 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13261 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "button node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13262 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13263 }
13264 return setters[subTypeId](node, item);
13265 }
13266
GetButtonAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13267 const ArkUI_AttributeItem* GetButtonAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13268 {
13269 static Getter* getters[] = { GetButtonLabel, GetButtonType };
13270 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13271 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "button node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13272 return nullptr;
13273 }
13274 g_attributeItem.size = RETURN_SIZE_ONE;
13275 return getters[subTypeId](node);
13276 }
13277
ResetButtonAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13278 void ResetButtonAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13279 {
13280 static Resetter* resetters[] = { ResetButtonLabel, ResetButtonType };
13281 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13282 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "button node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13283 return;
13284 }
13285 return resetters[subTypeId](node);
13286 }
13287
SetProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13288 int32_t SetProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13289 {
13290 static Setter* setters[] = { SetProgressValue, SetProgressTotal, SetProgressColor, SetProgressType };
13291 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13292 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "progress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13293 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13294 }
13295 return setters[subTypeId](node, item);
13296 }
13297
GetProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13298 const ArkUI_AttributeItem* GetProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13299 {
13300 static Getter* getters[] = { GetProgressValue, GetProgressTotal, GetProgressColor, GetProgressType };
13301 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13302 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "progress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13303 return nullptr;
13304 }
13305 g_attributeItem.size = RETURN_SIZE_ONE;
13306 return getters[subTypeId](node);
13307 }
13308
ResetProgressAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13309 void ResetProgressAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13310 {
13311 static Resetter* resetters[] = { ResetProgressValue, ResetProgressTotal, ResetProgressColor, ResetProgressType };
13312 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13313 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "progress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13314 return;
13315 }
13316 return resetters[subTypeId](node);
13317 }
13318
SetCheckboxAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13319 int32_t SetCheckboxAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13320 {
13321 static Setter* setters[] = { SetCheckboxSelect, SetCheckboxSelectedColor, SetCheckboxUnSelectedColor,
13322 SetCheckboxMark, SetCheckboxShape };
13323 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13324 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Checkbox node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13325 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13326 }
13327 return setters[subTypeId](node, item);
13328 }
13329
GetCheckboxAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13330 const ArkUI_AttributeItem* GetCheckboxAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13331 {
13332 static Getter* getters[] = { GetCheckboxSelect, GetCheckboxSelectedColor, GetCheckboxUnSelectedColor,
13333 GetCheckboxMark, GetCheckboxShape };
13334 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13335 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Checkbox node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13336 return nullptr;
13337 }
13338 g_attributeItem.size = RETURN_SIZE_ONE;
13339 return getters[subTypeId](node);
13340 }
13341
ResetCheckboxAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13342 void ResetCheckboxAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13343 {
13344 static Resetter* resetters[] = { ResetCheckboxSelect, ResetCheckboxSelectedColor, ResetCheckboxUnSelectedColor,
13345 ResetCheckboxMark, ResetCheckboxShape };
13346 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13347 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Checkbox node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13348 return;
13349 }
13350 return resetters[subTypeId](node);
13351 }
13352
SetXComponentAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13353 int32_t SetXComponentAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13354 {
13355 static Setter* setters[] = {
13356 SetXComponentId,
13357 SetXComponentType,
13358 SetXComponentSurfaceSize,
13359 };
13360 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13361 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "xcomponent node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13362 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13363 }
13364 return setters[subTypeId](node, value);
13365 }
13366
GetXComponentAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13367 const ArkUI_AttributeItem* GetXComponentAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13368 {
13369 static Getter* getters[] = { GetXComponentId, GetXComponentType, GetXComponentSurfaceSize, };
13370 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13371 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "xcomponent node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13372 return nullptr;
13373 }
13374 g_attributeItem.size = RETURN_SIZE_ONE;
13375 return getters[subTypeId](node);
13376 }
13377
ResetXComponentAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13378 void ResetXComponentAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13379 {
13380 static Resetter* setters[] = { nullptr, ResetXComponentType, ResetXComponentSurfaceSize };
13381 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Resetter*)) {
13382 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "xcomponent node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13383 return;
13384 }
13385 if (setters[subTypeId]) {
13386 setters[subTypeId](node);
13387 }
13388 }
13389
SetDatePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13390 int32_t SetDatePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13391 {
13392 static Setter* setters[] = { SetDatePickerLunar, SetDatePickerStart, SetDatePickerEnd, SetDatePickerSelected,
13393 SetDatePickerDisappearTextStyle, SetDatePickerTextStyle, SetDatePickerSelectedTextStyle };
13394 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13395 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "datepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13396 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13397 }
13398 return setters[subTypeId](node, item);
13399 }
13400
GetDatePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13401 const ArkUI_AttributeItem* GetDatePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13402 {
13403 static Getter* getters[] = { GetDatePickerLunar, GetDatePickerStart, GetDatePickerEnd, GetDatePickerSelected,
13404 GetDatePickerDisappearTextStyle, GetDatePickerTextStyle, GetDatePickerSelectedTextStyle };
13405 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13406 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "datepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13407 return &g_attributeItem;
13408 }
13409 return getters[subTypeId](node);
13410 }
13411
ResetDatePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13412 void ResetDatePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13413 {
13414 static Resetter* resetters[] = { ResetDatePickerLunar, ResetDatePickerStart, ResetDatePickerEnd,
13415 ResetDatePickerSelected, ResetDatePickerDisappearTextStyle, ResetDatePickerTextStyle,
13416 ResetDatePickerSelectedTextStyle };
13417 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13418 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "datepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13419 return;
13420 }
13421 return resetters[subTypeId](node);
13422 }
13423
SetTimePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13424 int32_t SetTimePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13425 {
13426 static Setter* setters[] = { SetTimePickerSelected, SetTimePickerUseMilitaryTime,
13427 SetTimePickerDisappearTextStyle, SetTimePickerTextStyle, SetTimePickerSelectedTextStyle };
13428 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13429 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "timepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13430 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13431 }
13432 return setters[subTypeId](node, item);
13433 }
13434
GetTimePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13435 const ArkUI_AttributeItem* GetTimePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13436 {
13437 static Getter* getters[] = { GetTimePickerSelected, GetTimePickerUseMilitaryTime, GetTimePickerDisappearTextStyle,
13438 GetTimePickerTextStyle, GetTimePickerSelectedTextStyle };
13439 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13440 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13441 return &g_attributeItem;
13442 }
13443 return getters[subTypeId](node);
13444 }
13445
ResetTimePickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13446 void ResetTimePickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13447 {
13448 static Resetter* resetters[] = { ResetTimePickerSelected, ResetTimePickerUseMilitaryTime,
13449 ResetTimePickerDisappearTextStyle, ResetTimePickerTextStyle, ResetTimePickerSelectedTextStyle };
13450 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13451 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "timepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13452 return;
13453 }
13454 return resetters[subTypeId](node);
13455 }
13456
SetTextPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13457 int32_t SetTextPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13458 {
13459 static Setter* setters[] = { SetTextPickerRange, SetTextPickerSelected, SetTextPickerValue,
13460 SetTextPickerDisappearTextStyle, SetTextPickerTextStyle, SetTextPickerSelectedTextStyle,
13461 SetTextPickerSelectedIndex, SetTextPickerCanLoop, SetTextPickerDefaultPickerItemHeight };
13462 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13463 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "textpicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13464 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13465 }
13466 return setters[subTypeId](node, item);
13467 }
13468
GetTextPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13469 const ArkUI_AttributeItem* GetTextPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13470 {
13471 static Getter* getters[] = { GetTextPickerRange, GetTextPickerSelected, GetTextPickerValue,
13472 GetTextPickerDisappearTextStyle, GetTextPickerTextStyle, GetTextPickerSelectedTextStyle,
13473 GetTextPickerSelectedIndex, GetTextPickerCanLoop, GetTextPickerDefaultPickerItemHeight };
13474 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13475 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13476 return &g_attributeItem;
13477 }
13478 return getters[subTypeId](node);
13479 }
13480
ResetTextPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13481 void ResetTextPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13482 {
13483 static Resetter* resetters[] = { ResetTextPickerRange, ResetTextPickerSelectedIndex, ResetTextPickerValue,
13484 ResetTextPickerDisappearTextStyle, ResetTextPickerTextStyle, ResetTextPickerSelectedTextStyle,
13485 ResetTextPickerSelectedIndex, ResetTextPickerCanLoop, ResetTextPickerDefaultPickerItemHeight };
13486 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13487 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "timepicker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13488 return;
13489 }
13490 return resetters[subTypeId](node);
13491 }
13492
SetCalendarPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13493 int32_t SetCalendarPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13494 {
13495 static Setter* setters[] = { SetHintRadius, SetSelectedDate, SetEdgeAlignment, SetCalendarPickerTextStyle };
13496 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13497 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "calendar picker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13498 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13499 }
13500 return setters[subTypeId](node, item);
13501 }
13502
ResetCalendarPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13503 void ResetCalendarPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13504 {
13505 static Resetter* resetters[] = { ResetHintRadius, ResetSelectedDate, ResetEdgeAlignment,
13506 ResetCalendarPickerTextStyle };
13507 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13508 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "calendar picker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13509 return;
13510 }
13511 return resetters[subTypeId](node);
13512 }
13513
GetCalendarPickerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13514 const ArkUI_AttributeItem* GetCalendarPickerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13515 {
13516 static Getter* getters[] = { GetHintRadius, GetSelectedDate, GetEdgeAlignment, GetCalendarPickerTextStyle };
13517 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13518 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "calendar picker node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13519 return nullptr;
13520 }
13521 return getters[subTypeId](node);
13522 }
13523
SetSliderAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13524 int32_t SetSliderAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13525 {
13526 static Setter* setters[] = {
13527 SetSliderBlockColor,
13528 SetSliderTrackColor,
13529 SetSliderSelectedColor,
13530 SetSliderShowSteps,
13531 SetSliderBlockStyle,
13532 SetSliderValue,
13533 SetSliderMinValue,
13534 SetSliderMaxValue,
13535 SetSliderStep,
13536 SetSliderDirection,
13537 SetSliderReverse,
13538 SetSliderStyle,
13539 SetSliderTrackThickness,
13540 SetSliderValidSlideRange,
13541 };
13542 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13543 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "slider node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13544 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13545 }
13546 return setters[subTypeId](node, item);
13547 }
13548
GetSliderAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13549 const ArkUI_AttributeItem* GetSliderAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13550 {
13551 static Getter* getters[] = {
13552 GetSliderBlockColor,
13553 GetSliderTrackColor,
13554 GetSliderSelectedColor,
13555 GetSliderShowSteps,
13556 GetSliderBlockStyle,
13557 GetSliderValue,
13558 GetSliderMinValue,
13559 GetSliderMaxValue,
13560 GetSliderStep,
13561 GetSliderDirection,
13562 GetSliderReverse,
13563 GetSliderStyle,
13564 GetSliderTrackThickness,
13565 GetSliderValidSlideRange,
13566 };
13567 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13568 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "slider node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13569 return nullptr;
13570 }
13571 g_attributeItem.size = RETURN_SIZE_ONE;
13572 return getters[subTypeId](node);
13573 }
13574
ResetSliderAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13575 void ResetSliderAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13576 {
13577 static Resetter* resetters[] = {
13578 ResetSliderBlockColor,
13579 ResetSliderTrackColor,
13580 ResetSliderSelectedColor,
13581 ResetSliderShowSteps,
13582 ResetSliderBlockStyle,
13583 ResetSliderValue,
13584 ResetSliderMinValue,
13585 ResetSliderMaxValue,
13586 ResetSliderStep,
13587 ResetSliderDirection,
13588 ResetSliderReverse,
13589 ResetSliderStyle,
13590 ResetSliderTrackThickness,
13591 ResetSliderValidSlideRange,
13592 };
13593 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13594 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "slider node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13595 return;
13596 }
13597 return resetters[subTypeId](node);
13598 }
13599
SetRadioAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13600 int32_t SetRadioAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13601 {
13602 static Setter* setters[] = { SetRadioChecked, SetRadioStyle, SetRadioValue, SetRadioGroup };
13603 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13604 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "radio node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13605 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13606 }
13607 return setters[subTypeId](node, item);
13608 }
13609
GetRadioAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13610 const ArkUI_AttributeItem* GetRadioAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13611 {
13612 static Getter* getters[] = { GetRadioChecked, GetRadioStyle, GetRadioValue, GetRadioGroup };
13613 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13614 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "radio node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13615 return nullptr;
13616 }
13617 g_attributeItem.size = RETURN_SIZE_ONE;
13618 return getters[subTypeId](node);
13619 }
13620
ResetRadioAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13621 void ResetRadioAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13622 {
13623 static Resetter* resetters[] = { ResetRadioChecked, ResetRadioStyle, ResetRadioValue, ResetRadioGroup };
13624 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13625 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "radio node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13626 return;
13627 }
13628 return resetters[subTypeId](node);
13629 }
13630
SetImageAnimatorAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13631 int32_t SetImageAnimatorAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13632 {
13633 static Setter* setters[] = { SetImageAnimatorSrc, SetImageAnimatorState, SetImageAnimatorDuration,
13634 SetImageAnimatorReverse, SetImageAnimatorFixedSize, SetImageAnimatorFillMode, SetImageAnimatorIterations };
13635 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13636 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "imageAnimator node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13637 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13638 }
13639 return setters[subTypeId](node, item);
13640 }
13641
GetImageAnimatorAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13642 const ArkUI_AttributeItem* GetImageAnimatorAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13643 {
13644 static Getter* getters[] = { GetImageAnimatorSrc, GetImageAnimatorState, GetImageAnimatorDuration,
13645 GetImageAnimatorReverse, GetImageAnimatorFixedSize, GetImageAnimatorFillMode, GetImageAnimatorIterations };
13646 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13647 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "imageAnimator node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13648 return nullptr;
13649 }
13650 return getters[subTypeId](node);
13651 }
13652
ResetImageAnimatorAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13653 void ResetImageAnimatorAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13654 {
13655 static Resetter* setters[] = { ResetImageAnimatorSrc, ResetImageAnimatorState, ResetImageAnimatorDuration,
13656 ResetImageAnimatorReverse, ResetImageAnimatorFixedSize, ResetImageAnimatorFillMode,
13657 ResetImageAnimatorIterations };
13658 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Resetter*)) {
13659 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "imageAnimator node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13660 return;
13661 }
13662 setters[subTypeId](node);
13663 }
13664
SetStackAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13665 int32_t SetStackAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13666 {
13667 static Setter* setters[] = { SetAlignContent };
13668 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13669 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "stack node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13670 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13671 }
13672 return setters[subTypeId](node, item);
13673 }
13674
GetStackAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13675 const ArkUI_AttributeItem* GetStackAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13676 {
13677 static Getter* getters[] = { GetAlignContent };
13678 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13679 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "stack node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13680 return nullptr;
13681 }
13682 return getters[subTypeId](node);
13683 }
13684
ResetStackAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13685 void ResetStackAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13686 {
13687 static Resetter* setters[] = { ResetAlignContent };
13688 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Resetter*)) {
13689 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "stack node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13690 return;
13691 }
13692 setters[subTypeId](node);
13693 }
13694
SetSwiperAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13695 int32_t SetSwiperAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13696 {
13697 static Setter* setters[] = { SetSwiperLoop, SetSwiperAutoPlay, SetSwiperShowIndicator, SetSwiperInterval,
13698 SetSwiperVertical, SetSwiperDuration, SetSwiperCurve, SetSwiperItemSpace, SetSwiperIndex, SetSwiperDisplayCount,
13699 SetSwiperDisableSwipe, SetSwiperShowDisplayArrow, SetSwiperEffectMode, SetSwiperNodeAdapter,
13700 SetSwiperCachedCount, SetSwiperPrevMargin, SetSwiperNextMargin, SetSwiperIndicator, SetSwiperNestedScroll,
13701 SetSwiperToIndex, SetSwiperIndicatorInteractive };
13702 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13703 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13704 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13705 }
13706 return setters[subTypeId](node, value);
13707 }
13708
ResetSwiperAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13709 void ResetSwiperAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13710 {
13711 static Resetter* resetters[] = { ResetSwiperLoop, ResetSwiperAutoPlay, ResetSwiperShowIndicator,
13712 ResetSwiperInterval, ResetSwiperVertical, ResetSwiperDuration, ResetSwiperCurve, ResetSwiperItemSpace,
13713 ResetSwiperIndex, ResetSwiperDisplayCount, ResetSwiperDisableSwipe, ResetSwiperShowDisplayArrow,
13714 ResetSwiperEffectMode, ResetSwiperNodeAdapter, ResetSwiperCachedCount, ResetSwiperPrevMargin,
13715 ResetSwiperNextMargin, ResetSwiperIndicator, ResetSwiperNestedScroll, nullptr,
13716 ResetSwiperIndicatorInteractive };
13717 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13718 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13719 return;
13720 }
13721 resetters[subTypeId](node);
13722 }
13723
GetSwiperAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13724 const ArkUI_AttributeItem* GetSwiperAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13725 {
13726 static Getter* getters[] = { GetSwiperLoop, GetSwiperAutoPlay, GetSwiperShowIndicator, GetSwiperInterval,
13727 GetSwiperVertical, GetSwiperDuration, GetSwiperCurve, GetSwiperItemSpace, GetSwiperIndex, GetSwiperDisplayCount,
13728 GetSwiperDisableSwipe, GetSwiperShowDisplayArrow, GetSwiperEffectMode, GetSwiperNodeAdapter,
13729 GetSwiperCachedCount, GetSwiperPrevMargin, GetSwiperNextMargin, GetSwiperIndicator, GetSwiperNestedScroll,
13730 nullptr, GetSwiperIndicatorInteractive };
13731 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13732 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "swiper node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13733 return nullptr;
13734 }
13735 g_attributeItem.size = RETURN_SIZE_ONE;
13736 return getters[subTypeId](node);
13737 }
13738
SetScrollAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13739 int32_t SetScrollAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13740 {
13741 static Setter* setters[] = { SetScrollScrollBar, SetScrollScrollBarWidth, SetScrollScrollBarColor,
13742 SetScrollScrollable, SetScrollEdgeEffect, SetScrollEnableScrollInteraction, SetScrollFriction,
13743 SetScrollScrollSnap, SetScrollNestedScroll, SetScrollTo, SetScrollEdge, SetScrollEnablePaging,
13744 SetScrollPage, SetScrollBy, SetScrollFling };
13745 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13746 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "scroll node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13747 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13748 }
13749 return setters[subTypeId](node, item);
13750 }
13751
GetScrollAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13752 const ArkUI_AttributeItem* GetScrollAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13753 {
13754 static Getter* getters[] = { GetScrollScrollBar, GetScrollScrollBarWidth, GetScrollScrollBarColor,
13755 GetScrollScrollable, GetScrollEdgeEffect, GetScrollEnableScrollInteraction, GetScrollFriction,
13756 GetScrollScrollSnap, GetScrollNestedScroll, GetScrollOffset, GetScrollEdge, GetScrollEnablePaging,
13757 nullptr, nullptr, nullptr };
13758 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13759 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "slider node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13760 return nullptr;
13761 }
13762 g_attributeItem.size = RETURN_SIZE_ONE;
13763 return getters[subTypeId](node);
13764 }
13765
ResetScrollAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13766 void ResetScrollAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13767 {
13768 static Resetter* resetters[] = { ResetScrollScrollBar, ResetScrollScrollBarWidth, ResetScrollScrollBarColor,
13769 ResetScrollScrollable, ResetScrollEdgeEffect, ResetScrollEnableScrollInteraction, ResetScrollFriction,
13770 ResetScrollScrollSnap, ResetScrollNestedScroll, ResetScrollTo, ResetScrollEdge, ResetScrollEnablePaging,
13771 nullptr, nullptr, nullptr };
13772 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13773 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "list node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13774 return;
13775 }
13776 return resetters[subTypeId](node);
13777 }
13778
SetListAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * value)13779 int32_t SetListAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* value)
13780 {
13781 static Setter* setters[] = { SetListDirection, SetListSticky, SetListSpace, SetListNodeAdapter, SetListCachedCount,
13782 SetListScrollToIndex, SetListAlignListItem, SetListChildrenMainSize, SetListInitialIndex, SetListDivider };
13783 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13784 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "list node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13785 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13786 }
13787 return setters[subTypeId](node, value);
13788 }
13789
GetListAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13790 const ArkUI_AttributeItem* GetListAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13791 {
13792 static Getter* getters[] = { GetListDirection, GetListSticky, GetListSpace, GetListNodeAdapter, GetListCachedCount,
13793 nullptr, GetListAlignListItem, nullptr, GetListInitialIndex, GetListDivider };
13794 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13795 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "loadingprogress node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13796 return &g_attributeItem;
13797 }
13798 return getters[subTypeId](node);
13799 }
13800
ResetListAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13801 void ResetListAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13802 {
13803 static Resetter* resetters[] = { ResetListDirection, ResetListSticky, ResetListSpace, ResetListNodeAdapter,
13804 ResetListCachedCount, nullptr, ResetListAlignListItem, ResetListChildrenMainSize, ResetListInitialIndex,
13805 ResetListDivider };
13806 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13807 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "list node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13808 return;
13809 }
13810 return resetters[subTypeId](node);
13811 }
13812
SetListItemAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13813 int32_t SetListItemAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13814 {
13815 static Setter* setters[] = { SetListItemSwiperAction };
13816 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13817 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "listitem node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13818 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13819 }
13820 return setters[subTypeId](node, item);
13821 }
13822
ResetListItemAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13823 void ResetListItemAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13824 {
13825 static Resetter* resetters[] = { ResetListItemSwiperAction };
13826 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13827 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "listitem node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13828 return;
13829 }
13830 if (resetters[subTypeId]) {
13831 return resetters[subTypeId](node);
13832 }
13833 }
13834
SetListItemGroupAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13835 int32_t SetListItemGroupAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13836 {
13837 static Setter* setters[] = { SetListItemGroupHeader, SetListItemGroupFooter, SetListItemGroupDivider,
13838 SetListItemGroupChildrenMainSize };
13839 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13840 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "listitemgroup node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13841 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13842 }
13843 return setters[subTypeId](node, item);
13844 }
13845
ResetListItemGroupAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13846 void ResetListItemGroupAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13847 {
13848 static Resetter* resetters[] = { nullptr, nullptr, ResetListItemGroupDivider, ResetListItemGroupChildrenMainSize };
13849 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13850 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "ListItemGroup node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13851 return;
13852 }
13853 if (resetters[subTypeId]) {
13854 return resetters[subTypeId](node);
13855 }
13856 }
13857
GetListItemGroupAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13858 const ArkUI_AttributeItem* GetListItemGroupAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13859 {
13860 static Getter* getters[] = { nullptr, nullptr, GetListItemGroupDivider, nullptr };
13861 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13862 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "ListItemGroup node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13863 return nullptr;
13864 }
13865 g_attributeItem.size = RETURN_SIZE_ONE;
13866 return getters[subTypeId](node);
13867 }
13868
SetColumnAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13869 int32_t SetColumnAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13870 {
13871 static Setter* setters[] = { SetAlignItems, SetJustifyContent };
13872 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13873 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "column node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13874 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13875 }
13876 return setters[subTypeId](node, item);
13877 }
13878
ResetColumnAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13879 void ResetColumnAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13880 {
13881 static Resetter* resetters[] = { ResetAlignItems, ResetJustifyContent };
13882 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13883 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "column node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13884 return;
13885 }
13886 return resetters[subTypeId](node);
13887 }
13888
GetColumnAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13889 const ArkUI_AttributeItem* GetColumnAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13890 {
13891 static Getter* getters[] = { GetAlignItems, GetJustifyContent };
13892 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13893 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "column node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13894 return nullptr;
13895 }
13896 g_attributeItem.size = RETURN_SIZE_ONE;
13897 return getters[subTypeId](node);
13898 }
13899
SetRowAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13900 int32_t SetRowAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13901 {
13902 static Setter* setters[] = { SetAlignItems, SetJustifyContent };
13903 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13904 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "row node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13905 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13906 }
13907 return setters[subTypeId](node, item);
13908 }
13909
ResetRowAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13910 void ResetRowAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13911 {
13912 static Resetter* resetters[] = { ResetAlignItems, ResetJustifyContent };
13913 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13914 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "row node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13915 return;
13916 }
13917 return resetters[subTypeId](node);
13918 }
13919
GetRowAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13920 const ArkUI_AttributeItem* GetRowAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13921 {
13922 static Getter* getters[] = { GetAlignItems, GetJustifyContent };
13923 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13924 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "row node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13925 return nullptr;
13926 }
13927 g_attributeItem.size = RETURN_SIZE_ONE;
13928 return getters[subTypeId](node);
13929 }
13930
SetFlexAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13931 int32_t SetFlexAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13932 {
13933 static Setter* setters[] = { SetFlexOptions };
13934 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13935 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "flex node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13936 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13937 }
13938 return setters[subTypeId](node, item);
13939 }
13940
ResetFlexAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13941 void ResetFlexAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13942 {
13943 static Resetter* resetters[] = { ResetFlexOptions };
13944 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13945 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "flex node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13946 return;
13947 }
13948 return resetters[subTypeId](node);
13949 }
13950
GetFlexAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13951 const ArkUI_AttributeItem* GetFlexAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13952 {
13953 static Getter* getters[] = { GetFlexOptions };
13954 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13955 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "flex node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13956 return nullptr;
13957 }
13958 g_attributeItem.size = RETURN_SIZE_ONE;
13959 return getters[subTypeId](node);
13960 }
13961
SetRefreshAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)13962 int32_t SetRefreshAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
13963 {
13964 static Setter* setters[] = { SetRefreshRefreshing, SetRefreshContent, SetRefreshPullDownRatio, SetRefreshOffset,
13965 SetPullToRefresh };
13966 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
13967 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "refresh node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13968 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
13969 }
13970 return setters[subTypeId](node, item);
13971 }
13972
GetRefreshAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13973 const ArkUI_AttributeItem* GetRefreshAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13974 {
13975 static Getter* getters[] = { GetRefreshRefreshing, nullptr, GetRefreshPullDownRatio, GetRefreshOffset,
13976 GetPullToRefresh };
13977 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
13978 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "refresh node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13979 return nullptr;
13980 }
13981 g_attributeItem.size = RETURN_SIZE_ONE;
13982 if (getters[subTypeId]) {
13983 return getters[subTypeId](node);
13984 }
13985 return nullptr;
13986 }
13987
ResetRefreshAttribute(ArkUI_NodeHandle node,int32_t subTypeId)13988 void ResetRefreshAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
13989 {
13990 static Resetter* resetters[] = { nullptr, ResetRefreshContent, ResetRefreshPullDownRatio, ResetRefreshOffset,
13991 ResetPullToRefresh };
13992 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
13993 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "refresh node attribute: %{public}d NOT IMPLEMENT", subTypeId);
13994 return;
13995 }
13996 if (resetters[subTypeId]) {
13997 return resetters[subTypeId](node);
13998 }
13999 }
14000
SetWaterFlowAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)14001 int32_t SetWaterFlowAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
14002 {
14003 static Setter* setters[] = { SetLayoutDirection, SetColumnsTemplate, SetRowsTemplate, SetWaterFlowColumnsGap,
14004 SetWaterFlowRowsGap, SetWaterFlowSectionOption, SetWaterFlowNodeAdapter, SetWaterFlowCachedCount,
14005 SetWaterFlowFooter, SetWaterFlowScrollToIndex, SetItemConstraintSize };
14006 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
14007 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "waterFlow node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14008 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14009 }
14010 return setters[subTypeId](node, item);
14011 }
14012
ResetWaterFlowAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14013 void ResetWaterFlowAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14014 {
14015 static Resetter* resetters[] = { ResetLayoutDirection, ResetColumnsTemplate, ResetRowsTemplate,
14016 ResetWaterFlowColumnsGap, ResetWaterFlowRowsGap, ResetWaterFlowSectionOption, ResetWaterFlowNodeAdapter,
14017 ResetWaterFlowCachedCount, ResetWaterFlowFooter, nullptr, ResetItemConstraintSize };
14018 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
14019 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "waterFlow node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14020 return;
14021 }
14022 return resetters[subTypeId](node);
14023 }
14024
GetWaterFlowAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14025 const ArkUI_AttributeItem* GetWaterFlowAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14026 {
14027 static Getter* getters[] = { GetLayoutDirection, GetColumnsTemplate, GetRowsTemplate, GetWaterFlowColumnsGap,
14028 GetWaterFlowRowsGap, GetWaterFlowSectionOption, GetWaterFlowNodeAdapter, GetWaterFlowCachedCount,
14029 nullptr, nullptr, GetItemConstraintSize };
14030 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
14031 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "waterFlow node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14032 return nullptr;
14033 }
14034 g_attributeItem.size = RETURN_SIZE_ONE;
14035 return getters[subTypeId](node);
14036 }
14037
SetRelativeContainerAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)14038 int32_t SetRelativeContainerAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
14039 {
14040 static Setter* setters[] = { SetRelativeContainerGuideLine, SetRelativeContainerBarrier };
14041 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
14042 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "RelativeContainer node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14043 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14044 }
14045 return setters[subTypeId](node, item);
14046 }
14047
ResetRelativeContainerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14048 void ResetRelativeContainerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14049 {
14050 static Resetter* resetters[] = { ResetRelativeContainerGuideLine, ResetRelativeContainerBarrier };
14051 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
14052 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "RelativeContainer node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14053 return;
14054 }
14055 return resetters[subTypeId](node);
14056 }
14057
GetRelativeContainerAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14058 const ArkUI_AttributeItem* GetRelativeContainerAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14059 {
14060 static Getter* getters[] = { GetRelativeContainerGuideLine, GetRelativeContainerBarrier };
14061 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
14062 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "RelativeContainer node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14063 return nullptr;
14064 }
14065 g_attributeItem.size = RETURN_SIZE_ONE;
14066 return getters[subTypeId](node);
14067 }
14068
SetGridAttribute(ArkUI_NodeHandle node,int32_t subTypeId,const ArkUI_AttributeItem * item)14069 int32_t SetGridAttribute(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item)
14070 {
14071 static Setter* setters[] = { SetGridColumnsTemplate, SetGridRowsTemplate, SetGridColumnsGap, SetGridRowsGap,
14072 SetGridNodeAdapter, SetGridCachedCount };
14073 if (static_cast<uint32_t>(subTypeId) >= sizeof(setters) / sizeof(Setter*)) {
14074 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Grid node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14075 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14076 }
14077 return setters[subTypeId](node, item);
14078 }
14079
ResetGridAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14080 void ResetGridAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14081 {
14082 static Resetter* resetters[] = { ResetGridColumnsTemplate, ResetGridRowsTemplate, ResetGridColumnsGap,
14083 ResetGridRowsGap, ResetGridNodeAdapter, ResetGridCachedCount };
14084 if (static_cast<uint32_t>(subTypeId) >= sizeof(resetters) / sizeof(Resetter*)) {
14085 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Grid node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14086 return;
14087 }
14088 return resetters[subTypeId](node);
14089 }
14090
GetGridAttribute(ArkUI_NodeHandle node,int32_t subTypeId)14091 const ArkUI_AttributeItem* GetGridAttribute(ArkUI_NodeHandle node, int32_t subTypeId)
14092 {
14093 static Getter* getters[] = { GetGridColumnsTemplate, GetGridRowsTemplate, GetGridColumnsGap, GetGridRowsGap,
14094 GetGridNodeAdapter, GetGridCachedCount };
14095 if (static_cast<uint32_t>(subTypeId) >= sizeof(getters) / sizeof(Getter*)) {
14096 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "Grid node attribute: %{public}d NOT IMPLEMENT", subTypeId);
14097 return nullptr;
14098 }
14099 g_attributeItem.size = RETURN_SIZE_ONE;
14100 return getters[subTypeId](node);
14101 }
14102 } // namespace
14103
SetNodeAttribute(ArkUI_NodeHandle node,ArkUI_NodeAttributeType type,const ArkUI_AttributeItem * item)14104 int32_t SetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAttributeType type, const ArkUI_AttributeItem* item)
14105 {
14106 using AttributeSetterClass = int32_t(ArkUI_NodeHandle node, int32_t subTypeId, const ArkUI_AttributeItem* item);
14107 static AttributeSetterClass* setterClasses[] = {
14108 SetCommonAttribute,
14109 SetTextAttribute,
14110 SetSpanAttribute,
14111 SetImageSpanAttribute,
14112 SetImageAttribute,
14113 SetToggleAttribute,
14114 SetLoadingProgressAttribute,
14115 SetTextInputAttribute,
14116 SetTextAreaAttribute,
14117 SetButtonAttribute,
14118 SetProgressAttribute,
14119 SetCheckboxAttribute,
14120 SetXComponentAttribute,
14121 SetDatePickerAttribute,
14122 SetTimePickerAttribute,
14123 SetTextPickerAttribute,
14124 SetCalendarPickerAttribute,
14125 SetSliderAttribute,
14126 SetRadioAttribute,
14127 SetImageAnimatorAttribute,
14128 SetStackAttribute,
14129 SetSwiperAttribute,
14130 SetScrollAttribute,
14131 SetListAttribute,
14132 SetListItemAttribute,
14133 SetListItemGroupAttribute,
14134 SetColumnAttribute,
14135 SetRowAttribute,
14136 SetFlexAttribute,
14137 SetRefreshAttribute,
14138 SetWaterFlowAttribute,
14139 nullptr,
14140 SetRelativeContainerAttribute,
14141 SetGridAttribute
14142 };
14143 int32_t subTypeClass = type / MAX_NODE_SCOPE_NUM;
14144 int32_t subTypeId = type % MAX_NODE_SCOPE_NUM;
14145 int32_t nodeSubTypeClass =
14146 subTypeClass < MAX_NODE_SCOPE_NUM ? subTypeClass : (subTypeClass - MAX_NODE_SCOPE_NUM + BASIC_COMPONENT_NUM);
14147 if ((static_cast<uint32_t>(nodeSubTypeClass) >= sizeof(setterClasses) / sizeof(AttributeSetterClass*)) ||
14148 !CheckIfAttributeLegal(node, type)) {
14149 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14150 }
14151 if (!setterClasses[nodeSubTypeClass]) {
14152 return ERROR_CODE_PARAM_INVALID;
14153 }
14154 auto result = setterClasses[nodeSubTypeClass](node, subTypeId, item);
14155 if (result == ERROR_CODE_NO_ERROR) {
14156 GetFullImpl()->getBasicAPI()->markDirty(node->uiNodeHandle, ARKUI_DIRTY_FLAG_ATTRIBUTE_DIFF);
14157 }
14158 return result;
14159 }
14160
GetNodeAttribute(ArkUI_NodeHandle node,ArkUI_NodeAttributeType type)14161 const ArkUI_AttributeItem* GetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAttributeType type)
14162 {
14163 ResetAttributeItem();
14164 using AttributeGetterClass = const ArkUI_AttributeItem*(ArkUI_NodeHandle node, int32_t subTypeId);
14165 static AttributeGetterClass* getterClasses[] = { GetCommonAttribute, GetTextAttribute, GetSpanAttribute,
14166 GetImageSpanAttribute, GetImageAttribute, GetToggleAttribute, GetLoadingProgressAttribute,
14167 GetTextInputAttribute, GetTextAreaAttribute, GetButtonAttribute, GetProgressAttribute, GetCheckboxAttribute,
14168 GetXComponentAttribute, GetDatePickerAttribute, GetTimePickerAttribute, GetTextPickerAttribute,
14169 GetCalendarPickerAttribute, GetSliderAttribute, GetRadioAttribute, GetImageAnimatorAttribute, GetStackAttribute,
14170 GetSwiperAttribute, GetScrollAttribute, GetListAttribute, nullptr, GetListItemGroupAttribute,
14171 GetColumnAttribute, GetRowAttribute, GetFlexAttribute, GetRefreshAttribute, GetWaterFlowAttribute, nullptr,
14172 GetRelativeContainerAttribute, GetGridAttribute };
14173 int32_t subTypeClass = type / MAX_NODE_SCOPE_NUM;
14174 int32_t subTypeId = type % MAX_NODE_SCOPE_NUM;
14175 int32_t nodeSubTypeClass =
14176 subTypeClass < MAX_NODE_SCOPE_NUM ? subTypeClass : (subTypeClass - MAX_NODE_SCOPE_NUM + BASIC_COMPONENT_NUM);
14177 if ((static_cast<uint32_t>(nodeSubTypeClass) >= sizeof(getterClasses) / sizeof(AttributeGetterClass*)) ||
14178 !CheckIfAttributeLegal(node, type)) {
14179 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "node attribute: %{public}d NOT IMPLEMENT", type);
14180 return nullptr;
14181 }
14182 if (!getterClasses[nodeSubTypeClass]) {
14183 return nullptr;
14184 }
14185 return getterClasses[nodeSubTypeClass](node, subTypeId);
14186 }
14187
ResetNodeAttribute(ArkUI_NodeHandle node,ArkUI_NodeAttributeType type)14188 int32_t ResetNodeAttribute(ArkUI_NodeHandle node, ArkUI_NodeAttributeType type)
14189 {
14190 using AttributeResetterClass = void(ArkUI_NodeHandle node, int32_t subTypeId);
14191 static AttributeResetterClass* resetterClasses[] = {
14192 ResetCommonAttribute,
14193 ResetTextAttribute,
14194 ResetSpanAttribute,
14195 ResetImageSpanAttribute,
14196 ResetImageAttribute,
14197 ResetToggleAttribute,
14198 ResetLoadingProgressAttribute,
14199 ResetTextInputAttribute,
14200 ResetTextAreaAttribute,
14201 ResetButtonAttribute,
14202 ResetProgressAttribute,
14203 ResetCheckboxAttribute,
14204 ResetXComponentAttribute,
14205 ResetDatePickerAttribute,
14206 ResetTimePickerAttribute,
14207 ResetTextPickerAttribute,
14208 ResetCalendarPickerAttribute,
14209 ResetSliderAttribute,
14210 ResetRadioAttribute,
14211 ResetImageAnimatorAttribute,
14212 ResetStackAttribute,
14213 ResetSwiperAttribute,
14214 ResetScrollAttribute,
14215 ResetListAttribute,
14216 ResetListItemAttribute,
14217 ResetListItemGroupAttribute,
14218 ResetColumnAttribute,
14219 ResetRowAttribute,
14220 ResetFlexAttribute,
14221 ResetRefreshAttribute,
14222 ResetWaterFlowAttribute,
14223 nullptr,
14224 ResetRelativeContainerAttribute,
14225 ResetGridAttribute
14226 };
14227 int32_t subTypeClass = type / MAX_NODE_SCOPE_NUM;
14228 int32_t subTypeId = type % MAX_NODE_SCOPE_NUM;
14229 int32_t nodeSubTypeClass =
14230 subTypeClass < MAX_NODE_SCOPE_NUM ? subTypeClass : (subTypeClass - MAX_NODE_SCOPE_NUM + BASIC_COMPONENT_NUM);
14231 if ((static_cast<uint32_t>(nodeSubTypeClass) >= sizeof(resetterClasses) / sizeof(AttributeResetterClass*)) ||
14232 !CheckIfAttributeLegal(node, type)) {
14233 TAG_LOGE(AceLogTag::ACE_NATIVE_NODE, "node attribute: %{public}d NOT IMPLEMENT", type);
14234 return ERROR_CODE_NATIVE_IMPL_TYPE_NOT_SUPPORTED;
14235 }
14236 if (!resetterClasses[nodeSubTypeClass]) {
14237 return ERROR_CODE_PARAM_INVALID;
14238 }
14239 resetterClasses[nodeSubTypeClass](node, subTypeId);
14240 GetFullImpl()->getBasicAPI()->markDirty(node->uiNodeHandle, ARKUI_DIRTY_FLAG_ATTRIBUTE_DIFF);
14241 return ERROR_CODE_NO_ERROR;
14242 }
14243
14244 } // namespace OHOS::Ace::NodeModel