• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/// <reference path="../component/units.d.ts" />
17
18import { ResourceStr } from 'GlobalResource';
19
20/**
21 * Declaration of the menu item on the right side.
22 * @syscap SystemCapability.ArkUI.ArkUI.Full
23 * @since 10
24 */
25export declare class SelectTitleBarMenuItem {
26  /**
27   * Icon resource for this menu item.
28   * @type { ResourceStr }.
29   * @since 10
30   */
31  value: ResourceStr;
32
33  /**
34   * Whether to enable this menu item.
35   * @type { boolean }.
36   * @since 10
37   */
38  isEnabled?: boolean;
39
40  /**
41   * Callback function when click on this menu item.
42   * @type { () => void }.
43   * @since 10
44   */
45  action?: () => void;
46}
47
48/**
49 * Declaration of the selectable title bar.
50 * @syscap SystemCapability.ArkUI.ArkUI.Full
51 * @since 10
52 */
53@Component
54export declare struct SelectTitleBar {
55  /**
56   * Selected index of the initial options in the drop-down menu. The index of the first item is 0.
57   * If this attribute is not set, the default value is -1. Which means, no menu item is selected.
58   * @type { number }.
59   * @since 10
60   */
61  @Prop selected: number;
62
63  /**
64   * Options inside the drop-down list.
65   * @type { Array<SelectOption> }.
66   * @since 10
67   */
68  options: Array<SelectOption>;
69
70  /**
71   * Menu items on the right side.
72   * @type { Array<SelectTitleBarMenuItem> }.
73   * @since 10
74   */
75  menuItems?: Array<SelectTitleBarMenuItem>;
76
77  /**
78   * Sub-title of this title bar.
79   * @type { ResourceStr }.
80   * @since 10
81   */
82  subtitle?: ResourceStr;
83
84  /**
85   * The number displayed in a badge.
86   * @type { number }.
87   * @since 10
88   */
89  badgeValue?: number;
90
91  /**
92   * Whether to hide the back arrow at the left side.
93   * @type { boolean }.
94   * @since 10
95   */
96  hidesBackButton?: boolean;
97
98  /**
99   * Callback function when an option is selected
100   * @type { (index: number) => void }.
101   * @since 10
102   */
103  onSelected?: ((index: number) => void);
104}
105