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 18 * @kit ArkUI 19 */ 20 21import { SymbolGlyphModifier, DividerModifier } from './@ohos.arkui.modifier'; 22import { ColorMetrics, LengthMetrics } from './@ohos.arkui.node'; 23/** 24 * Declare enum ToolBarV2ItemState 25 * 26 * @enum { number } 27 * @syscap SystemCapability.ArkUI.ArkUI.Full 28 * @crossplatform 29 * @atomicservice 30 * @since 18 31 */ 32export declare enum ToolBarV2ItemState { 33 /** 34 * Enable type. 35 * 36 * @syscap SystemCapability.ArkUI.ArkUI.Full 37 * @crossplatform 38 * @atomicservice 39 * @since 18 40 */ 41 ENABLE = 1, 42 /** 43 * Disable type. 44 * 45 * @syscap SystemCapability.ArkUI.ArkUI.Full 46 * @crossplatform 47 * @atomicservice 48 * @since 18 49 */ 50 DISABLE = 2, 51 /** 52 * Activate type. 53 * 54 * @syscap SystemCapability.ArkUI.ArkUI.Full 55 * @crossplatform 56 * @atomicservice 57 * @since 18 58 */ 59 ACTIVATE = 3 60} 61 62/** 63 * Defines toolBarV2 symbolGlyph. 64 * 65 * @syscap SystemCapability.ArkUI.ArkUI.Full 66 * @crossplatform 67 * @atomicservice 68 * @since 18 69 */ 70@ObservedV2 71export class ToolBarV2SymbolGlyph { 72 /** 73 * Modifier of toolbarV2's normal symbol. 74 * 75 * @type { SymbolGlyphModifier } 76 * @syscap SystemCapability.ArkUI.ArkUI.Full 77 * @crossplatform 78 * @atomicservice 79 * @since 18 80 */ 81 @Trace 82 normal: SymbolGlyphModifier; 83 /** 84 * Modifier of toolbarV2's activated symbol. 85 * 86 * @type { ?SymbolGlyphModifier } 87 * @syscap SystemCapability.ArkUI.ArkUI.Full 88 * @crossplatform 89 * @atomicservice 90 * @since 18 91 */ 92 @Trace 93 activated?: SymbolGlyphModifier; 94 /** 95 * The constructor used to create a ToolBarV2SymbolGlyph object. 96 * 97 * @param { ToolBarV2SymbolGlyphOptions } options - symbol info. 98 * @syscap SystemCapability.ArkUI.ArkUI.Full 99 * @crossplatform 100 * @atomicservice 101 * @since 18 102 */ 103 constructor(options: ToolBarV2SymbolGlyphOptions); 104} 105 106/** 107 * Declare the options of ToolBarV2SymbolGlyph 108 * 109 * @interface ToolBarV2SymbolGlyphOptions 110 * @syscap SystemCapability.ArkUI.ArkUI.Full 111 * @crossplatform 112 * @atomicservice 113 * @since 18 114 */ 115export interface ToolBarV2SymbolGlyphOptions { 116 /** 117 * Modifier of toolbarV2's normal symbol. 118 * 119 * @type { SymbolGlyphModifier } 120 * @syscap SystemCapability.ArkUI.ArkUI.Full 121 * @crossplatform 122 * @atomicservice 123 * @since 18 124 */ 125 normal: SymbolGlyphModifier; 126 /** 127 * Modifier of toolbarV2's activated symbol. 128 * 129 * @type { ?SymbolGlyphModifier } 130 * @syscap SystemCapability.ArkUI.ArkUI.Full 131 * @crossplatform 132 * @atomicservice 133 * @since 18 134 */ 135 activated?: SymbolGlyphModifier; 136} 137 138/** 139 * Declare type ToolBarV2ItemText 140 * 141 * @class ToolBarV2ItemText 142 * @syscap SystemCapability.ArkUI.ArkUI.Full 143 * @crossplatform 144 * @atomicservice 145 * @since 18 146 */ 147@ObservedV2 148export declare class ToolBarV2ItemText { 149 /** 150 * Define text content. 151 * 152 * @type { ResourceStr }. 153 * @syscap SystemCapability.ArkUI.ArkUI.Full 154 * @crossplatform 155 * @atomicservice 156 * @since 18 157 */ 158 @Trace 159 text: ResourceStr; 160 /** 161 * Define text fontColor. 162 * 163 * @type { ?ColorMetrics }. 164 * @syscap SystemCapability.ArkUI.ArkUI.Full 165 * @crossplatform 166 * @atomicservice 167 * @since 18 168 */ 169 @Trace 170 color?: ColorMetrics; 171 /** 172 * Text fontColor when the item is activated. 173 * 174 * @type { ?ColorMetrics }. 175 * @syscap SystemCapability.ArkUI.ArkUI.Full 176 * @crossplatform 177 * @atomicservice 178 * @since 18 179 */ 180 @Trace 181 activatedColor?: ColorMetrics; 182 /** 183 * The constructor used to create a ToolBarV2ItemText object. 184 * 185 * @param { ToolBarV2ItemTextOptions } options - text info. 186 * @syscap SystemCapability.ArkUI.ArkUI.Full 187 * @crossplatform 188 * @atomicservice 189 * @since 18 190 */ 191 constructor(options: ToolBarV2ItemTextOptions); 192} 193 194/** 195 * Declare the options of ToolBarV2ItemText 196 * 197 * @interface ToolBarV2ItemTextOptions 198 * @syscap SystemCapability.ArkUI.ArkUI.Full 199 * @crossplatform 200 * @atomicservice 201 * @since 18 202 */ 203export interface ToolBarV2ItemTextOptions { 204 /** 205 * Define text content. 206 * 207 * @type { ResourceStr }. 208 * @syscap SystemCapability.ArkUI.ArkUI.Full 209 * @crossplatform 210 * @atomicservice 211 * @since 18 212 */ 213 text: ResourceStr; 214 /** 215 * Define text fontColor. 216 * 217 * @type { ?ColorMetrics }. 218 * @syscap SystemCapability.ArkUI.ArkUI.Full 219 * @crossplatform 220 * @atomicservice 221 * @since 18 222 */ 223 color?: ColorMetrics; 224 /** 225 * Text fontColor when the item is activated. 226 * 227 * @type { ?ColorMetrics }. 228 * @syscap SystemCapability.ArkUI.ArkUI.Full 229 * @crossplatform 230 * @atomicservice 231 * @since 18 232 */ 233 activatedColor?: ColorMetrics; 234} 235 236/** 237 * Defines the icon type of ToolBarV2 item. 238 * 239 * @syscap SystemCapability.ArkUI.ArkUI.Full 240 * @crossplatform 241 * @atomicservice 242 * @since 18 243 */ 244export declare type ToolBarV2ItemIconType = ToolBarV2ItemImage | ToolBarV2SymbolGlyph; 245 246/** 247 * Declare type ToolBarV2ItemImage 248 * 249 * @class ToolBarV2ItemImage 250 * @syscap SystemCapability.ArkUI.ArkUI.Full 251 * @crossplatform 252 * @atomicservice 253 * @since 18 254 */ 255@ObservedV2 256export declare class ToolBarV2ItemImage { 257 /** 258 * Define icon resource. 259 * 260 * @type { ResourceStr }. 261 * @syscap SystemCapability.ArkUI.ArkUI.Full 262 * @crossplatform 263 * @atomicservice 264 * @since 18 265 */ 266 @Trace 267 src: ResourceStr; 268 /** 269 * Define icon fillColor. 270 * 271 * @type { ?ColorMetrics }. 272 * @syscap SystemCapability.ArkUI.ArkUI.Full 273 * @crossplatform 274 * @atomicservice 275 * @since 18 276 */ 277 @Trace 278 color?: ColorMetrics; 279 /** 280 * Icon fillColor when the item is activated. 281 * 282 * @type { ?ColorMetrics }. 283 * @syscap SystemCapability.ArkUI.ArkUI.Full 284 * @crossplatform 285 * @atomicservice 286 * @since 18 287 */ 288 @Trace 289 activatedColor?: ColorMetrics; 290 /** 291 * The constructor used to create a ToolBarV2ItemImage object. 292 * 293 * @param { ToolBarV2ItemImageOptions } options - text info. 294 * @syscap SystemCapability.ArkUI.ArkUI.Full 295 * @crossplatform 296 * @atomicservice 297 * @since 18 298 */ 299 constructor(options: ToolBarV2ItemImageOptions); 300} 301 302/** 303 * Declare the options of ToolBarV2ItemImage 304 * 305 * @interface ToolBarV2ItemImageOptions 306 * @syscap SystemCapability.ArkUI.ArkUI.Full 307 * @crossplatform 308 * @atomicservice 309 * @since 18 310 */ 311export interface ToolBarV2ItemImageOptions { 312 /** 313 * Define icon resource. 314 * 315 * @type { ResourceStr }. 316 * @syscap SystemCapability.ArkUI.ArkUI.Full 317 * @crossplatform 318 * @atomicservice 319 * @since 18 320 */ 321 src: ResourceStr; 322 /** 323 * Define icon fillColor. 324 * 325 * @type { ?ColorMetrics }. 326 * @syscap SystemCapability.ArkUI.ArkUI.Full 327 * @crossplatform 328 * @atomicservice 329 * @since 18 330 */ 331 color?: ColorMetrics; 332 /** 333 * Icon fillColor when the item is activated. 334 * 335 * @type { ?ColorMetrics }. 336 * @syscap SystemCapability.ArkUI.ArkUI.Full 337 * @crossplatform 338 * @atomicservice 339 * @since 18 340 */ 341 activatedColor?: ColorMetrics; 342} 343 344/** 345 * Declare type ToolBarV2Item 346 * 347 * @class ToolBarV2Item 348 * @syscap SystemCapability.ArkUI.ArkUI.Full 349 * @crossplatform 350 * @atomicservice 351 * @since 18 352 */ 353@ObservedV2 354export declare class ToolBarV2Item { 355 /** 356 * Define text content. 357 * 358 * @type { ToolBarV2ItemText }. 359 * @syscap SystemCapability.ArkUI.ArkUI.Full 360 * @crossplatform 361 * @atomicservice 362 * @since 18 363 */ 364 @Trace 365 content: ToolBarV2ItemText; 366 /** 367 * Define the action event. 368 * 369 * @type { ?ToolBarV2ItemAction }. 370 * @syscap SystemCapability.ArkUI.ArkUI.Full 371 * @crossplatform 372 * @atomicservice 373 * @since 18 374 */ 375 @Trace 376 action?: ToolBarV2ItemAction; 377 /** 378 * Define icon resource. 379 * 380 * @type { ?ToolBarV2ItemIconType }. 381 * @syscap SystemCapability.ArkUI.ArkUI.Full 382 * @crossplatform 383 * @atomicservice 384 * @since 18 385 */ 386 @Trace 387 icon?: ToolBarV2ItemIconType; 388 /** 389 * Define item type. 390 * 391 * @type { ?ToolBarV2ItemState }. 392 * @syscap SystemCapability.ArkUI.ArkUI.Full 393 * @crossplatform 394 * @atomicservice 395 * @since 18 396 */ 397 @Trace 398 state?: ToolBarV2ItemState; 399 /** 400 * The accessibilityText of item. 401 * 402 * @type { ?ResourceStr } 403 * @syscap SystemCapability.ArkUI.ArkUI.Full 404 * @crossplatform 405 * @atomicservice 406 * @since 18 407 */ 408 @Trace 409 accessibilityText?: ResourceStr; 410 /** 411 * The accessibilityDescription of item. 412 * 413 * @type { ?ResourceStr } 414 * @syscap SystemCapability.ArkUI.ArkUI.Full 415 * @crossplatform 416 * @atomicservice 417 * @since 18 418 */ 419 @Trace 420 accessibilityDescription?: ResourceStr; 421 /** 422 * The accessibilityLevel of item. 423 * 424 * @type { ?string } 425 * @default "auto" 426 * @syscap SystemCapability.ArkUI.ArkUI.Full 427 * @crossplatform 428 * @atomicservice 429 * @since 18 430 */ 431 @Trace 432 accessibilityLevel?: string; 433 /** 434 * The constructor used to create a ToolBarV2Item object. 435 * 436 * @param { ToolBarV2ItemOptions } options - text info. 437 * @syscap SystemCapability.ArkUI.ArkUI.Full 438 * @crossplatform 439 * @atomicservice 440 * @since 18 441 */ 442 constructor(options: ToolBarV2ItemOptions); 443} 444 445/** 446 * Declare the options of ToolBarV2Item 447 * 448 * @interface ToolBarV2ItemOptions 449 * @syscap SystemCapability.ArkUI.ArkUI.Full 450 * @crossplatform 451 * @atomicservice 452 * @since 18 453 */ 454export interface ToolBarV2ItemOptions { 455 /** 456 * Define text content. 457 * 458 * @type { ToolBarV2ItemText }. 459 * @syscap SystemCapability.ArkUI.ArkUI.Full 460 * @crossplatform 461 * @atomicservice 462 * @since 18 463 */ 464 content: ToolBarV2ItemText; 465 /** 466 * Define the action event. 467 * 468 * @type { ?ToolBarV2ItemAction }. 469 * @syscap SystemCapability.ArkUI.ArkUI.Full 470 * @crossplatform 471 * @atomicservice 472 * @since 18 473 */ 474 action?: ToolBarV2ItemAction; 475 /** 476 * Define icon resource. 477 * 478 * @type { ?ToolBarV2ItemIconType }. 479 * @syscap SystemCapability.ArkUI.ArkUI.Full 480 * @crossplatform 481 * @atomicservice 482 * @since 18 483 */ 484 icon?: ToolBarV2ItemIconType; 485 /** 486 * Define item type. 487 * 488 * @type { ?ToolBarV2ItemState }. 489 * @syscap SystemCapability.ArkUI.ArkUI.Full 490 * @crossplatform 491 * @atomicservice 492 * @since 18 493 */ 494 state?: ToolBarV2ItemState; 495 /** 496 * The accessibilityText of item. 497 * 498 * @type { ?ResourceStr } 499 * @syscap SystemCapability.ArkUI.ArkUI.Full 500 * @crossplatform 501 * @atomicservice 502 * @since 18 503 */ 504 accessibilityText?: ResourceStr; 505 /** 506 * The accessibilityDescription of item. 507 * 508 * @type { ?ResourceStr } 509 * @syscap SystemCapability.ArkUI.ArkUI.Full 510 * @crossplatform 511 * @atomicservice 512 * @since 18 513 */ 514 accessibilityDescription?: ResourceStr; 515 /** 516 * The accessibilityLevel of item. 517 * 518 * @type { ?string } 519 * @default "auto" 520 * @syscap SystemCapability.ArkUI.ArkUI.Full 521 * @crossplatform 522 * @atomicservice 523 * @since 18 524 */ 525 accessibilityLevel?: string; 526} 527 528/** 529 * Defines the action callback of ToolBarV2Item. 530 * 531 * @syscap SystemCapability.ArkUI.ArkUI.Full 532 * @crossplatform 533 * @atomicservice 534 * @since 18 535 */ 536export type ToolBarV2ItemAction = (index: number) => void; 537 538/** 539 * Declare ToolBarV2Modifier used in ToolBar 540 * 541 * @syscap SystemCapability.ArkUI.ArkUI.Full 542 * @crossplatform 543 * @atomicservice 544 * @since 18 545 */ 546export declare class ToolBarV2Modifier { 547 /** 548 * Sets the height of the toolBarV2. 549 * 550 * @param { LengthMetrics } height - toolBarV2's height. 551 * @returns { ToolBarV2Modifier } returns the instance of the ToolBarV2Modifier. 552 * @syscap SystemCapability.ArkUI.ArkUI.Full 553 * @crossplatform 554 * @atomicservice 555 * @since 18 556 */ 557 height(height: LengthMetrics): ToolBarV2Modifier; 558 /** 559 * Sets the backgroundColor of the toolBarV2. 560 * 561 * @param { ColorMetrics } backgroundColor - toolBarV2's backgroundColor. 562 * @returns { ToolBarV2Modifier } returns the instance of the ToolBarV2Modifier. 563 * @syscap SystemCapability.ArkUI.ArkUI.Full 564 * @crossplatform 565 * @atomicservice 566 * @since 18 567 */ 568 backgroundColor(backgroundColor: ColorMetrics): ToolBarV2Modifier; 569 /** 570 * Sets the left and right padding of the toolbarV2. 571 * 572 * @param { LengthMetrics } padding - left and right padding. 573 * @returns { ToolBarV2Modifier } returns the instance of the ToolBarV2Modifier. 574 * @syscap SystemCapability.ArkUI.ArkUI.Full 575 * @crossplatform 576 * @atomicservice 577 * @since 18 578 */ 579 padding(padding: LengthMetrics): ToolBarV2Modifier; 580 /** 581 * Sets whether or not to display the press status effect. 582 * 583 * @param { boolean } stateEffect - press status effect. 584 * @returns { ToolBarV2Modifier } returns the instance of the ToolBarV2Modifier. 585 * @syscap SystemCapability.ArkUI.ArkUI.Full 586 * @crossplatform 587 * @atomicservice 588 * @since 18 589 */ 590 stateEffect(stateEffect: boolean): ToolBarV2Modifier; 591} 592 593/** 594 * Declare Component ToolBarV2 595 * 596 * @struct { ToolBarV2 } 597 * @syscap SystemCapability.ArkUI.ArkUI.Full 598 * @crossplatform 599 * @atomicservice 600 * @since 18 601 */ 602@ComponentV2 603export declare struct ToolBarV2 { 604 /** 605 * Define toolbarV2 item list. 606 * 607 * @type { ToolBarV2Item[] } 608 * @syscap SystemCapability.ArkUI.ArkUI.Full 609 * @crossplatform 610 * @atomicservice 611 * @since 18 612 */ 613 @Require 614 @Param 615 toolBarList: ToolBarV2Item[]; 616 /** 617 * Define toolbarV2 activate item index, default is -1. 618 * 619 * @type { ?number } 620 * @syscap SystemCapability.ArkUI.ArkUI.Full 621 * @crossplatform 622 * @atomicservice 623 * @since 18 624 */ 625 @Param 626 activatedIndex?: number; 627 /** 628 * Define divider Modifier. 629 * 630 * @type { ?DividerModifier } 631 * @syscap SystemCapability.ArkUI.ArkUI.Full 632 * @crossplatform 633 * @atomicservice 634 * @since 18 635 */ 636 @Param dividerModifier?: DividerModifier; 637 /** 638 * Define toolbarV2 modifier. 639 * 640 * @type { ?ToolBarV2Modifier } 641 * @syscap SystemCapability.ArkUI.ArkUI.Full 642 * @crossplatform 643 * @atomicservice 644 * @since 18 645 */ 646 @Param toolBarModifier?: ToolBarV2Modifier; 647}