• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-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
21
22
23
24
25/**
26 * Declaration of the menu item on the right side.
27 * @syscap SystemCapability.ArkUI.ArkUI.Full
28 * @since 10
29 */
30/**
31 * Declaration of the menu item on the right side.
32 * @syscap SystemCapability.ArkUI.ArkUI.Full
33 * @atomicservice
34 * @since 11
35 */
36export declare class EditableTitleBarMenuItem {
37  /**
38   * Icon resource for this menu item.
39   * @type { ResourceStr }.
40   * @syscap SystemCapability.ArkUI.ArkUI.Full
41   * @since 10
42   */
43  /**
44   * Icon resource for this menu item.
45   * @type { ResourceStr }.
46   * @syscap SystemCapability.ArkUI.ArkUI.Full
47   * @atomicservice
48   * @since 11
49   */
50  value: ResourceStr;
51
52  /**
53   * Icon label for this menu item.
54   * @type { ?ResourceStr }.
55   * @syscap SystemCapability.ArkUI.ArkUI.Full
56   * @atomicservice
57   * @since 12
58   */
59  label?: ResourceStr;
60
61  /**
62   * Whether to enable this menu item.
63   * @type { ?boolean }.
64   * @syscap SystemCapability.ArkUI.ArkUI.Full
65   * @since 10
66   */
67  /**
68   * Whether to enable this menu item.
69   * @type { ?boolean }.
70   * @syscap SystemCapability.ArkUI.ArkUI.Full
71   * @atomicservice
72   * @since 11
73   */
74  isEnabled?: boolean;
75
76  /**
77   * Callback function when click on this menu item.
78   * @type { ?() => void }.
79   * @syscap SystemCapability.ArkUI.ArkUI.Full
80   * @since 10
81   */
82  /**
83   * Callback function when click on this menu item.
84   * @type { ?() => void }.
85   * @syscap SystemCapability.ArkUI.ArkUI.Full
86   * @atomicservice
87   * @since 11
88   */
89  action?: () => void;
90}
91
92/**
93 * Declaration of the image item .
94 * @syscap SystemCapability.ArkUI.ArkUI.Full
95 * @crossplatform
96 * @atomicservice
97 * @since 12
98 */
99export type EditableTitleBarItem = EditableTitleBarMenuItem;
100
101/**
102 * Declaration of the left icon type.
103 * @enum { EditableLeftIconType }.
104 * @syscap SystemCapability.ArkUI.ArkUI.Full
105 * @since 10
106 */
107/**
108 * Declaration of the left icon type.
109 * @enum { EditableLeftIconType }.
110 * @syscap SystemCapability.ArkUI.ArkUI.Full
111 * @atomicservice
112 * @since 11
113 */
114export declare enum EditableLeftIconType {
115  /**
116   * The back type.
117   * @syscap SystemCapability.ArkUI.ArkUI.Full
118   * @since 10
119   */
120  /**
121   * The back type.
122   * @syscap SystemCapability.ArkUI.ArkUI.Full
123   * @atomicservice
124   * @since 11
125   */
126  Back = 0,
127
128  /**
129   * The cancel type.
130   * @syscap SystemCapability.ArkUI.ArkUI.Full
131   * @since 10
132   */
133  /**
134   * The cancel type.
135   * @syscap SystemCapability.ArkUI.ArkUI.Full
136   * @atomicservice
137   * @since 11
138   */
139  Cancel = 1
140}
141
142/**
143 * Indicates the options of the editable title bar.
144 *
145 * @interface EditableTitleBarOptions
146 * @syscap SystemCapability.ArkUI.ArkUI.Full
147 * @crossplatform
148 * @atomicservice
149 * @since 12
150 */
151export declare interface EditableTitleBarOptions {
152  /**
153   * Background color.
154   *
155   * @type { ?ResourceColor }
156   * @syscap SystemCapability.ArkUI.ArkUI.Full
157   * @crossplatform
158   * @atomicservice
159   * @since 12
160   */
161  backgroundColor?: ResourceColor;
162
163  /**
164   * Background blur style.
165   *
166   * @type { ?BlurStyle }
167   * @syscap SystemCapability.ArkUI.ArkUI.Full
168   * @crossplatform
169   * @atomicservice
170   * @since 12
171   */
172  backgroundBlurStyle?: BlurStyle;
173
174  /**
175   * Indicates the types of the safe area.
176   *
177   * @type { ?Array<SafeAreaType> }
178   * @syscap SystemCapability.ArkUI.ArkUI.Full
179   * @crossplatform
180   * @atomicservice
181   * @since 12
182   */
183  safeAreaTypes?: Array<SafeAreaType>;
184
185  /**
186   * Indicates the edges of the safe area.
187   *
188   * @type { ?Array<SafeAreaEdge> }
189   * @syscap SystemCapability.ArkUI.ArkUI.Full
190   * @crossplatform
191   * @atomicservice
192   * @since 12
193   */
194  safeAreaEdges?: Array<SafeAreaEdge>;
195}
196
197/**
198 * Declaration of the editable title bar.
199 * @syscap SystemCapability.ArkUI.ArkUI.Full
200 * @since 10
201 */
202/**
203 * Declaration of the editable title bar.
204 * @syscap SystemCapability.ArkUI.ArkUI.Full
205 * @atomicservice
206 * @since 11
207 */
208@Component
209export declare struct EditableTitleBar {
210  /**
211   * Style of the left icon.
212   * @type { EditableLeftIconType }.
213   * @syscap SystemCapability.ArkUI.ArkUI.Full
214   * @since 10
215   */
216  /**
217   * Style of the left icon.
218   * @type { EditableLeftIconType }.
219   * @syscap SystemCapability.ArkUI.ArkUI.Full
220   * @atomicservice
221   * @since 11
222   */
223  leftIconStyle: EditableLeftIconType;
224
225  /**
226   * Image item between the left icon and the title.
227   * @type { ?EditableTitleBarItem }
228   * @syscap SystemCapability.ArkUI.ArkUI.Full
229   * @crossplatform
230   * @atomicservice
231   * @since 12
232   */
233  imageItem?: EditableTitleBarItem;
234
235  /**
236   * Title of this title bar.
237   * @type { ResourceStr }.
238   * @syscap SystemCapability.ArkUI.ArkUI.Full
239   * @since 10
240   */
241  /**
242   * Title of this title bar.
243   * @type { ResourceStr }.
244   * @syscap SystemCapability.ArkUI.ArkUI.Full
245   * @atomicservice
246   * @since 11
247   */
248  title: ResourceStr;
249
250  /**
251   * Sub-Title of this title bar.
252   * @type { ?ResourceStr }
253   * @syscap SystemCapability.ArkUI.ArkUI.Full
254   * @crossplatform
255   * @atomicservice
256   * @since 12
257   */
258  subtitle?: ResourceStr;
259
260  /**
261   * Whether to required the save icon.
262   * @type { boolean }
263   * @default true
264   * @syscap SystemCapability.ArkUI.ArkUI.Full
265   * @crossplatform
266   * @atomicservice
267   * @since 12
268   */
269  isSaveIconRequired: boolean;
270
271  /**
272   * Menu items on the right side.
273   * @type { ?Array<EditableTitleBarMenuItem> }.
274   * @syscap SystemCapability.ArkUI.ArkUI.Full
275   * @since 10
276   */
277  /**
278   * Menu items on the right side.
279   * @type { ?Array<EditableTitleBarMenuItem> }.
280   * @syscap SystemCapability.ArkUI.ArkUI.Full
281   * @atomicservice
282   * @since 11
283   */
284  menuItems?: Array<EditableTitleBarMenuItem>;
285
286  /**
287   * Callback function when click on the save icon at the right side.
288   * @type { ?() => void }.
289   * @syscap SystemCapability.ArkUI.ArkUI.Full
290   * @since 10
291   */
292  /**
293   * Callback function when click on the save icon at the right side.
294   * @type { ?() => void }.
295   * @syscap SystemCapability.ArkUI.ArkUI.Full
296   * @atomicservice
297   * @since 11
298   */
299  onSave?: () => void;
300
301  /**
302   * Callback function when click on the cancel icon at the left side.
303   * @type { ?() => void }.
304   * @syscap SystemCapability.ArkUI.ArkUI.Full
305   * @since 10
306   */
307  /**
308   * Callback function when click on the cancel icon at the left side.
309   * @type { ?() => void }.
310   * @syscap SystemCapability.ArkUI.ArkUI.Full
311   * @atomicservice
312   * @since 11
313   */
314  onCancel?: () => void;
315
316  /**
317   * Indicates the options of titlebar.
318   * @type { EditableTitleBarOptions }
319   * @default {expandSafeAreaTypes: SafeAreaType.SYSTEM, expandSafeAreaEdges: SafeAreaEdge.TOP}
320   * @syscap SystemCapability.ArkUI.ArkUI.Full
321   * @crossplatform
322   * @atomicservice
323   * @since 12
324   */
325  options: EditableTitleBarOptions;
326
327  /**
328   * Sets the content margin.
329   * @type { ?LocalizedMargin }
330   * @default {start: LengthMetrics.resource($r('sys.float.margin_left')),
331   * <br> end: LengthMetrics.resource($r('sys.float.margin_right'))}
332   * @syscap SystemCapability.ArkUI.ArkUI.Full
333   * @crossplatform
334   * @atomicservice
335   * @since 12
336   */
337  @Prop contentMargin?: LocalizedMargin;
338}
339