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