• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "core/interfaces/native/node/tabs_modifier.h"
16 
17 #include "bridge/common/utils/utils.h"
18 #include "core/components_ng/pattern/tabs/tabs_model_ng.h"
19 #include "core/common/resource/resource_manager.h"
20 #include "core/common/resource/resource_wrapper.h"
21 #include "core/common/resource/resource_parse_utils.h"
22 #include "core/pipeline_ng/pipeline_context.h"
23 
24 namespace OHOS::Ace::NG {
25 constexpr int NUM_0 = 0;
26 constexpr int NUM_1 = 1;
27 constexpr int NUM_2 = 2;
28 constexpr int NUM_3 = 3;
29 constexpr int NUM_4 = 4;
30 constexpr int DEFAULT_LENGTH = 3;
31 constexpr int DEFAULT_LENGTH_OF_BAR_GRID_ALIGN = 5;
32 constexpr int DEFAULT_LENGTH_OF_BAR_GRID_ALIGN_VALUES = 2;
33 constexpr int DEFAULT_ANIMATION_DURATION = 300;
34 constexpr int ANIMATION_CURVE_TYPE_STR = 1;
35 constexpr int ANIMATION_CURVE_TYPE_FUNC = 2;
36 
SetTabBarMode(ArkUINodeHandle node,ArkUI_Int32 tabsBarMode)37 void SetTabBarMode(ArkUINodeHandle node, ArkUI_Int32 tabsBarMode)
38 {
39     auto* frameNode = reinterpret_cast<FrameNode*>(node);
40     CHECK_NULL_VOID(frameNode);
41     auto barMode = static_cast<TabBarMode>(tabsBarMode);
42     TabsModelNG::SetTabBarMode(frameNode, barMode);
43 }
SetScrollableBarModeOptions(ArkUINodeHandle node,const ArkUI_Float32 value,ArkUI_Int32 unit,ArkUI_Int32 layoutStyle)44 void SetScrollableBarModeOptions(ArkUINodeHandle node, const ArkUI_Float32 value,
45     ArkUI_Int32 unit, ArkUI_Int32 layoutStyle)
46 {
47     auto* frameNode = reinterpret_cast<FrameNode*>(node);
48     CHECK_NULL_VOID(frameNode);
49     ScrollableBarModeOptions option;
50     CalcDimension margin = Dimension(value, static_cast<OHOS::Ace::DimensionUnit>(unit));
51     option.margin = margin;
52     if (layoutStyle < static_cast<int32_t>(LayoutStyle::ALWAYS_CENTER) ||
53         layoutStyle > static_cast<int32_t>(LayoutStyle::SPACE_BETWEEN_OR_CENTER)) {
54         option.nonScrollableLayoutStyle = std::nullopt;
55     } else {
56         option.nonScrollableLayoutStyle = (static_cast<LayoutStyle>(layoutStyle));
57     }
58     TabsModelNG::SetScrollableBarModeOptions(frameNode, option);
59 }
60 
CreateScrollableBarModeOptionsWithResourceObj(ArkUINodeHandle node,void * marginRawPtr)61 void CreateScrollableBarModeOptionsWithResourceObj(ArkUINodeHandle node, void* marginRawPtr)
62 {
63     CHECK_NULL_VOID(SystemProperties::ConfigChangePerform());
64     auto* frameNode = reinterpret_cast<FrameNode*>(node);
65     CHECK_NULL_VOID(frameNode);
66     auto* marginPtr = reinterpret_cast<ResourceObject*>(marginRawPtr);
67     auto marginResObj = AceType::Claim(marginPtr);
68     TabsModelNG::HandleScrollableBarMargin(frameNode, marginResObj, true);
69 }
70 
SetBarGridAlign(ArkUINodeHandle node,const ArkUI_Float32 * values,ArkUI_Int32 valuesLength,const ArkUI_Int32 * units,ArkUI_Int32 unitsLength)71 void SetBarGridAlign(ArkUINodeHandle node, const ArkUI_Float32* values, ArkUI_Int32 valuesLength,
72     const ArkUI_Int32* units, ArkUI_Int32 unitsLength)
73 {
74     auto* frameNode = reinterpret_cast<FrameNode*>(node);
75     CHECK_NULL_VOID(frameNode);
76 
77     if (unitsLength != DEFAULT_LENGTH_OF_BAR_GRID_ALIGN || valuesLength != DEFAULT_LENGTH_OF_BAR_GRID_ALIGN_VALUES) {
78         return;
79     }
80     BarGridColumnOptions columnOption;
81     columnOption.sm = units[NUM_2];
82     columnOption.md = units[NUM_3];
83     columnOption.lg = units[NUM_4];
84     columnOption.gutter = Dimension(values[NUM_0], static_cast<OHOS::Ace::DimensionUnit>(units[NUM_0]));
85     columnOption.margin = Dimension(values[NUM_1], static_cast<OHOS::Ace::DimensionUnit>(units[NUM_1]));
86 
87     TabsModelNG::SetBarGridAlign(frameNode, columnOption);
88 }
89 
CreateBarGridAlignWithResourceObj(ArkUINodeHandle node,void * columnGutterRawPtr,void * columnMarginRawPtr)90 void CreateBarGridAlignWithResourceObj(ArkUINodeHandle node, void* columnGutterRawPtr, void* columnMarginRawPtr)
91 {
92     CHECK_NULL_VOID(SystemProperties::ConfigChangePerform());
93     auto* frameNode = reinterpret_cast<FrameNode*>(node);
94     CHECK_NULL_VOID(frameNode);
95     auto* columnGutterPtr = reinterpret_cast<ResourceObject*>(columnGutterRawPtr);
96     auto columnGutterResObj = AceType::Claim(columnGutterPtr);
97     auto* columnMarginPtr = reinterpret_cast<ResourceObject*>(columnMarginRawPtr);
98     auto columnMarginResObj = AceType::Claim(columnMarginPtr);
99     TabsModelNG::HandleBarGridGutter(frameNode, columnGutterResObj, true);
100     TabsModelNG::HandleBarGridMargin(frameNode, columnMarginResObj, true);
101 }
102 
SetDivider(ArkUINodeHandle node,ArkUI_Uint32 color,const ArkUI_Float32 * values,const ArkUI_Int32 * units,ArkUI_Int32 length)103 void SetDivider(ArkUINodeHandle node, ArkUI_Uint32 color, const ArkUI_Float32* values, const ArkUI_Int32* units,
104     ArkUI_Int32 length)
105 {
106     auto* frameNode = reinterpret_cast<FrameNode*>(node);
107     CHECK_NULL_VOID(frameNode);
108 
109     if (length != DEFAULT_LENGTH) {
110         return;
111     }
112     TabsItemDivider divider;
113     divider.strokeWidth = Dimension(values[NUM_0], static_cast<OHOS::Ace::DimensionUnit>(units[NUM_0]));
114     divider.startMargin = Dimension(values[NUM_1], static_cast<OHOS::Ace::DimensionUnit>(units[NUM_1]));
115     divider.endMargin = Dimension(values[NUM_2], static_cast<OHOS::Ace::DimensionUnit>(units[NUM_2]));
116     divider.color = Color(color);
117 
118     TabsModelNG::SetDivider(frameNode, divider);
119 }
120 
SetDividerColorByUser(ArkUINodeHandle node,ArkUI_Bool isByUser)121 void SetDividerColorByUser(ArkUINodeHandle node, ArkUI_Bool isByUser)
122 {
123     auto* frameNode = reinterpret_cast<FrameNode*>(node);
124     CHECK_NULL_VOID(frameNode);
125     TabsModelNG::SetDividerColorByUser(frameNode, isByUser);
126 }
127 
CreateDividerWithResourceObj(ArkUINodeHandle node,void * strokeWidthRawPtr,void * colorRawPtr,void * startMarginRawPtr,void * endMarginRawPtr)128 void CreateDividerWithResourceObj(ArkUINodeHandle node,
129     void* strokeWidthRawPtr, void* colorRawPtr, void* startMarginRawPtr, void* endMarginRawPtr)
130 {
131     CHECK_NULL_VOID(SystemProperties::ConfigChangePerform());
132     auto* frameNode = reinterpret_cast<FrameNode*>(node);
133     CHECK_NULL_VOID(frameNode);
134     auto* strokeWidthPtr = reinterpret_cast<ResourceObject*>(strokeWidthRawPtr);
135     auto strokeWidthResObj = AceType::Claim(strokeWidthPtr);
136     TabsModelNG::HandleDividerStrokeWidth(frameNode, strokeWidthResObj, true);
137     auto* colorPtr = reinterpret_cast<ResourceObject*>(colorRawPtr);
138     auto colorResObj = AceType::Claim(colorPtr);
139     TabsModelNG::HandleDividerColor(frameNode, colorResObj, true);
140     auto* startMarginPtr = reinterpret_cast<ResourceObject*>(startMarginRawPtr);
141     auto startMarginResObj = AceType::Claim(startMarginPtr);
142     TabsModelNG::HandleDividerStartMargin(frameNode, startMarginResObj, true);
143     auto* endMarginPtr = reinterpret_cast<ResourceObject*>(endMarginRawPtr);
144     auto endMarginResObj = AceType::Claim(endMarginPtr);
145     TabsModelNG::HandleDividerEndMargin(frameNode, endMarginResObj, true);
146 }
147 
SetFadingEdge(ArkUINodeHandle node,ArkUI_Bool fadingEdge)148 void SetFadingEdge(ArkUINodeHandle node, ArkUI_Bool fadingEdge)
149 {
150     auto* frameNode = reinterpret_cast<FrameNode*>(node);
151     CHECK_NULL_VOID(frameNode);
152     TabsModelNG::SetFadingEdge(frameNode, fadingEdge);
153 }
SetTabOnUnselected(ArkUINodeHandle node,void * callback)154 void SetTabOnUnselected(ArkUINodeHandle node, void* callback)
155 {
156     auto* frameNode = reinterpret_cast<FrameNode*>(node);
157     CHECK_NULL_VOID(frameNode);
158     if (callback) {
159         auto onEvent = reinterpret_cast<std::function<void(const BaseEventInfo*)>*>(callback);
160         TabsModelNG::SetOnUnselected(frameNode, std::move(*onEvent));
161     } else {
162         TabsModelNG::SetOnUnselected(frameNode, nullptr);
163     }
164 }
SetBarBackgroundColor(ArkUINodeHandle node,ArkUI_Uint32 color)165 void SetBarBackgroundColor(ArkUINodeHandle node, ArkUI_Uint32 color)
166 {
167     auto* frameNode = reinterpret_cast<FrameNode*>(node);
168     CHECK_NULL_VOID(frameNode);
169     TabsModelNG::SetBarBackgroundColor(frameNode, Color(color));
170     TabsModelNG::SetBarBackgroundColorByUser(frameNode, true);
171 }
172 
CreateBarBackgroundColorWithResourceObj(ArkUINodeHandle node,void * bgColorRawPtr)173 void CreateBarBackgroundColorWithResourceObj(ArkUINodeHandle node, void* bgColorRawPtr)
174 {
175     CHECK_NULL_VOID(SystemProperties::ConfigChangePerform());
176     auto* frameNode = reinterpret_cast<FrameNode*>(node);
177     CHECK_NULL_VOID(frameNode);
178     auto* bgColorPtr = reinterpret_cast<ResourceObject*>(bgColorRawPtr);
179     auto bgColorResObj = AceType::Claim(bgColorPtr);
180     TabsModelNG::HandleBarBackgroundColor(frameNode, bgColorResObj, true);
181 }
182 
SetBarBackgroundBlurStyle(ArkUINodeHandle node,ArkUITabBarBackgroundBlurStyle * styleOption)183 void SetBarBackgroundBlurStyle(ArkUINodeHandle node, ArkUITabBarBackgroundBlurStyle* styleOption)
184 {
185     auto* frameNode = reinterpret_cast<FrameNode*>(node);
186     CHECK_NULL_VOID(frameNode);
187     ArkUI_Int32 blurStyle = styleOption->blurStyle;
188     ArkUI_Int32 colorMode = styleOption->colorMode;
189     ArkUI_Int32 adaptiveColor = styleOption->adaptiveColor;
190     ArkUI_Int32 policy = styleOption->policy;
191     ArkUI_Int32 blurType = styleOption->blurType;
192     BlurStyleOption bgBlurStyle;
193     if (blurStyle >= 0) {
194         if (blurStyle >= static_cast<int>(BlurStyle::NO_MATERIAL) &&
195             blurStyle <= static_cast<int>(BlurStyle::COMPONENT_ULTRA_THICK)) {
196             bgBlurStyle.blurStyle = static_cast<BlurStyle>(blurStyle);
197         }
198     }
199     bool isHasOptions = !((styleOption->colorMode < 0) && (styleOption->adaptiveColor < 0) &&
200         (styleOption->scale < 0) && (styleOption->blurValuesSize == 0));
201     if (isHasOptions) {
202         if (colorMode >= static_cast<int32_t>(ThemeColorMode::SYSTEM) &&
203             colorMode <= static_cast<int32_t>(ThemeColorMode::DARK)) {
204             bgBlurStyle.colorMode = static_cast<ThemeColorMode>(colorMode);
205         }
206         if (adaptiveColor >= static_cast<int32_t>(AdaptiveColor::DEFAULT) &&
207             adaptiveColor <= static_cast<int32_t>(AdaptiveColor::AVERAGE)) {
208             bgBlurStyle.adaptiveColor = static_cast<AdaptiveColor>(adaptiveColor);
209         }
210         bgBlurStyle.scale = std::clamp(styleOption->scale, 0.0f, 1.0f);
211         BlurOption blurOption;
212         blurOption.grayscale.assign(styleOption->blurValues, styleOption->blurValues + styleOption->blurValuesSize);
213         bgBlurStyle.blurOption = blurOption;
214     }
215     bgBlurStyle.policy = static_cast<BlurStyleActivePolicy>(policy);
216     bgBlurStyle.blurType = static_cast<BlurType>(blurType);
217     bgBlurStyle.isValidColor = styleOption->isValidColor;
218     Color inactiveColor(styleOption->inactiveColor);
219     bgBlurStyle.inactiveColor = inactiveColor;
220     TabsModelNG::SetBarBackgroundBlurStyle(frameNode, bgBlurStyle);
221 }
222 
CreateBarBackgroundBlurStyleWithResourceObj(ArkUINodeHandle node,void * inactiveColorRawPtr)223 void CreateBarBackgroundBlurStyleWithResourceObj(ArkUINodeHandle node, void* inactiveColorRawPtr)
224 {
225     CHECK_NULL_VOID(SystemProperties::ConfigChangePerform());
226     auto* frameNode = reinterpret_cast<FrameNode*>(node);
227     CHECK_NULL_VOID(frameNode);
228     auto* inactiveColorPtr = reinterpret_cast<ResourceObject*>(inactiveColorRawPtr);
229     auto inactiveColorResObj = AceType::Claim(inactiveColorPtr);
230     TabsModelNG::HandleBackgroundBlurStyleInactiveColor(frameNode, inactiveColorResObj, true);
231 }
232 
SetBarOverlap(ArkUINodeHandle node,ArkUI_Bool barOverlap)233 void SetBarOverlap(ArkUINodeHandle node, ArkUI_Bool barOverlap)
234 {
235     auto* frameNode = reinterpret_cast<FrameNode*>(node);
236     CHECK_NULL_VOID(frameNode);
237     TabsModelNG::SetBarOverlap(frameNode, barOverlap);
238 }
SetIsVertical(ArkUINodeHandle node,ArkUI_Bool isVertical)239 void SetIsVertical(ArkUINodeHandle node, ArkUI_Bool isVertical)
240 {
241     auto* frameNode = reinterpret_cast<FrameNode*>(node);
242     CHECK_NULL_VOID(frameNode);
243     TabsModelNG::SetIsVertical(frameNode, isVertical);
244 }
SetTabBarPosition(ArkUINodeHandle node,ArkUI_Int32 barVal)245 void SetTabBarPosition(ArkUINodeHandle node, ArkUI_Int32 barVal)
246 {
247     auto* frameNode = reinterpret_cast<FrameNode*>(node);
248     CHECK_NULL_VOID(frameNode);
249     TabsModelNG::SetTabBarPosition(frameNode, static_cast<BarPosition>(barVal));
250 }
SetTabsOptionsIndex(ArkUINodeHandle node,ArkUI_Int32 indexVal)251 void SetTabsOptionsIndex(ArkUINodeHandle node, ArkUI_Int32 indexVal)
252 {
253     auto* frameNode = reinterpret_cast<FrameNode*>(node);
254     CHECK_NULL_VOID(frameNode);
255     TabsModelNG::SetTabBarIndex(frameNode, indexVal < 0 ? 0 : indexVal);
256 }
SetTabsOptionsController(ArkUINodeHandle node,ArkUINodeHandle tabsController)257 void SetTabsOptionsController(ArkUINodeHandle node, ArkUINodeHandle tabsController)
258 {
259     auto* frameNode = reinterpret_cast<FrameNode*>(node);
260     CHECK_NULL_VOID(frameNode);
261     TabsModelNG::SetTabsController(frameNode,
262         AceType::Claim(reinterpret_cast<OHOS::Ace::SwiperController*>(tabsController)));
263 }
SetTabsOptionsBarModifier(ArkUINodeHandle node,void * callback)264 void SetTabsOptionsBarModifier(ArkUINodeHandle node, void* callback)
265 {
266     auto* frameNode = reinterpret_cast<FrameNode*>(node);
267     CHECK_NULL_VOID(frameNode);
268     if (callback) {
269         auto onApply = reinterpret_cast<std::function<void(WeakPtr<NG::FrameNode>)>*>(callback);
270         TabsModelNG::SetBarModifier(frameNode, std::move(*onApply));
271     } else {
272         TabsModelNG::SetBarModifier(frameNode, nullptr);
273     }
274 }
SetScrollable(ArkUINodeHandle node,ArkUI_Bool scrollable)275 void SetScrollable(ArkUINodeHandle node, ArkUI_Bool scrollable)
276 {
277     auto* frameNode = reinterpret_cast<FrameNode*>(node);
278     CHECK_NULL_VOID(frameNode);
279     TabsModelNG::SetScrollable(frameNode, scrollable);
280 }
SetBarAdaptiveHeight(ArkUINodeHandle node,ArkUI_Bool value)281 void SetBarAdaptiveHeight(ArkUINodeHandle node, ArkUI_Bool value)
282 {
283     auto* frameNode = reinterpret_cast<FrameNode*>(node);
284     CHECK_NULL_VOID(frameNode);
285     TabsModelNG::SetBarAdaptiveHeight(frameNode, value);
286 }
SetNoMinHeightLimit(ArkUINodeHandle node,ArkUI_Bool value)287 void SetNoMinHeightLimit(ArkUINodeHandle node, ArkUI_Bool value)
288 {
289     auto* frameNode = reinterpret_cast<FrameNode*>(node);
290     CHECK_NULL_VOID(frameNode);
291     TabsModelNG::SetNoMinHeightLimit(frameNode, value);
292 }
SetTabBarWidth(ArkUINodeHandle node,ArkUI_Float32 value,ArkUI_Int32 unit)293 void SetTabBarWidth(ArkUINodeHandle node, ArkUI_Float32 value, ArkUI_Int32 unit)
294 {
295     auto* frameNode = reinterpret_cast<FrameNode*>(node);
296     CHECK_NULL_VOID(frameNode);
297     CalcDimension width = Dimension(value, static_cast<OHOS::Ace::DimensionUnit>(unit));
298     TabsModelNG::SetTabBarWidth(frameNode, width);
299 }
300 
CreateTabBarWidthWithResourceObj(ArkUINodeHandle node,void * widthRawPtr)301 void CreateTabBarWidthWithResourceObj(ArkUINodeHandle node, void* widthRawPtr)
302 {
303     CHECK_NULL_VOID(SystemProperties::ConfigChangePerform());
304     auto* frameNode = reinterpret_cast<FrameNode*>(node);
305     CHECK_NULL_VOID(frameNode);
306     auto* widthPtr = reinterpret_cast<ResourceObject*>(widthRawPtr);
307     auto widthResObj = AceType::Claim(widthPtr);
308     TabsModelNG::HandleBarWidth(frameNode, widthResObj, true);
309 }
310 
SetTabBarHeight(ArkUINodeHandle node,ArkUI_Float32 value,ArkUI_Int32 unit)311 void SetTabBarHeight(ArkUINodeHandle node, ArkUI_Float32 value, ArkUI_Int32 unit)
312 {
313     auto* frameNode = reinterpret_cast<FrameNode*>(node);
314     CHECK_NULL_VOID(frameNode);
315     CalcDimension width = Dimension(value, static_cast<OHOS::Ace::DimensionUnit>(unit));
316     TabsModelNG::SetTabBarHeight(frameNode, width);
317 }
318 
CreateTabBarHeightWithResourceObj(ArkUINodeHandle node,void * heightRawPtr)319 void CreateTabBarHeightWithResourceObj(ArkUINodeHandle node, void* heightRawPtr)
320 {
321     CHECK_NULL_VOID(SystemProperties::ConfigChangePerform());
322     auto* frameNode = reinterpret_cast<FrameNode*>(node);
323     CHECK_NULL_VOID(frameNode);
324     auto* heightPtr = reinterpret_cast<ResourceObject*>(heightRawPtr);
325     auto heightResObj = AceType::Claim(heightPtr);
326     TabsModelNG::HandleBarHeight(frameNode, heightResObj, true);
327 }
328 
SetAnimationCurve(ArkUINodeHandle node,ArkUI_Uint32 type,ArkUI_CharPtr curveChar,void * curveCallback)329 void SetAnimationCurve(ArkUINodeHandle node, ArkUI_Uint32 type, ArkUI_CharPtr curveChar, void* curveCallback)
330 {
331     auto* frameNode = reinterpret_cast<FrameNode*>(node);
332     CHECK_NULL_VOID(frameNode);
333     RefPtr<Curve> curve;
334     if (type == ANIMATION_CURVE_TYPE_STR && curveChar != nullptr) {
335         curve = Framework::CreateCurve(curveChar, false);
336     } else if (type == ANIMATION_CURVE_TYPE_FUNC && curveCallback != nullptr) {
337         auto callback = reinterpret_cast<std::function<float(float)>*>(curveCallback);
338         curve = Framework::CreateCurve(*callback);
339     }
340     TabsModelNG::SetAnimationCurve(frameNode, curve);
341 }
342 
SetAnimationDuration(ArkUINodeHandle node,ArkUI_Float32 duration)343 void SetAnimationDuration(ArkUINodeHandle node, ArkUI_Float32 duration)
344 {
345     auto* frameNode = reinterpret_cast<FrameNode*>(node);
346     CHECK_NULL_VOID(frameNode);
347     if (std::isnan(duration)) {
348         auto pipelineContext = PipelineContext::GetCurrentContext();
349         CHECK_NULL_VOID(pipelineContext);
350         auto tabTheme = pipelineContext->GetTheme<TabTheme>();
351         CHECK_NULL_VOID(tabTheme);
352         TabsModelNG::SetAnimationDuration(frameNode,
353             static_cast<ArkUI_Float32>(tabTheme->GetTabContentAnimationDuration()));
354     }
355     TabsModelNG::SetAnimationDuration(frameNode, duration);
356 }
ResetTabBarMode(ArkUINodeHandle node)357 void ResetTabBarMode(ArkUINodeHandle node)
358 {
359     auto* frameNode = reinterpret_cast<FrameNode*>(node);
360     CHECK_NULL_VOID(frameNode);
361     TabBarMode barMode = TabBarMode::FIXED;
362     TabsModelNG::SetTabBarMode(frameNode, barMode);
363 }
ResetScrollableBarModeOptions(ArkUINodeHandle node)364 void ResetScrollableBarModeOptions(ArkUINodeHandle node)
365 {
366     auto* frameNode = reinterpret_cast<FrameNode*>(node);
367     CHECK_NULL_VOID(frameNode);
368     ScrollableBarModeOptions defaultOption;
369     CalcDimension margin = Dimension(0.0, DimensionUnit::VP);
370     defaultOption.margin = margin;
371     defaultOption.nonScrollableLayoutStyle = std::nullopt;
372     TabsModelNG::SetScrollableBarModeOptions(frameNode, defaultOption);
373 
374     CreateScrollableBarModeOptionsWithResourceObj(node, nullptr);
375 }
ResetBarGridAlign(ArkUINodeHandle node)376 void ResetBarGridAlign(ArkUINodeHandle node)
377 {
378     auto* frameNode = reinterpret_cast<FrameNode*>(node);
379     CHECK_NULL_VOID(frameNode);
380     BarGridColumnOptions columnOption;
381     TabsModelNG::SetBarGridAlign(frameNode, columnOption);
382 
383     CreateBarGridAlignWithResourceObj(node, nullptr, nullptr);
384 }
ResetDivider(ArkUINodeHandle node)385 void ResetDivider(ArkUINodeHandle node)
386 {
387     auto* frameNode = reinterpret_cast<FrameNode*>(node);
388     CHECK_NULL_VOID(frameNode);
389 
390     TabsItemDivider divider;
391     divider.isNull = true;
392 
393     TabsModelNG::SetDivider(frameNode, divider);
394     TabsModelNG::SetDividerColorByUser(frameNode, false);
395 
396     CreateDividerWithResourceObj(node, nullptr, nullptr, nullptr, nullptr);
397 }
ResetFadingEdge(ArkUINodeHandle node)398 void ResetFadingEdge(ArkUINodeHandle node)
399 {
400     auto* frameNode = reinterpret_cast<FrameNode*>(node);
401     CHECK_NULL_VOID(frameNode);
402     TabsModelNG::SetFadingEdge(frameNode, true);
403 }
ResetTabOnUnselected(ArkUINodeHandle node)404 void ResetTabOnUnselected(ArkUINodeHandle node)
405 {
406     auto* frameNode = reinterpret_cast<FrameNode*>(node);
407     CHECK_NULL_VOID(frameNode);
408     TabsModelNG::SetOnUnselected(frameNode, nullptr);
409 }
ResetBarBackgroundColor(ArkUINodeHandle node)410 void ResetBarBackgroundColor(ArkUINodeHandle node)
411 {
412     auto* frameNode = reinterpret_cast<FrameNode*>(node);
413     CHECK_NULL_VOID(frameNode);
414     TabsModelNG::SetBarBackgroundColor(frameNode, Color::BLACK.BlendOpacity(0.0f));
415     TabsModelNG::SetBarBackgroundColorByUser(frameNode, false);
416 
417     CreateBarBackgroundColorWithResourceObj(node, nullptr);
418 }
ResetBarBackgroundBlurStyle(ArkUINodeHandle node)419 void ResetBarBackgroundBlurStyle(ArkUINodeHandle node)
420 {
421     auto* frameNode = reinterpret_cast<FrameNode*>(node);
422     CHECK_NULL_VOID(frameNode);
423     BlurStyleOption bgBlurStyle;
424     TabsModelNG::SetBarBackgroundBlurStyle(frameNode, bgBlurStyle);
425 
426     CreateBarBackgroundBlurStyleWithResourceObj(node, nullptr);
427 }
ResetBarOverlap(ArkUINodeHandle node)428 void ResetBarOverlap(ArkUINodeHandle node)
429 {
430     auto* frameNode = reinterpret_cast<FrameNode*>(node);
431     CHECK_NULL_VOID(frameNode);
432     TabsModelNG::SetBarOverlap(frameNode, false);
433 }
ResetIsVertical(ArkUINodeHandle node)434 void ResetIsVertical(ArkUINodeHandle node)
435 {
436     auto* frameNode = reinterpret_cast<FrameNode*>(node);
437     CHECK_NULL_VOID(frameNode);
438     TabsModelNG::SetIsVertical(frameNode, false);
439 }
440 
ResetTabBarPosition(ArkUINodeHandle node)441 void ResetTabBarPosition(ArkUINodeHandle node)
442 {
443     auto* frameNode = reinterpret_cast<FrameNode*>(node);
444     CHECK_NULL_VOID(frameNode);
445     TabsModelNG::SetTabBarPosition(frameNode, BarPosition::START);
446 }
447 
ResetTabsOptionsIndex(ArkUINodeHandle node)448 void ResetTabsOptionsIndex(ArkUINodeHandle node)
449 {
450     auto* frameNode = reinterpret_cast<FrameNode*>(node);
451     CHECK_NULL_VOID(frameNode);
452     TabsModelNG::SetTabBarIndex(frameNode, 0);
453 }
454 
ResetTabsOptionsBarModifier(ArkUINodeHandle node)455 void ResetTabsOptionsBarModifier(ArkUINodeHandle node)
456 {
457     auto* frameNode = reinterpret_cast<FrameNode*>(node);
458     CHECK_NULL_VOID(frameNode);
459     TabsModelNG::SetBarModifier(frameNode, nullptr);
460 }
461 
ResetScrollable(ArkUINodeHandle node)462 void ResetScrollable(ArkUINodeHandle node)
463 {
464     auto* frameNode = reinterpret_cast<FrameNode*>(node);
465     CHECK_NULL_VOID(frameNode);
466     TabsModelNG::SetScrollable(frameNode, true);
467 }
ResetTabBarWidth(ArkUINodeHandle node)468 void ResetTabBarWidth(ArkUINodeHandle node)
469 {
470     auto* frameNode = reinterpret_cast<FrameNode*>(node);
471     CHECK_NULL_VOID(frameNode);
472     CalcDimension width = Dimension(-1.0, DimensionUnit::VP);
473     TabsModelNG::SetTabBarWidth(frameNode, width);
474 
475     CreateTabBarWidthWithResourceObj(node, nullptr);
476 }
ResetTabBarHeight(ArkUINodeHandle node)477 void ResetTabBarHeight(ArkUINodeHandle node)
478 {
479     auto* frameNode = reinterpret_cast<FrameNode*>(node);
480     CHECK_NULL_VOID(frameNode);
481     CalcDimension width = Dimension(-1.0, DimensionUnit::VP);
482     TabsModelNG::SetTabBarHeight(frameNode, width);
483 
484     CreateTabBarHeightWithResourceObj(node, nullptr);
485 }
486 
ResetAnimationCurve(ArkUINodeHandle node)487 void ResetAnimationCurve(ArkUINodeHandle node)
488 {
489     auto* frameNode = reinterpret_cast<FrameNode*>(node);
490     CHECK_NULL_VOID(frameNode);
491     RefPtr<Curve> curve;
492     TabsModelNG::SetAnimationCurve(frameNode, curve);
493 }
494 
ResetAnimationDuration(ArkUINodeHandle node)495 void ResetAnimationDuration(ArkUINodeHandle node)
496 {
497     auto* frameNode = reinterpret_cast<FrameNode*>(node);
498     CHECK_NULL_VOID(frameNode);
499     TabsModelNG::SetAnimationDuration(frameNode, DEFAULT_ANIMATION_DURATION);
500 }
501 
ResetBarAdaptiveHeight(ArkUINodeHandle node)502 void ResetBarAdaptiveHeight(ArkUINodeHandle node)
503 {
504     auto* frameNode = reinterpret_cast<FrameNode*>(node);
505     CHECK_NULL_VOID(frameNode);
506     TabsModelNG::SetBarAdaptiveHeight(frameNode, false);
507 }
508 
ResetNoMinHeightLimit(ArkUINodeHandle node)509 void ResetNoMinHeightLimit(ArkUINodeHandle node)
510 {
511     auto* frameNode = reinterpret_cast<FrameNode*>(node);
512     CHECK_NULL_VOID(frameNode);
513     TabsModelNG::SetNoMinHeightLimit(frameNode, false);
514 }
515 
SetTabClip(ArkUINodeHandle node,ArkUI_Bool clipEdge)516 void SetTabClip(ArkUINodeHandle node, ArkUI_Bool clipEdge)
517 {
518     auto* frameNode = reinterpret_cast<FrameNode*>(node);
519     CHECK_NULL_VOID(frameNode);
520     TabsModelNG::SetClipEdge(frameNode, clipEdge);
521 }
522 
ResetTabClip(ArkUINodeHandle node)523 void ResetTabClip(ArkUINodeHandle node)
524 {
525     auto* frameNode = reinterpret_cast<FrameNode*>(node);
526     CHECK_NULL_VOID(frameNode);
527     TabsModelNG::SetClipEdge(frameNode, false);
528 }
529 
SetTabEdgeEffect(ArkUINodeHandle node,ArkUI_Uint32 edgeEffect)530 void SetTabEdgeEffect(ArkUINodeHandle node, ArkUI_Uint32 edgeEffect)
531 {
532     auto* frameNode = reinterpret_cast<FrameNode*>(node);
533     CHECK_NULL_VOID(frameNode);
534     TabsModelNG::SetEdgeEffect(frameNode, edgeEffect);
535 }
536 
ResetTabEdgeEffect(ArkUINodeHandle node)537 void ResetTabEdgeEffect(ArkUINodeHandle node)
538 {
539     auto* frameNode = reinterpret_cast<FrameNode*>(node);
540     CHECK_NULL_VOID(frameNode);
541     TabsModelNG::SetEdgeEffect(frameNode, NUM_0);
542 }
543 
SetTabPageFlipMode(ArkUINodeHandle node,ArkUI_Int32 pageFlipMode)544 void SetTabPageFlipMode(ArkUINodeHandle node, ArkUI_Int32 pageFlipMode)
545 {
546     auto* frameNode = reinterpret_cast<FrameNode*>(node);
547     CHECK_NULL_VOID(frameNode);
548     TabsModelNG::SetPageFlipMode(frameNode, pageFlipMode);
549 }
550 
ResetTabPageFlipMode(ArkUINodeHandle node)551 void ResetTabPageFlipMode(ArkUINodeHandle node)
552 {
553     auto* frameNode = reinterpret_cast<FrameNode*>(node);
554     CHECK_NULL_VOID(frameNode);
555     TabsModelNG::SetPageFlipMode(frameNode, NUM_0);
556 }
557 
SetTabWidthAuto(ArkUINodeHandle node)558 void SetTabWidthAuto(ArkUINodeHandle node)
559 {
560     auto* frameNode = reinterpret_cast<FrameNode*>(node);
561     CHECK_NULL_VOID(frameNode);
562     ViewAbstract::ClearWidthOrHeight(frameNode, true);
563     TabsModelNG::SetWidthAuto(frameNode, true);
564 }
565 
ResetTabWidthAuto(ArkUINodeHandle node)566 void ResetTabWidthAuto(ArkUINodeHandle node)
567 {
568     auto* frameNode = reinterpret_cast<FrameNode*>(node);
569     CHECK_NULL_VOID(frameNode);
570     TabsModelNG::SetWidthAuto(frameNode, false);
571 }
572 
SetTabHeightAuto(ArkUINodeHandle node)573 void SetTabHeightAuto(ArkUINodeHandle node)
574 {
575     auto* frameNode = reinterpret_cast<FrameNode*>(node);
576     CHECK_NULL_VOID(frameNode);
577     ViewAbstract::ClearWidthOrHeight(frameNode, false);
578     TabsModelNG::SetHeightAuto(frameNode, true);
579 }
580 
ResetTabHeightAuto(ArkUINodeHandle node)581 void ResetTabHeightAuto(ArkUINodeHandle node)
582 {
583     auto* frameNode = reinterpret_cast<FrameNode*>(node);
584     CHECK_NULL_VOID(frameNode);
585     TabsModelNG::SetHeightAuto(frameNode, false);
586 }
587 
SetAnimateMode(ArkUINodeHandle node,ArkUI_Uint32 mode)588 void SetAnimateMode(ArkUINodeHandle node, ArkUI_Uint32 mode)
589 {
590     auto* frameNode = reinterpret_cast<FrameNode*>(node);
591     CHECK_NULL_VOID(frameNode);
592     TabsModelNG::SetAnimateMode(frameNode, static_cast<TabAnimateMode>(mode));
593 }
594 
ResetAnimateMode(ArkUINodeHandle node)595 void ResetAnimateMode(ArkUINodeHandle node)
596 {
597     auto* frameNode = reinterpret_cast<FrameNode*>(node);
598     CHECK_NULL_VOID(frameNode);
599     TabsModelNG::SetAnimateMode(frameNode, TabAnimateMode::CONTENT_FIRST);
600 }
601 
SetBarBackgroundEffect(ArkUINodeHandle node,ArkUITabBarBackgroundEffect * effectOption)602 void SetBarBackgroundEffect(ArkUINodeHandle node, ArkUITabBarBackgroundEffect* effectOption)
603 {
604     auto* frameNode = reinterpret_cast<FrameNode*>(node);
605     CHECK_NULL_VOID(frameNode);
606     CalcDimension radius;
607     if (AceApplicationInfo::GetInstance().GreatOrEqualTargetAPIVersion(PlatformVersion::VERSION_FOURTEEN)) {
608         radius = CalcDimension(effectOption->radius, DimensionUnit::VP);
609     } else {
610         radius = CalcDimension(effectOption->radius, DimensionUnit::PX);
611     }
612     Color color(effectOption->color);
613     BlurOption blurOption;
614     blurOption.grayscale.assign(effectOption->blurValues, effectOption->blurValues + effectOption->blurValuesSize);
615 
616     EffectOption option;
617     option.radius = radius;
618     option.saturation = effectOption->saturation;
619     option.brightness = effectOption->brightness;
620     option.color = color;
621     option.adaptiveColor = static_cast<AdaptiveColor>(effectOption->adaptiveColor);
622     option.blurOption = blurOption;
623     option.blurType = static_cast<BlurType>(effectOption->blurType);
624     option.policy = static_cast<BlurStyleActivePolicy>(effectOption->policy);
625     Color inactiveColor(effectOption->inactiveColor);
626     option.inactiveColor = inactiveColor;
627     option.isValidColor = effectOption->isValidColor;
628     TabsModelNG::SetBarBackgroundEffect(frameNode, option);
629 }
630 
CreateBarBackgroundEffectWithResourceObj(ArkUINodeHandle node,void * colorRawPtr,void * inactiveColorRawPtr)631 void CreateBarBackgroundEffectWithResourceObj(ArkUINodeHandle node, void* colorRawPtr, void* inactiveColorRawPtr)
632 {
633     CHECK_NULL_VOID(SystemProperties::ConfigChangePerform());
634     auto* frameNode = reinterpret_cast<FrameNode*>(node);
635     CHECK_NULL_VOID(frameNode);
636     auto* colorPtr = reinterpret_cast<ResourceObject*>(colorRawPtr);
637     auto colorResObj = AceType::Claim(colorPtr);
638     TabsModelNG::HandleBackgroundEffectColor(frameNode, colorResObj, true);
639     auto* inactiveColorPtr = reinterpret_cast<ResourceObject*>(inactiveColorRawPtr);
640     auto inactiveColorResObj = AceType::Claim(inactiveColorPtr);
641     TabsModelNG::HandleBackgroundEffectInactiveColor(frameNode, inactiveColorResObj, true);
642 }
643 
ResetBarBackgroundEffect(ArkUINodeHandle node)644 void ResetBarBackgroundEffect(ArkUINodeHandle node)
645 {
646     auto* frameNode = reinterpret_cast<FrameNode*>(node);
647     CHECK_NULL_VOID(frameNode);
648     CalcDimension radius;
649     radius.SetValue(0.0f);
650     double saturation = 1.0f;
651     double brightness = 1.0f;
652     Color color = Color::TRANSPARENT;
653     color.SetValue(Color::TRANSPARENT.GetValue());
654     auto adaptiveColor = AdaptiveColor::DEFAULT;
655     BlurOption blurOption;
656     EffectOption effectOption = { radius, saturation, brightness, color, adaptiveColor, blurOption };
657     TabsModelNG::SetBarBackgroundEffect(frameNode, effectOption);
658 
659     CreateBarBackgroundEffectWithResourceObj(node, nullptr, nullptr);
660 }
661 
SetTabsOnSelected(ArkUINodeHandle node,void * callback)662 void SetTabsOnSelected(ArkUINodeHandle node, void* callback)
663 {
664     auto* frameNode = reinterpret_cast<FrameNode*>(node);
665     CHECK_NULL_VOID(frameNode);
666     if (callback) {
667         auto onEvent = reinterpret_cast<std::function<void(const BaseEventInfo*)>*>(callback);
668         TabsModelNG::SetOnSelected(frameNode, std::move(*onEvent));
669     } else {
670         TabsModelNG::SetOnSelected(frameNode, nullptr);
671     }
672 }
673 
ResetTabsOnSelected(ArkUINodeHandle node)674 void ResetTabsOnSelected(ArkUINodeHandle node)
675 {
676     auto* frameNode = reinterpret_cast<FrameNode*>(node);
677     CHECK_NULL_VOID(frameNode);
678     TabsModelNG::SetOnSelected(frameNode, nullptr);
679 }
680 
SetCachedMaxCount(ArkUINodeHandle node,ArkUI_Int32 count,ArkUI_Int32 mode)681 void SetCachedMaxCount(ArkUINodeHandle node, ArkUI_Int32 count, ArkUI_Int32 mode)
682 {
683     auto* frameNode = reinterpret_cast<FrameNode*>(node);
684     CHECK_NULL_VOID(frameNode);
685     auto cacheMode = TabsCacheMode::CACHE_BOTH_SIDE;
686     if (mode >= static_cast<int32_t>(TabsCacheMode::CACHE_BOTH_SIDE) &&
687         mode <= static_cast<int32_t>(TabsCacheMode::CACHE_LATEST_SWITCHED)) {
688         cacheMode = static_cast<TabsCacheMode>(mode);
689     }
690     TabsModelNG::SetCachedMaxCount(frameNode, count, cacheMode);
691 }
692 
ResetCachedMaxCount(ArkUINodeHandle node)693 void ResetCachedMaxCount(ArkUINodeHandle node)
694 {
695     auto* frameNode = reinterpret_cast<FrameNode*>(node);
696     CHECK_NULL_VOID(frameNode);
697     TabsModelNG::SetCachedMaxCount(frameNode, std::nullopt, TabsCacheMode::CACHE_BOTH_SIDE);
698 }
SetTabsOnChange(ArkUINodeHandle node,void * callback)699 void SetTabsOnChange(ArkUINodeHandle node, void* callback)
700 {
701     auto* frameNode = reinterpret_cast<FrameNode*>(node);
702     CHECK_NULL_VOID(frameNode);
703     if (callback) {
704         auto onChange = reinterpret_cast<std::function<void(const BaseEventInfo*)>*>(callback);
705         TabsModelNG::SetOnChange(frameNode, std::move(*onChange));
706     } else {
707         TabsModelNG::SetOnChange(frameNode, nullptr);
708     }
709 }
710 
ResetTabsOnChange(ArkUINodeHandle node)711 void ResetTabsOnChange(ArkUINodeHandle node)
712 {
713     auto* frameNode = reinterpret_cast<FrameNode*>(node);
714     CHECK_NULL_VOID(frameNode);
715     TabsModelNG::SetOnChange(frameNode, nullptr);
716 }
717 
SetTabsOnTabBarClick(ArkUINodeHandle node,void * callback)718 void SetTabsOnTabBarClick(ArkUINodeHandle node, void* callback)
719 {
720     auto* frameNode = reinterpret_cast<FrameNode*>(node);
721     CHECK_NULL_VOID(frameNode);
722     if (callback) {
723         auto onTabBarClick = reinterpret_cast<std::function<void(const BaseEventInfo*)>*>(callback);
724         TabsModelNG::SetOnTabBarClick(frameNode, std::move(*onTabBarClick));
725     } else {
726         TabsModelNG::SetOnTabBarClick(frameNode, nullptr);
727     }
728 }
729 
ResetTabsOnTabBarClick(ArkUINodeHandle node)730 void ResetTabsOnTabBarClick(ArkUINodeHandle node)
731 {
732     auto* frameNode = reinterpret_cast<FrameNode*>(node);
733     CHECK_NULL_VOID(frameNode);
734     TabsModelNG::SetOnTabBarClick(frameNode, nullptr);
735 }
736 
SetTabsOnAnimationStart(ArkUINodeHandle node,void * callback)737 void SetTabsOnAnimationStart(ArkUINodeHandle node, void* callback)
738 {
739     auto* frameNode = reinterpret_cast<FrameNode*>(node);
740     CHECK_NULL_VOID(frameNode);
741     if (callback) {
742         auto onAnimationStart =
743             reinterpret_cast<std::function<void(int32_t, int32_t, const AnimationCallbackInfo&)>*>(callback);
744         TabsModelNG::SetOnAnimationStart(frameNode, std::move(*onAnimationStart));
745     } else {
746         TabsModelNG::SetOnAnimationStart(frameNode, nullptr);
747     }
748 }
749 
ResetTabsOnAnimationStart(ArkUINodeHandle node)750 void ResetTabsOnAnimationStart(ArkUINodeHandle node)
751 {
752     auto* frameNode = reinterpret_cast<FrameNode*>(node);
753     CHECK_NULL_VOID(frameNode);
754     TabsModelNG::SetOnAnimationStart(frameNode, nullptr);
755 }
756 
SetTabsOnAnimationEnd(ArkUINodeHandle node,void * callback)757 void SetTabsOnAnimationEnd(ArkUINodeHandle node, void* callback)
758 {
759     auto* frameNode = reinterpret_cast<FrameNode*>(node);
760     CHECK_NULL_VOID(frameNode);
761     if (callback) {
762         auto onAnimationEnd = reinterpret_cast<std::function<void(int32_t, const AnimationCallbackInfo&)>*>(callback);
763         TabsModelNG::SetOnAnimationEnd(frameNode, std::move(*onAnimationEnd));
764     } else {
765         TabsModelNG::SetOnAnimationEnd(frameNode, nullptr);
766     }
767 }
768 
ResetTabsOnAnimationEnd(ArkUINodeHandle node)769 void ResetTabsOnAnimationEnd(ArkUINodeHandle node)
770 {
771     auto* frameNode = reinterpret_cast<FrameNode*>(node);
772     CHECK_NULL_VOID(frameNode);
773     TabsModelNG::SetOnAnimationEnd(frameNode, nullptr);
774 }
775 
SetTabsOnGestureSwipe(ArkUINodeHandle node,void * callback)776 void SetTabsOnGestureSwipe(ArkUINodeHandle node, void* callback)
777 {
778     auto* frameNode = reinterpret_cast<FrameNode*>(node);
779     CHECK_NULL_VOID(frameNode);
780     if (callback) {
781         auto onGestureSwipe = reinterpret_cast<std::function<void(int32_t, const AnimationCallbackInfo&)>*>(callback);
782         TabsModelNG::SetOnGestureSwipe(frameNode, std::move(*onGestureSwipe));
783     } else {
784         TabsModelNG::SetOnGestureSwipe(frameNode, nullptr);
785     }
786 }
787 
ResetTabsOnGestureSwipe(ArkUINodeHandle node)788 void ResetTabsOnGestureSwipe(ArkUINodeHandle node)
789 {
790     auto* frameNode = reinterpret_cast<FrameNode*>(node);
791     CHECK_NULL_VOID(frameNode);
792     TabsModelNG::SetOnGestureSwipe(frameNode, nullptr);
793 }
794 
SetTabsOnContentWillChange(ArkUINodeHandle node,void * callback)795 void SetTabsOnContentWillChange(ArkUINodeHandle node, void* callback)
796 {
797     auto* frameNode = reinterpret_cast<FrameNode*>(node);
798     CHECK_NULL_VOID(frameNode);
799     if (callback) {
800         auto onContentWillChange = reinterpret_cast<std::function<bool(int32_t, int32_t)>*>(callback);
801         TabsModelNG::SetOnContentWillChange(frameNode, std::move(*onContentWillChange));
802     } else {
803         TabsModelNG::SetOnContentWillChange(frameNode, nullptr);
804     }
805 }
806 
ResetTabsOnContentWillChange(ArkUINodeHandle node)807 void ResetTabsOnContentWillChange(ArkUINodeHandle node)
808 {
809     auto* frameNode = reinterpret_cast<FrameNode*>(node);
810     CHECK_NULL_VOID(frameNode);
811     TabsModelNG::SetOnContentWillChange(frameNode, nullptr);
812 }
813 
SetTabsIsCustomAnimation(ArkUINodeHandle node,ArkUI_Bool isCustom)814 void SetTabsIsCustomAnimation(ArkUINodeHandle node, ArkUI_Bool isCustom)
815 {
816     auto* frameNode = reinterpret_cast<FrameNode*>(node);
817     CHECK_NULL_VOID(frameNode);
818     TabsModelNG::SetIsCustomAnimation(frameNode, isCustom);
819 }
820 
ResetTabsIsCustomAnimation(ArkUINodeHandle node)821 void ResetTabsIsCustomAnimation(ArkUINodeHandle node)
822 {
823     auto* frameNode = reinterpret_cast<FrameNode*>(node);
824     CHECK_NULL_VOID(frameNode);
825     TabsModelNG::SetIsCustomAnimation(frameNode, false);
826 }
827 
828 namespace NodeModifier {
GetTabsModifier()829 const ArkUITabsModifier* GetTabsModifier()
830 {
831     CHECK_INITIALIZED_FIELDS_BEGIN(); // don't move this line
832     static const ArkUITabsModifier modifier = {
833         .setTabBarMode = SetTabBarMode,
834         .setScrollableBarModeOptions = SetScrollableBarModeOptions,
835         .setBarGridAlign = SetBarGridAlign,
836         .setDivider = SetDivider,
837         .setDividerColorByUser = SetDividerColorByUser,
838         .setFadingEdge = SetFadingEdge,
839         .setTabOnUnselected = SetTabOnUnselected,
840         .setBarBackgroundColor = SetBarBackgroundColor,
841         .setBarBackgroundBlurStyle = SetBarBackgroundBlurStyle,
842         .setBarOverlap = SetBarOverlap,
843         .setIsVertical = SetIsVertical,
844         .setTabBarPosition = SetTabBarPosition,
845         .setTabsOptionsIndex = SetTabsOptionsIndex,
846         .setTabsOptionsController = SetTabsOptionsController,
847         .setTabsOptionsBarModifier = SetTabsOptionsBarModifier,
848         .setScrollable = SetScrollable,
849         .setTabBarWidth = SetTabBarWidth,
850         .setTabBarHeight = SetTabBarHeight,
851         .setBarAdaptiveHeight = SetBarAdaptiveHeight,
852         .setAnimationCurve = SetAnimationCurve,
853         .setNoMinHeightLimit = SetNoMinHeightLimit,
854         .setAnimationDuration = SetAnimationDuration,
855         .resetTabBarMode = ResetTabBarMode,
856         .resetScrollableBarModeOptions = ResetScrollableBarModeOptions,
857         .resetBarGridAlign = ResetBarGridAlign,
858         .resetDivider = ResetDivider,
859         .resetFadingEdge = ResetFadingEdge,
860         .resetTabOnUnselected = ResetTabOnUnselected,
861         .resetBarBackgroundColor = ResetBarBackgroundColor,
862         .resetBarBackgroundBlurStyle = ResetBarBackgroundBlurStyle,
863         .resetBarOverlap = ResetBarOverlap,
864         .resetIsVertical = ResetIsVertical,
865         .resetTabBarPosition = ResetTabBarPosition,
866         .resetTabsOptionsIndex = ResetTabsOptionsIndex,
867         .resetTabsOptionsBarModifier = ResetTabsOptionsBarModifier,
868         .resetScrollable = ResetScrollable,
869         .resetTabBarWidth = ResetTabBarWidth,
870         .resetTabBarHeight = ResetTabBarHeight,
871         .resetBarAdaptiveHeight = ResetBarAdaptiveHeight,
872         .resetAnimationCurve = ResetAnimationCurve,
873         .resetNoMinHeightLimit = ResetNoMinHeightLimit,
874         .resetAnimationDuration = ResetAnimationDuration,
875         .setTabClip = SetTabClip,
876         .resetTabClip = ResetTabClip,
877         .setTabEdgeEffect = SetTabEdgeEffect,
878         .resetTabEdgeEffect = ResetTabEdgeEffect,
879         .setTabPageFlipMode = SetTabPageFlipMode,
880         .resetTabPageFlipMode = ResetTabPageFlipMode,
881         .setTabWidthAuto = SetTabWidthAuto,
882         .resetTabWidthAuto = ResetTabWidthAuto,
883         .setTabHeightAuto = SetTabHeightAuto,
884         .resetTabHeightAuto = ResetTabHeightAuto,
885         .setAnimateMode = SetAnimateMode,
886         .resetAnimateMode = ResetAnimateMode,
887         .setBarBackgroundEffect = SetBarBackgroundEffect,
888         .resetBarBackgroundEffect = ResetBarBackgroundEffect,
889         .setTabsOnSelected = SetTabsOnSelected,
890         .resetTabsOnSelected = ResetTabsOnSelected,
891         .setCachedMaxCount = SetCachedMaxCount,
892         .resetCachedMaxCount = ResetCachedMaxCount,
893         .setTabsOnChange = SetTabsOnChange,
894         .resetTabsOnChange = ResetTabsOnChange,
895         .setTabsOnTabBarClick = SetTabsOnTabBarClick,
896         .resetTabsOnTabBarClick = ResetTabsOnTabBarClick,
897         .setTabsOnAnimationStart = SetTabsOnAnimationStart,
898         .resetTabsOnAnimationStart = ResetTabsOnAnimationStart,
899         .setTabsOnAnimationEnd = SetTabsOnAnimationEnd,
900         .resetTabsOnAnimationEnd = ResetTabsOnAnimationEnd,
901         .setTabsOnGestureSwipe = SetTabsOnGestureSwipe,
902         .resetTabsOnGestureSwipe = ResetTabsOnGestureSwipe,
903         .setTabsOnContentWillChange = SetTabsOnContentWillChange,
904         .resetTabsOnContentWillChange = ResetTabsOnContentWillChange,
905         .setTabsIsCustomAnimation = SetTabsIsCustomAnimation,
906         .resetTabsIsCustomAnimation = ResetTabsIsCustomAnimation,
907         .createScrollableBarModeOptionsWithResourceObj = CreateScrollableBarModeOptionsWithResourceObj,
908         .createBarGridAlignWithResourceObj = CreateBarGridAlignWithResourceObj,
909         .createDividerWithResourceObj = CreateDividerWithResourceObj,
910         .createBarBackgroundColorWithResourceObj = CreateBarBackgroundColorWithResourceObj,
911         .createBarBackgroundBlurStyleWithResourceObj = CreateBarBackgroundBlurStyleWithResourceObj,
912         .createTabBarWidthWithResourceObj = CreateTabBarWidthWithResourceObj,
913         .createTabBarHeightWithResourceObj = CreateTabBarHeightWithResourceObj,
914         .createBarBackgroundEffectWithResourceObj = CreateBarBackgroundEffectWithResourceObj,
915     };
916     CHECK_INITIALIZED_FIELDS_END(modifier, 0, 0, 0); // don't move this line
917 
918     return &modifier;
919 }
920 
GetCJUITabsModifier()921 const CJUITabsModifier* GetCJUITabsModifier()
922 {
923     CHECK_INITIALIZED_FIELDS_BEGIN(); // don't move this line
924     static const CJUITabsModifier modifier = {
925         .setTabBarMode = SetTabBarMode,
926         .setScrollableBarModeOptions = SetScrollableBarModeOptions,
927         .setBarGridAlign = SetBarGridAlign,
928         .setDivider = SetDivider,
929         .setFadingEdge = SetFadingEdge,
930         .setBarBackgroundColor = SetBarBackgroundColor,
931         .setBarBackgroundBlurStyle = SetBarBackgroundBlurStyle,
932         .setBarOverlap = SetBarOverlap,
933         .setIsVertical = SetIsVertical,
934         .setTabBarPosition = SetTabBarPosition,
935         .setTabsOptionsIndex = SetTabsOptionsIndex,
936         .setTabsOptionsController = SetTabsOptionsController,
937         .setTabsOptionsBarModifier = SetTabsOptionsBarModifier,
938         .setScrollable = SetScrollable,
939         .setTabBarWidth = SetTabBarWidth,
940         .setTabBarHeight = SetTabBarHeight,
941         .setBarAdaptiveHeight = SetBarAdaptiveHeight,
942         .setAnimationDuration = SetAnimationDuration,
943         .resetTabBarMode = ResetTabBarMode,
944         .resetScrollableBarModeOptions = ResetScrollableBarModeOptions,
945         .resetBarGridAlign = ResetBarGridAlign,
946         .resetDivider = ResetDivider,
947         .resetFadingEdge = ResetFadingEdge,
948         .resetBarBackgroundColor = ResetBarBackgroundColor,
949         .resetBarBackgroundBlurStyle = ResetBarBackgroundBlurStyle,
950         .resetBarOverlap = ResetBarOverlap,
951         .resetIsVertical = ResetIsVertical,
952         .resetTabBarPosition = ResetTabBarPosition,
953         .resetTabsOptionsIndex = ResetTabsOptionsIndex,
954         .resetTabsOptionsBarModifier = ResetTabsOptionsBarModifier,
955         .resetScrollable = ResetScrollable,
956         .resetTabBarWidth = ResetTabBarWidth,
957         .resetTabBarHeight = ResetTabBarHeight,
958         .resetBarAdaptiveHeight = ResetBarAdaptiveHeight,
959         .resetAnimationDuration = ResetAnimationDuration,
960         .setTabClip = SetTabClip,
961         .resetTabClip = ResetTabClip,
962         .setTabEdgeEffect = SetTabEdgeEffect,
963         .resetTabEdgeEffect = ResetTabEdgeEffect,
964         .setTabWidthAuto = SetTabWidthAuto,
965         .resetTabWidthAuto = ResetTabWidthAuto,
966         .setTabHeightAuto = SetTabHeightAuto,
967         .resetTabHeightAuto = ResetTabHeightAuto,
968         .setAnimateMode = SetAnimateMode,
969         .resetAnimateMode = ResetAnimateMode,
970         .setBarBackgroundEffect = SetBarBackgroundEffect,
971         .resetBarBackgroundEffect = ResetBarBackgroundEffect,
972         .setTabsOnSelected = SetTabsOnSelected,
973         .resetTabsOnSelected = ResetTabsOnSelected,
974     };
975     CHECK_INITIALIZED_FIELDS_END(modifier, 0, 0, 0); // don't move this line
976 
977     return &modifier;
978 }
979 }
980 } // namespace OHOS::Ace::NG
981