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 * Defined the controller of node container.Provides lifecycle callbacks for the associated NodeContainer
2761847f8eSopenharmony_ci * and methods to control the child node of the NodeContainer.
2861847f8eSopenharmony_ci * 
2961847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
3061847f8eSopenharmony_ci * @crossplatform
3161847f8eSopenharmony_ci * @since 11
3261847f8eSopenharmony_ci */
3361847f8eSopenharmony_ci/**
3461847f8eSopenharmony_ci * Defined the controller of node container.Provides lifecycle callbacks for the associated NodeContainer
3561847f8eSopenharmony_ci * and methods to control the child node of the NodeContainer.
3661847f8eSopenharmony_ci * 
3761847f8eSopenharmony_ci * @syscap SystemCapability.ArkUI.ArkUI.Full
3861847f8eSopenharmony_ci * @crossplatform
3961847f8eSopenharmony_ci * @atomicservice
4061847f8eSopenharmony_ci * @since 12
4161847f8eSopenharmony_ci */
4261847f8eSopenharmony_ciexport abstract class NodeController {
4361847f8eSopenharmony_ci  /**
4461847f8eSopenharmony_ci   * MakeNode Method. Used to build a node tree and return the a FrameNode or null, and
4561847f8eSopenharmony_ci   * attach the return result to the associated NodeContainer.
4661847f8eSopenharmony_ci   * Executed when the associated NodeContainer is created or the rebuild function is called.
4761847f8eSopenharmony_ci   *
4861847f8eSopenharmony_ci   * @param { UIContext } uiContext - uiContext used to makeNode
4961847f8eSopenharmony_ci   * @returns { FrameNode | null } - Returns a FrameNode or null.
5061847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
5161847f8eSopenharmony_ci   * @crossplatform
5261847f8eSopenharmony_ci   * @since 11
5361847f8eSopenharmony_ci   */
5461847f8eSopenharmony_ci  /**
5561847f8eSopenharmony_ci   * MakeNode Method. Used to build a node tree and return the a FrameNode or null, and
5661847f8eSopenharmony_ci   * attach the return result to the associated NodeContainer.
5761847f8eSopenharmony_ci   * Executed when the associated NodeContainer is created or the rebuild function is called.
5861847f8eSopenharmony_ci   *
5961847f8eSopenharmony_ci   * @param { UIContext } uiContext - uiContext used to makeNode
6061847f8eSopenharmony_ci   * @returns { FrameNode | null } - Returns a FrameNode or null.
6161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
6261847f8eSopenharmony_ci   * @crossplatform
6361847f8eSopenharmony_ci   * @atomicservice
6461847f8eSopenharmony_ci   * @since 12
6561847f8eSopenharmony_ci   */
6661847f8eSopenharmony_ci  abstract makeNode(uiContext: UIContext): FrameNode | null;
6761847f8eSopenharmony_ci
6861847f8eSopenharmony_ci  /**
6961847f8eSopenharmony_ci   * AboutToResize Method. Executed when the associated NodeContainer performs the measure method.
7061847f8eSopenharmony_ci   *
7161847f8eSopenharmony_ci   * @param { Size } size - size used to resize
7261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
7361847f8eSopenharmony_ci   * @crossplatform
7461847f8eSopenharmony_ci   * @since 11
7561847f8eSopenharmony_ci   */
7661847f8eSopenharmony_ci  /**
7761847f8eSopenharmony_ci   * AboutToResize Method. Executed when the associated NodeContainer performs the measure method.
7861847f8eSopenharmony_ci   *
7961847f8eSopenharmony_ci   * @param { Size } size - size used to resize
8061847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
8161847f8eSopenharmony_ci   * @crossplatform
8261847f8eSopenharmony_ci   * @atomicservice
8361847f8eSopenharmony_ci   * @since 12
8461847f8eSopenharmony_ci   */
8561847f8eSopenharmony_ci  aboutToResize?(size: Size): void;
8661847f8eSopenharmony_ci
8761847f8eSopenharmony_ci  /**
8861847f8eSopenharmony_ci   * AboutToAppear Method. Executed when the associated NodeContainer is aboutToAppear.
8961847f8eSopenharmony_ci   *
9061847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
9161847f8eSopenharmony_ci   * @crossplatform
9261847f8eSopenharmony_ci   * @since 11
9361847f8eSopenharmony_ci   */
9461847f8eSopenharmony_ci  /**
9561847f8eSopenharmony_ci   * AboutToAppear Method. Executed when the associated NodeContainer is aboutToAppear.
9661847f8eSopenharmony_ci   *
9761847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
9861847f8eSopenharmony_ci   * @crossplatform
9961847f8eSopenharmony_ci   * @atomicservice
10061847f8eSopenharmony_ci   * @since 12
10161847f8eSopenharmony_ci   */
10261847f8eSopenharmony_ci  aboutToAppear?(): void;
10361847f8eSopenharmony_ci
10461847f8eSopenharmony_ci  /**
10561847f8eSopenharmony_ci   * AboutToDisappear Method. Executed when the associated NodeContainer is aboutToDisappear.
10661847f8eSopenharmony_ci   *
10761847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
10861847f8eSopenharmony_ci   * @crossplatform
10961847f8eSopenharmony_ci   * @since 11
11061847f8eSopenharmony_ci   */
11161847f8eSopenharmony_ci  /**
11261847f8eSopenharmony_ci   * AboutToDisappear Method. Executed when the associated NodeContainer is aboutToDisappear.
11361847f8eSopenharmony_ci   *
11461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
11561847f8eSopenharmony_ci   * @crossplatform
11661847f8eSopenharmony_ci   * @atomicservice
11761847f8eSopenharmony_ci   * @since 12
11861847f8eSopenharmony_ci   */
11961847f8eSopenharmony_ci  aboutToDisappear?(): void;
12061847f8eSopenharmony_ci
12161847f8eSopenharmony_ci  /**
12261847f8eSopenharmony_ci   * Rebuild Method. Used to invoke the makeNode method.
12361847f8eSopenharmony_ci   *
12461847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
12561847f8eSopenharmony_ci   * @crossplatform
12661847f8eSopenharmony_ci   * @since 11
12761847f8eSopenharmony_ci   */
12861847f8eSopenharmony_ci  /**
12961847f8eSopenharmony_ci   * Rebuild Method. Used to re invoke the makeNode method.
13061847f8eSopenharmony_ci   *
13161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
13261847f8eSopenharmony_ci   * @crossplatform
13361847f8eSopenharmony_ci   * @atomicservice
13461847f8eSopenharmony_ci   * @since 12
13561847f8eSopenharmony_ci   */
13661847f8eSopenharmony_ci  rebuild(): void;
13761847f8eSopenharmony_ci
13861847f8eSopenharmony_ci  /**
13961847f8eSopenharmony_ci   * OnTouchEvent Method. Executed when associated NodeContainer is touched.
14061847f8eSopenharmony_ci   *
14161847f8eSopenharmony_ci   * @param { TouchEvent } event - The TouchEvent when associated NodeContainer is touched.
14261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
14361847f8eSopenharmony_ci   * @crossplatform
14461847f8eSopenharmony_ci   * @since 11
14561847f8eSopenharmony_ci   */
14661847f8eSopenharmony_ci  /**
14761847f8eSopenharmony_ci   * OnTouchEvent Method. Executed when associated NodeContainer is touched.
14861847f8eSopenharmony_ci   *
14961847f8eSopenharmony_ci   * @param { TouchEvent } event - The TouchEvent when associated NodeContainer is touched.
15061847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
15161847f8eSopenharmony_ci   * @crossplatform
15261847f8eSopenharmony_ci   * @atomicservice
15361847f8eSopenharmony_ci   * @since 12
15461847f8eSopenharmony_ci   */
15561847f8eSopenharmony_ci  onTouchEvent?(event: TouchEvent): void;
15661847f8eSopenharmony_ci
15761847f8eSopenharmony_ci  /**
15861847f8eSopenharmony_ci   * OnAttach Method. Executed when the associated NodeContainer is attached to the main tree.
15961847f8eSopenharmony_ci   *
16061847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
16161847f8eSopenharmony_ci   * @crossplatform
16261847f8eSopenharmony_ci   * @atomicservice
16361847f8eSopenharmony_ci   * @since 14
16461847f8eSopenharmony_ci   */
16561847f8eSopenharmony_ci  onAttach?(): void;
16661847f8eSopenharmony_ci
16761847f8eSopenharmony_ci  /**
16861847f8eSopenharmony_ci   * OnDetach Method. Executed when the associated NodeContainer is detached from the main tree.
16961847f8eSopenharmony_ci   *
17061847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
17161847f8eSopenharmony_ci   * @crossplatform
17261847f8eSopenharmony_ci   * @atomicservice
17361847f8eSopenharmony_ci   * @since 14
17461847f8eSopenharmony_ci   */
17561847f8eSopenharmony_ci  onDetach?(): void;
17661847f8eSopenharmony_ci  
17761847f8eSopenharmony_ci  /**
17861847f8eSopenharmony_ci   * OnBind Method. Executed when the NodeController is bound to a NodeContainer.
17961847f8eSopenharmony_ci   *
18061847f8eSopenharmony_ci   * @param { number } containerId - the uniqueId of the NodeContainer.
18161847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
18261847f8eSopenharmony_ci   * @crossplatform
18361847f8eSopenharmony_ci   * @atomicservice
18461847f8eSopenharmony_ci   * @since 14
18561847f8eSopenharmony_ci   */
18661847f8eSopenharmony_ci  onBind?(containerId: number): void;
18761847f8eSopenharmony_ci
18861847f8eSopenharmony_ci  /**
18961847f8eSopenharmony_ci   * OnUnbind Method. Executed when the NodeController is unbind with the NodeContainer.
19061847f8eSopenharmony_ci   *
19161847f8eSopenharmony_ci   * @param { number } containerId - the uniqueId of the NodeContainer.
19261847f8eSopenharmony_ci   * @syscap SystemCapability.ArkUI.ArkUI.Full
19361847f8eSopenharmony_ci   * @crossplatform
19461847f8eSopenharmony_ci   * @atomicservice
19561847f8eSopenharmony_ci   * @since 14
19661847f8eSopenharmony_ci   */
19761847f8eSopenharmony_ci  onUnbind?(containerId: number): void;
19861847f8eSopenharmony_ci}
199