• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2024 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 Defines the arc button component
18 * @kit ArkUI
19 */
20
21import { ColorMetrics, LengthMetrics } from '@ohos.arkui.node';
22
23 /**
24 * Describes the Position of arc button.
25 *
26 * @enum { number }
27 * @syscap SystemCapability.ArkUI.ArkUI.Circle
28 * @crossplatform
29 * @atomicservice
30 * @since 18
31 */
32export declare enum ArcButtonPosition {
33    /**
34     * The top edge button is located above the circular screen.
35     *
36     * @syscap SystemCapability.ArkUI.ArkUI.Circle
37     * @crossplatform
38     * @atomicservice
39     * @since 18
40     */
41    TOP_EDGE = 0,
42    /**
43     * The bottom edge button is located below the circular screen.
44     *
45     * @syscap SystemCapability.ArkUI.ArkUI.Circle
46     * @crossplatform
47     * @atomicservice
48     * @since 18
49     */
50    BOTTOM_EDGE = 1
51}
52
53/**
54 * Provides an arc button style.
55 *
56 * @enum { number }
57 * @syscap SystemCapability.ArkUI.ArkUI.Circle
58 * @crossplatform
59 * @atomicservice
60 * @since 18
61 */
62export declare enum ArcButtonStyleMode {
63    /**
64     * Emphasis status, light style.
65     *
66     * @syscap SystemCapability.ArkUI.ArkUI.Circle
67     * @crossplatform
68     * @atomicservice
69     * @since 18
70     */
71    EMPHASIZED_LIGHT = 0,
72    /**
73     * Emphasis status, dark style.
74     *
75     * @syscap SystemCapability.ArkUI.ArkUI.Circle
76     * @crossplatform
77     * @atomicservice
78     * @since 18
79     */
80    EMPHASIZED_DARK = 1,
81    /**
82     * Normal status, light style.
83     *
84     * @syscap SystemCapability.ArkUI.ArkUI.Circle
85     * @crossplatform
86     * @atomicservice
87     * @since 18
88     */
89    NORMAL_LIGHT = 2,
90    /**
91     * Normal status, dark style.
92     *
93     * @syscap SystemCapability.ArkUI.ArkUI.Circle
94     * @crossplatform
95     * @atomicservice
96     * @since 18
97     */
98    NORMAL_DARK = 3,
99
100    /**
101     * Custom status, custom style.
102     *
103     * @syscap SystemCapability.ArkUI.ArkUI.Circle
104     * @crossplatform
105     * @atomicservice
106     * @since 18
107     */
108    CUSTOM = 4
109}
110
111/**
112 * Defines an arc button status.
113 *
114 * @enum { number }
115 * @syscap SystemCapability.ArkUI.ArkUI.Circle
116 * @crossplatform
117 * @atomicservice
118 * @since 18
119 */
120export declare enum ArcButtonStatus {
121    /**
122     * Normal state.
123     *
124     * @syscap SystemCapability.ArkUI.ArkUI.Circle
125     * @crossplatform
126     * @atomicservice
127     * @since 18
128     */
129    NORMAL = 0,
130    /**
131     * Pressed state.
132     *
133     * @syscap SystemCapability.ArkUI.ArkUI.Circle
134     * @crossplatform
135     * @atomicservice
136     * @since 18
137     */
138    PRESSED = 1,
139    /**
140     * Disabled state.
141     *
142     * @syscap SystemCapability.ArkUI.ArkUI.Circle
143     * @crossplatform
144     * @atomicservice
145     * @since 18
146     */
147    DISABLED = 2
148}
149
150/**
151 * Defines the arc button options.
152 *
153 * @interface CommonArcButtonOptions
154 * @syscap SystemCapability.ArkUI.ArkUI.Circle
155 * @crossplatform
156 * @atomicservice
157 * @since 18
158 */
159interface CommonArcButtonOptions {
160    /**
161     * Describes the arc button position.
162     *
163     * @type { ? ArcButtonPosition}
164     * @syscap SystemCapability.ArkUI.ArkUI.Circle
165     * @crossplatform
166     * @atomicservice
167     * @since 18
168     */
169    position?: ArcButtonPosition;
170    /**
171     * Describes the arc button style mode.
172     *
173     * @type { ?ArcButtonStyleMode }
174     * @syscap SystemCapability.ArkUI.ArkUI.Circle
175     * @crossplatform
176     * @atomicservice
177     * @since 18
178     */
179    styleMode?: ArcButtonStyleMode;
180    /**
181     * Describes the arc button status.
182     *
183     * @type { ?ArcButtonStatus }
184     * @syscap SystemCapability.ArkUI.ArkUI.Circle
185     * @crossplatform
186     * @atomicservice
187     * @since 18
188     */
189    status?: ArcButtonStatus;
190    /**
191     * Describes the arc button displays text.
192     *
193     * @type { ?ResourceStr }
194     * @syscap SystemCapability.ArkUI.ArkUI.Circle
195     * @crossplatform
196     * @atomicservice
197     * @since 18
198     */
199    label?: ResourceStr;
200    /**
201     * Describe the blurred background style of the arc-shaped button.
202     *
203     * @type { ?BlurStyle }
204     * @syscap SystemCapability.ArkUI.ArkUI.Circle
205     * @crossplatform
206     * @atomicservice
207     * @since 18
208     */
209    backgroundBlurStyle?: BlurStyle;
210    /**
211     * Describes the arc button background color.
212     *
213     * @type { ?ColorMetrics }
214     * @syscap SystemCapability.ArkUI.ArkUI.Circle
215     * @crossplatform
216     * @atomicservice
217     * @since 18
218     */
219    backgroundColor?: ColorMetrics;
220    /**
221     * Describes the arc button shadow color.
222     *
223     * @type { ?ColorMetrics }
224     * @syscap SystemCapability.ArkUI.ArkUI.Circle
225     * @crossplatform
226     * @atomicservice
227     * @since 18
228     */
229    shadowColor?: ColorMetrics;
230    /**
231     * Describes the arc button shadow switch.
232     *
233     * @type { ?boolean }
234     * @syscap SystemCapability.ArkUI.ArkUI.Circle
235     * @crossplatform
236     * @atomicservice
237     * @since 18
238     */
239    shadowEnabled?: boolean;
240    /**
241     * Describes the arc button text size.
242     *
243     * @type { ?LengthMetrics }
244     * @syscap SystemCapability.ArkUI.ArkUI.Circle
245     * @crossplatform
246     * @atomicservice
247     * @since 18
248     */
249    fontSize?: LengthMetrics;
250    /**
251     * Describes the arc button text color.
252     *
253     * @type { ?ColorMetrics }
254     * @syscap SystemCapability.ArkUI.ArkUI.Circle
255     * @crossplatform
256     * @atomicservice
257     * @since 18
258     */
259    fontColor?: ColorMetrics;
260    /**
261     * Describes the arc button pressed text color.
262     *
263     * @type { ?ColorMetrics }
264     * @syscap SystemCapability.ArkUI.ArkUI.Circle
265     * @crossplatform
266     * @atomicservice
267     * @since 18
268     */
269    pressedFontColor?: ColorMetrics;
270    /**
271     * Describes the arc button text style.
272     *
273     * @type { ?FontStyle }
274     * @syscap SystemCapability.ArkUI.ArkUI.Circle
275     * @crossplatform
276     * @atomicservice
277     * @since 18
278     */
279    fontStyle?: FontStyle;
280    /**
281     * Describes the arc button text family.
282     *
283     * @type { ?(string | Resource) }
284     * @syscap SystemCapability.ArkUI.ArkUI.Circle
285     * @crossplatform
286     * @atomicservice
287     * @since 18
288     */
289    fontFamily?: string | Resource;
290    /**
291     * Describes the arc button text margin.
292     *
293     * @type { ?LocalizedMargin }
294     * @syscap SystemCapability.ArkUI.ArkUI.Circle
295     * @crossplatform
296     * @atomicservice
297     * @since 18
298     */
299    fontMargin?: LocalizedMargin;
300
301    /**
302     * Describes the arc button touch event.
303     *
304     * @type { ?Callback<TouchEvent> }
305     * @syscap SystemCapability.ArkUI.ArkUI.Circle
306     * @crossplatform
307     * @atomicservice
308     * @since 18
309     */
310    onTouch?: Callback<TouchEvent>;
311
312    /**
313     * Describes the arc button click event.
314     *
315     * @type { ?Callback<ClickEvent> }
316     * @syscap SystemCapability.ArkUI.ArkUI.Circle
317     * @crossplatform
318     * @atomicservice
319     * @since 18
320     */
321    onClick?: Callback<ClickEvent>;
322}
323/**
324 * The class for ArcButtonOptions.
325 *
326 * @syscap SystemCapability.ArkUI.ArkUI.Circle
327 * @crossplatform
328 * @atomicservice
329 * @since 18
330 */
331export declare class ArcButtonOptions {
332    /**
333     * Describes the position of button on screen.
334     *
335     * @type { ArcButtonPosition }
336     * @syscap SystemCapability.ArkUI.ArkUI.Circle
337     * @crossplatform
338     * @atomicservice
339     * @since 18
340     */
341    position: ArcButtonPosition;
342    /**
343     * Describes the controller for scrollable container.
344     *
345     * @type { ArcButtonStyleMode }
346     * @syscap SystemCapability.ArkUI.ArkUI.Circle
347     * @crossplatform
348     * @atomicservice
349     * @since 18
350     */
351    styleMode: ArcButtonStyleMode;
352    /**
353     * Describes the arc button status.
354     *
355     * @type { ArcButtonStatus }
356     * @syscap SystemCapability.ArkUI.ArkUI.Circle
357     * @crossplatform
358     * @atomicservice
359     * @since 18
360     */
361    status: ArcButtonStatus;
362    /**
363     * Describes the arc button displays text.
364     *
365     * @type { ResourceStr }
366     * @syscap SystemCapability.ArkUI.ArkUI.Circle
367     * @crossplatform
368     * @atomicservice
369     * @since 18
370     */
371    label: ResourceStr;
372    /**
373     * Describe the blurred background style of the arc-shaped button.
374     *
375     * @type { BlurStyle }
376     * @syscap SystemCapability.ArkUI.ArkUI.Circle
377     * @crossplatform
378     * @atomicservice
379     * @since 18
380     */
381    backgroundBlurStyle: BlurStyle;
382    /**
383     * Describes the arc button background color.
384     *
385     * @type { ColorMetrics }
386     * @syscap SystemCapability.ArkUI.ArkUI.Circle
387     * @crossplatform
388     * @atomicservice
389     * @since 18
390     */
391    backgroundColor: ColorMetrics;
392    /**
393     * Describes the arc button shadow color.
394     *
395     * @type { ColorMetrics }
396     * @syscap SystemCapability.ArkUI.ArkUI.Circle
397     * @crossplatform
398     * @atomicservice
399     * @since 18
400     */
401    shadowColor: ColorMetrics;
402    /**
403     * Describes the arc button shadow switch.
404     *
405     * @type { boolean }
406     * @syscap SystemCapability.ArkUI.ArkUI.Circle
407     * @crossplatform
408     * @atomicservice
409     * @since 18
410     */
411    shadowEnabled: boolean;
412    /**
413     * Describes the arc button text size.
414     *
415     * @type { LengthMetrics }
416     * @syscap SystemCapability.ArkUI.ArkUI.Circle
417     * @crossplatform
418     * @atomicservice
419     * @since 18
420     */
421    fontSize: LengthMetrics;
422    /**
423     * Describes the arc button text color.
424     *
425     * @type { ColorMetrics }
426     * @syscap SystemCapability.ArkUI.ArkUI.Circle
427     * @crossplatform
428     * @atomicservice
429     * @since 18
430     */
431    fontColor: ColorMetrics;
432    /**
433     * Describes the arc button pressed text color.
434     *
435     * @type { ColorMetrics }
436     * @syscap SystemCapability.ArkUI.ArkUI.Circle
437     * @crossplatform
438     * @atomicservice
439     * @since 18
440     */
441    pressedFontColor: ColorMetrics;
442    /**
443     * Describes the arc button text style.
444     *
445     * @type { FontStyle }
446     * @syscap SystemCapability.ArkUI.ArkUI.Circle
447     * @crossplatform
448     * @atomicservice
449     * @since 18
450     */
451    fontStyle: FontStyle;
452    /**
453     * Describes the arc button text family.
454     *
455     * @type { (string | Resource) }
456     * @syscap SystemCapability.ArkUI.ArkUI.Circle
457     * @crossplatform
458     * @atomicservice
459     * @since 18
460     */
461    fontFamily: string | Resource;
462    /**
463     * Describes the arc button text margin.
464     *
465     * @type { LocalizedMargin }
466     * @syscap SystemCapability.ArkUI.ArkUI.Circle
467     * @crossplatform
468     * @atomicservice
469     * @since 18
470     */
471    fontMargin: LocalizedMargin;
472
473    /**
474     * Describes the arc button touch event.
475     *
476     * @type { ?Callback<TouchEvent> }
477     * @syscap SystemCapability.ArkUI.ArkUI.Circle
478     * @crossplatform
479     * @atomicservice
480     * @since 18
481     */
482    onTouch?: Callback<TouchEvent>;
483
484    /**
485     * Describes the arc button click event.
486     *
487     * @type { ?Callback<ClickEvent> }
488     * @syscap SystemCapability.ArkUI.ArkUI.Circle
489     * @crossplatform
490     * @atomicservice
491     * @since 18
492     */
493    onClick?: Callback<ClickEvent>;
494
495    /**
496     * Constructor of the CommonArcButtonOptions.
497     *
498     * @param { CommonArcButtonOptions } options
499     * @syscap SystemCapability.ArkUI.ArkUI.Circle
500     * @crossplatform
501     * @atomicservice
502     * @since 18
503     */
504    constructor(options: CommonArcButtonOptions);
505}
506/**
507 * Declare Component ArcButton
508 *
509 * @syscap SystemCapability.ArkUI.ArkUI.Circle
510 * @crossplatform
511 * @atomicservice
512 * @since 18
513 */
514@Component
515export declare struct ArcButton {
516    /**
517     * Describes the arc button options.
518     *
519     * @type { ArcButtonOptions }
520     * @syscap SystemCapability.ArkUI.ArkUI.Circle
521     * @crossplatform
522     * @atomicservice
523     * @since 18
524     */
525    @Require
526    readonly options: ArcButtonOptions;
527}
528