• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2021-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
21/**
22 * Declare the type of status button
23 *
24 * @enum { number }
25 * @syscap SystemCapability.ArkUI.ArkUI.Full
26 * @since 8
27 */
28/**
29 * Declare the type of status button
30 *
31 * @enum { number }
32 * @syscap SystemCapability.ArkUI.ArkUI.Full
33 * @form
34 * @since 9
35 */
36/**
37 * Declare the type of status button
38 *
39 * @enum { number }
40 * @syscap SystemCapability.ArkUI.ArkUI.Full
41 * @crossplatform
42 * @form
43 * @since 10
44 */
45/**
46 * Declare the type of status button
47 *
48 * @enum { number }
49 * @syscap SystemCapability.ArkUI.ArkUI.Full
50 * @crossplatform
51 * @form
52 * @atomicservice
53 * @since 11
54 */
55declare enum ToggleType {
56  /**
57   * Checkbox
58   *
59   * @syscap SystemCapability.ArkUI.ArkUI.Full
60   * @since 8
61   */
62  /**
63   * Checkbox
64   *
65   * @syscap SystemCapability.ArkUI.ArkUI.Full
66   * @form
67   * @since 9
68   */
69  /**
70   * Checkbox
71   *
72   * @syscap SystemCapability.ArkUI.ArkUI.Full
73   * @crossplatform
74   * @form
75   * @since 10
76   */
77  /**
78   * Checkbox
79   *
80   * @syscap SystemCapability.ArkUI.ArkUI.Full
81   * @crossplatform
82   * @form
83   * @atomicservice
84   * @since 11
85   */
86  Checkbox,
87
88  /**
89   * Switch
90   *
91   * @syscap SystemCapability.ArkUI.ArkUI.Full
92   * @since 8
93   */
94  /**
95   * Switch
96   *
97   * @syscap SystemCapability.ArkUI.ArkUI.Full
98   * @form
99   * @since 9
100   */
101  /**
102   * Switch
103   *
104   * @syscap SystemCapability.ArkUI.ArkUI.Full
105   * @crossplatform
106   * @form
107   * @since 10
108   */
109  /**
110   * Switch
111   *
112   * @syscap SystemCapability.ArkUI.ArkUI.Full
113   * @crossplatform
114   * @form
115   * @atomicservice
116   * @since 11
117   */
118  Switch,
119
120  /**
121   * Button
122   *
123   * @syscap SystemCapability.ArkUI.ArkUI.Full
124   * @since 8
125   */
126  /**
127   * Button
128   *
129   * @syscap SystemCapability.ArkUI.ArkUI.Full
130   * @form
131   * @since 9
132   */
133  /**
134   * Button
135   *
136   * @syscap SystemCapability.ArkUI.ArkUI.Full
137   * @crossplatform
138   * @form
139   * @since 10
140   */
141  /**
142   * Button
143   *
144   * @syscap SystemCapability.ArkUI.ArkUI.Full
145   * @crossplatform
146   * @form
147   * @atomicservice
148   * @since 11
149   */
150  Button,
151}
152
153/**
154 * Defines the switch style.
155 *
156 * @interface SwitchStyle
157 * @syscap SystemCapability.ArkUI.ArkUI.Full
158 * @crossplatform
159 * @atomicservice
160 * @since 12
161 */
162declare interface SwitchStyle {
163  /**
164   * Set the radius of the point of the switch.
165   *
166   * @type { ?(number | Resource) }
167   * @syscap SystemCapability.ArkUI.ArkUI.Full
168   * @crossplatform
169   * @atomicservice
170   * @since 12
171   */
172  pointRadius?: number | Resource;
173
174  /**
175   * Set the color of the unselected switch.
176   *
177   * @type { ?ResourceColor }
178   * @syscap SystemCapability.ArkUI.ArkUI.Full
179   * @crossplatform
180   * @atomicservice
181   * @since 12
182   */
183  unselectedColor?: ResourceColor;
184
185  /**
186   * Set the color of the point of the switch.
187   *
188   * @type { ?ResourceColor }
189   * @syscap SystemCapability.ArkUI.ArkUI.Full
190   * @crossplatform
191   * @atomicservice
192   * @since 12
193   */
194  pointColor?: ResourceColor;
195
196  /**
197   * Set the border radius of the track of the switch.
198   *
199   * @type { ?(number | Resource) }
200   * @syscap SystemCapability.ArkUI.ArkUI.Full
201   * @crossplatform
202   * @atomicservice
203   * @since 12
204   */
205  trackBorderRadius?: number | Resource;
206}
207
208/**
209 * ToggleConfiguration used by toggle Modifier
210 *
211 * @interface ToggleConfiguration
212 * @syscap SystemCapability.ArkUI.ArkUI.Full
213 * @crossplatform
214 * @atomicservice
215 * @since 12
216 */
217declare interface ToggleConfiguration extends CommonConfiguration<ToggleConfiguration> {
218
219  /**
220   * Indicates whether the Toggle is on.
221   *
222   * @type { boolean }
223   * @syscap SystemCapability.ArkUI.ArkUI.Full
224   * @crossplatform
225   * @atomicservice
226   * @since 12
227   */
228  isOn: boolean;
229
230  /**
231   * Indicates whether the Toggle is enabled.
232   *
233   * @type { boolean }
234   * @syscap SystemCapability.ArkUI.ArkUI.Full
235   * @crossplatform
236   * @atomicservice
237   * @since 12
238   */
239  enabled: boolean;
240
241  /**
242   * Trigger toggle select change
243   *
244   * @type { Callback<boolean> }
245   * @syscap SystemCapability.ArkUI.ArkUI.Full
246   * @crossplatform
247   * @atomicservice
248   * @since 12
249   */
250  triggerChange: Callback<boolean>;
251}
252
253/**
254 * Defines the toggle interface.
255 *
256 * @interface ToggleInterface
257 * @syscap SystemCapability.ArkUI.ArkUI.Full
258 * @since 8
259 */
260/**
261 * Defines the toggle interface.
262 *
263 * @interface ToggleInterface
264 * @syscap SystemCapability.ArkUI.ArkUI.Full
265 * @form
266 * @since 9
267 */
268/**
269 * Defines the toggle interface.
270 *
271 * @interface ToggleInterface
272 * @syscap SystemCapability.ArkUI.ArkUI.Full
273 * @crossplatform
274 * @form
275 * @since 10
276 */
277/**
278 * Defines the toggle interface.
279 *
280 * @interface ToggleInterface
281 * @syscap SystemCapability.ArkUI.ArkUI.Full
282 * @crossplatform
283 * @form
284 * @atomicservice
285 * @since 11
286 */
287interface ToggleInterface {
288  /**
289   * Set parameters to obtain the toggle.
290   *
291   * @param { object } options
292   * @returns { ToggleAttribute }
293   * @syscap SystemCapability.ArkUI.ArkUI.Full
294   * @since 8
295   */
296  /**
297   * Set parameters to obtain the toggle.
298   *
299   * @param { object } options
300   * @returns { ToggleAttribute }
301   * @syscap SystemCapability.ArkUI.ArkUI.Full
302   * @form
303   * @since 9
304   */
305  /**
306   * Set parameters to obtain the toggle.
307   *
308   * @param { object } options
309   * @returns { ToggleAttribute }
310   * @syscap SystemCapability.ArkUI.ArkUI.Full
311   * @crossplatform
312   * @form
313   * @since 10
314   */
315  /**
316   * Set parameters to obtain the toggle.
317   *
318   * @param { object } options
319   * @returns { ToggleAttribute }
320   * @syscap SystemCapability.ArkUI.ArkUI.Full
321   * @crossplatform
322   * @form
323   * @atomicservice
324   * @since 11
325   */
326  (options: { type: ToggleType; isOn?: boolean }): ToggleAttribute;
327}
328
329/**
330 * Defines the toggle attribute functions
331 *
332 * @extends CommonMethod<ToggleAttribute>
333 * @syscap SystemCapability.ArkUI.ArkUI.Full
334 * @since 8
335 */
336/**
337 * Defines the toggle attribute functions
338 *
339 * @extends CommonMethod<ToggleAttribute>
340 * @syscap SystemCapability.ArkUI.ArkUI.Full
341 * @form
342 * @since 9
343 */
344/**
345 * Defines the toggle attribute functions
346 *
347 * @extends CommonMethod<ToggleAttribute>
348 * @syscap SystemCapability.ArkUI.ArkUI.Full
349 * @crossplatform
350 * @form
351 * @since 10
352 */
353/**
354 * Defines the toggle attribute functions
355 *
356 * @extends CommonMethod<ToggleAttribute>
357 * @syscap SystemCapability.ArkUI.ArkUI.Full
358 * @crossplatform
359 * @form
360 * @atomicservice
361 * @since 11
362 */
363declare class ToggleAttribute extends CommonMethod<ToggleAttribute> {
364  /**
365   * Called when the selected state of the component changes.
366   *
367   * @param { function } callback
368   * @returns { ToggleAttribute }
369   * @syscap SystemCapability.ArkUI.ArkUI.Full
370   * @since 8
371   */
372  /**
373   * Called when the selected state of the component changes.
374   *
375   * @param { function } callback
376   * @returns { ToggleAttribute }
377   * @syscap SystemCapability.ArkUI.ArkUI.Full
378   * @form
379   * @since 9
380   */
381  /**
382   * Called when the selected state of the component changes.
383   *
384   * @param { function } callback
385   * @returns { ToggleAttribute }
386   * @syscap SystemCapability.ArkUI.ArkUI.Full
387   * @crossplatform
388   * @form
389   * @since 10
390   */
391  /**
392   * Called when the selected state of the component changes.
393   *
394   * @param { function } callback
395   * @returns { ToggleAttribute }
396   * @syscap SystemCapability.ArkUI.ArkUI.Full
397   * @crossplatform
398   * @form
399   * @atomicservice
400   * @since 11
401   */
402  onChange(callback: (isOn: boolean) => void): ToggleAttribute;
403
404  /**
405   * Set the content modifier of toggle.
406   *
407   * @param { ContentModifier<ToggleConfiguration> } modifier - The content modifier of toggle.
408   * @returns { ToggleAttribute }
409   * @syscap SystemCapability.ArkUI.ArkUI.Full
410   * @crossplatform
411   * @atomicservice
412   * @since 12
413   */
414  contentModifier(modifier: ContentModifier<ToggleConfiguration>): ToggleAttribute;
415
416  /**
417   * Called when the color of the selected button is set.
418   *
419   * @param { ResourceColor } value
420   * @returns { ToggleAttribute }
421   * @syscap SystemCapability.ArkUI.ArkUI.Full
422   * @since 8
423   */
424  /**
425   * Called when the color of the selected button is set.
426   *
427   * @param { ResourceColor } value
428   * @returns { ToggleAttribute }
429   * @syscap SystemCapability.ArkUI.ArkUI.Full
430   * @form
431   * @since 9
432   */
433  /**
434   * Called when the color of the selected button is set.
435   *
436   * @param { ResourceColor } value
437   * @returns { ToggleAttribute }
438   * @syscap SystemCapability.ArkUI.ArkUI.Full
439   * @crossplatform
440   * @form
441   * @since 10
442   */
443  /**
444   * Called when the color of the selected button is set.
445   *
446   * @param { ResourceColor } value
447   * @returns { ToggleAttribute }
448   * @syscap SystemCapability.ArkUI.ArkUI.Full
449   * @crossplatform
450   * @form
451   * @atomicservice
452   * @since 11
453   */
454  selectedColor(value: ResourceColor): ToggleAttribute;
455
456  /**
457   * Called when the color of the selected button is set.
458   *
459   * @param { ResourceColor } color
460   * @returns { ToggleAttribute }
461   * @syscap SystemCapability.ArkUI.ArkUI.Full
462   * @since 8
463   */
464  /**
465   * Called when the color of the selected button is set.
466   *
467   * @param { ResourceColor } color
468   * @returns { ToggleAttribute }
469   * @syscap SystemCapability.ArkUI.ArkUI.Full
470   * @form
471   * @since 9
472   */
473  /**
474   * Called when the color of the selected button is set.
475   *
476   * @param { ResourceColor } color
477   * @returns { ToggleAttribute }
478   * @syscap SystemCapability.ArkUI.ArkUI.Full
479   * @crossplatform
480   * @form
481   * @since 10
482   */
483  /**
484   * Called when the color of the selected button is set.
485   *
486   * @param { ResourceColor } color
487   * @returns { ToggleAttribute }
488   * @syscap SystemCapability.ArkUI.ArkUI.Full
489   * @crossplatform
490   * @form
491   * @atomicservice
492   * @since 11
493   */
494  switchPointColor(color: ResourceColor): ToggleAttribute;
495
496  /**
497   * Set the style of the switch.
498   *
499   * @param { SwitchStyle } value
500   * @returns { ToggleAttribute }
501   * @syscap SystemCapability.ArkUI.ArkUI.Full
502   * @crossplatform
503   * @atomicservice
504   * @since 12
505   */
506  switchStyle(value: SwitchStyle): ToggleAttribute;
507}
508
509/**
510 * Defines Toggle Component.
511 *
512 * @syscap SystemCapability.ArkUI.ArkUI.Full
513 * @since 8
514 */
515/**
516 * Defines Toggle Component.
517 *
518 * @syscap SystemCapability.ArkUI.ArkUI.Full
519 * @form
520 * @since 9
521 */
522/**
523 * Defines Toggle Component.
524 *
525 * @syscap SystemCapability.ArkUI.ArkUI.Full
526 * @crossplatform
527 * @form
528 * @since 10
529 */
530/**
531 * Defines Toggle Component.
532 *
533 * @syscap SystemCapability.ArkUI.ArkUI.Full
534 * @crossplatform
535 * @form
536 * @atomicservice
537 * @since 11
538 */
539declare const Toggle: ToggleInterface;
540
541/**
542 * Defines Toggle Component instance.
543 *
544 * @syscap SystemCapability.ArkUI.ArkUI.Full
545 * @since 8
546 */
547/**
548 * Defines Toggle Component instance.
549 *
550 * @syscap SystemCapability.ArkUI.ArkUI.Full
551 * @form
552 * @since 9
553 */
554/**
555 * Defines Toggle Component instance.
556 *
557 * @syscap SystemCapability.ArkUI.ArkUI.Full
558 * @crossplatform
559 * @form
560 * @since 10
561 */
562/**
563 * Defines Toggle Component instance.
564 *
565 * @syscap SystemCapability.ArkUI.ArkUI.Full
566 * @crossplatform
567 * @form
568 * @atomicservice
569 * @since 11
570 */
571declare const ToggleInstance: ToggleAttribute;
572