• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023 Huawei Device Co., Ltd.
3 * Licensed under the Apache License, Version 2.0 (the "License");
4 * you may not use this file except in compliance with the License.
5 * You may obtain a copy of the License at
6 *
7 *     http://www.apache.org/licenses/LICENSE-2.0
8 *
9 * Unless required by applicable law or agreed to in writing, software
10 * distributed under the License is distributed on an "AS IS" BASIS,
11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 * See the License for the specific language governing permissions and
13 * limitations under the License.
14 */
15
16/**
17 * @file
18 * @kit ArkUI
19 */
20
21import { UIContext } from '../@ohos.arkui.UIContext';
22import { FrameNode } from './FrameNode';
23import { Size } from './Graphics';
24
25/*** if arkts 1.2 */
26import { Callback } from '../@ohos.base';
27import { TouchEvent } from './component/common';
28/*** endif */
29
30/**
31 * Defined the controller of node container.Provides lifecycle callbacks for the associated NodeContainer
32 * and methods to control the child node of the NodeContainer.
33 *
34 * @syscap SystemCapability.ArkUI.ArkUI.Full
35 * @crossplatform
36 * @since 11
37 */
38/**
39 * Defined the controller of node container.Provides lifecycle callbacks for the associated NodeContainer
40 * and methods to control the child node of the NodeContainer.
41 *
42 * @syscap SystemCapability.ArkUI.ArkUI.Full
43 * @crossplatform
44 * @atomicservice
45 * @since 12
46 */
47/**
48 * Defined the controller of node container.Provides lifecycle callbacks for the associated NodeContainer
49 * and methods to control the child node of the NodeContainer.
50 *
51 * @syscap SystemCapability.ArkUI.ArkUI.Full
52 * @crossplatform
53 * @atomicservice
54 * @since 20
55 * @arkts 1.1&1.2
56 */
57export declare abstract class NodeController {
58  /**
59   * MakeNode Method. Used to build a node tree and return the a FrameNode or null, and
60   * attach the return result to the associated NodeContainer.
61   * Executed when the associated NodeContainer is created or the rebuild function is called.
62   *
63   * @param { UIContext } uiContext - uiContext used to makeNode
64   * @returns { FrameNode | null } - Returns a FrameNode or null.
65   * @syscap SystemCapability.ArkUI.ArkUI.Full
66   * @crossplatform
67   * @since 11
68   */
69  /**
70   * MakeNode Method. Used to build a node tree and return the a FrameNode or null, and
71   * attach the return result to the associated NodeContainer.
72   * Executed when the associated NodeContainer is created or the rebuild function is called.
73   *
74   * @param { UIContext } uiContext - uiContext used to makeNode
75   * @returns { FrameNode | null } - Returns a FrameNode or null.
76   * @syscap SystemCapability.ArkUI.ArkUI.Full
77   * @crossplatform
78   * @atomicservice
79   * @since arkts{'1.1':'12','1.2':'20'}
80   * @arkts 1.1&1.2
81   */
82  abstract makeNode(uiContext: UIContext): FrameNode | null;
83
84  /**
85   * AboutToResize Method. Executed when the associated NodeContainer performs the measure method.
86   *
87   * @param { Size } size - size used to resize
88   * @syscap SystemCapability.ArkUI.ArkUI.Full
89   * @crossplatform
90   * @since 11
91   */
92  /**
93   * AboutToResize Method. Executed when the associated NodeContainer performs the measure method.
94   *
95   * @param { Size } size - size used to resize
96   * @syscap SystemCapability.ArkUI.ArkUI.Full
97   * @crossplatform
98   * @atomicservice
99   * @since 12
100   */
101  aboutToResize?(size: Size): void;
102
103  /**
104   * AboutToResize Method. Executed when the associated NodeContainer performs the measure method.
105   *
106   * @param { Size } size - size used to resize
107   * @syscap SystemCapability.ArkUI.ArkUI.Full
108   * @crossplatform
109   * @atomicservice
110   * @since 20
111   * @arkts 1.2
112   */
113  aboutToResize(size: Size): void;
114
115  /**
116   * AboutToAppear Method. Executed when the associated NodeContainer is aboutToAppear.
117   *
118   * @syscap SystemCapability.ArkUI.ArkUI.Full
119   * @crossplatform
120   * @since 11
121   */
122  /**
123   * AboutToAppear Method. Executed when the associated NodeContainer is aboutToAppear.
124   *
125   * @syscap SystemCapability.ArkUI.ArkUI.Full
126   * @crossplatform
127   * @atomicservice
128   * @since 12
129   */
130  aboutToAppear?(): void;
131
132  /**
133   * AboutToAppear Method. Executed when the associated NodeContainer is aboutToAppear.
134   *
135   * @syscap SystemCapability.ArkUI.ArkUI.Full
136   * @crossplatform
137   * @atomicservice
138   * @since 20
139   * @arkts 1.2
140   */
141  aboutToAppear(): void;
142
143  /**
144   * AboutToDisappear Method. Executed when the associated NodeContainer is aboutToDisappear.
145   *
146   * @syscap SystemCapability.ArkUI.ArkUI.Full
147   * @crossplatform
148   * @since 11
149   */
150  /**
151   * AboutToDisappear Method. Executed when the associated NodeContainer is aboutToDisappear.
152   *
153   * @syscap SystemCapability.ArkUI.ArkUI.Full
154   * @crossplatform
155   * @atomicservice
156   * @since 12
157   */
158  aboutToDisappear?(): void;
159
160  /**
161   * AboutToDisappear Method. Executed when the associated NodeContainer is aboutToDisappear.
162   *
163   * @syscap SystemCapability.ArkUI.ArkUI.Full
164   * @crossplatform
165   * @atomicservice
166   * @since 20
167   * @arkts 1.2
168   */
169  aboutToDisappear(): void;
170
171  /**
172   * Rebuild Method. Used to invoke the makeNode method.
173   *
174   * @syscap SystemCapability.ArkUI.ArkUI.Full
175   * @crossplatform
176   * @since 11
177   */
178  /**
179   * Rebuild Method. Used to re invoke the makeNode method.
180   *
181   * @syscap SystemCapability.ArkUI.ArkUI.Full
182   * @crossplatform
183   * @atomicservice
184   * @since 12
185   */
186  rebuild(): void;
187
188  /**
189   * OnTouchEvent Method. Executed when associated NodeContainer is touched.
190   *
191   * @param { TouchEvent } event - The TouchEvent when associated NodeContainer is touched.
192   * @syscap SystemCapability.ArkUI.ArkUI.Full
193   * @crossplatform
194   * @since 11
195   */
196  /**
197   * OnTouchEvent Method. Executed when associated NodeContainer is touched.
198   *
199   * @param { TouchEvent } event - The TouchEvent when associated NodeContainer is touched.
200   * @syscap SystemCapability.ArkUI.ArkUI.Full
201   * @crossplatform
202   * @atomicservice
203   * @since 12
204   */
205  onTouchEvent?(event: TouchEvent): void;
206
207  /**
208   * OnTouchEvent Method. Executed when associated NodeContainer is touched.
209   *
210   * @param { TouchEvent } event - The TouchEvent when associated NodeContainer is touched.
211   * @syscap SystemCapability.ArkUI.ArkUI.Full
212   * @crossplatform
213   * @atomicservice
214   * @since 20
215   * @arkts 1.2
216   */
217  onTouchEvent(event: TouchEvent): void;
218
219  /**
220   * OnAttach Method. Executed when the associated NodeContainer is attached to the main tree.
221   *
222   * @syscap SystemCapability.ArkUI.ArkUI.Full
223   * @crossplatform
224   * @atomicservice
225   * @since 18
226   */
227  onAttach?(): void;
228
229  /**
230   * OnAttach Method. Executed when the associated NodeContainer is attached to the main tree.
231   *
232   * @syscap SystemCapability.ArkUI.ArkUI.Full
233   * @crossplatform
234   * @atomicservice
235   * @since 20
236   * @arkts 1.2
237   */
238  onAttach(): void;
239
240  /**
241   * OnDetach Method. Executed when the associated NodeContainer is detached from the main tree.
242   *
243   * @syscap SystemCapability.ArkUI.ArkUI.Full
244   * @crossplatform
245   * @atomicservice
246   * @since 18
247   */
248  onDetach?(): void;
249
250  /**
251   * OnDetach Method. Executed when the associated NodeContainer is detached from the main tree.
252   *
253   * @syscap SystemCapability.ArkUI.ArkUI.Full
254   * @crossplatform
255   * @atomicservice
256   * @since 20
257   * @arkts 1.2
258   */
259  onDetach(): void;
260
261  /**
262   * OnWillBind Method. Executed before the NodeController is bound to a NodeContainer.
263   *
264   * @param { number } containerId - the uniqueId of the NodeContainer.
265   * @syscap SystemCapability.ArkUI.ArkUI.Full
266   * @crossplatform
267   * @atomicservice
268   * @since 18
269   */
270  onWillBind?(containerId: number): void;
271
272  /**
273   * OnWillBind Method. Executed before the NodeController is bound to a NodeContainer.
274   *
275   * @param { number } containerId - the uniqueId of the NodeContainer.
276   * @syscap SystemCapability.ArkUI.ArkUI.Full
277   * @crossplatform
278   * @atomicservice
279   * @since 20
280   * @arkts 1.2
281   */
282  onWillBind(containerId: number): void;
283
284  /**
285   * OnWillUnbind Method. Executed before the NodeController is unbind with the NodeContainer.
286   *
287   * @param { number } containerId - the uniqueId of the NodeContainer.
288   * @syscap SystemCapability.ArkUI.ArkUI.Full
289   * @crossplatform
290   * @atomicservice
291   * @since 18
292   */
293  onWillUnbind?(containerId: number): void;
294
295  /**
296   * OnWillUnbind Method. Executed before the NodeController is unbind with the NodeContainer.
297   *
298   * @param { number } containerId - the uniqueId of the NodeContainer.
299   * @syscap SystemCapability.ArkUI.ArkUI.Full
300   * @crossplatform
301   * @atomicservice
302   * @since 20
303   * @arkts 1.2
304   */
305  onWillUnbind(containerId: number): void;
306
307  /**
308   * OnBind Method. Executed after the NodeController is bound to a NodeContainer.
309   *
310   * @param { number } containerId - the uniqueId of the NodeContainer.
311   * @syscap SystemCapability.ArkUI.ArkUI.Full
312   * @crossplatform
313   * @atomicservice
314   * @since 18
315   */
316  onBind?(containerId: number): void;
317
318  /**
319   * OnBind Method. Executed when the NodeController is bound to a NodeContainer.
320   *
321   * @param { number } containerId - the uniqueId of the NodeContainer.
322   * @syscap SystemCapability.ArkUI.ArkUI.Full
323   * @crossplatform
324   * @atomicservice
325   * @since 20
326   * @arkts 1.2
327   */
328  onBind(containerId: number): void;
329
330  /**
331   * OnUnbind Method. Executed after the NodeController is unbind with the NodeContainer.
332   *
333   * @param { number } containerId - the uniqueId of the NodeContainer.
334   * @syscap SystemCapability.ArkUI.ArkUI.Full
335   * @crossplatform
336   * @atomicservice
337   * @since 18
338   */
339  onUnbind?(containerId: number): void;
340
341  /**
342   * OnUnbind Method. Executed when the NodeController is unbind with the NodeContainer.
343   *
344   * @param { number } containerId - the uniqueId of the NodeContainer.
345   * @syscap SystemCapability.ArkUI.ArkUI.Full
346   * @crossplatform
347   * @atomicservice
348   * @since 20
349   * @arkts 1.2
350   */
351  onUnbind(containerId: number): void;
352}
353