• 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 Provide some common interface for focus.
18 * @kit ArkUI
19 */
20
21/*** if arkts 1.2 */
22import { LengthMetrics , ColorMetrics } from '../Graphics';
23/*** endif */
24
25/**
26 * Focus box style.
27 *
28 * @interface FocusBoxStyle
29 * @syscap SystemCapability.ArkUI.ArkUI.Full
30 * @crossplatform
31 * @atomicservice
32 * @since arkts {'1.1':'12','1.2':'20'}
33 * @arkts 1.1&1.2
34 */
35declare interface FocusBoxStyle {
36  /**
37   * Describes the focus-box margin.
38   *
39   * @type { ?LengthMetrics }
40   * @syscap SystemCapability.ArkUI.ArkUI.Full
41   * @crossplatform
42   * @atomicservice
43   * @since arkts {'1.1':'12','1.2':'20'}
44   * @arkts 1.1&1.2
45   */
46  margin?: LengthMetrics;
47  /**
48   * Describes the focus-box color.
49   *
50   * @type { ?ColorMetrics }
51   * @syscap SystemCapability.ArkUI.ArkUI.Full
52   * @crossplatform
53   * @atomicservice
54   * @since arkts {'1.1':'12','1.2':'20'}
55   * @arkts 1.1&1.2
56   */
57  strokeColor?: ColorMetrics;
58  /**
59   * Describes the focus-box stroke width.
60   *
61   * @type { ?LengthMetrics }
62   * @syscap SystemCapability.ArkUI.ArkUI.Full
63   * @crossplatform
64   * @atomicservice
65   * @since arkts {'1.1':'12','1.2':'20'}
66   * @arkts 1.1&1.2
67   */
68  strokeWidth?: LengthMetrics;
69}
70
71/**
72 * Focus Priority
73 *
74 * @enum { number }
75 * @syscap SystemCapability.ArkUI.ArkUI.Full
76 * @crossplatform
77 * @atomicservice
78 * @since arkts {'1.1':'12','1.2':'20'}
79 * @arkts 1.1&1.2
80 */
81declare enum FocusPriority {
82  /**
83   * Default priority.
84   *
85   * @syscap SystemCapability.ArkUI.ArkUI.Full
86   * @crossplatform
87   * @atomicservice
88   * @since arkts {'1.1':'12','1.2':'20'}
89   * @arkts 1.1&1.2
90   */
91  AUTO = 0,
92
93  /**
94   * Prior priority.
95   *
96   * @syscap SystemCapability.ArkUI.ArkUI.Full
97   * @crossplatform
98   * @atomicservice
99   * @since arkts {'1.1':'12','1.2':'20'}
100   * @arkts 1.1&1.2
101   */
102  PRIOR = 2000,
103
104  /**
105   * Previous focus priority.
106   *
107   * @syscap SystemCapability.ArkUI.ArkUI.Full
108   * @crossplatform
109   * @atomicservice
110   * @since arkts {'1.1':'12','1.2':'20'}
111   * @arkts 1.1&1.2
112   */
113  PREVIOUS = 3000,
114}
115
116/**
117 * Key processing mode.
118 * Determines the priority of key event processing when component cannot handle the key event.
119 *
120 * @enum { number }
121 * @syscap SystemCapability.ArkUI.ArkUI.Full
122 * @crossplatform
123 * @atomicservice
124 * @since arkts {'1.1':'15','1.2':'20'}
125 * @arkts 1.1&1.2
126 */
127declare enum KeyProcessingMode {
128  /**
129   * Key events are used to move focus.
130   *
131   * @syscap SystemCapability.ArkUI.ArkUI.Full
132   * @crossplatform
133   * @atomicservice
134   * @since arkts {'1.1':'15','1.2':'20'}
135   * @arkts 1.1&1.2
136   */
137  FOCUS_NAVIGATION = 0,
138
139  /**
140   * Key events bubble up to ancestors.
141   *
142   * @syscap SystemCapability.ArkUI.ArkUI.Full
143   * @crossplatform
144   * @atomicservice
145   * @since arkts {'1.1':'15','1.2':'20'}
146   * @arkts 1.1&1.2
147   */
148  ANCESTOR_EVENT = 1,
149}