123b3eb3cSopenharmony_ci/*
223b3eb3cSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License.
523b3eb3cSopenharmony_ci * You may obtain a copy of the License at
623b3eb3cSopenharmony_ci *
723b3eb3cSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
823b3eb3cSopenharmony_ci *
923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and
1323b3eb3cSopenharmony_ci * limitations under the License.
1423b3eb3cSopenharmony_ci */
1523b3eb3cSopenharmony_ci
1623b3eb3cSopenharmony_ci#ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_INTERFACES_NATIVE_NODE_NODE_EXTENED_H
1723b3eb3cSopenharmony_ci#define FOUNDATION_ACE_FRAMEWORKS_CORE_INTERFACES_NATIVE_NODE_NODE_EXTENED_H
1823b3eb3cSopenharmony_ci
1923b3eb3cSopenharmony_ci#include "drawable_descriptor.h"
2023b3eb3cSopenharmony_ci#include "native_node.h"
2123b3eb3cSopenharmony_ci#include "native_type.h"
2223b3eb3cSopenharmony_ci#include "resource.h"
2323b3eb3cSopenharmony_ci
2423b3eb3cSopenharmony_ci#include "frameworks/core/interfaces/arkoala/arkoala_api.h"
2523b3eb3cSopenharmony_ci#include "interfaces/inner_api/drawable_descriptor/drawable_descriptor.h"
2623b3eb3cSopenharmony_ci#include "pixelmap_native_impl.h"
2723b3eb3cSopenharmony_ci
2823b3eb3cSopenharmony_ci
2923b3eb3cSopenharmony_ci#ifdef __cplusplus
3023b3eb3cSopenharmony_ciextern "C" {
3123b3eb3cSopenharmony_ci#endif
3223b3eb3cSopenharmony_cistruct ArkUI_LayoutConstraint {
3323b3eb3cSopenharmony_ci    /** 元素最小宽度。 */
3423b3eb3cSopenharmony_ci    int32_t minWidth;
3523b3eb3cSopenharmony_ci    /** 元素最小高度。 */
3623b3eb3cSopenharmony_ci    int32_t minHeight;
3723b3eb3cSopenharmony_ci    /** 元素最大宽度。 */
3823b3eb3cSopenharmony_ci    int32_t maxWidth;
3923b3eb3cSopenharmony_ci    /** 元素最小宽度。 */
4023b3eb3cSopenharmony_ci    int32_t maxHeight;
4123b3eb3cSopenharmony_ci    /** 元素宽度百分比基准。 */
4223b3eb3cSopenharmony_ci    int32_t percentReferWidth;
4323b3eb3cSopenharmony_ci    /** 元素高度百分比基准。*/
4423b3eb3cSopenharmony_ci    int32_t percentReferHeight;
4523b3eb3cSopenharmony_ci};
4623b3eb3cSopenharmony_ci
4723b3eb3cSopenharmony_ci/**
4823b3eb3cSopenharmony_ci * @brief 定义自定义组件回调事件的参数类型。
4923b3eb3cSopenharmony_ci *
5023b3eb3cSopenharmony_ci * @since 12
5123b3eb3cSopenharmony_ci */
5223b3eb3cSopenharmony_cistruct ArkUI_CustomNodeAsyncEvent {
5323b3eb3cSopenharmony_ci    /** 数据数组对象。*/
5423b3eb3cSopenharmony_ci    ArkUI_NumberValue data[MAX_COMPONENT_EVENT_ARG_NUM];
5523b3eb3cSopenharmony_ci};
5623b3eb3cSopenharmony_ci
5723b3eb3cSopenharmony_ci/**
5823b3eb3cSopenharmony_ci * 定义组件绘制上下文类型结构。
5923b3eb3cSopenharmony_ci *
6023b3eb3cSopenharmony_ci * @since 12
6123b3eb3cSopenharmony_ci */
6223b3eb3cSopenharmony_cistruct ArkUI_DrawContext {
6323b3eb3cSopenharmony_ci    /** 画布宽度。*/
6423b3eb3cSopenharmony_ci    int32_t width;
6523b3eb3cSopenharmony_ci    /** 画布高度。*/
6623b3eb3cSopenharmony_ci    int32_t height;
6723b3eb3cSopenharmony_ci    /** 绘制的画布。*/
6823b3eb3cSopenharmony_ci    void* canvas;
6923b3eb3cSopenharmony_ci};
7023b3eb3cSopenharmony_ci
7123b3eb3cSopenharmony_ci/**
7223b3eb3cSopenharmony_ci * @brief 定义自定义组件事件的通用结构类型。
7323b3eb3cSopenharmony_ci *
7423b3eb3cSopenharmony_ci * @since 12
7523b3eb3cSopenharmony_ci */
7623b3eb3cSopenharmony_cistruct ArkUI_NodeCustomEvent {
7723b3eb3cSopenharmony_ci    int32_t targetId;
7823b3eb3cSopenharmony_ci    ArkUI_NodeHandle node;
7923b3eb3cSopenharmony_ci    ArkUICustomNodeEvent* event;
8023b3eb3cSopenharmony_ci    ArkUI_LayoutConstraint constraint;
8123b3eb3cSopenharmony_ci    void* userData;
8223b3eb3cSopenharmony_ci};
8323b3eb3cSopenharmony_ci
8423b3eb3cSopenharmony_cistruct ArkUI_OptionalFloat {
8523b3eb3cSopenharmony_ci    int32_t isSet;
8623b3eb3cSopenharmony_ci    float value;
8723b3eb3cSopenharmony_ci};
8823b3eb3cSopenharmony_ci
8923b3eb3cSopenharmony_cistruct ArkUI_OptionalInt {
9023b3eb3cSopenharmony_ci    int32_t isSet;
9123b3eb3cSopenharmony_ci    int32_t value;
9223b3eb3cSopenharmony_ci};
9323b3eb3cSopenharmony_ci
9423b3eb3cSopenharmony_cistruct ArkUI_OptionalUint {
9523b3eb3cSopenharmony_ci    int32_t isSet;
9623b3eb3cSopenharmony_ci    uint32_t value;
9723b3eb3cSopenharmony_ci};
9823b3eb3cSopenharmony_ci
9923b3eb3cSopenharmony_cistruct ArkUI_OptionalCharPtr {
10023b3eb3cSopenharmony_ci    int32_t isSet;
10123b3eb3cSopenharmony_ci    const char* value;
10223b3eb3cSopenharmony_ci};
10323b3eb3cSopenharmony_ci
10423b3eb3cSopenharmony_cistruct ArkUI_SwiperIndicator {
10523b3eb3cSopenharmony_ci    ArkUI_SwiperIndicatorType type;
10623b3eb3cSopenharmony_ci    ArkUI_OptionalFloat dimLeft;
10723b3eb3cSopenharmony_ci    ArkUI_OptionalFloat dimTop;
10823b3eb3cSopenharmony_ci    ArkUI_OptionalFloat dimRight;
10923b3eb3cSopenharmony_ci    ArkUI_OptionalFloat dimBottom;
11023b3eb3cSopenharmony_ci    ArkUI_OptionalFloat itemWidth;
11123b3eb3cSopenharmony_ci    ArkUI_OptionalFloat itemHeight;
11223b3eb3cSopenharmony_ci    ArkUI_OptionalFloat selectedItemWidth;
11323b3eb3cSopenharmony_ci    ArkUI_OptionalFloat selectedItemHeight;
11423b3eb3cSopenharmony_ci    ArkUI_OptionalInt maskValue;
11523b3eb3cSopenharmony_ci    ArkUI_OptionalUint colorValue;
11623b3eb3cSopenharmony_ci    ArkUI_OptionalUint selectedColorValue;
11723b3eb3cSopenharmony_ci    ArkUI_OptionalInt maxDisplayCount;
11823b3eb3cSopenharmony_ci};
11923b3eb3cSopenharmony_ci
12023b3eb3cSopenharmony_cistruct ArkUI_DrawableDescriptor {
12123b3eb3cSopenharmony_ci    OH_PixelmapNativeHandle pixelMap;
12223b3eb3cSopenharmony_ci    OH_PixelmapNativeHandle* pixelMapArray;
12323b3eb3cSopenharmony_ci    ArkUI_Int32 size;
12423b3eb3cSopenharmony_ci    std::shared_ptr<OHOS::Ace::Napi::DrawableDescriptor> drawableDescriptor;
12523b3eb3cSopenharmony_ci    std::shared_ptr<OHOS::Ace::Napi::AnimatedDrawableDescriptor> animatedDrawableDescriptor;
12623b3eb3cSopenharmony_ci    std::shared_ptr<OHOS::Ace::Napi::LayeredDrawableDescriptor> layeredDrawableDescriptor;
12723b3eb3cSopenharmony_ci    std::shared_ptr<ArkUI_Resource> resource;
12823b3eb3cSopenharmony_ci};
12923b3eb3cSopenharmony_ci
13023b3eb3cSopenharmony_cistruct ArkUI_AccessibilityState {
13123b3eb3cSopenharmony_ci    ArkUI_OptionalInt isDisabled;
13223b3eb3cSopenharmony_ci    ArkUI_OptionalInt isSelected;
13323b3eb3cSopenharmony_ci    ArkUI_OptionalInt checkedType;
13423b3eb3cSopenharmony_ci};
13523b3eb3cSopenharmony_ci
13623b3eb3cSopenharmony_cistruct ArkUI_AccessibilityValue {
13723b3eb3cSopenharmony_ci    ArkUI_OptionalInt min;
13823b3eb3cSopenharmony_ci    ArkUI_OptionalInt max;
13923b3eb3cSopenharmony_ci    ArkUI_OptionalInt current;
14023b3eb3cSopenharmony_ci    ArkUI_OptionalCharPtr text;
14123b3eb3cSopenharmony_ci};
14223b3eb3cSopenharmony_ci
14323b3eb3cSopenharmony_cistruct ArkUI_CustomSpanMeasureInfo {
14423b3eb3cSopenharmony_ci    float fontSize;
14523b3eb3cSopenharmony_ci};
14623b3eb3cSopenharmony_ci
14723b3eb3cSopenharmony_cistruct ArkUI_CustomSpanMetrics {
14823b3eb3cSopenharmony_ci    float width;
14923b3eb3cSopenharmony_ci    float height;
15023b3eb3cSopenharmony_ci};
15123b3eb3cSopenharmony_ci
15223b3eb3cSopenharmony_cistruct ArkUI_CustomSpanDrawInfo {
15323b3eb3cSopenharmony_ci    float optionsX;
15423b3eb3cSopenharmony_ci    float optionsLineTop;
15523b3eb3cSopenharmony_ci    float optionsLineBottom;
15623b3eb3cSopenharmony_ci    float optionsBaseLine;
15723b3eb3cSopenharmony_ci};
15823b3eb3cSopenharmony_ci
15923b3eb3cSopenharmony_ci#ifdef __cplusplus
16023b3eb3cSopenharmony_ci};
16123b3eb3cSopenharmony_ci#endif
16223b3eb3cSopenharmony_ci
16323b3eb3cSopenharmony_cinamespace OHOS::Ace::NodeModel {
16423b3eb3cSopenharmony_ci
16523b3eb3cSopenharmony_civoid NodeAddExtraData(ArkUI_NodeHandle node, ArkUI_NodeCustomEventType eventType, int32_t targetId, void* userData);
16623b3eb3cSopenharmony_ciint32_t RegisterNodeCustomEvent(
16723b3eb3cSopenharmony_ci    ArkUI_NodeHandle node, ArkUI_NodeCustomEventType eventType, int32_t targetId, void* userData);
16823b3eb3cSopenharmony_civoid NodeRemoveExtraData(ArkUI_NodeHandle node, ArkUI_NodeCustomEventType eventType);
16923b3eb3cSopenharmony_civoid UnregisterNodeCustomEvent(ArkUI_NodeHandle node, ArkUI_NodeCustomEventType eventType);
17023b3eb3cSopenharmony_civoid RegisterNodeCustomReceiver(void (*eventReceiver)(ArkUI_NodeCustomEvent* event));
17123b3eb3cSopenharmony_civoid UnregisterNodeCustomEventReceiver();
17223b3eb3cSopenharmony_civoid HandleInnerCustomEvent(ArkUICustomNodeEvent* origin);
17323b3eb3cSopenharmony_civoid HandleCustomEvent(ArkUI_NodeCustomEvent* event);
17423b3eb3cSopenharmony_ciint32_t AddNodeCustomEventReceiver(ArkUI_NodeHandle nodePtr, void (*eventReceiver)(ArkUI_NodeCustomEvent* event));
17523b3eb3cSopenharmony_ciint32_t RemoveNodeCustomEventReceiver(ArkUI_NodeHandle nodePtr,
17623b3eb3cSopenharmony_ci    void (*eventReceiver)(ArkUI_NodeCustomEvent* event));
17723b3eb3cSopenharmony_ciint32_t SetMeasuredSize(ArkUI_NodeHandle node, int32_t width, int32_t height);
17823b3eb3cSopenharmony_ciint32_t SetLayoutPosition(ArkUI_NodeHandle node, int32_t positionX, int32_t positionY);
17923b3eb3cSopenharmony_ciint32_t GetLayoutConstraint(ArkUI_NodeHandle node, ArkUI_LayoutConstraint* layoutConstraint);
18023b3eb3cSopenharmony_ciArkUI_IntSize GetMeasuredSize(ArkUI_NodeHandle node);
18123b3eb3cSopenharmony_ciArkUI_IntOffset GetLayoutPosition(ArkUI_NodeHandle node);
18223b3eb3cSopenharmony_ciint32_t MeasureNode(ArkUI_NodeHandle node, ArkUI_LayoutConstraint* constraint);
18323b3eb3cSopenharmony_ciint32_t LayoutNode(ArkUI_NodeHandle node, int32_t positionX, int32_t positionY);
18423b3eb3cSopenharmony_ci
18523b3eb3cSopenharmony_ciuint32_t GetTotalChildCount(ArkUI_NodeHandle node);
18623b3eb3cSopenharmony_ciArkUI_NodeHandle GetChildAt(ArkUI_NodeHandle node, int32_t position);
18723b3eb3cSopenharmony_ciArkUI_NodeHandle GetFirstChild(ArkUI_NodeHandle node);
18823b3eb3cSopenharmony_ciArkUI_NodeHandle GetLastChild(ArkUI_NodeHandle node);
18923b3eb3cSopenharmony_ciArkUI_NodeHandle GetPreviousSibling(ArkUI_NodeHandle node);
19023b3eb3cSopenharmony_ciArkUI_NodeHandle GetNextSibling(ArkUI_NodeHandle node);
19123b3eb3cSopenharmony_ciArkUI_NodeHandle GetParent(ArkUI_NodeHandle node);
19223b3eb3cSopenharmony_ciint32_t RemoveAllChildren(ArkUI_NodeHandle parentNode);
19323b3eb3cSopenharmony_ci} // namespace OHOS::Ace::NodeModel
19423b3eb3cSopenharmony_ci#endif // FOUNDATION_ACE_FRAMEWORKS_CORE_INTERFACES_NATIVE_NODE_NODE_EXTENED_H