From cb6ffcae3c15255f630a0f5b5f68938f91ae0f8c Mon Sep 17 00:00:00 2001 From: Zhang-Dong-hui Date: Tue, 26 Aug 2025 16:08:10 +0800 Subject: [PATCH] 1.2 supports arcScrollBar and arcList Signed-off-by: Zhang-Dong-hui Change-Id: I2fde46f904b371786e0324e1eb1dc353d12b54f8 --- .../arkoala-arkts/arktsconfig-gn.json | 6 + .../arkui-ohos/@ohos.arkui.ArcList.ts | 737 ++++++++++++++++++ .../arkui-ohos/@ohos.arkui.ArcScrollBar.ts | 105 +++ .../arkts/ArkUIGeneratedNativeModule.ts | 52 ++ .../peers/CallbackDeserializeCall.ts | 10 + .../src/component/peers/CallbackKind.ts | 1 + .../src/component/peers/Deserializer.ts | 43 + .../src/component/peers/Serializer.ts | 42 + .../arkoala-arkts/components.gni | 6 + .../native/src/generated/Serializers.h | 93 +++ .../src/generated/arkoala_api_generated.h | 99 +++ .../native/src/generated/bridge_generated.cc | 306 ++++++++ .../generated/callback_deserialize_call.cc | 24 + .../native/src/generated/callback_kind.h | 1 + .../src/generated/callback_managed_caller.cc | 26 + .../pattern/list/list_item_model_static.cpp | 9 + .../pattern/list/list_item_model_static.h | 1 + .../scroll_bar/scroll_bar_model_static.cpp | 9 + .../scroll_bar/scroll_bar_model_static.h | 1 + .../interface/arkoala_api_generated.h | 99 +++ .../generated/interface/node_interface.gni | 3 + .../native/implementation/all_modifiers.cpp | 6 + .../implementation/arc_list_item_modifier.cpp | 159 ++++ .../implementation/arc_list_modifier.cpp | 367 +++++++++ .../arc_scroll_bar_modifier.cpp | 56 ++ 25 files changed, 2261 insertions(+) create mode 100644 frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/@ohos.arkui.ArcList.ts create mode 100644 frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/@ohos.arkui.ArcScrollBar.ts create mode 100644 frameworks/core/interfaces/native/implementation/arc_list_item_modifier.cpp create mode 100644 frameworks/core/interfaces/native/implementation/arc_list_modifier.cpp create mode 100644 frameworks/core/interfaces/native/implementation/arc_scroll_bar_modifier.cpp diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arktsconfig-gn.json b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arktsconfig-gn.json index f48462c2d30..848a74d9881 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arktsconfig-gn.json +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arktsconfig-gn.json @@ -123,6 +123,12 @@ ], "@ohos.arkui.component": [ "./arkui/component" + ], + "@ohos.arkui.ArcList": [ + "./@ohos.arkui.ArcList" + ], + "@ohos.arkui.ArcScrollBar": [ + "./@ohos.arkui.ArcScrollBar" ] } }, diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/@ohos.arkui.ArcList.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/@ohos.arkui.ArcList.ts new file mode 100644 index 00000000000..6d19f3c10fa --- /dev/null +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/@ohos.arkui.ArcList.ts @@ -0,0 +1,737 @@ +/* + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! + +import { KPointer, RuntimeType } from "@koalaui/interop" +import { LengthMetrics, ColorMetrics } from "arkui/Graphics" +import { ArkCommonMethodPeer, ArkCommonMethodComponent, ArkCommonMethodStyle, AttributeModifier, ChildrenMainSize, CommonMethod, OnScrollCallback, OnWillScrollCallback } from "arkui/component/common" +import { int32 } from "@koalaui/common" +import { ComponentBase } from "arkui/ComponentBase" +import { PeerNode } from "arkui/PeerNode" +import { ArkUIGeneratedNativeModule } from "#components" +import { CrownSensitivity, BarState } from "arkui/component/enums" +import { VoidCallback } from "arkui/component/units" +import { memo, memo_stable } from "@koalaui/runtime/annotations" +import { Scroller } from "arkui/component/scroll" +import { ComponentContent } from "arkui/component/arkui-custom" +import { SwipeActionOptions } from "arkui/component/listItem" +import { NodeAttach, remember } from "@koalaui/runtime" +import { Serializer } from "arkui/component/peers/Serializer" +export class ArkArcListPeer extends ArkCommonMethodPeer { + protected constructor(peerPtr: KPointer, id: int32, name: string = "", flags: int32 = 0) { + super(peerPtr, id, name, flags) + } + public static create(component?: ComponentBase, flags: int32 = 0): ArkArcListPeer { + const peerId = PeerNode.nextId() + const _peerPtr = ArkUIGeneratedNativeModule._ArcList_construct(peerId, flags) + const _peer = new ArkArcListPeer(_peerPtr, peerId, 'ArcList', flags) + component?.setPeer(_peer) + return _peer + } + setArcListOptionsAttribute(options?: ArkListOptions): void { + const thisSerializer : Serializer = Serializer.hold() + if (options !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const optionsTmpValue = options! + thisSerializer.writeArkListOptions(optionsTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListInterface_setArcListOptions(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setDigitalCrownSensitivityAttribute(value: CrownSensitivity | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = (value as CrownSensitivity) + thisSerializer.writeInt32(valueTmpValue.valueOf()) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setDigitalCrownSensitivity(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setSpaceAttribute(value: LengthMetrics | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.writeLengthMetrics(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setSpace(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setScrollBarAttribute(value: BarState | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = (value as BarState) + thisSerializer.writeInt32(valueTmpValue.valueOf()) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setScrollBar(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setScrollBarColorAttribute(value: ColorMetrics | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.writeColorMetrics(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setScrollBarColor(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setScrollBarWidthAttribute(value: LengthMetrics | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.writeLengthMetrics(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setScrollBarWidth(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setCachedCountAttribute(value: number | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.NUMBER) + const valueTmpValue = value! + thisSerializer.writeNumber(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setCachedCount(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setChainAnimationAttribute(value: boolean | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.BOOLEAN) + const valueTmpValue = value! + thisSerializer.writeBoolean(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setChainAnimation(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setChildrenMainSizeAttribute(value: ChildrenMainSize | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.writeChildrenMainSize(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setChildrenMainSize(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setEnableScrollInteractionAttribute(value: boolean | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.BOOLEAN) + const valueTmpValue = value! + thisSerializer.writeBoolean(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setEnableScrollInteraction(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setFadingEdgeAttribute(value: boolean | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.BOOLEAN) + const valueTmpValue = value! + thisSerializer.writeBoolean(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setFadingEdge(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setFrictionAttribute(value: number | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.NUMBER) + const valueTmpValue = value! + thisSerializer.writeNumber(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setFriction(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setFlingSpeedLimitAttribute(value: number | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.NUMBER) + const valueTmpValue = value! + thisSerializer.writeNumber(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setFlingSpeedLimit(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setOnScrollIndexAttribute(value: ArcScrollIndexHandler | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.holdAndWriteCallback(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setOnScrollIndex(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setOnReachStartAttribute(value: VoidCallback | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.holdAndWriteCallback(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setOnReachStart(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setOnReachEndAttribute(value: VoidCallback | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.holdAndWriteCallback(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setOnReachEnd(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setOnScrollStartAttribute(value: VoidCallback | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.holdAndWriteCallback(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setOnScrollStart(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setOnScrollStopAttribute(value: VoidCallback | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.holdAndWriteCallback(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setOnScrollStop(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setOnWillScrollAttribute(value: OnWillScrollCallback | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.holdAndWriteCallback(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setOnWillScroll(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setOnDidScrollAttribute(value: OnScrollCallback | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.holdAndWriteCallback(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListAttribute_setOnDidScroll(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } +} +export type ArcScrollIndexHandler = (start: number, end: number, center: number) => void; +export interface ArkListOptions { + initialIndex?: number; + scroller?: Scroller; + header?: ComponentContent; +} +export type ArcListInterface = (options?: ArkListOptions) => ArcListAttribute; +export interface ArcListAttribute extends CommonMethod { + setArcListOptions(options?: ArkListOptions): this { + return this; + } + digitalCrownSensitivity(value: CrownSensitivity | undefined): this { + return this; + } + space(value: LengthMetrics | undefined): this { + return this; + } + scrollBar(value: BarState | undefined): this { + return this; + } + scrollBarColor(value: ColorMetrics | undefined): this { + return this; + } + scrollBarWidth(value: LengthMetrics | undefined): this { + return this; + } + cachedCount(value: number | undefined): this { + return this; + } + chainAnimation(value: boolean | undefined): this { + return this; + } + childrenMainSize(value: ChildrenMainSize | undefined): this { + return this; + } + enableScrollInteraction(value: boolean | undefined): this { + return this; + } + fadingEdge(value: boolean | undefined): this { + return this; + } + friction(value: number | undefined): this { + return this; + } + flingSpeedLimit(value: number | undefined): this { + return this; + } + onScrollIndex(value: ArcScrollIndexHandler | undefined): this { + return this; + } + onReachStart(value: VoidCallback | undefined): this { + return this; + } + onReachEnd(value: VoidCallback | undefined): this { + return this; + } + onScrollStart(value: VoidCallback | undefined): this { + return this; + } + onScrollStop(value: VoidCallback | undefined): this { + return this; + } + onWillScroll(value: OnWillScrollCallback | undefined): this { + return this; + } + onDidScroll(value: OnScrollCallback | undefined): this { + return this; + } + attributeModifier(value: AttributeModifier | AttributeModifier | undefined): this { + return this; + } +} +export class ArkArcListStyle extends ArkCommonMethodStyle implements ArcListAttribute { + digitalCrownSensitivity_value?: CrownSensitivity | undefined + space_value?: LengthMetrics | undefined + scrollBar_value?: BarState | undefined + scrollBarColor_value?: ColorMetrics | undefined + scrollBarWidth_value?: LengthMetrics | undefined + cachedCount_value?: number | undefined + chainAnimation_value?: boolean | undefined + childrenMainSize_value?: ChildrenMainSize | undefined + enableScrollInteraction_value?: boolean | undefined + fadingEdge_value?: boolean | undefined + friction_value?: number | undefined + flingSpeedLimit_value?: number | undefined + onScrollIndex_value?: ArcScrollIndexHandler | undefined + onReachStart_value?: VoidCallback | undefined + onReachEnd_value?: VoidCallback | undefined + onScrollStart_value?: VoidCallback | undefined + onScrollStop_value?: VoidCallback | undefined + onWillScroll_value?: OnWillScrollCallback | undefined + onDidScroll_value?: OnScrollCallback | undefined + attributeModifier_value?: AttributeModifier | AttributeModifier | undefined + setArcListOptions(options?: ArkListOptions): this { + return this; + } + digitalCrownSensitivity(value: CrownSensitivity | undefined): this { + return this + } + space(value: LengthMetrics | undefined): this { + return this + } + scrollBar(value: BarState | undefined): this { + return this + } + scrollBarColor(value: ColorMetrics | undefined): this { + return this + } + scrollBarWidth(value: LengthMetrics | undefined): this { + return this + } + cachedCount(value: number | undefined): this { + return this + } + chainAnimation(value: boolean | undefined): this { + return this + } + childrenMainSize(value: ChildrenMainSize | undefined): this { + return this + } + enableScrollInteraction(value: boolean | undefined): this { + return this + } + fadingEdge(value: boolean | undefined): this { + return this + } + friction(value: number | undefined): this { + return this + } + flingSpeedLimit(value: number | undefined): this { + return this + } + onScrollIndex(value: ArcScrollIndexHandler | undefined): this { + return this + } + onReachStart(value: VoidCallback | undefined): this { + return this + } + onReachEnd(value: VoidCallback | undefined): this { + return this + } + onScrollStart(value: VoidCallback | undefined): this { + return this + } + onScrollStop(value: VoidCallback | undefined): this { + return this + } + onWillScroll(value: OnWillScrollCallback | undefined): this { + return this + } + onDidScroll(value: OnScrollCallback | undefined): this { + return this + } + public attributeModifier(value: AttributeModifier | AttributeModifier | undefined): this { + throw new Error("Not implemented") + } +} + +export class ArkArcListComponent extends ArkCommonMethodComponent implements ArcListAttribute { + getPeer(): ArkArcListPeer { + return (this.peer as ArkArcListPeer) + } + public setArcListOptions(options?: ArkListOptions): this { + if (this.checkPriority("setArcListOptions")) { + const options_casted = options as (ArkListOptions | undefined) + this.getPeer()?.setArcListOptionsAttribute(options_casted) + return this + } + return this + } + public digitalCrownSensitivity(value: CrownSensitivity | undefined): this { + if (this.checkPriority("digitalCrownSensitivity")) { + const value_casted = value as (CrownSensitivity | undefined) + this.getPeer()?.setDigitalCrownSensitivityAttribute(value_casted) + return this + } + return this + } + public space(value: LengthMetrics | undefined): this { + if (this.checkPriority("space")) { + const value_casted = value as (LengthMetrics | undefined) + this.getPeer()?.setSpaceAttribute(value_casted) + return this + } + return this + } + public scrollBar(value: BarState | undefined): this { + if (this.checkPriority("scrollBar")) { + const value_casted = value as (BarState | undefined) + this.getPeer()?.setScrollBarAttribute(value_casted) + return this + } + return this + } + public scrollBarColor(value: ColorMetrics | undefined): this { + if (this.checkPriority("scrollBarColor")) { + const value_casted = value as (ColorMetrics | undefined) + this.getPeer()?.setScrollBarColorAttribute(value_casted) + return this + } + return this + } + public scrollBarWidth(value: LengthMetrics | undefined): this { + if (this.checkPriority("scrollBarWidth")) { + const value_casted = value as (LengthMetrics | undefined) + this.getPeer()?.setScrollBarWidthAttribute(value_casted) + return this + } + return this + } + public cachedCount(value: number | undefined): this { + if (this.checkPriority("cachedCount")) { + const value_casted = value as (number | undefined) + this.getPeer()?.setCachedCountAttribute(value_casted) + return this + } + return this + } + public chainAnimation(value: boolean | undefined): this { + if (this.checkPriority("chainAnimation")) { + const value_casted = value as (boolean | undefined) + this.getPeer()?.setChainAnimationAttribute(value_casted) + return this + } + return this + } + public childrenMainSize(value: ChildrenMainSize | undefined): this { + if (this.checkPriority("childrenMainSize")) { + const value_casted = value as (ChildrenMainSize | undefined) + this.getPeer()?.setChildrenMainSizeAttribute(value_casted) + return this + } + return this + } + public enableScrollInteraction(value: boolean | undefined): this { + if (this.checkPriority("enableScrollInteraction")) { + const value_casted = value as (boolean | undefined) + this.getPeer()?.setEnableScrollInteractionAttribute(value_casted) + return this + } + return this + } + public fadingEdge(value: boolean | undefined): this { + if (this.checkPriority("fadingEdge")) { + const value_casted = value as (boolean | undefined) + this.getPeer()?.setFadingEdgeAttribute(value_casted) + return this + } + return this + } + public friction(value: number | undefined): this { + if (this.checkPriority("friction")) { + const value_casted = value as (number | undefined) + this.getPeer()?.setFrictionAttribute(value_casted) + return this + } + return this + } + public flingSpeedLimit(value: number | undefined): this { + if (this.checkPriority("flingSpeedLimit")) { + const value_casted = value as (number | undefined) + this.getPeer()?.setFlingSpeedLimitAttribute(value_casted) + return this + } + return this + } + public onScrollIndex(value: ArcScrollIndexHandler | undefined): this { + if (this.checkPriority("onScrollIndex")) { + const value_casted = value as (ArcScrollIndexHandler | undefined) + this.getPeer()?.setOnScrollIndexAttribute(value_casted) + return this + } + return this + } + public onReachStart(value: VoidCallback | undefined): this { + if (this.checkPriority("onReachStart")) { + const value_casted = value as (VoidCallback | undefined) + this.getPeer()?.setOnReachStartAttribute(value_casted) + return this + } + return this + } + public onReachEnd(value: VoidCallback | undefined): this { + if (this.checkPriority("onReachEnd")) { + const value_casted = value as (VoidCallback | undefined) + this.getPeer()?.setOnReachEndAttribute(value_casted) + return this + } + return this + } + public onScrollStart(value: VoidCallback | undefined): this { + if (this.checkPriority("onScrollStart")) { + const value_casted = value as (VoidCallback | undefined) + this.getPeer()?.setOnScrollStartAttribute(value_casted) + return this + } + return this + } + public onScrollStop(value: VoidCallback | undefined): this { + if (this.checkPriority("onScrollStop")) { + const value_casted = value as (VoidCallback | undefined) + this.getPeer()?.setOnScrollStopAttribute(value_casted) + return this + } + return this + } + public onWillScroll(value: OnWillScrollCallback | undefined): this { + if (this.checkPriority("onWillScroll")) { + const value_casted = value as (OnWillScrollCallback | undefined) + this.getPeer()?.setOnWillScrollAttribute(value_casted) + return this + } + return this + } + public onDidScroll(value: OnScrollCallback | undefined): this { + if (this.checkPriority("onDidScroll")) { + const value_casted = value as (OnScrollCallback | undefined) + this.getPeer()?.setOnDidScrollAttribute(value_casted) + return this + } + return this + } + public attributeModifier(value: AttributeModifier | AttributeModifier | undefined): this { + return this + } + public applyAttributesFinish(): void { + // we call this function outside of class, so need to make it public + super.applyAttributesFinish() + } +} + +@memo +export function ArcList( + @memo + style: ((attributes: ArcListAttribute) => void) | undefined, + @memo + content_?: () => void, +): void { + const receiver = remember((): ArkArcListComponent => { + return new ArkArcListComponent() + }) + NodeAttach((): ArkArcListPeer => ArkArcListPeer.create(receiver), (_: ArkArcListPeer): void => { + style?.(receiver) + content_?.() + }) +} + +export class ArkArcListItemPeer extends ArkCommonMethodPeer { + protected constructor(peerPtr: KPointer, id: int32, name: string = "", flags: int32 = 0) { + super(peerPtr, id, name, flags) + } + public static create(component?: ComponentBase, flags: int32 = 0): ArkArcListItemPeer { + const peerId = PeerNode.nextId() + const _peerPtr = ArkUIGeneratedNativeModule._ArcListItem_construct(peerId, flags) + const _peer = new ArkArcListItemPeer(_peerPtr, peerId, 'ArcListItem', flags) + component?.setPeer(_peer) + return _peer + } + setAutoScaleAttribute(value: boolean | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.BOOLEAN) + const valueTmpValue = value! + thisSerializer.writeBoolean(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListItemAttribute_setAutoScale(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } + setSwipeActionAttribute(value: SwipeActionOptions | undefined): void { + const thisSerializer : Serializer = Serializer.hold() + if (value !== undefined) { + thisSerializer.writeInt8(RuntimeType.OBJECT) + const valueTmpValue = value! + thisSerializer.writeSwipeActionOptions(valueTmpValue) + } else { + thisSerializer.writeInt8(RuntimeType.UNDEFINED) + } + ArkUIGeneratedNativeModule._ArcListItemAttribute_setSwipeAction(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } +} + +export type ArcListItemInterface = () => ArcListItemAttribute; +export interface ArcListItemAttribute extends CommonMethod { + autoScale(value: boolean | undefined): this { + return this; + } + swipeAction(value: SwipeActionOptions | undefined): this { + return this; + } +} +export class ArkArcListItemStyle extends ArkCommonMethodStyle implements ArcListItemAttribute { + autoScale_value?: boolean | undefined + swipeAction_value?: SwipeActionOptions | undefined + attributeModifier_value?: AttributeModifier | AttributeModifier | undefined + autoScale(value: boolean | undefined): this { + return this; + } + swipeAction(value: SwipeActionOptions | undefined): this { + return this; + } +} + +export class ArkArcListItemComponent extends ArkCommonMethodComponent implements ArcListItemAttribute { + getPeer(): ArkArcListItemPeer { + return (this.peer as ArkArcListItemPeer) + } + + public autoScale(value: boolean | undefined): this { + if (this.checkPriority("autoScale")) { + const value_casted = value as (boolean | undefined) + this.getPeer()?.setAutoScaleAttribute(value_casted) + return this + } + return this + } + + public swipeAction(value: SwipeActionOptions | undefined): this { + if (this.checkPriority("swipeAction")) { + const value_casted = value as (SwipeActionOptions | undefined) + this.getPeer()?.setSwipeActionAttribute(value_casted) + return this + } + return this + } + + public attributeModifier(value: AttributeModifier | AttributeModifier | undefined): this { + return this + } + public applyAttributesFinish(): void { + // we call this function outside of class, so need to make it public + super.applyAttributesFinish() + } +} + +@memo +export function ArcListItem( + @memo + style: ((attributes: ArcListItemAttribute) => void) | undefined, + @memo + content_?: () => void, +): void { + const receiver = remember((): ArkArcListItemComponent => { + return new ArkArcListItemComponent() + }) + NodeAttach((): ArkArcListItemPeer => ArkArcListItemPeer.create(receiver), (_: ArkArcListItemPeer): void => { + style?.(receiver) + content_?.() + }) +} diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/@ohos.arkui.ArcScrollBar.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/@ohos.arkui.ArcScrollBar.ts new file mode 100644 index 00000000000..56e6eb4364e --- /dev/null +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/@ohos.arkui.ArcScrollBar.ts @@ -0,0 +1,105 @@ +/* + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + + +// WARNING! THIS FILE IS AUTO-GENERATED, DO NOT MAKE CHANGES, THEY WILL BE LOST ON NEXT GENERATION! + +import { KPointer } from "@koalaui/interop" +import { int32 } from "@koalaui/common" +import { ComponentBase } from "arkui/ComponentBase" +import { PeerNode } from "arkui/PeerNode" +import { ArkUIGeneratedNativeModule, TypeChecker } from "#components" +import { ArkCommonMethodComponent, ArkCommonMethodPeer, ArkCommonMethodStyle, AttributeModifier, CommonMethod } from "arkui/component/common" +import { memo, memo_stable } from "@koalaui/runtime/annotations" +import { Scroller } from "arkui/component/scroll" +import { BarState } from "arkui/component/enums" +import { NodeAttach, remember } from "@koalaui/runtime" +import { Serializer } from "arkui/component/peers/Serializer" +export class ArkArcScrollBarPeer extends ArkCommonMethodPeer { + protected constructor(peerPtr: KPointer, id: int32, name: string = "", flags: int32 = 0) { + super(peerPtr, id, name, flags) + } + public static create(component?: ComponentBase, flags: int32 = 0): ArkArcScrollBarPeer { + const peerId = PeerNode.nextId() + const _peerPtr = ArkUIGeneratedNativeModule._ArcScrollBar_construct(peerId, flags) + const _peer = new ArkArcScrollBarPeer(_peerPtr, peerId, 'ArcScrollBar', flags) + component?.setPeer(_peer) + return _peer + } + setArcScrollBarOptionsAttribute(options: ArcScrollBarOptions): void { + const thisSerializer : Serializer = Serializer.hold() + thisSerializer.writeArcScrollBarOptions(options) + ArkUIGeneratedNativeModule._ArcScrollBarInterface_setArcScrollBarOptions(this.peer.ptr, thisSerializer.asBuffer(), thisSerializer.length()) + thisSerializer.release() + } +} +export interface ArcScrollBarOptions { + scroller: Scroller; + state?: BarState; +} +export interface ArcScrollBarAttribute extends CommonMethod { + setArcScrollBarOptions(options?: ArcScrollBarOptions): this { + return this; + } + attributeModifier(value: AttributeModifier | AttributeModifier | undefined): this { + throw new Error("Unimplemented method attributeModifier") + } +} +export class ArkArcScrollBarStyle extends ArkCommonMethodStyle implements ArcScrollBarAttribute { + attributeModifier_value?: AttributeModifier | AttributeModifier | undefined + public setArcScrollBarOptions(options?: ArcScrollBarOptions): this { + return this; + } + public attributeModifier(value: AttributeModifier | AttributeModifier | undefined): this { + throw new Error("Not implemented") + } +} + +export class ArkArcScrollBarComponent extends ArkCommonMethodComponent implements ArcScrollBarAttribute { + getPeer(): ArkArcScrollBarPeer { + return (this.peer as ArkArcScrollBarPeer) + } + public setArcScrollBarOptions(options: ArcScrollBarOptions): this { + if (this.checkPriority("setArcScrollBarOptions")) { + const options_casted = options as (ArcScrollBarOptions) + this.getPeer()?.setArcScrollBarOptionsAttribute(options_casted) + return this + } + return this + } + public attributeModifier(value: AttributeModifier | AttributeModifier | undefined): this { + return this + } + public applyAttributesFinish(): void { + // we call this function outside of class, so need to make it public + super.applyAttributesFinish() + } +} + +@memo +export function ArcScrollBar( + @memo + style: ((attributes: ArcScrollBarAttribute) => void) | undefined, + @memo + content_?: () => void, +): void { + const receiver = remember((): ArkArcScrollBarComponent => { + return new ArkArcScrollBarComponent() + }) + NodeAttach((): ArkArcScrollBarPeer => ArkArcScrollBarPeer.create(receiver), (_: ArkArcScrollBarPeer): void => { + style?.(receiver) + content_?.() + }) +} diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/ArkUIGeneratedNativeModule.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/ArkUIGeneratedNativeModule.ts index f0d3bf483b9..400a52b56a7 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/ArkUIGeneratedNativeModule.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/arkts/ArkUIGeneratedNativeModule.ts @@ -160,6 +160,58 @@ export class ArkUIGeneratedNativeModule { @ani.unsafe.Direct native static _ArcAlphabetIndexerExtender_SetConstructInfo(node: KPointer, thisArray: KSerializerBuffer, thisLength: int32, selected: number): void @ani.unsafe.Direct + native static _ArcList_construct(id: KInt, flags: KInt): KPointer + @ani.unsafe.Direct + native static _ArcListInterface_setArcListOptions(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setDigitalCrownSensitivity(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setSpace(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setScrollBar(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setScrollBarColor(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setScrollBarWidth(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setCachedCount(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setChainAnimation(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setChildrenMainSize(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setEnableScrollInteraction(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setFadingEdge(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setFriction(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setFlingSpeedLimit(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setOnScrollIndex(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setOnReachStart(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setOnReachEnd(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setOnScrollStart(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setOnScrollStop(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setOnWillScroll(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListAttribute_setOnDidScroll(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListItem_construct(id: KInt, flags: KInt): KPointer + @ani.unsafe.Direct + native static _ArcListItemAttribute_setAutoScale(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcListItemAttribute_setSwipeAction(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct + native static _ArcScrollBar_construct(id: KInt, flags: KInt): KPointer + @ani.unsafe.Direct + native static _ArcScrollBarInterface_setArcScrollBarOptions(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void + @ani.unsafe.Direct native static _Badge_construct(id: KInt, flags: KInt): KPointer @ani.unsafe.Direct native static _BadgeInterface_setBadgeOptions0(ptr: KPointer, thisArray: KSerializerBuffer, thisLength: int32): void diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/CallbackDeserializeCall.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/CallbackDeserializeCall.ts index 0f9e53a4d2e..e3818f98543 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/CallbackDeserializeCall.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/CallbackDeserializeCall.ts @@ -113,6 +113,7 @@ import { NodeContainer_AboutToResizeCallback } from "./../nodeContainer" import { Size, DrawContext } from "../../Graphics" import { DrawCallback } from "./../../RenderNode" import { ToggleConfiguration } from "../toggle" +import { ArcScrollIndexHandler } from "@ohos.arkui.ArcList" export function deserializeAndCallAccessibilityCallback(thisDeserializer: Deserializer): void { const _resourceId : int32 = thisDeserializer.readInt32() const _call = (ResourceHolder.instance().get(_resourceId) as AccessibilityCallback) @@ -126,6 +127,14 @@ export function deserializeAndCallAccessibilityFocusCallback(thisDeserializer: D let isFocus : boolean = thisDeserializer.readBoolean() _call(isFocus) } +export function deserializeAndCallArcScrollIndexHandler(thisDeserializer: Deserializer): void { + const _resourceId : int32 = thisDeserializer.readInt32() + const _call = (ResourceHolder.instance().get(_resourceId) as ArcScrollIndexHandler) + let start : number = (thisDeserializer.readNumber() as number) + let end : number = (thisDeserializer.readNumber() as number) + let center : number = (thisDeserializer.readNumber() as number) + _call(start, end, center) +} export function deserializeAndCallAsyncCallback_Array_TextMenuItem_Array_TextMenuItem(thisDeserializer: Deserializer): void { const _resourceId : int32 = thisDeserializer.readInt32() const _call = (ResourceHolder.instance().get(_resourceId) as ((menuItems: Array) => Array)) @@ -2813,6 +2822,7 @@ export function deserializeAndCallCallback(thisDeserializer: Deserializer): void switch (kind) { case 589030517/*CallbackKind.Kind_AccessibilityCallback*/: return deserializeAndCallAccessibilityCallback(thisDeserializer); case 1715445305/*CallbackKind.Kind_AccessibilityFocusCallback*/: return deserializeAndCallAccessibilityFocusCallback(thisDeserializer); + case -274386039/*CallbackKind.Kind_ArcScrollIndexHandler*/: return deserializeAndCallArcScrollIndexHandler(thisDeserializer); case 300202685/*CallbackKind.Kind_AsyncCallback_Array_TextMenuItem_Array_TextMenuItem*/: return deserializeAndCallAsyncCallback_Array_TextMenuItem_Array_TextMenuItem(thisDeserializer); case 1289587365/*CallbackKind.Kind_AsyncCallback_image_PixelMap_Void*/: return deserializeAndCallAsyncCallback_image_PixelMap_Void(thisDeserializer); case -1581515233/*CallbackKind.Kind_AsyncCallback_TextMenuItem_TextRange_Boolean*/: return deserializeAndCallAsyncCallback_TextMenuItem_TextRange_Boolean(thisDeserializer); diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/CallbackKind.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/CallbackKind.ts index be0ebaa79ee..9586caf04d5 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/CallbackKind.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/CallbackKind.ts @@ -2,6 +2,7 @@ import { int32, float32 } from "@koalaui/common" export enum CallbackKind { Kind_AccessibilityCallback = 589030517, Kind_AccessibilityFocusCallback = 1715445305, + Kind_ArcScrollIndexHandler = -274386039, Kind_AsyncCallback_Array_TextMenuItem_Array_TextMenuItem = 300202685, Kind_AsyncCallback_image_PixelMap_Void = 1289587365, Kind_AsyncCallback_TextMenuItem_TextRange_Boolean = -1581515233, diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts index 96118b109a0..91c1ca508a2 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Deserializer.ts @@ -195,6 +195,8 @@ import { LevelOrderInternal, LevelMode, ImmersiveMode, LevelOrder } from "@ohos/ import { PointerStyle, DataSyncOptions } from '#external' import { UIContextUtil } from "arkui/handwritten/UIContextUtil" import { uiObserver } from "@ohos/arkui/observer" +import { ArkListOptions } from "@ohos.arkui.ArcList" +import { ArcScrollBarOptions } from "@ohos.arkui.ArcScrollBar" export class Deserializer extends DeserializerBase { constructor(data: KSerializerBuffer | KUint8ArrayPtr, length: int32) { super(data, length) @@ -9298,6 +9300,47 @@ export class Deserializer extends DeserializerBase { let value : ListItemOptions = ({style: style_result} as ListItemOptions) return value } + readArcScrollbarOptions(): ArcScrollBarOptions { + let valueDeserializer : Deserializer = this + const scroller_result : Scroller = (valueDeserializer.readScroller() as Scroller) + const state_buf_runtimeType = (valueDeserializer.readInt8() as int32) + let state_buf : BarState | undefined + if ((RuntimeType.UNDEFINED) != (state_buf_runtimeType)) + { + state_buf = TypeChecker.BarState_FromNumeric(valueDeserializer.readInt32()) + } + const state_result : BarState | undefined = state_buf + let value : ArcScrollBarOptions = ({scroller: scroller_result, state: state_result} as ArcScrollBarOptions) + return value + } + readArkListOptions(): ArkListOptions { + let valueDeserializer : Deserializer = this + const initialIndex_buf_runtimeType = (valueDeserializer.readInt8() as int32) + let initialIndex_buf : number | undefined + if ((RuntimeType.UNDEFINED) != (initialIndex_buf_runtimeType)) + { + initialIndex_buf = (valueDeserializer.readNumber() as number) + } + const initialIndex_result : number | undefined = initialIndex_buf + + const scroller_buf_runtimeType = (valueDeserializer.readInt8() as int32) + let scroller_buf : Scroller | undefined + if ((RuntimeType.UNDEFINED) != (scroller_buf_runtimeType)) + { + scroller_buf = (valueDeserializer.readScroller() as Scroller) + } + const scroller_result : Scroller | undefined = scroller_buf + + const header_buf_runtimeType = (valueDeserializer.readInt8() as int32) + let header_buf : ComponentContent | undefined + if ((RuntimeType.UNDEFINED) != (header_buf_runtimeType)) + { + header_buf = (valueDeserializer.readComponentContent() as ComponentContent) + } + const header_result : ComponentContent | undefined = header_buf + let value : ArkListOptions = ({initialIndex: initialIndex_result, scroller: scroller_result, header: header_result} as ArkListOptions) + return value + } readListOptions(): ListOptions { let valueDeserializer : Deserializer = this const initialIndex_buf_runtimeType = (valueDeserializer.readInt8() as int32) diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Serializer.ts b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Serializer.ts index 81b607bc28e..970b612feac 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Serializer.ts +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/arkui-ohos/src/component/peers/Serializer.ts @@ -182,6 +182,8 @@ import promptAction from '@ohos/promptAction' import { LevelMode, ImmersiveMode, LevelOrder } from "@ohos/promptAction" import { PointerStyle, DataSyncOptions } from '#external' import { uiObserver } from "@ohos/arkui/observer" +import { ArkListOptions } from "@ohos.arkui.ArcList" +import { ArcScrollBarOptions } from "@ohos.arkui.ArcScrollBar" export class Serializer extends SerializerBase { private static pool?: Array | undefined = undefined private static poolTop: int32 = -1 @@ -4268,6 +4270,46 @@ export class Serializer extends SerializerBase { valueSerializer.writeInt32(TypeChecker.ListItemStyle_ToNumeric(value_style_value)) } } + writeArkListOptions(value: ArkListOptions): void { + let valueSerializer: Serializer = this + const value_initialIndex = value.initialIndex + let value_initialIndex_type: int32 = RuntimeType.UNDEFINED + value_initialIndex_type = runtimeType(value_initialIndex) + valueSerializer.writeInt8(value_initialIndex_type as int32) + if ((RuntimeType.UNDEFINED) != (value_initialIndex_type)) { + const value_initialIndex_value = value_initialIndex! + valueSerializer.writeNumber(value_initialIndex_value) + } + const value_scroller = value.scroller + let value_scroller_type: int32 = RuntimeType.UNDEFINED + value_scroller_type = runtimeType(value_scroller) + valueSerializer.writeInt8(value_scroller_type as int32) + if ((RuntimeType.UNDEFINED) != (value_scroller_type)) { + const value_scroller_value = value_scroller! + valueSerializer.writeScroller(value_scroller_value) + } + const valueHolderForHeader = value.header; + let value_builderComponent_type: int32 = RuntimeType.UNDEFINED + value_builderComponent_type = runtimeType(valueHolderForHeader) + valueSerializer.writeInt8(value_builderComponent_type as int32) + if ((RuntimeType.UNDEFINED) != (value_builderComponent_type)) { + const value_builderComponent_value = valueHolderForHeader! + valueSerializer.writeComponentContent(value_builderComponent_value) + } + } + writeArcScrollBarOptions(value: ArcScrollBarOptions): void { + let valueSerializer: Serializer = this + const value_scroller = value.scroller + valueSerializer.writeScroller(value_scroller) + const value_state = value.state + let value_state_type: int32 = RuntimeType.UNDEFINED + value_state_type = runtimeType(value_state) + valueSerializer.writeInt8(value_state_type as int32) + if ((RuntimeType.UNDEFINED) != (value_state_type)) { + const value_state_value = (value_state as BarState) + valueSerializer.writeInt32(TypeChecker.BarState_ToNumeric(value_state_value)) + } + } writeListOptions(value: ListOptions): void { let valueSerializer : Serializer = this const value_initialIndex = value.initialIndex diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/components.gni b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/components.gni index 01c0bd5ee70..4fca1cdd1a5 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/components.gni +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala-arkts/components.gni @@ -19,6 +19,8 @@ arkui_files = [ "arkui-preprocessed/arkui/AlphabetIndexerModifier.ets", "arkui-preprocessed/@ohos.animator.ets", "arkui-preprocessed/@ohos.arkui.ArcAlphabetIndexer.ets", + "arkui-preprocessed/@ohos.arkui.ArcList.ets", + "arkui-preprocessed/@ohos.arkui.ArcScrollBar.ets", "arkui-preprocessed/@ohos.arkui.Parallelize.ets", "arkui-preprocessed/@ohos.arkui.UIContext.ets", "arkui-preprocessed/@ohos.arkui.componentSnapshot.ets", @@ -536,6 +538,8 @@ arkui_path_keys = [ "@koalaui/runtime/annotations", "@component_handwritten/*", "@ohos/animator", + "@ohos.arkui.ArcList", + "@ohos.arkui.ArcScrollBar", "@ohos/arkui/UIContext", "@ohos.arkui.UIContext", "@ohos.arkui.node", @@ -579,6 +583,8 @@ arkui_path_values = [ "../incremental/runtime/annotations", "arkui-preprocessed/arkui/component/*", "arkui-preprocessed/@ohos.animator.ets", + "arkui-preprocessed/@ohos.arkui.ArcList.ets", + "arkui-preprocessed/@ohos.arkui.ArcScrollBar.ets", "arkui-preprocessed/@ohos.arkui.UIContext.ets", "arkui-preprocessed/@ohos.arkui.UIContext.ets", "arkui-preprocessed/arkui/ohos.arkui.node.ets", diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h index 921d3377a81..07c00263383 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/Serializers.h @@ -68396,6 +68396,58 @@ class Serializer : public SerializerBase { valueSerializer.writeInt32(static_cast(value_style_value)); } } + void writeArkListOptions(Ark_ArkListOptions value) + { + Serializer& valueSerializer = *this; + const auto valueHolderForInitialIndex = value.initialIndex; + if (runtimeType(valueHolderForInitialIndex) != INTEROP_RUNTIME_UNDEFINED) { + valueSerializer.writeInt8(INTEROP_RUNTIME_OBJECT); + const auto valueHolderForInitialIndexTmpValue = valueHolderForInitialIndex.value; + valueSerializer.writeNumber(valueHolderForInitialIndexTmpValue); + } else { + valueSerializer.writeInt8(INTEROP_RUNTIME_UNDEFINED); + } + const auto value_scroller = value.scroller; + Ark_Int32 value_scroller_type = INTEROP_RUNTIME_UNDEFINED; + value_scroller_type = runtimeType(value_scroller); + valueSerializer.writeInt8(value_scroller_type); + if ((INTEROP_RUNTIME_UNDEFINED) != (value_scroller_type)) { + const auto value_scroller_value = value_scroller.value; + valueSerializer.writeScroller(value_scroller_value); + } else { + valueSerializer.writeInt8(INTEROP_RUNTIME_UNDEFINED); + } + + const auto valueHolderForHeader = value.header; + Ark_Int32 value_header_type = INTEROP_RUNTIME_UNDEFINED; + value_header_type = runtimeType(valueHolderForHeader); + valueSerializer.writeInt8(value_header_type); + if ((INTEROP_RUNTIME_UNDEFINED) != (value_header_type)) { + const auto value_header_value = valueHolderForHeader.value; + valueSerializer.writeComponentContent(value_header_value); + } else { + valueSerializer.writeInt8(INTEROP_RUNTIME_UNDEFINED); + } + } + void writeArcScrollBarOptions(Ark_ArcScrollBarOptions value) + { + Serializer& valueSerializer = *this; + const auto value_scroller = value.scroller; + Ark_Int32 value_scroller_type = INTEROP_RUNTIME_UNDEFINED; + value_scroller_type = runtimeType(value_scroller); + valueSerializer.writeInt8(value_scroller_type); + if ((INTEROP_RUNTIME_UNDEFINED) != (value_scroller_type)) { + valueSerializer.writeScroller(value_scroller); + } + const auto valueHolderForState = value.state; + if (runtimeType(valueHolderForState) != INTEROP_RUNTIME_UNDEFINED) { + valueSerializer.writeInt8(INTEROP_RUNTIME_OBJECT); + const auto valueHolderForStateTmpValue = valueHolderForState.value; + valueSerializer.writeInt32(static_cast(valueHolderForStateTmpValue)); + } else { + valueSerializer.writeInt8(INTEROP_RUNTIME_UNDEFINED); + } + } void writeListOptions(Ark_ListOptions value) { Serializer& valueSerializer = *this; @@ -95432,6 +95484,47 @@ class Deserializer : public DeserializerBase { value.style = style_buf; return value; } + Ark_ArkListOptions readArkListOptions() + { + Ark_ArkListOptions value = {}; + Deserializer& valueDeserializer = *this; + const auto initialIndexTmpBuf_runtimeType = static_cast(valueDeserializer.readInt8()); + Opt_Number initialIndexTmpBuf = {}; + initialIndexTmpBuf.tag = initialIndexTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((initialIndexTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + initialIndexTmpBuf.value = static_cast(valueDeserializer.readNumber()); + } + value.initialIndex = initialIndexTmpBuf; + const auto scrollerTmpBuf_runtimeType = static_cast(valueDeserializer.readInt8()); + Opt_Scroller scrollerTmpBuf = {}; + scrollerTmpBuf.tag = scrollerTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((scrollerTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + scrollerTmpBuf.value = static_cast(valueDeserializer.readScroller()); + } + value.scroller = scrollerTmpBuf; + const auto headerTmpBuf_runtimeType = static_cast(valueDeserializer.readInt8()); + Opt_ComponentContent headerTmpBuf = {}; + headerTmpBuf.tag = headerTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((headerTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + headerTmpBuf.value = static_cast(valueDeserializer.readComponentContent()); + } + value.header = headerTmpBuf; + return value; + } + Ark_ArcScrollBarOptions readArcScrollBarOptions() + { + Ark_ArcScrollBarOptions value = {}; + Deserializer& valueDeserializer = *this; + value.scroller = static_cast(valueDeserializer.readScroller()); + const auto stateTmpBuf_runtimeType = static_cast(valueDeserializer.readInt8()); + Opt_BarState stateTmpBuf = {}; + stateTmpBuf.tag = stateTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((stateTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + stateTmpBuf.value = static_cast(valueDeserializer.readInt32()); + } + value.state = stateTmpBuf; + return value; + } Ark_ListOptions readListOptions() { Ark_ListOptions value = {}; diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/arkoala_api_generated.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/arkoala_api_generated.h index c7e06fb0b4c..6536f9e0ec9 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/arkoala_api_generated.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/arkoala_api_generated.h @@ -264,6 +264,8 @@ typedef struct AccessibilityCallback AccessibilityCallback; typedef struct Opt_AccessibilityCallback Opt_AccessibilityCallback; typedef struct AccessibilityFocusCallback AccessibilityFocusCallback; typedef struct Opt_AccessibilityFocusCallback Opt_AccessibilityFocusCallback; +typedef struct ArcScrollIndexHandler ArcScrollIndexHandler; +typedef struct Opt_ArcScrollIndexHandler Opt_ArcScrollIndexHandler; typedef struct Ark_AlphabetIndexerAttribute Ark_AlphabetIndexerAttribute; typedef struct Opt_AlphabetIndexerAttribute Opt_AlphabetIndexerAttribute; typedef struct AnimatedDrawableDescriptorPeer AnimatedDrawableDescriptorPeer; @@ -1741,6 +1743,10 @@ typedef struct Opt_AnimationRange_Number Opt_AnimationRange_Number; typedef struct AppearSymbolEffectPeer AppearSymbolEffectPeer; typedef struct AppearSymbolEffectPeer* Ark_AppearSymbolEffect; typedef struct Opt_AppearSymbolEffect Opt_AppearSymbolEffect; +typedef struct Ark_ArcScrollBarOptions Ark_ArcScrollBarOptions; +typedef struct Opt_ArcScrollBarOptions Opt_ArcScrollBarOptions; +typedef struct Ark_ArkListOptions Ark_ArkListOptions; +typedef struct Opt_ArkListOptions Opt_ArkListOptions; typedef struct Ark_ASTCResource Ark_ASTCResource; typedef struct Opt_ASTCResource Opt_ASTCResource; typedef struct Ark_AutoPlayOptions Ark_AutoPlayOptions; @@ -6901,6 +6907,16 @@ typedef struct Opt_AccessibilityFocusCallback { Ark_Tag tag; AccessibilityFocusCallback value; } Opt_AccessibilityFocusCallback; +typedef struct ArcScrollIndexHandler { + /* kind: Callback */ + Ark_CallbackResource resource; + void (*call)(const Ark_Int32 resourceId, const Ark_Number start, const Ark_Number end, const Ark_Number center); + void (*callSync)(Ark_VMContext vmContext, const Ark_Int32 resourceId, const Ark_Number start, const Ark_Number end, const Ark_Number center); +} ArcScrollIndexHandler; +typedef struct Opt_ArcScrollIndexHandler { + Ark_Tag tag; + ArcScrollIndexHandler value; +} Opt_ArcScrollIndexHandler; typedef struct Ark_AlphabetIndexerAttribute { void *handle; } Ark_AlphabetIndexerAttribute; @@ -12247,6 +12263,25 @@ typedef struct Opt_AppearSymbolEffect { Ark_Tag tag; Ark_AppearSymbolEffect value; } Opt_AppearSymbolEffect; +typedef struct Ark_ArcScrollBarOptions { + /* kind: Interface */ + Ark_Scroller scroller; + Opt_BarState state; +} Ark_ArcScrollBarOptions; +typedef struct Opt_ArcScrollBarOptions { + Ark_Tag tag; + Ark_ArcScrollBarOptions value; +} Opt_ArcScrollBarOptions; +typedef struct Ark_ArkListOptions { + /* kind: Interface */ + Opt_Number initialIndex; + Opt_Scroller scroller; + Opt_ComponentContent header; +} Ark_ArkListOptions; +typedef struct Opt_ArkListOptions { + Ark_Tag tag; + Ark_ArkListOptions value; +} Opt_ArkListOptions; typedef struct Ark_ASTCResource { Array_String sources; Ark_Number column; @@ -20291,6 +20326,67 @@ typedef struct GENERATED_ArkUIAnimatorModifier { const Opt_Callback_Number_Void* value); } GENERATED_ArkUIAnimatorModifier; +typedef struct GENERATED_ArkUIArcListItemModifier { + Ark_NativePointer (*construct)(Ark_Int32 id, + Ark_Int32 flags); + void (*setAutoScale)(Ark_NativePointer node, + const Opt_Boolean* options); + void (*setSwipeAction)(Ark_NativePointer node, + const Opt_SwipeActionOptions* value); +} GENERATED_ArkUIArcListItemModifier; + +typedef struct GENERATED_ArkUIArcListModifier { + Ark_NativePointer (*construct)(Ark_Int32 id, + Ark_Int32 flags); + void (*setArcListOptions)(Ark_NativePointer node, + const Opt_ArkListOptions* options); + void (*setDigitalCrownSensitivity)(Ark_NativePointer node, + const Opt_CrownSensitivity* value); + void (*setSpace)(Ark_NativePointer node, + const Opt_LengthMetrics* value); + void (*setScrollBar)(Ark_NativePointer node, + const Opt_BarState* value); + void (*setScrollBarColor)(Ark_NativePointer node, + const Opt_ColorMetrics* value); + void (*setScrollBarWidth)(Ark_NativePointer node, + const Opt_LengthMetrics* value); + void (*setCachedCount)(Ark_NativePointer node, + const Opt_Number* value); + void (*setChainAnimation)(Ark_NativePointer node, + const Opt_Boolean* value); + void (*setChildrenMainSize)(Ark_NativePointer node, + const Opt_ChildrenMainSize* value); + void (*setEnableScrollInteraction)(Ark_NativePointer node, + const Opt_Boolean* value); + void (*setFadingEdge)(Ark_NativePointer node, + const Opt_Boolean* value); + void (*setFriction)(Ark_NativePointer node, + const Opt_Number* value); + void (*setFlingSpeedLimit)(Ark_NativePointer node, + const Opt_Number* value); + void (*setOnScrollIndex)(Ark_NativePointer node, + const Opt_ArcScrollIndexHandler* value); + void (*setOnReachStart)(Ark_NativePointer node, + const Opt_VoidCallback* value); + void (*setOnReachEnd)(Ark_NativePointer node, + const Opt_VoidCallback* value); + void (*setOnScrollStart)(Ark_NativePointer node, + const Opt_VoidCallback* value); + void (*setOnScrollStop)(Ark_NativePointer node, + const Opt_VoidCallback* value); + void (*setOnWillScroll)(Ark_NativePointer node, + const Opt_OnWillScrollCallback* value); + void (*setOnDidScroll)(Ark_NativePointer node, + const Opt_OnScrollCallback* value); +} GENERATED_ArkUIArcListModifier; + +typedef struct GENERATED_ArkUIArcScrollBarModifier { + Ark_NativePointer (*construct)(Ark_Int32 id, + Ark_Int32 flags); + void (*setArcScrollBarOptions)(Ark_NativePointer node, + const Ark_ArcScrollBarOptions* options); +} GENERATED_ArkUIArcScrollBarModifier; + typedef struct GENERATED_ArkUIBadgeModifier { Ark_NativePointer (*construct)(Ark_Int32 id, Ark_Int32 flags); @@ -28342,6 +28438,9 @@ typedef struct GENERATED_ArkUINodeModifiers { const GENERATED_ArkUIAbilityComponentModifier* (*getAbilityComponentModifier)(); const GENERATED_ArkUIAlphabetIndexerModifier* (*getAlphabetIndexerModifier)(); const GENERATED_ArkUIAnimatorModifier* (*getAnimatorModifier)(); + const GENERATED_ArkUIArcListItemModifier* (*getArcListItemModifier)(); + const GENERATED_ArkUIArcListModifier* (*getArcListModifier)(); + const GENERATED_ArkUIArcScrollBarModifier* (*getArcScrollBarModifier)(); const GENERATED_ArkUIBadgeModifier* (*getBadgeModifier)(); const GENERATED_ArkUIBlankModifier* (*getBlankModifier)(); const GENERATED_ArkUIButtonModifier* (*getButtonModifier)(); diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/bridge_generated.cc b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/bridge_generated.cc index e844279350d..82583d699f4 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/bridge_generated.cc +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/bridge_generated.cc @@ -908,6 +908,312 @@ void impl_AnimatorAttribute_onFrame(Ark_NativePointer thisPtr, KSerializerBuffer GetNodeModifiers()->getAnimatorModifier()->setOnFrame(self, (const Opt_Callback_Number_Void*)&value_value); } KOALA_INTEROP_DIRECT_V3(AnimatorAttribute_onFrame, Ark_NativePointer, KSerializerBuffer, int32_t) +Ark_NativePointer impl_ArcList_construct(Ark_Int32 id, Ark_Int32 flags) { + return GetNodeModifiers()->getArcListModifier()->construct(id, flags); +} +KOALA_INTEROP_DIRECT_2(ArcList_construct, Ark_NativePointer, Ark_Int32, Ark_Int32) +void impl_ArcListInterface_setArcListOptions(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto optionsValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_ArkListOptions optionsValueTempTmpBuf = {}; + optionsValueTempTmpBuf.tag = optionsValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((optionsValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + optionsValueTempTmpBuf.value = thisDeserializer.readArkListOptions(); + } + Opt_ArkListOptions optionsValueTemp = optionsValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setArcListOptions(self, static_cast(&optionsValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListInterface_setArcListOptions, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setDigitalCrownSensitivity(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_CrownSensitivity valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = static_cast(thisDeserializer.readInt32()); + } + Opt_CrownSensitivity valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setDigitalCrownSensitivity(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setDigitalCrownSensitivity, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setSpace(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_LengthMetrics valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = static_cast(thisDeserializer.readLengthMetrics()); + } + Opt_LengthMetrics valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setSpace(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setSpace, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setScrollBar(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_BarState valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = static_cast(thisDeserializer.readInt32()); + } + Opt_BarState valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setScrollBar(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setScrollBar, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setScrollBarColor(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_ColorMetrics valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = static_cast(thisDeserializer.readColorMetrics()); + } + Opt_ColorMetrics valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setScrollBarColor(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setScrollBarColor, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setScrollBarWidth(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_LengthMetrics valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = static_cast(thisDeserializer.readLengthMetrics()); + } + Opt_LengthMetrics valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setScrollBarWidth(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setScrollBarWidth, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setCachedCount(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_Number valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = static_cast(thisDeserializer.readNumber()); + } + Opt_Number valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setCachedCount(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setCachedCount, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setChainAnimation(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_Boolean valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = thisDeserializer.readBoolean(); + } + Opt_Boolean valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setChainAnimation(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setChainAnimation, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setChildrenMainSize(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_ChildrenMainSize valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = static_cast(thisDeserializer.readChildrenMainSize()); + } + Opt_ChildrenMainSize valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setChildrenMainSize(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setChildrenMainSize, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setEnableScrollInteraction(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_Boolean valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = thisDeserializer.readBoolean(); + } + Opt_Boolean valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setEnableScrollInteraction(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setEnableScrollInteraction, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setFadingEdge(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_Boolean valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = thisDeserializer.readBoolean(); + } + Opt_Boolean valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setFadingEdge(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setFadingEdge, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setFriction(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_Number valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = static_cast(thisDeserializer.readNumber()); + } + Opt_Number valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setFriction(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setFriction, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setFlingSpeedLimit(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_Number valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = static_cast(thisDeserializer.readNumber()); + } + Opt_Number valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setFlingSpeedLimit(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setFlingSpeedLimit, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setOnScrollIndex(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_ArcScrollIndexHandler valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = {thisDeserializer.readCallbackResource(), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCaller(Kind_ArcScrollIndexHandler)))), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCallerSync(Kind_ArcScrollIndexHandler))))}; + } + Opt_ArcScrollIndexHandler valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setOnScrollIndex(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setOnScrollIndex, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setOnReachStart(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_VoidCallback valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = {thisDeserializer.readCallbackResource(), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCaller(Kind_VoidCallback)))), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCallerSync(Kind_VoidCallback))))}; + } + Opt_VoidCallback valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setOnReachStart(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setOnReachStart, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setOnReachEnd(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_VoidCallback valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = {thisDeserializer.readCallbackResource(), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCaller(Kind_VoidCallback)))), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCallerSync(Kind_VoidCallback))))}; + } + Opt_VoidCallback valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setOnReachEnd(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setOnReachEnd, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setOnScrollStart(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_VoidCallback valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = {thisDeserializer.readCallbackResource(), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCaller(Kind_VoidCallback)))), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCallerSync(Kind_VoidCallback))))}; + } + Opt_VoidCallback valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setOnScrollStart(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setOnScrollStart, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setOnScrollStop(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_VoidCallback valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = {thisDeserializer.readCallbackResource(), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCaller(Kind_VoidCallback)))), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCallerSync(Kind_VoidCallback))))}; + } + Opt_VoidCallback valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setOnScrollStop(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setOnScrollStop, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setOnWillScroll(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_OnWillScrollCallback valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = {thisDeserializer.readCallbackResource(), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCaller(Kind_OnWillScrollCallback)))), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCallerSync(Kind_OnWillScrollCallback))))}; + } + Opt_OnWillScrollCallback valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setOnWillScroll(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setOnWillScroll, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListAttribute_setOnDidScroll(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_OnScrollCallback valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = {thisDeserializer.readCallbackResource(), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCaller(Kind_OnScrollCallback)))), reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCallerSync(Kind_OnScrollCallback))))}; + } + Opt_OnScrollCallback valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListModifier()->setOnDidScroll(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListAttribute_setOnDidScroll, Ark_NativePointer, KSerializerBuffer, int32_t) +Ark_NativePointer impl_ArcListItem_construct(Ark_Int32 id, Ark_Int32 flags) { + return GetNodeModifiers()->getArcListItemModifier()->construct(id, flags); +} +KOALA_INTEROP_DIRECT_2(ArcListItem_construct, Ark_NativePointer, Ark_Int32, Ark_Int32) +void impl_ArcListItemAttribute_setAutoScale(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_Boolean valueValueTempTmpBuf = {}; + valueValueTempTmpBuf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((valueValueTempTmpBuf_runtimeType) != (INTEROP_RUNTIME_UNDEFINED)) { + valueValueTempTmpBuf.value = thisDeserializer.readBoolean(); + } + Opt_Boolean valueValueTemp = valueValueTempTmpBuf;; + GetNodeModifiers()->getArcListItemModifier()->setAutoScale(self, static_cast(&valueValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcListItemAttribute_setAutoScale, Ark_NativePointer, KSerializerBuffer, int32_t) +void impl_ArcListItemAttribute_setSwipeAction(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + const auto valueValueTempTmpBuf_runtimeType = static_cast(thisDeserializer.readInt8()); + Opt_SwipeActionOptions value_value_buf = {}; + value_value_buf.tag = valueValueTempTmpBuf_runtimeType == INTEROP_RUNTIME_UNDEFINED ? INTEROP_TAG_UNDEFINED : INTEROP_TAG_OBJECT; + if ((INTEROP_RUNTIME_UNDEFINED) != (valueValueTempTmpBuf_runtimeType)) + { + value_value_buf.value = thisDeserializer.readSwipeActionOptions(); + } + Opt_SwipeActionOptions value_value = value_value_buf; + GetNodeModifiers()->getArcListItemModifier()->setSwipeAction(self, (const Opt_SwipeActionOptions*)&value_value); +} +KOALA_INTEROP_DIRECT_V3(ArcListItemAttribute_setSwipeAction, Ark_NativePointer, KSerializerBuffer, int32_t) +Ark_NativePointer impl_ArcScrollBar_construct(Ark_Int32 id, Ark_Int32 flags) { + return GetNodeModifiers()->getArcScrollBarModifier()->construct(id, flags); +} +KOALA_INTEROP_DIRECT_2(ArcScrollBar_construct, Ark_NativePointer, Ark_Int32, Ark_Int32) +void impl_ArcScrollBarInterface_setArcScrollBarOptions(Ark_NativePointer thisPtr, KSerializerBuffer thisArray, int32_t thisLength) { + Ark_NodeHandle self = reinterpret_cast(thisPtr); + Deserializer thisDeserializer(thisArray, thisLength); + Ark_ArcScrollBarOptions optionsValueTemp = thisDeserializer.readArcScrollBarOptions(); + GetNodeModifiers()->getArcScrollBarModifier()->setArcScrollBarOptions(self, static_cast(&optionsValueTemp)); +} +KOALA_INTEROP_DIRECT_V3(ArcScrollBarInterface_setArcScrollBarOptions, Ark_NativePointer, KSerializerBuffer, int32_t) Ark_NativePointer impl_Badge_construct(Ark_Int32 id, Ark_Int32 flags) { return GetNodeModifiers()->getBadgeModifier()->construct(id, flags); } diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_deserialize_call.cc b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_deserialize_call.cc index 2369296ca72..a980cc52a03 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_deserialize_call.cc +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_deserialize_call.cc @@ -58,6 +58,28 @@ void deserializeAndCallSyncAccessibilityFocusCallback(Ark_VMContext vmContext, K Ark_Boolean isFocus = thisDeserializer.readBoolean(); _callSync(vmContext, _resourceId, isFocus); } +void deserializeAndCallArcScrollIndexHandler(KSerializerBuffer thisArray, Ark_Int32 thisLength) +{ + Deserializer thisDeserializer = Deserializer(thisArray, thisLength); + const Ark_Int32 _resourceId = thisDeserializer.readInt32(); + const auto _call = reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCaller(Kind_ArcScrollIndexHandler)))); + thisDeserializer.readPointer(); + Ark_Number start = static_cast(thisDeserializer.readNumber()); + Ark_Number end = static_cast(thisDeserializer.readNumber()); + Ark_Number center = static_cast(thisDeserializer.readNumber()); + _call(_resourceId, start, end, center); +} +void deserializeAndCallSyncArcScrollIndexHandler(Ark_VMContext vmContext, KSerializerBuffer thisArray, Ark_Int32 thisLength) +{ + Deserializer thisDeserializer = Deserializer(thisArray, thisLength); + const Ark_Int32 _resourceId = thisDeserializer.readInt32(); + thisDeserializer.readPointer(); + const auto _callSync = reinterpret_cast(thisDeserializer.readPointerOrDefault(reinterpret_cast(getManagedCallbackCallerSync(Kind_ArcScrollIndexHandler)))); + Ark_Number start = static_cast(thisDeserializer.readNumber()); + Ark_Number end = static_cast(thisDeserializer.readNumber()); + Ark_Number center = static_cast(thisDeserializer.readNumber()); + _callSync(vmContext, _resourceId, start, end, center); +} void deserializeAndCallAsyncCallback_Array_TextMenuItem_Array_TextMenuItem(KSerializerBuffer thisArray, Ark_Int32 thisLength) { Deserializer thisDeserializer = Deserializer(thisArray, thisLength); @@ -7505,6 +7527,7 @@ void deserializeAndCallCallback(Ark_Int32 kind, KSerializerBuffer thisArray, Ark switch (kind) { case 589030517/*Kind_AccessibilityCallback*/: return deserializeAndCallAccessibilityCallback(thisArray, thisLength); case 1715445305/*Kind_AccessibilityFocusCallback*/: return deserializeAndCallAccessibilityFocusCallback(thisArray, thisLength); + case -274386039/*Kind_ArcScrollIndexHandler*/: return deserializeAndCallArcScrollIndexHandler(thisArray, thisLength); case 300202685/*Kind_AsyncCallback_Array_TextMenuItem_Array_TextMenuItem*/: return deserializeAndCallAsyncCallback_Array_TextMenuItem_Array_TextMenuItem(thisArray, thisLength); case 1289587365/*Kind_AsyncCallback_image_PixelMap_Void*/: return deserializeAndCallAsyncCallback_image_PixelMap_Void(thisArray, thisLength); case -1581515233/*Kind_AsyncCallback_TextMenuItem_TextRange_Boolean*/: return deserializeAndCallAsyncCallback_TextMenuItem_TextRange_Boolean(thisArray, thisLength); @@ -7830,6 +7853,7 @@ void deserializeAndCallCallbackSync(Ark_VMContext vmContext, Ark_Int32 kind, KSe switch (kind) { case 589030517/*Kind_AccessibilityCallback*/: return deserializeAndCallSyncAccessibilityCallback(vmContext, thisArray, thisLength); case 1715445305/*Kind_AccessibilityFocusCallback*/: return deserializeAndCallSyncAccessibilityFocusCallback(vmContext, thisArray, thisLength); + case -274386039/*Kind_ArcScrollIndexHandler*/: return deserializeAndCallSyncArcScrollIndexHandler(vmContext, thisArray, thisLength); case 300202685/*Kind_AsyncCallback_Array_TextMenuItem_Array_TextMenuItem*/: return deserializeAndCallSyncAsyncCallback_Array_TextMenuItem_Array_TextMenuItem(vmContext, thisArray, thisLength); case 1289587365/*Kind_AsyncCallback_image_PixelMap_Void*/: return deserializeAndCallSyncAsyncCallback_image_PixelMap_Void(vmContext, thisArray, thisLength); case -1581515233/*Kind_AsyncCallback_TextMenuItem_TextRange_Boolean*/: return deserializeAndCallSyncAsyncCallback_TextMenuItem_TextRange_Boolean(vmContext, thisArray, thisLength); diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_kind.h b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_kind.h index ce0c3f0e140..55805def060 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_kind.h +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_kind.h @@ -5,6 +5,7 @@ typedef enum CallbackKind { Kind_AccessibilityCallback = 589030517, Kind_AccessibilityFocusCallback = 1715445305, + Kind_ArcScrollIndexHandler = -274386039, Kind_AsyncCallback_Array_TextMenuItem_Array_TextMenuItem = 300202685, Kind_AsyncCallback_image_PixelMap_Void = 1289587365, Kind_AsyncCallback_TextMenuItem_TextRange_Boolean = -1581515233, diff --git a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_managed_caller.cc b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_managed_caller.cc index 6659c3d1193..1a8cc9c2760 100644 --- a/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_managed_caller.cc +++ b/frameworks/bridge/arkts_frontend/koala_projects/arkoala/framework/native/src/generated/callback_managed_caller.cc @@ -64,6 +64,30 @@ void callManagedAccessibilityFocusCallbackSync(Ark_VMContext vmContext, Ark_Int3 argsSerializer.writeBoolean(isFocus); KOALA_INTEROP_CALL_VOID(vmContext, 1, sizeof(_buffer), _buffer); } +void callManagedArcScrollIndexHandler(Ark_Int32 resourceId, Ark_Number start, Ark_Number end, Ark_Number center) +{ + CallbackBuffer _buffer = {{}, {}}; + const Ark_CallbackResource _callbackResourceSelf = {resourceId, holdManagedCallbackResource, releaseManagedCallbackResource}; + _buffer.resourceHolder.holdCallbackResource(&_callbackResourceSelf); + SerializerBase argsSerializer = SerializerBase((KSerializerBuffer)&(_buffer.buffer), sizeof(_buffer.buffer), &(_buffer.resourceHolder)); + argsSerializer.writeInt32(Kind_ArcScrollIndexHandler); + argsSerializer.writeInt32(resourceId); + argsSerializer.writeNumber(start); + argsSerializer.writeNumber(end); + argsSerializer.writeNumber(center); + enqueueCallback(&_buffer); +} +void callManagedArcScrollIndexHandlerSync(Ark_VMContext vmContext, Ark_Int32 resourceId, Ark_Number start, Ark_Number end, Ark_Number center) +{ + uint8_t _buffer[4096]; + SerializerBase argsSerializer = SerializerBase((KSerializerBuffer)&_buffer, sizeof(_buffer), nullptr); + argsSerializer.writeInt32(Kind_ArcScrollIndexHandler); + argsSerializer.writeInt32(resourceId); + argsSerializer.writeNumber(start); + argsSerializer.writeNumber(end); + argsSerializer.writeNumber(center); + KOALA_INTEROP_CALL_VOID(vmContext, 1, sizeof(_buffer), _buffer); +} void callManagedAsyncCallback_Array_TextMenuItem_Array_TextMenuItem(Ark_Int32 resourceId, Array_TextMenuItem menuItems, Callback_Array_TextMenuItem_Void continuation) { CallbackBuffer _buffer = {{}, {}}; @@ -8087,6 +8111,7 @@ Ark_NativePointer getManagedCallbackCaller(CallbackKind kind) switch (kind) { case Kind_AccessibilityCallback: return reinterpret_cast(callManagedAccessibilityCallback); case Kind_AccessibilityFocusCallback: return reinterpret_cast(callManagedAccessibilityFocusCallback); + case Kind_ArcScrollIndexHandler: return reinterpret_cast(callManagedArcScrollIndexHandler); case Kind_AsyncCallback_Array_TextMenuItem_Array_TextMenuItem: return reinterpret_cast(callManagedAsyncCallback_Array_TextMenuItem_Array_TextMenuItem); case Kind_AsyncCallback_image_PixelMap_Void: return reinterpret_cast(callManagedAsyncCallback_image_PixelMap_Void); case Kind_AsyncCallback_TextMenuItem_TextRange_Boolean: return reinterpret_cast(callManagedAsyncCallback_TextMenuItem_TextRange_Boolean); @@ -8412,6 +8437,7 @@ Ark_NativePointer getManagedCallbackCallerSync(CallbackKind kind) switch (kind) { case Kind_AccessibilityCallback: return reinterpret_cast(callManagedAccessibilityCallbackSync); case Kind_AccessibilityFocusCallback: return reinterpret_cast(callManagedAccessibilityFocusCallbackSync); + case Kind_ArcScrollIndexHandler: return reinterpret_cast(callManagedArcScrollIndexHandlerSync); case Kind_AsyncCallback_Array_TextMenuItem_Array_TextMenuItem: return reinterpret_cast(callManagedAsyncCallback_Array_TextMenuItem_Array_TextMenuItemSync); case Kind_AsyncCallback_image_PixelMap_Void: return reinterpret_cast(callManagedAsyncCallback_image_PixelMap_VoidSync); case Kind_AsyncCallback_TextMenuItem_TextRange_Boolean: return reinterpret_cast(callManagedAsyncCallback_TextMenuItem_TextRange_BooleanSync); diff --git a/frameworks/core/components_ng/pattern/list/list_item_model_static.cpp b/frameworks/core/components_ng/pattern/list/list_item_model_static.cpp index dd2f6114088..0bb6ec4a52f 100644 --- a/frameworks/core/components_ng/pattern/list/list_item_model_static.cpp +++ b/frameworks/core/components_ng/pattern/list/list_item_model_static.cpp @@ -145,4 +145,13 @@ void ListItemModelStatic::SetSwiperAction(FrameNode* frameNode, std::function& autoScale) +{ + CHECK_NULL_VOID(frameNode); + if (autoScale.has_value()) { + ACE_UPDATE_NODE_LAYOUT_PROPERTY(ArcListItemLayoutProperty, AutoScale, autoScale.value(), frameNode); + } else { + ACE_RESET_NODE_LAYOUT_PROPERTY(ArcListItemLayoutProperty, AutoScale, frameNode); + } +} } // namespace OHOS::Ace::NG \ No newline at end of file diff --git a/frameworks/core/components_ng/pattern/list/list_item_model_static.h b/frameworks/core/components_ng/pattern/list/list_item_model_static.h index 3adc9082136..4fba07b2bdf 100644 --- a/frameworks/core/components_ng/pattern/list/list_item_model_static.h +++ b/frameworks/core/components_ng/pattern/list/list_item_model_static.h @@ -39,6 +39,7 @@ public: static void SetSwiperAction(FrameNode* frameNode, std::function&& startAction, std::function&& endAction, OnOffsetChangeFunc&& onOffsetChangeFunc, const std::optional& edgeEffect); + static void SetAutoScale(FrameNode* frameNode, const std::optional& autoScale); }; } // namespace OHOS::Ace::NG #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_LIST_LIST_ITEM_MODEL_STATIC_H diff --git a/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_model_static.cpp b/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_model_static.cpp index 7914cbde232..c1b620825ca 100644 --- a/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_model_static.cpp +++ b/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_model_static.cpp @@ -13,6 +13,8 @@ * limitations under the License. */ #include "core/components_ng/pattern/scroll_bar/scroll_bar_model_static.h" + +#include "core/components_ng/pattern/arc_scroll_bar/arc_scroll_bar_pattern.h" #include "core/components_ng/pattern/scroll_bar/scroll_bar_pattern.h" namespace OHOS::Ace::NG { @@ -24,6 +26,13 @@ RefPtr ScrollBarModelStatic::CreateFrameNode(int32_t nodeId) V2::SCROLL_BAR_ETS_TAG, nodeId, []() { return AceType::MakeRefPtr(); }); } +RefPtr ScrollBarModelStatic::CreateArcScrollBarFrameNode(int32_t nodeId) +{ + ACE_LAYOUT_SCOPED_TRACE("Create[%s][self:%d]", V2::ARC_SCROLL_BAR_ETS_TAG, nodeId); + return FrameNode::GetOrCreateFrameNode( + V2::ARC_SCROLL_BAR_ETS_TAG, nodeId, []() { return AceType::MakeRefPtr(); }); +} + RefPtr ScrollBarModelStatic::SetScrollBarProxy(FrameNode* frameNode, const RefPtr& proxy) { auto scrollBarProxy = AceType::DynamicCast(proxy); diff --git a/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_model_static.h b/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_model_static.h index 2ac8261bb2a..191e69783ce 100644 --- a/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_model_static.h +++ b/frameworks/core/components_ng/pattern/scroll_bar/scroll_bar_model_static.h @@ -22,6 +22,7 @@ namespace OHOS::Ace::NG { class ACE_EXPORT ScrollBarModelStatic { public: static RefPtr CreateFrameNode(int32_t nodeId); + static RefPtr CreateArcScrollBarFrameNode(int32_t nodeId); static RefPtr SetScrollBarProxy(FrameNode* frameNode, const RefPtr& proxy); static void SetDirection(FrameNode* frameNode, const std::optional& direction); static void SetState(FrameNode* frameNode, const std::optional& state); diff --git a/frameworks/core/interfaces/native/generated/interface/arkoala_api_generated.h b/frameworks/core/interfaces/native/generated/interface/arkoala_api_generated.h index 66aa23663c8..79d8150203f 100644 --- a/frameworks/core/interfaces/native/generated/interface/arkoala_api_generated.h +++ b/frameworks/core/interfaces/native/generated/interface/arkoala_api_generated.h @@ -264,6 +264,8 @@ typedef struct AccessibilityCallback AccessibilityCallback; typedef struct Opt_AccessibilityCallback Opt_AccessibilityCallback; typedef struct AccessibilityFocusCallback AccessibilityFocusCallback; typedef struct Opt_AccessibilityFocusCallback Opt_AccessibilityFocusCallback; +typedef struct ArcScrollIndexHandler ArcScrollIndexHandler; +typedef struct Opt_ArcScrollIndexHandler Opt_ArcScrollIndexHandler; typedef struct Ark_AlphabetIndexerAttribute Ark_AlphabetIndexerAttribute; typedef struct Opt_AlphabetIndexerAttribute Opt_AlphabetIndexerAttribute; typedef struct AnimatedDrawableDescriptorPeer AnimatedDrawableDescriptorPeer; @@ -1741,6 +1743,10 @@ typedef struct Opt_AnimationRange_Number Opt_AnimationRange_Number; typedef struct AppearSymbolEffectPeer AppearSymbolEffectPeer; typedef struct AppearSymbolEffectPeer* Ark_AppearSymbolEffect; typedef struct Opt_AppearSymbolEffect Opt_AppearSymbolEffect; +typedef struct Ark_ArcScrollBarOptions Ark_ArcScrollBarOptions; +typedef struct Opt_ArcScrollBarOptions Opt_ArcScrollBarOptions; +typedef struct Ark_ArkListOptions Ark_ArkListOptions; +typedef struct Opt_ArkListOptions Opt_ArkListOptions; typedef struct Ark_ASTCResource Ark_ASTCResource; typedef struct Opt_ASTCResource Opt_ASTCResource; typedef struct Ark_AutoPlayOptions Ark_AutoPlayOptions; @@ -6899,6 +6905,16 @@ typedef struct Opt_AccessibilityFocusCallback { Ark_Tag tag; AccessibilityFocusCallback value; } Opt_AccessibilityFocusCallback; +typedef struct ArcScrollIndexHandler { + /* kind: Callback */ + Ark_CallbackResource resource; + void (*call)(const Ark_Int32 resourceId, const Ark_Number start, const Ark_Number end, const Ark_Number center); + void (*callSync)(Ark_VMContext vmContext, const Ark_Int32 resourceId, const Ark_Number start, const Ark_Number end, const Ark_Number center); +} ArcScrollIndexHandler; +typedef struct Opt_ArcScrollIndexHandler { + Ark_Tag tag; + ArcScrollIndexHandler value; +} Opt_ArcScrollIndexHandler; typedef struct Ark_AlphabetIndexerAttribute { void *handle; } Ark_AlphabetIndexerAttribute; @@ -12245,6 +12261,25 @@ typedef struct Opt_AppearSymbolEffect { Ark_Tag tag; Ark_AppearSymbolEffect value; } Opt_AppearSymbolEffect; +typedef struct Ark_ArcScrollBarOptions { + /* kind: Interface */ + Ark_Scroller scroller; + Opt_BarState state; +} Ark_ArcScrollBarOptions; +typedef struct Opt_ArcScrollBarOptions { + Ark_Tag tag; + Ark_ArcScrollBarOptions value; +} Opt_ArcScrollBarOptions; +typedef struct Ark_ArkListOptions { + /* kind: Interface */ + Opt_Number initialIndex; + Opt_Scroller scroller; + Opt_ComponentContent header; +} Ark_ArkListOptions; +typedef struct Opt_ArkListOptions { + Ark_Tag tag; + Ark_ArkListOptions value; +} Opt_ArkListOptions; typedef struct Ark_ASTCResource { Array_String sources; Ark_Number column; @@ -20289,6 +20324,67 @@ typedef struct GENERATED_ArkUIAnimatorModifier { const Opt_Callback_Number_Void* value); } GENERATED_ArkUIAnimatorModifier; +typedef struct GENERATED_ArkUIArcListItemModifier { + Ark_NativePointer (*construct)(Ark_Int32 id, + Ark_Int32 flags); + void (*setAutoScale)(Ark_NativePointer node, + const Opt_Boolean* value); + void (*setSwipeAction)(Ark_NativePointer node, + const Opt_SwipeActionOptions* value); +} GENERATED_ArkUIArcListItemModifier; + +typedef struct GENERATED_ArkUIArcListModifier { + Ark_NativePointer (*construct)(Ark_Int32 id, + Ark_Int32 flags); + void (*setArcListOptions)(Ark_NativePointer node, + const Opt_ArkListOptions* options); + void (*setDigitalCrownSensitivity)(Ark_NativePointer node, + const Opt_CrownSensitivity* value); + void (*setSpace)(Ark_NativePointer node, + const Opt_LengthMetrics* value); + void (*setScrollBar)(Ark_NativePointer node, + const Opt_BarState* value); + void (*setScrollBarColor)(Ark_NativePointer node, + const Opt_ColorMetrics* value); + void (*setScrollBarWidth)(Ark_NativePointer node, + const Opt_LengthMetrics* value); + void (*setCachedCount)(Ark_NativePointer node, + const Opt_Number* value); + void (*setChainAnimation)(Ark_NativePointer node, + const Opt_Boolean* value); + void (*setChildrenMainSize)(Ark_NativePointer node, + const Opt_ChildrenMainSize* value); + void (*setEnableScrollInteraction)(Ark_NativePointer node, + const Opt_Boolean* value); + void (*setFadingEdge)(Ark_NativePointer node, + const Opt_Boolean* value); + void (*setFriction)(Ark_NativePointer node, + const Opt_Number* value); + void (*setFlingSpeedLimit)(Ark_NativePointer node, + const Opt_Number* value); + void (*setOnScrollIndex)(Ark_NativePointer node, + const Opt_ArcScrollIndexHandler* value); + void (*setOnReachStart)(Ark_NativePointer node, + const Opt_VoidCallback* value); + void (*setOnReachEnd)(Ark_NativePointer node, + const Opt_VoidCallback* value); + void (*setOnScrollStart)(Ark_NativePointer node, + const Opt_VoidCallback* value); + void (*setOnScrollStop)(Ark_NativePointer node, + const Opt_VoidCallback* value); + void (*setOnWillScroll)(Ark_NativePointer node, + const Opt_OnWillScrollCallback* value); + void (*setOnDidScroll)(Ark_NativePointer node, + const Opt_OnScrollCallback* value); +} GENERATED_ArkUIArcListModifier; + +typedef struct GENERATED_ArkUIArcScrollBarModifier { + Ark_NativePointer (*construct)(Ark_Int32 id, + Ark_Int32 flags); + void (*setArcScrollBarOptions)(Ark_NativePointer node, + const Ark_ArcScrollBarOptions* options); +} GENERATED_ArkUIArcScrollBarModifier; + typedef struct GENERATED_ArkUIBadgeModifier { Ark_NativePointer (*construct)(Ark_Int32 id, Ark_Int32 flags); @@ -28341,6 +28437,9 @@ typedef struct GENERATED_ArkUINodeModifiers { const GENERATED_ArkUIAbilityComponentModifier* (*getAbilityComponentModifier)(); const GENERATED_ArkUIAlphabetIndexerModifier* (*getAlphabetIndexerModifier)(); const GENERATED_ArkUIAnimatorModifier* (*getAnimatorModifier)(); + const GENERATED_ArkUIArcListItemModifier* (*getArcListItemModifier)(); + const GENERATED_ArkUIArcListModifier* (*getArcListModifier)(); + const GENERATED_ArkUIArcScrollBarModifier* (*getArcScrollBarModifier)(); const GENERATED_ArkUIBadgeModifier* (*getBadgeModifier)(); const GENERATED_ArkUIBlankModifier* (*getBlankModifier)(); const GENERATED_ArkUIButtonModifier* (*getButtonModifier)(); diff --git a/frameworks/core/interfaces/native/generated/interface/node_interface.gni b/frameworks/core/interfaces/native/generated/interface/node_interface.gni index c0027879ba9..cc9f46ba4ef 100644 --- a/frameworks/core/interfaces/native/generated/interface/node_interface.gni +++ b/frameworks/core/interfaces/native/generated/interface/node_interface.gni @@ -29,6 +29,9 @@ generated_sources = [ "implementation/animator_modifier.cpp", "implementation/appear_symbol_effect_accessor.cpp", "implementation/arc_alphabet_indexer_extender_accessor.cpp", + "implementation/arc_list_item_modifier.cpp", + "implementation/arc_list_modifier.cpp", + "implementation/arc_scroll_bar_modifier.cpp", "implementation/axis_event_accessor.cpp", "implementation/background_color_style_accessor.cpp", "implementation/badge_modifier.cpp", diff --git a/frameworks/core/interfaces/native/implementation/all_modifiers.cpp b/frameworks/core/interfaces/native/implementation/all_modifiers.cpp index 7758b6ea912..ba512c536c6 100644 --- a/frameworks/core/interfaces/native/implementation/all_modifiers.cpp +++ b/frameworks/core/interfaces/native/implementation/all_modifiers.cpp @@ -91,6 +91,9 @@ const GENERATED_ArkUIComponentRootModifier* GetComponentRootModifier(); const GENERATED_ArkUIAbilityComponentModifier* GetAbilityComponentModifier(); const GENERATED_ArkUIAlphabetIndexerModifier* GetAlphabetIndexerModifier(); const GENERATED_ArkUIAnimatorModifier* GetAnimatorModifier(); +const GENERATED_ArkUIArcListItemModifier* GetArcListItemModifier(); +const GENERATED_ArkUIArcListModifier* GetArcListModifier(); +const GENERATED_ArkUIArcScrollBarModifier* GetArcScrollBarModifier(); const GENERATED_ArkUIBadgeModifier* GetBadgeModifier(); const GENERATED_ArkUIBlankModifier* GetBlankModifier(); const GENERATED_ArkUIButtonModifier* GetButtonModifier(); @@ -456,6 +459,9 @@ const GENERATED_ArkUINodeModifiers* GENERATED_GetArkUINodeModifiers() GetAbilityComponentModifier, GetAlphabetIndexerModifier, GetAnimatorModifier, + GetArcListItemModifier, + GetArcListModifier, + GetArcScrollBarModifier, GetBadgeModifier, GetBlankModifier, GetButtonModifier, diff --git a/frameworks/core/interfaces/native/implementation/arc_list_item_modifier.cpp b/frameworks/core/interfaces/native/implementation/arc_list_item_modifier.cpp new file mode 100644 index 00000000000..4d5d2fb24c2 --- /dev/null +++ b/frameworks/core/interfaces/native/implementation/arc_list_item_modifier.cpp @@ -0,0 +1,159 @@ +/* + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "core/components_ng/base/frame_node.h" +#include "core/components_ng/pattern/list/list_item_model_ng.h" +#include "core/components_ng/pattern/list/list_item_model_static.h" +#include "core/interfaces/native/utility/callback_helper.h" +#include "core/interfaces/native/utility/converter.h" +#include "core/interfaces/native/utility/reverse_converter.h" +#include "core/interfaces/native/generated/interface/ui_node_api.h" +#include "core/components_v2/list/list_properties.h" + +namespace OHOS::Ace::NG { +namespace { +void AssignVoidCallback(std::function& dst, const Opt_Callback_Void& src) +{ + auto arkCallback = Converter::OptConvert(src); + if (arkCallback) { + dst = [callback = CallbackHelper(arkCallback.value())]() { + callback.Invoke(); + }; + } +} + +void AssignOnStateChangedEventCallback(OnStateChangedEvent& dst, const Opt_Callback_SwipeActionState_Void& src) +{ + auto arkCallback = Converter::OptConvert(src); + if (arkCallback) { + dst = [callback = CallbackHelper(arkCallback.value())](SwipeActionState state) { + auto arkState = Converter::ArkValue(state); + callback.Invoke(arkState); + }; + } +} + +void SetDeleteArea(const Opt_Union_CustomBuilder_SwipeActionItem& arg, bool isStartArea, FrameNode* frameNode, + Ark_NativePointer node) +{ + CHECK_NULL_VOID(frameNode); + + Converter::VisitUnion(arg, + [isStartArea, frameNode, node](const CustomNodeBuilder& value) { + CallbackHelper(value).BuildAsync([isStartArea, frameNode](const RefPtr& uiNode) { + CHECK_NULL_VOID(uiNode); + ListItemModelStatic::SetDeleteArea( + frameNode, Referenced::RawPtr(uiNode), nullptr, nullptr, nullptr, nullptr, + Dimension(0, DimensionUnit::VP), isStartArea); + }, node); + }, + [isStartArea, frameNode, node](const Ark_SwipeActionItem& value) { + auto length = Converter::OptConvert(value.actionAreaDistance); + auto builder = Converter::OptConvert(value.builder); + OnDeleteEvent onActionCallback; + AssignVoidCallback(onActionCallback, value.onAction); + + OnEnterDeleteAreaEvent onEnterActionAreaCallback; + AssignVoidCallback(onEnterActionAreaCallback, value.onEnterActionArea); + + OnExitDeleteAreaEvent onExitActionAreaCallback; + AssignVoidCallback(onExitActionAreaCallback, value.onExitActionArea); + + OnStateChangedEvent onStateChangeCallback; + AssignOnStateChangedEventCallback(onStateChangeCallback, value.onStateChange); + if (builder.has_value()) { + CallbackHelper(builder.value()).BuildAsync([ + frameNode, length, isStartArea, + onAction = std::move(onActionCallback), + onEnterActionArea = std::move(onEnterActionAreaCallback), + onExitActionArea = std::move(onExitActionAreaCallback), + onStateChange = std::move(onStateChangeCallback) + ](const RefPtr& uiNode) mutable { + ListItemModelStatic::SetDeleteArea(frameNode, Referenced::RawPtr(uiNode), std::move(onAction), + std::move(onEnterActionArea), std::move(onExitActionArea), std::move(onStateChange), + length, isStartArea); + }, node); + } else { + ListItemModelStatic::SetDeleteArea(frameNode, nullptr, std::move(onActionCallback), + std::move(onEnterActionAreaCallback), std::move(onExitActionAreaCallback), + std::move(onStateChangeCallback), length, isStartArea); + } + }, + []() {} + ); +} +} // namespace +} // namespace OHOS::Ace::NG + +namespace OHOS::Ace::NG::GeneratedModifier { +namespace ArcListItemModifier { +Ark_NativePointer ConstructImpl(Ark_Int32 id, + Ark_Int32 flags) +{ + auto frameNode = ListItemModelStatic::CreateFrameNode(id, true); + CHECK_NULL_RETURN(frameNode, nullptr); + frameNode->IncRefCount(); + return AceType::RawPtr(frameNode); +} +} // ArcListItemModifier +namespace ArcListItemAttributeModifier { +void AutoScaleImpl(Ark_NativePointer node, + const Opt_Boolean* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto convValue = Converter::OptConvert(*value); + ListItemModelStatic::SetAutoScale(frameNode, *convValue); +} + +void SwipeActionImpl(Ark_NativePointer node, + const Opt_SwipeActionOptions* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto optValue = Converter::GetOptPtr(value); + if (!optValue) { + // TODO: Reset value + return; + } + + SetDeleteArea(optValue->start, true, frameNode, node); + SetDeleteArea(optValue->end, false, frameNode, node); + + using OnOffsetChangeType = std::function; + OnOffsetChangeType onOffsetChangeCallback; + auto arkOnOffsetChange = Converter::OptConvert(optValue->onOffsetChange); + if (arkOnOffsetChange) { + onOffsetChangeCallback = [arkCallback = CallbackHelper(*arkOnOffsetChange)](int32_t offset) { + auto arkOffset = Converter::ArkValue(offset); + arkCallback.Invoke(arkOffset); + }; + } + + auto edgeEffect = Converter::OptConvert(optValue->edgeEffect); + ListItemModelStatic::SetSwiperAction(frameNode, nullptr, nullptr, + std::move(onOffsetChangeCallback), edgeEffect); +} +} // ArcListItemAttributeModifier +const GENERATED_ArkUIArcListItemModifier* GetArcListItemModifier() +{ + static const GENERATED_ArkUIArcListItemModifier ArkUIArcListItemModifierImpl { + ArcListItemModifier::ConstructImpl, + ArcListItemAttributeModifier::AutoScaleImpl, + ArcListItemAttributeModifier::SwipeActionImpl, + }; + return &ArkUIArcListItemModifierImpl; +} +} diff --git a/frameworks/core/interfaces/native/implementation/arc_list_modifier.cpp b/frameworks/core/interfaces/native/implementation/arc_list_modifier.cpp new file mode 100644 index 00000000000..8b057277d5e --- /dev/null +++ b/frameworks/core/interfaces/native/implementation/arc_list_modifier.cpp @@ -0,0 +1,367 @@ +/* + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "children_main_size_peer.h" +#include "color_metrics_peer.h" +#include "list_scroller_peer_impl.h" + +#include "base/geometry/axis.h" +#include "core/common/container.h" +#include "core/components_ng/base/frame_node.h" +#include "core/components_ng/pattern/list/list_model_ng.h" +#include "core/components_ng/pattern/list/list_model_static.h" +#include "core/components_ng/pattern/scroll_bar/proxy/scroll_bar_proxy.h" +#include "core/interfaces/native/generated/interface/ui_node_api.h" +#include "core/interfaces/native/utility/callback_helper.h" +#include "core/interfaces/native/utility/converter.h" +#include "core/interfaces/native/utility/reverse_converter.h" +#include "core/interfaces/native/utility/validators.h" +#include "frameworks/core/components/list/list_theme.h" +#include "frameworks/core/components_ng/pattern/scrollable/scrollable_model_static.h" +#include "frameworks/core/components_ng/pattern/scrollable/scrollable_properties.h" +#include "frameworks/core/components_v2/list/list_properties.h" +namespace OHOS::Ace::NG::Converter { + struct ArkListOptions { + std::optional initialIndex; + std::optional scroller; + }; + + template<> + ArkListOptions Convert(const Ark_ArkListOptions& src) + { + return { + .initialIndex = OptConvert(src.initialIndex), + .scroller = OptConvert(src.scroller) + }; + } +} + +namespace OHOS::Ace::NG::GeneratedModifier { +namespace ArcListModifier { +Ark_NativePointer ConstructImpl(Ark_Int32 id, + Ark_Int32 flags) +{ + auto frameNode = ListModelStatic::CreateFrameNode(id, true); + CHECK_NULL_RETURN(frameNode, nullptr); + frameNode->IncRefCount(); + return AceType::RawPtr(frameNode); +} +} // ArcListModifier +namespace ArcListInterfaceModifier { +void SetArcListOptionsImpl(Ark_NativePointer node, + const Opt_ArkListOptions* options) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + CHECK_NULL_VOID(options); + + auto optionsOpt = Converter::OptConvert(*options); + if (!optionsOpt.has_value()) { + return; + } + + auto initialIndex = optionsOpt.value().initialIndex; + ListModelStatic::SetInitialIndex(frameNode, initialIndex); + + RefPtr positionController = ListModelStatic::GetOrCreateController(frameNode); + RefPtr scrollBarProxy = ListModelStatic::GetOrCreateScrollBarProxy(frameNode); + auto abstPeerPtrOpt = optionsOpt.value().scroller; + CHECK_NULL_VOID(abstPeerPtrOpt); + auto peerImplPtr = *abstPeerPtrOpt; + CHECK_NULL_VOID(peerImplPtr); + peerImplPtr->SetController(positionController); + peerImplPtr->SetScrollBarProxy(scrollBarProxy); +} +} // ArcListInterfaceModifier +namespace ArcListAttributeModifier { +void DigitalCrownSensitivityImpl(Ark_NativePointer node, + const Opt_CrownSensitivity* value) +{ +#ifdef SUPPORT_DIGITAL_CROWN + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto convValue = value ? Converter::OptConvert(*value) : std::nullopt; + ScrollableModelStatic::SetDigitalCrownSensitivity(frameNode, convValue); +#endif +} +void SpaceImpl(Ark_NativePointer node, + const Opt_LengthMetrics* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto space = Converter::OptConvert(*value); + ListModelStatic::SetListSpace(frameNode, space); +} +void ScrollBarImpl(Ark_NativePointer node, + const Opt_BarState* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + std::optional mode = Converter::OptConvert(*value); + ListModelStatic::SetListScrollBar(frameNode, EnumToInt(mode)); +} +void ScrollBarColorImpl(Ark_NativePointer node, + const Opt_ColorMetrics* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + std::optional barColor = std::nullopt; + auto optValue = Converter::GetOptPtr(value); + if (optValue) { + auto peer = *optValue; + barColor = Color(peer->colorValue.value); + } + ScrollableModelStatic::SetScrollBarColor(frameNode, barColor); +} +void ScrollBarWidthImpl(Ark_NativePointer node, + const Opt_LengthMetrics* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto convValue = Converter::OptConvert(*value); + Validator::ValidateNonNegative(convValue); + Validator::ValidateNonPercent(convValue); + ScrollableModelStatic::SetScrollBarWidth(frameNode, convValue); +} +void CachedCountImpl(Ark_NativePointer node, + const Opt_Number* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto convValue = Converter::OptConvert(*value); + if (!convValue) { + // TODO: Reset value + return; + } + ListModelStatic::SetCachedCount(frameNode, *convValue); +} +void ChainAnimationImpl(Ark_NativePointer node, + const Opt_Boolean* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto convValue = Converter::OptConvert(*value); + if (!convValue) { + // TODO: Reset value + return; + } + ListModelStatic::SetChainAnimation(frameNode, *convValue); +} +void ChildrenMainSizeImpl(Ark_NativePointer node, + const Opt_ChildrenMainSize* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto optValue = Converter::GetOptPtr(value); + if (!optValue) { + // TODO: Reset value + return; + } + auto peer = *optValue; + CHECK_NULL_VOID(peer); + RefPtr handler = ListModelStatic::GetOrCreateListChildrenMainSize(frameNode); + peer->SetHandler(handler); +} +void EnableScrollInteractionImpl(Ark_NativePointer node, + const Opt_Boolean* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto convValue = Converter::OptConvert(*value); + if (!convValue) { + // TODO: Reset value + return; + } + ListModelStatic::SetScrollEnabled(frameNode, *convValue); +} +void FadingEdgeImpl(Ark_NativePointer node, + const Opt_Boolean* enabled) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + + std::optional fadingEdge; + if (enabled) { + fadingEdge = Converter::OptConvert(*enabled); + } + + std::optional fadingEdgeLength; + ScrollableModelStatic::SetFadingEdge(frameNode, fadingEdge, fadingEdgeLength); +} +void FrictionImpl(Ark_NativePointer node, + const Opt_Number* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + ListModelStatic::SetListFriction(frameNode, Converter::OptConvert(*value)); +} +void FlingSpeedLimitImpl(Ark_NativePointer node, + const Opt_Number* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); +} +void OnScrollIndexImpl(Ark_NativePointer node, + const Opt_ArcScrollIndexHandler* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto optValue = Converter::GetOptPtr(value); + if (!optValue) { + // TODO: Reset value + return; + } + auto onScrollIndex = [arkCallback = CallbackHelper(*optValue)] + (const int32_t start, const int32_t end, const int32_t center) { + auto arkStart = Converter::ArkValue(start); + auto arkEnd = Converter::ArkValue(end); + auto arkCenter = Converter::ArkValue(center); + arkCallback.Invoke(arkStart, arkEnd, arkCenter); + }; + ListModelStatic::SetOnScrollIndex(frameNode, std::move(onScrollIndex)); +} +void OnReachStartImpl(Ark_NativePointer node, + const Opt_VoidCallback* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto optValue = Converter::GetOptPtr(value); + if (!optValue) { + // TODO: Reset value + return; + } + auto onReachStart = [arkCallback = CallbackHelper(*optValue)]() { + arkCallback.Invoke(); + }; + ListModelStatic::SetOnReachStart(frameNode, std::move(onReachStart)); +} +void OnReachEndImpl(Ark_NativePointer node, + const Opt_VoidCallback* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto optValue = Converter::GetOptPtr(value); + if (!optValue) { + // TODO: Reset value + return; + } + auto onReachEnd = [arkCallback = CallbackHelper(*optValue)]() { + arkCallback.Invoke(); + }; + ListModelStatic::SetOnReachEnd(frameNode, std::move(onReachEnd)); +} +void OnScrollStartImpl(Ark_NativePointer node, + const Opt_VoidCallback* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto optValue = Converter::GetOptPtr(value); + if (!optValue) { + // TODO: Reset value + return; + } + auto onScrollStart = [arkCallback = CallbackHelper(*optValue)]() { + arkCallback.Invoke(); + }; + ListModelStatic::SetOnScrollStart(frameNode, std::move(onScrollStart)); +} +void OnScrollStopImpl(Ark_NativePointer node, + const Opt_VoidCallback* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + auto optValue = Converter::GetOptPtr(value); + if (!optValue) { + // TODO: Reset value + return; + } + auto onScrollStop = [arkCallback = CallbackHelper(*optValue)]() { + arkCallback.Invoke(); + }; + ListModelStatic::SetOnScrollStop(frameNode, std::move(onScrollStop)); +} +void OnWillScrollImpl(Ark_NativePointer node, + const Opt_OnWillScrollCallback* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + std::optional arkCallback; + if (value) { + arkCallback = Converter::OptConvert(*value); + } + if (arkCallback) { + auto modelCallback = [callback = CallbackHelper(arkCallback.value())] + (const Dimension& scrollOffset, const ScrollState& scrollState, const ScrollSource& scrollSource) -> + ScrollFrameResult { + auto arkScrollOffset = Converter::ArkValue(scrollOffset); + auto arkScrollState = Converter::ArkValue(scrollState); + auto arkScrollSource = Converter::ArkValue(scrollSource); + auto resultOpt = + callback.InvokeWithOptConvertResult( + arkScrollOffset, arkScrollState, arkScrollSource); + return resultOpt.value_or(ScrollFrameResult()); + }; + ScrollableModelStatic::SetOnWillScroll(frameNode, std::move(modelCallback)); + } else { + ScrollableModelStatic::SetOnWillScroll(frameNode, nullptr); + } +} +void OnDidScrollImpl(Ark_NativePointer node, + const Opt_OnScrollCallback* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + CHECK_NULL_VOID(value); + auto callValue = Converter::OptConvert(*value); + if (!callValue.has_value()) { + return; + } + auto onDidScroll = [arkCallback = CallbackHelper(callValue.value())]( + Dimension oIn, ScrollState stateIn) { + auto state = Converter::ArkValue(stateIn); + auto scrollOffset = Converter::ArkValue(oIn); + arkCallback.Invoke(scrollOffset, state); + }; + ScrollableModelStatic::SetOnDidScroll(frameNode, std::move(onDidScroll)); +} +} // ArcListAttributeModifier +const GENERATED_ArkUIArcListModifier* GetArcListModifier() +{ + static const GENERATED_ArkUIArcListModifier ArkUIArcListModifierImpl { + ArcListModifier::ConstructImpl, + ArcListInterfaceModifier::SetArcListOptionsImpl, + ArcListAttributeModifier::DigitalCrownSensitivityImpl, + ArcListAttributeModifier::SpaceImpl, + ArcListAttributeModifier::ScrollBarImpl, + ArcListAttributeModifier::ScrollBarColorImpl, + ArcListAttributeModifier::ScrollBarWidthImpl, + ArcListAttributeModifier::CachedCountImpl, + ArcListAttributeModifier::ChainAnimationImpl, + ArcListAttributeModifier::ChildrenMainSizeImpl, + ArcListAttributeModifier::EnableScrollInteractionImpl, + ArcListAttributeModifier::FadingEdgeImpl, + ArcListAttributeModifier::FrictionImpl, + ArcListAttributeModifier::FlingSpeedLimitImpl, + ArcListAttributeModifier::OnScrollIndexImpl, + ArcListAttributeModifier::OnReachStartImpl, + ArcListAttributeModifier::OnReachEndImpl, + ArcListAttributeModifier::OnScrollStartImpl, + ArcListAttributeModifier::OnScrollStopImpl, + ArcListAttributeModifier::OnWillScrollImpl, + ArcListAttributeModifier::OnDidScrollImpl, + }; + return &ArkUIArcListModifierImpl; +} +} diff --git a/frameworks/core/interfaces/native/implementation/arc_scroll_bar_modifier.cpp b/frameworks/core/interfaces/native/implementation/arc_scroll_bar_modifier.cpp new file mode 100644 index 00000000000..bd5f5c63cff --- /dev/null +++ b/frameworks/core/interfaces/native/implementation/arc_scroll_bar_modifier.cpp @@ -0,0 +1,56 @@ +/* + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#include "core/components_ng/base/frame_node.h" +#include "core/interfaces/native/utility/converter.h" +#include "core/components_ng/pattern/scroll_bar/scroll_bar_model_static.h" +#include "core/interfaces/native/implementation/scroller_peer_impl.h" + +namespace OHOS::Ace::NG::GeneratedModifier { +namespace ArcScrollBarModifier { +Ark_NativePointer ConstructImpl(Ark_Int32 id, + Ark_Int32 flags) +{ + auto frameNode = ScrollBarModelStatic::CreateArcScrollBarFrameNode(id); + CHECK_NULL_RETURN(frameNode, nullptr); + frameNode->IncRefCount(); + return AceType::RawPtr(frameNode); +} +} // ArcScrollBarModifier +namespace ArcScrollBarInterfaceModifier { +void SetArcScrollBarOptionsImpl(Ark_NativePointer node, + const Ark_ArcScrollBarOptions* value) +{ + auto frameNode = reinterpret_cast(node); + CHECK_NULL_VOID(frameNode); + if (value) { + auto scrollerPeer = value->scroller; + auto scrollProxy = ScrollBarModelStatic::SetScrollBarProxy(frameNode, scrollerPeer->GetScrollBarProxy()); + scrollerPeer->SetScrollBarProxy(scrollProxy); + } + const auto state = value ? Converter::OptConvert(value->state) : std::nullopt; + ScrollBarModelStatic::SetState(frameNode, state); +} +} // ArcScrollBarInterfaceModifier +const GENERATED_ArkUIArcScrollBarModifier* GetArcScrollBarModifier() +{ + static const GENERATED_ArkUIArcScrollBarModifier ArkUIArcScrollBarModifierImpl { + ArcScrollBarModifier::ConstructImpl, + ArcScrollBarInterfaceModifier::SetArcScrollBarOptionsImpl, + }; + return &ArkUIArcScrollBarModifierImpl; +} + +} -- Gitee