161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit ArkUI
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport { UIContext } from '../@ohos.arkui.UIContext';
2261847f8eSopenharmony_ciimport { FrameNode } from './FrameNode';
2361847f8eSopenharmony_ciimport { Size } from './Graphics';
2461847f8eSopenharmony_ci
2561847f8eSopenharmony_ci/**
2661847f8eSopenharmony_ci * Render type of the node using for indicating that
2761847f8eSopenharmony_ci * if the node will be shown on the display or rendered to a texture
2861847f8eSopenharmony_ci *
2961847f8eSopenharmony_ci * @enum { number } Render type
3061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
3161847f8eSopenharmony_ci * @crossplatform
3261847f8eSopenharmony_ci * @since 11
3361847f8eSopenharmony_ci */
3461847f8eSopenharmony_ci/**
3561847f8eSopenharmony_ci * Render type of the node using for indicating that
3661847f8eSopenharmony_ci * if the node will be shown on the display or rendered to a texture
3761847f8eSopenharmony_ci *
3861847f8eSopenharmony_ci * @enum { number } Render type
3961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
4061847f8eSopenharmony_ci * @crossplatform
4161847f8eSopenharmony_ci * @atomicservice
4261847f8eSopenharmony_ci * @since 12
4361847f8eSopenharmony_ci */
4461847f8eSopenharmony_cideclare enum NodeRenderType {
4561847f8eSopenharmony_ci  /**
4661847f8eSopenharmony_ci   * Display type.The node will be shown on the display.
4761847f8eSopenharmony_ci   *
4861847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
4961847f8eSopenharmony_ci   * @crossplatform
5061847f8eSopenharmony_ci   * @since 11
5161847f8eSopenharmony_ci   */
5261847f8eSopenharmony_ci  /**
5361847f8eSopenharmony_ci   * Display type.The node will be shown on the display.
5461847f8eSopenharmony_ci   *
5561847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
5661847f8eSopenharmony_ci   * @crossplatform
5761847f8eSopenharmony_ci   * @atomicservice
5861847f8eSopenharmony_ci   * @since 12
5961847f8eSopenharmony_ci   */
6061847f8eSopenharmony_ci  RENDER_TYPE_DISPLAY = 0,
6161847f8eSopenharmony_ci
6261847f8eSopenharmony_ci  /**
6361847f8eSopenharmony_ci   * Exporting texture type.The node will be render to a  texture.
6461847f8eSopenharmony_ci   *
6561847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
6661847f8eSopenharmony_ci   * @since 11
6761847f8eSopenharmony_ci   */
6861847f8eSopenharmony_ci  /**
6961847f8eSopenharmony_ci   * Exporting texture type.The node will be render to a  texture.
7061847f8eSopenharmony_ci   *
7161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
7261847f8eSopenharmony_ci   * @atomicservice
7361847f8eSopenharmony_ci   * @since 12
7461847f8eSopenharmony_ci   */
7561847f8eSopenharmony_ci  RENDER_TYPE_TEXTURE = 1,
7661847f8eSopenharmony_ci}
7761847f8eSopenharmony_ci
7861847f8eSopenharmony_ci/**
7961847f8eSopenharmony_ci * RenderOptions info.
8061847f8eSopenharmony_ci *
8161847f8eSopenharmony_ci * @interface RenderOptions
8261847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
8361847f8eSopenharmony_ci * @crossplatform
8461847f8eSopenharmony_ci * @since 11
8561847f8eSopenharmony_ci */
8661847f8eSopenharmony_ci/**
8761847f8eSopenharmony_ci * RenderOptions info.
8861847f8eSopenharmony_ci *
8961847f8eSopenharmony_ci * @interface RenderOptions
9061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
9161847f8eSopenharmony_ci * @crossplatform
9261847f8eSopenharmony_ci * @atomicservice
9361847f8eSopenharmony_ci * @since 12
9461847f8eSopenharmony_ci */
9561847f8eSopenharmony_ciexport interface RenderOptions {
9661847f8eSopenharmony_ci  /**
9761847f8eSopenharmony_ci   * The ideal size of the node.
9861847f8eSopenharmony_ci   * @type { ?Size } selfIdealSize - The ideal size of the node
9961847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
10061847f8eSopenharmony_ci   * @crossplatform
10161847f8eSopenharmony_ci   * @since 11
10261847f8eSopenharmony_ci   */
10361847f8eSopenharmony_ci  /**
10461847f8eSopenharmony_ci   * The ideal size of the node.
10561847f8eSopenharmony_ci   * @type { ?Size } selfIdealSize - The ideal size of the node
10661847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
10761847f8eSopenharmony_ci   * @crossplatform
10861847f8eSopenharmony_ci   * @atomicservice
10961847f8eSopenharmony_ci   * @since 12
11061847f8eSopenharmony_ci   */
11161847f8eSopenharmony_ci  selfIdealSize?: Size;
11261847f8eSopenharmony_ci
11361847f8eSopenharmony_ci  /**
11461847f8eSopenharmony_ci   * Render type of the node.
11561847f8eSopenharmony_ci   * @type { ?NodeRenderType } type - Render type of the node
11661847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
11761847f8eSopenharmony_ci   * @since 11
11861847f8eSopenharmony_ci   */
11961847f8eSopenharmony_ci  /**
12061847f8eSopenharmony_ci   * Render type of the node.
12161847f8eSopenharmony_ci   * @type { ?NodeRenderType } type - Render type of the node
12261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
12361847f8eSopenharmony_ci   * @atomicservice
12461847f8eSopenharmony_ci   * @since 12
12561847f8eSopenharmony_ci   */
12661847f8eSopenharmony_ci  type?: NodeRenderType;
12761847f8eSopenharmony_ci
12861847f8eSopenharmony_ci  /**
12961847f8eSopenharmony_ci   * The surfaceId of a texture consumer
13061847f8eSopenharmony_ci   * @type { ?string } surfaceId - surfaceId of a consumer who can receive the texture of the Node
13161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
13261847f8eSopenharmony_ci   * @since 11
13361847f8eSopenharmony_ci   */
13461847f8eSopenharmony_ci  /**
13561847f8eSopenharmony_ci   * The surfaceId of a texture consumer
13661847f8eSopenharmony_ci   * @type { ?string } surfaceId - surfaceId of a consumer who can receive the texture of the Node
13761847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
13861847f8eSopenharmony_ci   * @atomicservice
13961847f8eSopenharmony_ci   * @since 12
14061847f8eSopenharmony_ci   */
14161847f8eSopenharmony_ci  surfaceId?: string;
14261847f8eSopenharmony_ci}
14361847f8eSopenharmony_ci
14461847f8eSopenharmony_ci
14561847f8eSopenharmony_ci/**
14661847f8eSopenharmony_ci * BuildOptions info.
14761847f8eSopenharmony_ci *
14861847f8eSopenharmony_ci * @interface BuildOptions
14961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
15061847f8eSopenharmony_ci * @crossplatform
15161847f8eSopenharmony_ci * @atomicservice
15261847f8eSopenharmony_ci * @since 12
15361847f8eSopenharmony_ci */
15461847f8eSopenharmony_ciexport interface BuildOptions {
15561847f8eSopenharmony_ci
15661847f8eSopenharmony_ci  /**
15761847f8eSopenharmony_ci   * Build type of the Builder.
15861847f8eSopenharmony_ci   * @type { ?boolean } nestingBuilderSupported - Build type of the Builder.
15961847f8eSopenharmony_ci   * Indicates whether support the type that WrappedBuilder contains builder used different params.
16061847f8eSopenharmony_ci   * 
16161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
16261847f8eSopenharmony_ci   * @crossplatform
16361847f8eSopenharmony_ci   * @atomicservice
16461847f8eSopenharmony_ci   * @since 12
16561847f8eSopenharmony_ci   */
16661847f8eSopenharmony_ci  nestingBuilderSupported?: boolean;
16761847f8eSopenharmony_ci
16861847f8eSopenharmony_ci}
16961847f8eSopenharmony_ci
17061847f8eSopenharmony_ci/**
17161847f8eSopenharmony_ci * Defines BuilderNode.
17261847f8eSopenharmony_ci *
17361847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
17461847f8eSopenharmony_ci * @crossplatform
17561847f8eSopenharmony_ci * @since 11
17661847f8eSopenharmony_ci */
17761847f8eSopenharmony_ci/**
17861847f8eSopenharmony_ci * Defines BuilderNode.
17961847f8eSopenharmony_ci *
18061847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
18161847f8eSopenharmony_ci * @crossplatform
18261847f8eSopenharmony_ci * @atomicservice
18361847f8eSopenharmony_ci * @since 12
18461847f8eSopenharmony_ci */
18561847f8eSopenharmony_ciexport class BuilderNode<Args extends Object[]> {
18661847f8eSopenharmony_ci  /**
18761847f8eSopenharmony_ci   * Constructor.
18861847f8eSopenharmony_ci   *
18961847f8eSopenharmony_ci   * @param { UIContext } uiContext - uiContext used to create the BuilderNode
19061847f8eSopenharmony_ci   * @param { RenderOptions } options - Render options of the Builder Node
19161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
19261847f8eSopenharmony_ci   * @crossplatform
19361847f8eSopenharmony_ci   * @since 11
19461847f8eSopenharmony_ci   */
19561847f8eSopenharmony_ci  /**
19661847f8eSopenharmony_ci   * Constructor.
19761847f8eSopenharmony_ci   *
19861847f8eSopenharmony_ci   * @param { UIContext } uiContext - uiContext used to create the BuilderNode
19961847f8eSopenharmony_ci   * @param { RenderOptions } options - Render options of the Builder Node
20061847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
20161847f8eSopenharmony_ci   * @crossplatform
20261847f8eSopenharmony_ci   * @atomicservice
20361847f8eSopenharmony_ci   * @since 12
20461847f8eSopenharmony_ci   */
20561847f8eSopenharmony_ci  constructor(uiContext: UIContext, options?: RenderOptions);
20661847f8eSopenharmony_ci
20761847f8eSopenharmony_ci  /**
20861847f8eSopenharmony_ci   * Build the BuilderNode with the builder.
20961847f8eSopenharmony_ci   *
21061847f8eSopenharmony_ci   * @param { WrappedBuilder<Args> } builder - Defined the builder will be called to build the node.
21161847f8eSopenharmony_ci   * @param { Object } arg - Defined the args will be used in the builder.
21261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
21361847f8eSopenharmony_ci   * @crossplatform
21461847f8eSopenharmony_ci   * @since 11
21561847f8eSopenharmony_ci   */
21661847f8eSopenharmony_ci  /**
21761847f8eSopenharmony_ci   * Build the BuilderNode with the builder.
21861847f8eSopenharmony_ci   *
21961847f8eSopenharmony_ci   * @param { WrappedBuilder<Args> } builder - Defined the builder will be called to build the node.
22061847f8eSopenharmony_ci   * @param { Object } arg - Defined the args will be used in the builder.
22161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
22261847f8eSopenharmony_ci   * @crossplatform
22361847f8eSopenharmony_ci   * @atomicservice
22461847f8eSopenharmony_ci   * @since 12
22561847f8eSopenharmony_ci   */
22661847f8eSopenharmony_ci  build(builder: WrappedBuilder<Args>, arg?: Object): void;
22761847f8eSopenharmony_ci
22861847f8eSopenharmony_ci  /**
22961847f8eSopenharmony_ci   * Build the BuilderNode with the builder.Support the type that WrappedBuilder contains builder used different params.
23061847f8eSopenharmony_ci   *
23161847f8eSopenharmony_ci   * @param { WrappedBuilder<Args> } builder - Defined the builder will be called to build the node.
23261847f8eSopenharmony_ci   * @param { Object } arg - Defined the args will be used in the builder.
23361847f8eSopenharmony_ci   * @param { BuildOptions } options - Defined the options will be used when build.
23461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
23561847f8eSopenharmony_ci   * @crossplatform
23661847f8eSopenharmony_ci   * @atomicservice
23761847f8eSopenharmony_ci   * @since 12
23861847f8eSopenharmony_ci   */
23961847f8eSopenharmony_ci  build(builder: WrappedBuilder<Args>, arg: Object, options: BuildOptions): void;
24061847f8eSopenharmony_ci
24161847f8eSopenharmony_ci  /**
24261847f8eSopenharmony_ci   * Update the BuilderNode based on the provided parameters.
24361847f8eSopenharmony_ci   *
24461847f8eSopenharmony_ci   * @param { Object } arg - Parameters used to update the BuilderNode, which must match the types required by the builder bound to the BuilderNode.
24561847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
24661847f8eSopenharmony_ci   * @crossplatform
24761847f8eSopenharmony_ci   * @since 11
24861847f8eSopenharmony_ci   */
24961847f8eSopenharmony_ci  /**
25061847f8eSopenharmony_ci   * Update the BuilderNode based on the provided parameters.
25161847f8eSopenharmony_ci   *
25261847f8eSopenharmony_ci   * @param { Object } arg - Parameters used to update the BuilderNode, which must match the types required by the builder bound to the BuilderNode.
25361847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
25461847f8eSopenharmony_ci   * @crossplatform
25561847f8eSopenharmony_ci   * @atomicservice
25661847f8eSopenharmony_ci   * @since 12
25761847f8eSopenharmony_ci   */
25861847f8eSopenharmony_ci  update(arg: Object): void;
25961847f8eSopenharmony_ci
26061847f8eSopenharmony_ci  /**
26161847f8eSopenharmony_ci   * Get the FrameNode in BuilderNode.
26261847f8eSopenharmony_ci   *
26361847f8eSopenharmony_ci   * @returns { FrameNode | null } - Returns a FrameNode inside the BuilderNode, or null if not contained.
26461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
26561847f8eSopenharmony_ci   * @crossplatform
26661847f8eSopenharmony_ci   * @since 11
26761847f8eSopenharmony_ci   */
26861847f8eSopenharmony_ci  /**
26961847f8eSopenharmony_ci   * Get the FrameNode in BuilderNode.
27061847f8eSopenharmony_ci   *
27161847f8eSopenharmony_ci   * @returns { FrameNode | null } - Returns a FrameNode inside the BuilderNode, or null if not contained.
27261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
27361847f8eSopenharmony_ci   * @crossplatform
27461847f8eSopenharmony_ci   * @atomicservice
27561847f8eSopenharmony_ci   * @since 12
27661847f8eSopenharmony_ci   */
27761847f8eSopenharmony_ci  getFrameNode(): FrameNode | null;
27861847f8eSopenharmony_ci
27961847f8eSopenharmony_ci  /**
28061847f8eSopenharmony_ci   * Dispatch touchEvent to targetNode.
28161847f8eSopenharmony_ci   *
28261847f8eSopenharmony_ci   * @param { TouchEvent } event - The touchEvent which will be sent to the targetNode.
28361847f8eSopenharmony_ci   * @returns { boolean } - Returns true if the TouchEvent has been successfully posted to the targetNode, false otherwise.
28461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
28561847f8eSopenharmony_ci   * @crossplatform
28661847f8eSopenharmony_ci   * @since 11
28761847f8eSopenharmony_ci   */
28861847f8eSopenharmony_ci  /**
28961847f8eSopenharmony_ci   * Dispatch touchEvent to targetNode.
29061847f8eSopenharmony_ci   *
29161847f8eSopenharmony_ci   * @param { TouchEvent } event - The touchEvent which will be sent to the targetNode.
29261847f8eSopenharmony_ci   * @returns { boolean } - Returns true if the TouchEvent has been successfully posted to the targetNode, false otherwise.
29361847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
29461847f8eSopenharmony_ci   * @crossplatform
29561847f8eSopenharmony_ci   * @atomicservice
29661847f8eSopenharmony_ci   * @since 12
29761847f8eSopenharmony_ci   */
29861847f8eSopenharmony_ci  postTouchEvent(event: TouchEvent): boolean;
29961847f8eSopenharmony_ci
30061847f8eSopenharmony_ci  /**
30161847f8eSopenharmony_ci   * Dispose the BuilderNode immediately.
30261847f8eSopenharmony_ci   *
30361847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
30461847f8eSopenharmony_ci   * @crossplatform
30561847f8eSopenharmony_ci   * @atomicservice
30661847f8eSopenharmony_ci   * @since 12
30761847f8eSopenharmony_ci   */
30861847f8eSopenharmony_ci  dispose(): void;
30961847f8eSopenharmony_ci
31061847f8eSopenharmony_ci  /**
31161847f8eSopenharmony_ci   * Reuse the BuilderNode based on the provided parameters.
31261847f8eSopenharmony_ci   *
31361847f8eSopenharmony_ci   * @param { Object } [param] - Parameters for reusing BuilderNode.
31461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
31561847f8eSopenharmony_ci   * @crossplatform
31661847f8eSopenharmony_ci   * @atomicservice
31761847f8eSopenharmony_ci   * @since 12
31861847f8eSopenharmony_ci   */
31961847f8eSopenharmony_ci  reuse(param?: Object): void;
32061847f8eSopenharmony_ci
32161847f8eSopenharmony_ci  /**
32261847f8eSopenharmony_ci   * Recycle the BuilderNode.
32361847f8eSopenharmony_ci   *
32461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
32561847f8eSopenharmony_ci   * @crossplatform
32661847f8eSopenharmony_ci   * @atomicservice
32761847f8eSopenharmony_ci   * @since 12
32861847f8eSopenharmony_ci   */
32961847f8eSopenharmony_ci  recycle(): void;
33061847f8eSopenharmony_ci
33161847f8eSopenharmony_ci  /**
33261847f8eSopenharmony_ci   * Notify BuilderNode to update the configuration to trigger a reload of the BuilderNode.
33361847f8eSopenharmony_ci   *
33461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
33561847f8eSopenharmony_ci   * @crossplatform
33661847f8eSopenharmony_ci   * @atomicservice
33761847f8eSopenharmony_ci   * @since 12
33861847f8eSopenharmony_ci   */
33961847f8eSopenharmony_ci   updateConfiguration(): void;
34061847f8eSopenharmony_ci}
341