1/* 2 * Copyright (c) 2023-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 23 24import { SymbolGlyphModifier, DividerModifier } from './@ohos.arkui.modifier'; 25import { LengthMetrics } from './@ohos.arkui.node'; 26/** 27 * Declare enum ItemState 28 * @enum { ItemState } 29 * @syscap SystemCapability.ArkUI.ArkUI.Full 30 * @since 10 31 */ 32/** 33 * Declare enum ItemState 34 * @enum { ItemState } 35 * @syscap SystemCapability.ArkUI.ArkUI.Full 36 * @atomicservice 37 * @since 11 38 */ 39export declare enum ItemState { 40 /** 41 * Enable type. 42 * @syscap SystemCapability.ArkUI.ArkUI.Full 43 * @since 10 44 */ 45 /** 46 * Enable type. 47 * @syscap SystemCapability.ArkUI.ArkUI.Full 48 * @atomicservice 49 * @since 11 50 */ 51 ENABLE = 1, 52 /** 53 * Disable type. 54 * @syscap SystemCapability.ArkUI.ArkUI.Full 55 * @since 10 56 */ 57 /** 58 * Disable type. 59 * @syscap SystemCapability.ArkUI.ArkUI.Full 60 * @atomicservice 61 * @since 11 62 */ 63 DISABLE = 2, 64 /** 65 * Activate type. 66 * @syscap SystemCapability.ArkUI.ArkUI.Full 67 * @since 10 68 */ 69 /** 70 * Activate type. 71 * @syscap SystemCapability.ArkUI.ArkUI.Full 72 * @atomicservice 73 * @since 11 74 */ 75 ACTIVATE = 3 76} 77 78/** 79 * Defines toolBar symbolGlyph options. 80 * 81 * @interface ToolBarSymbolGlyphOptions 82 * @syscap SystemCapability.ArkUI.ArkUI.Full 83 * @atomicservice 84 * @since 13 85 */ 86export interface ToolBarSymbolGlyphOptions { 87 88 /** 89 * Modifier of toolbar's normal symbol. 90 * 91 * @type { ?SymbolGlyphModifier } 92 * @syscap SystemCapability.ArkUI.ArkUI.Full 93 * @atomicservice 94 * @since 13 95 */ 96 normal?: SymbolGlyphModifier; 97 98 /** 99 * Modifier of toolbar's activated symbol. 100 * 101 * @type { ?SymbolGlyphModifier } 102 * @syscap SystemCapability.ArkUI.ArkUI.Full 103 * @atomicservice 104 * @since 13 105 */ 106 activated?: SymbolGlyphModifier; 107} 108 109/** 110 * Declare type ToolBarOption 111 * @syscap SystemCapability.ArkUI.ArkUI.Full 112 * @since 10 113 */ 114/** 115 * Declare type ToolBarOption 116 * @syscap SystemCapability.ArkUI.ArkUI.Full 117 * @atomicservice 118 * @since 11 119 */ 120@Observed 121export declare class ToolBarOption { 122 /** 123 * Define text content. 124 * @type { ResourceStr }. 125 * @syscap SystemCapability.ArkUI.ArkUI.Full 126 * @since 10 127 */ 128 /** 129 * Define text content. 130 * @type { ResourceStr }. 131 * @syscap SystemCapability.ArkUI.ArkUI.Full 132 * @atomicservice 133 * @since 11 134 */ 135 content: ResourceStr; 136 /** 137 * Define the action event. 138 * @type { ?() => void }. 139 * @syscap SystemCapability.ArkUI.ArkUI.Full 140 * @since 10 141 */ 142 /** 143 * Define the action event. 144 * @type { ?() => void }. 145 * @syscap SystemCapability.ArkUI.ArkUI.Full 146 * @atomicservice 147 * @since 11 148 */ 149 action?: () => void; 150 /** 151 * Define icon resource. 152 * @type { ?Resource }. 153 * @syscap SystemCapability.ArkUI.ArkUI.Full 154 * @since 10 155 */ 156 /** 157 * Define icon resource. 158 * @type { ?Resource }. 159 * @syscap SystemCapability.ArkUI.ArkUI.Full 160 * @atomicservice 161 * @since 11 162 */ 163 icon?: Resource; 164 /** 165 * Define item type. 166 * @type { ?ItemState }. 167 * @syscap SystemCapability.ArkUI.ArkUI.Full 168 * @since 10 169 */ 170 /** 171 * Define item type. 172 * @type { ?ItemState }. 173 * @syscap SystemCapability.ArkUI.ArkUI.Full 174 * @atomicservice 175 * @since 11 176 */ 177 state?: ItemState; 178 /** 179 * Define text fontColor. 180 * @type { ?ResourceColor }. 181 * @syscap SystemCapability.ArkUI.ArkUI.Full 182 * @atomicservice 183 * @since 13 184 */ 185 textColor?: ResourceColor; 186 /** 187 * Text fontColor when the item is activated. 188 * @type { ?ResourceColor }. 189 * @syscap SystemCapability.ArkUI.ArkUI.Full 190 * @atomicservice 191 * @since 13 192 */ 193 activatedTextColor?: ResourceColor; 194 /** 195 * Define icon fillColor. 196 * @type { ?ResourceColor }. 197 * @syscap SystemCapability.ArkUI.ArkUI.Full 198 * @atomicservice 199 * @since 13 200 */ 201 iconColor?: ResourceColor; 202 /** 203 * Icon fillColor when the item is activated. 204 * @type { ?ResourceColor }. 205 * @syscap SystemCapability.ArkUI.ArkUI.Full 206 * @atomicservice 207 * @since 13 208 */ 209 activatedIconColor?: ResourceColor; 210 /** 211 * Item symbol icon. 212 * 213 * @type { ?ToolBarSymbolGlyphOptions } 214 * @syscap SystemCapability.ArkUI.ArkUI.Full 215 * @atomicservice 216 * @since 13 217 */ 218 toolBarSymbolOptions?: ToolBarSymbolGlyphOptions; 219} 220 221/** 222 * Declare ToolBarOptions use in ToolBar 223 * @syscap SystemCapability.ArkUI.ArkUI.Full 224 * @since 10 225 */ 226/** 227 * Declare ToolBarOptions use in ToolBar 228 * @syscap SystemCapability.ArkUI.ArkUI.Full 229 * @atomicservice 230 * @since 11 231 */ 232@Observed 233export declare class ToolBarOptions extends Array<ToolBarOption> { 234} 235 236/** 237 * Declare ToolBarModifier use in ToolBar 238 * @syscap SystemCapability.ArkUI.ArkUI.Full 239 * @atomicservice 240 * @since 13 241 */ 242export declare class ToolBarModifier { 243 /** 244 * Sets the height of the toolBar. 245 * 246 * @param { LengthMetrics } height - toolBar's height. 247 * @returns { ToolBarModifier } returns the instance of the ToolBarModifier. 248 * @syscap SystemCapability.ArkUI.ArkUI.Full 249 * @atomicservice 250 * @since 13 251 */ 252 height(height: LengthMetrics): ToolBarModifier; 253 /** 254 * Sets the backgroundColor of the toolBar. 255 * 256 * @param { ResourceColor } backgroundColor - toolBar's backgroundColor. 257 * @returns { ToolBarModifier } returns the instance of the ToolBarModifier. 258 * @syscap SystemCapability.ArkUI.ArkUI.Full 259 * @atomicservice 260 * @since 13 261 */ 262 backgroundColor(backgroundColor: ResourceColor): ToolBarModifier; 263 /** 264 * Sets the left and right padding of the toolbar. 265 * 266 * @param { LengthMetrics } padding - left and right padding. 267 * @returns { ToolBarModifier } returns the instance of the ToolBarModifier. 268 * @syscap SystemCapability.ArkUI.ArkUI.Full 269 * @atomicservice 270 * @since 13 271 */ 272 padding(padding: LengthMetrics): ToolBarModifier; 273 /** 274 * Sets whether or not to display the press status effect. 275 * 276 * @param { boolean } stateEffect - press status effect. 277 * @returns { ToolBarModifier } returns the instance of the ToolBarModifier. 278 * @syscap SystemCapability.ArkUI.ArkUI.Full 279 * @atomicservice 280 * @since 13 281 */ 282 stateEffect(stateEffect: boolean): ToolBarModifier; 283} 284 285/** 286 * Declare Component ToolBar 287 * @syscap SystemCapability.ArkUI.ArkUI.Full 288 * @since 10 289 */ 290/** 291 * Declare Component ToolBar 292 * @syscap SystemCapability.ArkUI.ArkUI.Full 293 * @atomicservice 294 * @since 11 295 */ 296@Component 297export declare struct ToolBar { 298 /** 299 * Define toolbar list array. 300 * @type { ToolBarOptions }. 301 * @syscap SystemCapability.ArkUI.ArkUI.Full 302 * @since 10 303 */ 304 /** 305 * Define toolbar list array. 306 * @type { ToolBarOptions }. 307 * @syscap SystemCapability.ArkUI.ArkUI.Full 308 * @atomicservice 309 * @since 11 310 */ 311 @ObjectLink toolBarList: ToolBarOptions; 312 /** 313 * Define toolbar activate item index, default is -1. 314 * @type { ?number }. 315 * @syscap SystemCapability.ArkUI.ArkUI.Full 316 * @since 10 317 */ 318 /** 319 * Define toolbar activate item index, default is -1. 320 * @type { ?number }. 321 * @syscap SystemCapability.ArkUI.ArkUI.Full 322 * @atomicservice 323 * @since 11 324 */ 325 @Prop activateIndex?: number; 326 /** 327 * Define toolbar controller. 328 * @type { TabsController }. 329 * @syscap SystemCapability.ArkUI.ArkUI.Full 330 * @since 10 331 */ 332 /** 333 * Define toolbar controller. 334 * @type { TabsController }. 335 * @syscap SystemCapability.ArkUI.ArkUI.Full 336 * @atomicservice 337 * @since 11 338 */ 339 controller: TabsController; 340 /** 341 * Define divider Modifier. 342 * @type { ?DividerModifier }. 343 * @syscap SystemCapability.ArkUI.ArkUI.Full 344 * @atomicservice 345 * @since 13 346 */ 347 @Prop dividerModifier?: DividerModifier; 348 /** 349 * Define toolbar modifier. 350 * @type { ?ToolBarModifier }. 351 * @syscap SystemCapability.ArkUI.ArkUI.Full 352 * @atomicservice 353 * @since 13 354 */ 355 @Prop toolBarModifier?: ToolBarModifier; 356}