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 * Symbol style for this menu item. 54 * @type { ?SymbolGlyphModifier }. 55 * @syscap SystemCapability.ArkUI.ArkUI.Full 56 * @atomicservice 57 * @since 18 58 */ 59 symbolStyle?: SymbolGlyphModifier; 60 61 /** 62 * Icon label for this menu item. 63 * @type { ?ResourceStr }. 64 * @syscap SystemCapability.ArkUI.ArkUI.Full 65 * @atomicservice 66 * @since 12 67 */ 68 label?: ResourceStr; 69 70 /** 71 * Whether to enable this menu item. 72 * @type { ?boolean }. 73 * @syscap SystemCapability.ArkUI.ArkUI.Full 74 * @since 10 75 */ 76 /** 77 * Whether to enable this menu item. 78 * @type { ?boolean }. 79 * @syscap SystemCapability.ArkUI.ArkUI.Full 80 * @atomicservice 81 * @since 11 82 */ 83 isEnabled?: boolean; 84 85 /** 86 * Callback function when click on this menu item. 87 * @type { ?() => void }. 88 * @syscap SystemCapability.ArkUI.ArkUI.Full 89 * @since 10 90 */ 91 /** 92 * Callback function when click on this menu item. 93 * @type { ?() => void }. 94 * @syscap SystemCapability.ArkUI.ArkUI.Full 95 * @atomicservice 96 * @since 11 97 */ 98 action?: () => void; 99 100 /** 101 * The accessibilityText of this menu item. 102 * @type { ?ResourceStr }. 103 * @syscap SystemCapability.ArkUI.ArkUI.Full 104 * @atomicservice 105 * @since 18 106 */ 107 accessibilityText?: ResourceStr; 108 109 /** 110 * The accessibilityDescription of this menu item. 111 * @type { ?ResourceStr } 112 * @syscap SystemCapability.ArkUI.ArkUI.Full 113 * @atomicservice 114 * @since 18 115 */ 116 accessibilityDescription?: ResourceStr; 117 118 /** 119 * The accessibilityLevel of this menu item. 120 * @type { ?string } 121 * @default "auto" 122 * @syscap SystemCapability.ArkUI.ArkUI.Full 123 * @atomicservice 124 * @since 18 125 */ 126 accessibilityLevel?: string; 127 128 /** 129 * Set the default focus state of this menu item. 130 * @type { ?boolean }. 131 * @default { false }. 132 * @syscap SystemCapability.ArkUI.ArkUI.Full 133 * @atomicservice 134 * @since 18 135 */ 136 defaultFocus?: boolean; 137} 138 139/** 140 * Declaration of the image item . 141 * @syscap SystemCapability.ArkUI.ArkUI.Full 142 * @crossplatform 143 * @atomicservice 144 * @since 12 145 */ 146export type EditableTitleBarItem = EditableTitleBarMenuItem; 147 148/** 149 * Declaration of the left icon type. 150 * @enum { EditableLeftIconType }. 151 * @syscap SystemCapability.ArkUI.ArkUI.Full 152 * @since 10 153 */ 154/** 155 * Declaration of the left icon type. 156 * @enum { EditableLeftIconType }. 157 * @syscap SystemCapability.ArkUI.ArkUI.Full 158 * @atomicservice 159 * @since 11 160 */ 161export declare enum EditableLeftIconType { 162 /** 163 * The back type. 164 * @syscap SystemCapability.ArkUI.ArkUI.Full 165 * @since 10 166 */ 167 /** 168 * The back type. 169 * @syscap SystemCapability.ArkUI.ArkUI.Full 170 * @atomicservice 171 * @since 11 172 */ 173 Back = 0, 174 175 /** 176 * The cancel type. 177 * @syscap SystemCapability.ArkUI.ArkUI.Full 178 * @since 10 179 */ 180 /** 181 * The cancel type. 182 * @syscap SystemCapability.ArkUI.ArkUI.Full 183 * @atomicservice 184 * @since 11 185 */ 186 Cancel = 1 187} 188 189/** 190 * Indicates the options of the editable title bar. 191 * 192 * @interface EditableTitleBarOptions 193 * @syscap SystemCapability.ArkUI.ArkUI.Full 194 * @crossplatform 195 * @atomicservice 196 * @since 12 197 */ 198export declare interface EditableTitleBarOptions { 199 /** 200 * Background color. 201 * 202 * @type { ?ResourceColor } 203 * @syscap SystemCapability.ArkUI.ArkUI.Full 204 * @crossplatform 205 * @atomicservice 206 * @since 12 207 */ 208 backgroundColor?: ResourceColor; 209 210 /** 211 * Background blur style. 212 * 213 * @type { ?BlurStyle } 214 * @syscap SystemCapability.ArkUI.ArkUI.Full 215 * @crossplatform 216 * @atomicservice 217 * @since 12 218 */ 219 backgroundBlurStyle?: BlurStyle; 220 221 /** 222 * Indicates the types of the safe area. 223 * 224 * @type { ?Array<SafeAreaType> } 225 * @syscap SystemCapability.ArkUI.ArkUI.Full 226 * @crossplatform 227 * @atomicservice 228 * @since 12 229 */ 230 safeAreaTypes?: Array<SafeAreaType>; 231 232 /** 233 * Indicates the edges of the safe area. 234 * 235 * @type { ?Array<SafeAreaEdge> } 236 * @syscap SystemCapability.ArkUI.ArkUI.Full 237 * @crossplatform 238 * @atomicservice 239 * @since 12 240 */ 241 safeAreaEdges?: Array<SafeAreaEdge>; 242} 243 244/** 245 * Declaration of the editable title bar. 246 * @syscap SystemCapability.ArkUI.ArkUI.Full 247 * @since 10 248 */ 249/** 250 * Declaration of the editable title bar. 251 * @syscap SystemCapability.ArkUI.ArkUI.Full 252 * @atomicservice 253 * @since 11 254 */ 255@Component 256export declare struct EditableTitleBar { 257 /** 258 * Style of the left icon. 259 * @type { EditableLeftIconType }. 260 * @syscap SystemCapability.ArkUI.ArkUI.Full 261 * @since 10 262 */ 263 /** 264 * Style of the left icon. 265 * @type { EditableLeftIconType }. 266 * @syscap SystemCapability.ArkUI.ArkUI.Full 267 * @atomicservice 268 * @since 11 269 */ 270 leftIconStyle: EditableLeftIconType; 271 272 /** 273 * Image item between the left icon and the title. 274 * @type { ?EditableTitleBarItem } 275 * @syscap SystemCapability.ArkUI.ArkUI.Full 276 * @crossplatform 277 * @atomicservice 278 * @since 12 279 */ 280 imageItem?: EditableTitleBarItem; 281 282 /** 283 * Title of this title bar. 284 * @type { ResourceStr }. 285 * @syscap SystemCapability.ArkUI.ArkUI.Full 286 * @since 10 287 */ 288 /** 289 * Title of this title bar. 290 * @type { ResourceStr }. 291 * @syscap SystemCapability.ArkUI.ArkUI.Full 292 * @atomicservice 293 * @since 11 294 */ 295 title: ResourceStr; 296 297 /** 298 * Sub-Title of this title bar. 299 * @type { ?ResourceStr } 300 * @syscap SystemCapability.ArkUI.ArkUI.Full 301 * @crossplatform 302 * @atomicservice 303 * @since 12 304 */ 305 subtitle?: ResourceStr; 306 307 /** 308 * Whether to required the save icon. 309 * @type { boolean } 310 * @default true 311 * @syscap SystemCapability.ArkUI.ArkUI.Full 312 * @crossplatform 313 * @atomicservice 314 * @since 12 315 */ 316 isSaveIconRequired: boolean; 317 318 /** 319 * Menu items on the right side. 320 * @type { ?Array<EditableTitleBarMenuItem> }. 321 * @syscap SystemCapability.ArkUI.ArkUI.Full 322 * @since 10 323 */ 324 /** 325 * Menu items on the right side. 326 * @type { ?Array<EditableTitleBarMenuItem> }. 327 * @syscap SystemCapability.ArkUI.ArkUI.Full 328 * @atomicservice 329 * @since 11 330 */ 331 menuItems?: Array<EditableTitleBarMenuItem>; 332 333 /** 334 * Callback function when click on the save icon at the right side. 335 * @type { ?() => void }. 336 * @syscap SystemCapability.ArkUI.ArkUI.Full 337 * @since 10 338 */ 339 /** 340 * Callback function when click on the save icon at the right side. 341 * @type { ?() => void }. 342 * @syscap SystemCapability.ArkUI.ArkUI.Full 343 * @atomicservice 344 * @since 11 345 */ 346 onSave?: () => void; 347 348 /** 349 * Callback function when click on the cancel icon at the left side. 350 * @type { ?() => void }. 351 * @syscap SystemCapability.ArkUI.ArkUI.Full 352 * @since 10 353 */ 354 /** 355 * Callback function when click on the cancel icon at the left side. 356 * @type { ?() => void }. 357 * @syscap SystemCapability.ArkUI.ArkUI.Full 358 * @atomicservice 359 * @since 11 360 */ 361 onCancel?: () => void; 362 363 /** 364 * Indicates the options of titlebar. 365 * @type { EditableTitleBarOptions } 366 * @default {expandSafeAreaTypes: SafeAreaType.SYSTEM, expandSafeAreaEdges: SafeAreaEdge.TOP} 367 * @syscap SystemCapability.ArkUI.ArkUI.Full 368 * @crossplatform 369 * @atomicservice 370 * @since 12 371 */ 372 options: EditableTitleBarOptions; 373 374 /** 375 * Sets the content margin. 376 * @type { ?LocalizedMargin } 377 * @default {start: LengthMetrics.resource($r('sys.float.margin_left')), 378 * <br> end: LengthMetrics.resource($r('sys.float.margin_right'))} 379 * @syscap SystemCapability.ArkUI.ArkUI.Full 380 * @crossplatform 381 * @atomicservice 382 * @since 12 383 */ 384 @Prop contentMargin?: LocalizedMargin; 385 386 /** 387 * Sets the default focus state of left icon. 388 * @type { ?boolean } 389 * @default { false } 390 * @syscap SystemCapability.ArkUI.ArkUI.Full 391 * @crossplatform 392 * @atomicservice 393 * @since 18 394 */ 395 leftIconDefaultFocus?: boolean; 396 397 /** 398 * Sets the default focus state of save icon. 399 * @type { ?boolean } 400 * @default { false } 401 * @syscap SystemCapability.ArkUI.ArkUI.Full 402 * @crossplatform 403 * @atomicservice 404 * @since 18 405 */ 406 saveIconDefaultFocus?: boolean; 407} 408