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 16if (!('finalizeConstruction' in ViewPU.prototype)) { 17 Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { }); 18} 19const KeyCode = requireNapi('multimodalInput.keyCode').KeyCode; 20const hilog = requireNapi('hilog'); 21const PUBLIC_MORE = { 'id': -1, 'type': 40000, params: ['sys.symbol.dot_grid_2x2'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 22const PUBLIC_BACK = { 'id': -1, 'type': 40000, params: ['sys.symbol.arrow_left'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 23const TEXT_EDITABLE_DIALOG = '18.3fp'; 24const IMAGE_SIZE = '64vp'; 25const MAX_DIALOG = '256vp'; 26const MIN_DIALOG = '216vp'; 27const RESOURCE_TYPE_SYMBOL = 40000; 28class Util { 29 static isSymbolResource(q21) { 30 if (!Util.isResourceType(q21)) { 31 return false; 32 } 33 let r21 = q21; 34 return r21.type === RESOURCE_TYPE_SYMBOL; 35 } 36 static isResourceType(p21) { 37 if (!p21) { 38 return false; 39 } 40 if (typeof p21 === 'string' || typeof p21 === 'undefined') { 41 return false; 42 } 43 return true; 44 } 45} 46class ButtonGestureModifier { 47 constructor(o21) { 48 this.fontSize = 1; 49 this.controller = null; 50 this.controller = o21; 51 } 52 applyGesture(n21) { 53 if (this.fontSize >= ButtonGestureModifier.minFontSize) { 54 n21.addGesture(new LongPressGestureHandler({ repeat: false, duration: ButtonGestureModifier.longPressTime }) 55 .onAction(() => { 56 if (n21) { 57 this.controller?.open(); 58 } 59 }) 60 .onActionEnd(() => { 61 this.controller?.close(); 62 })); 63 } 64 else { 65 n21.clearGestures(); 66 } 67 } 68} 69ButtonGestureModifier.longPressTime = 500; 70ButtonGestureModifier.minFontSize = 1.75; 71class ComposeTitleBar extends ViewPU { 72 constructor(h21, i21, j21, k21 = -1, l21 = undefined, m21) { 73 super(h21, j21, k21, m21); 74 if (typeof l21 === 'function') { 75 this.paramsGenerator_ = l21; 76 } 77 this.item = undefined; 78 this.title = ''; 79 this.subtitle = ''; 80 this.menuItems = []; 81 this.__titleMaxWidth = new ObservedPropertySimplePU(0, this, 'titleMaxWidth'); 82 this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 83 this.__uniqueId = new ObservedPropertySimplePU(-1, this, 'uniqueId'); 84 this.addProvidedVar('uniqueId', this.__uniqueId, false); 85 this.setInitiallyProvidedValue(i21); 86 this.finalizeConstruction(); 87 } 88 setInitiallyProvidedValue(g21) { 89 if (g21.item !== undefined) { 90 this.item = g21.item; 91 } 92 if (g21.title !== undefined) { 93 this.title = g21.title; 94 } 95 if (g21.subtitle !== undefined) { 96 this.subtitle = g21.subtitle; 97 } 98 if (g21.menuItems !== undefined) { 99 this.menuItems = g21.menuItems; 100 } 101 if (g21.titleMaxWidth !== undefined) { 102 this.titleMaxWidth = g21.titleMaxWidth; 103 } 104 if (g21.fontSize !== undefined) { 105 this.fontSize = g21.fontSize; 106 } 107 if (g21.uniqueId !== undefined) { 108 this.uniqueId = g21.uniqueId; 109 } 110 } 111 updateStateVars(f21) { 112 } 113 purgeVariableDependenciesOnElmtId(e21) { 114 this.__titleMaxWidth.purgeDependencyOnElmtId(e21); 115 this.__fontSize.purgeDependencyOnElmtId(e21); 116 this.__uniqueId.purgeDependencyOnElmtId(e21); 117 } 118 aboutToBeDeleted() { 119 this.__titleMaxWidth.aboutToBeDeleted(); 120 this.__fontSize.aboutToBeDeleted(); 121 this.__uniqueId.aboutToBeDeleted(); 122 SubscriberManager.Get().delete(this.id__()); 123 this.aboutToBeDeletedInternal(); 124 } 125 get titleMaxWidth() { 126 return this.__titleMaxWidth.get(); 127 } 128 set titleMaxWidth(d21) { 129 this.__titleMaxWidth.set(d21); 130 } 131 get fontSize() { 132 return this.__fontSize.get(); 133 } 134 set fontSize(c21) { 135 this.__fontSize.set(c21); 136 } 137 get uniqueId() { 138 return this.__uniqueId.get(); 139 } 140 set uniqueId(b21) { 141 this.__uniqueId.set(b21); 142 } 143 initialRender() { 144 this.observeComponentCreation2((v20, w20) => { 145 Flex.create({ 146 justifyContent: FlexAlign.SpaceBetween, 147 alignItems: ItemAlign.Stretch 148 }); 149 Flex.onAppear(() => { 150 this.uniqueId = this.getUIContext().getFrameNodeByUniqueId(this.getUniqueId())?.getFirstChild()?.getUniqueId(); 151 }); 152 Flex.width('100%'); 153 Flex.height(ComposeTitleBar.totalHeight); 154 Flex.backgroundColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_background'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 155 Flex.onAreaChange((x20, y20) => { 156 let z20 = Number(y20.width); 157 if (this.menuItems !== undefined) { 158 let a21 = this.menuItems.length; 159 if (a21 >= CollapsibleMenuSection.maxCountOfVisibleItems) { 160 z20 = z20 - ImageMenuItem.imageHotZoneWidth * CollapsibleMenuSection.maxCountOfVisibleItems; 161 } 162 else if (a21 > 0) { 163 z20 = z20 - ImageMenuItem.imageHotZoneWidth * a21; 164 } 165 } 166 this.titleMaxWidth = z20; 167 this.titleMaxWidth -= ComposeTitleBar.leftPadding; 168 this.titleMaxWidth -= ImageMenuItem.imageHotZoneWidth; 169 if (this.item !== undefined) { 170 this.titleMaxWidth -= ComposeTitleBar.portraitImageLeftPadding + 171 ComposeTitleBar.portraitImageSize + 172 ComposeTitleBar.portraitImageRightPadding; 173 } 174 this.titleMaxWidth -= ComposeTitleBar.rightPadding; 175 }); 176 }, Flex); 177 this.observeComponentCreation2((t20, u20) => { 178 Row.create(); 179 Row.margin({ left: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_default_padding_start'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } }); 180 }, Row); 181 { 182 this.observeComponentCreation2((p20, q20) => { 183 if (q20) { 184 let r20 = new ImageMenuItem(this, { 185 item: { 186 value: PUBLIC_BACK, 187 isEnabled: true, 188 action: () => this.getUIContext()?.getRouter()?.back() 189 }, 190 index: -1, 191 itemIndex: -1 192 }, undefined, p20, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 113, col: 9 }); 193 ViewPU.create(r20); 194 let j = () => { 195 return { 196 item: { 197 value: PUBLIC_BACK, 198 isEnabled: true, 199 action: () => this.getUIContext()?.getRouter()?.back() 200 }, 201 index: -1, 202 itemIndex: -1 203 }; 204 }; 205 r20.paramsGenerator_ = j; 206 } 207 else { 208 this.updateStateVarsOfChildByElmtId(p20, {}); 209 } 210 }, { name: 'ImageMenuItem' }); 211 } 212 this.observeComponentCreation2((n20, o20) => { 213 Row.create(); 214 Row.accessibilityGroup(true); 215 Row.accessibilityDescription({ 216 'id': -1, 217 'type': 10003, 218 params: ['sys.string.subheader_accessibility_title'], 219 'bundleName': '__harDefaultBundleName__', 220 'moduleName': '__harDefaultModuleName__' 221 }); 222 }, Row); 223 this.observeComponentCreation2((j20, k20) => { 224 If.create(); 225 if (this.item !== undefined) { 226 this.ifElseBranchUpdateFunction(0, () => { 227 this.observeComponentCreation2((l20, m20) => { 228 Image.create(this.item.value); 229 Image.width(ComposeTitleBar.portraitImageSize); 230 Image.height(ComposeTitleBar.portraitImageSize); 231 Image.margin({ 232 left: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_paragraph_margin_xs'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 233 right: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_paragraph_margin_m'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } 234 }); 235 Image.focusable(false); 236 Image.borderRadius(ImageMenuItem.buttonBorderRadius); 237 }, Image); 238 }); 239 } 240 else { 241 this.ifElseBranchUpdateFunction(1, () => { 242 }); 243 } 244 }, If); 245 If.pop(); 246 this.observeComponentCreation2((h20, i20) => { 247 Column.create(); 248 Column.justifyContent(FlexAlign.Start); 249 Column.alignItems(HorizontalAlign.Start); 250 Column.constraintSize({ maxWidth: this.titleMaxWidth }); 251 }, Column); 252 this.observeComponentCreation2((b20, c20) => { 253 If.create(); 254 if (this.title !== undefined) { 255 this.ifElseBranchUpdateFunction(0, () => { 256 this.observeComponentCreation2((f20, g20) => { 257 Row.create(); 258 Row.justifyContent(FlexAlign.Start); 259 }, Row); 260 this.observeComponentCreation2((d20, e20) => { 261 Text.create(this.title); 262 Text.fontWeight(FontWeight.Medium); 263 Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_headline8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 264 Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_text'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 265 Text.maxLines(this.subtitle !== undefined ? 1 : 2); 266 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 267 Text.constraintSize({ maxWidth: this.titleMaxWidth }); 268 }, Text); 269 Text.pop(); 270 Row.pop(); 271 }); 272 } 273 else { 274 this.ifElseBranchUpdateFunction(1, () => { 275 }); 276 } 277 }, If); 278 If.pop(); 279 this.observeComponentCreation2((v19, w19) => { 280 If.create(); 281 if (this.subtitle !== undefined) { 282 this.ifElseBranchUpdateFunction(0, () => { 283 this.observeComponentCreation2((z19, a20) => { 284 Row.create(); 285 Row.justifyContent(FlexAlign.Start); 286 }, Row); 287 this.observeComponentCreation2((x19, y19) => { 288 Text.create(this.subtitle); 289 Text.fontSize({ 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_text_size_over_line'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 290 Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_subtitle_text'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 291 Text.maxLines(1); 292 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 293 Text.constraintSize({ maxWidth: this.titleMaxWidth }); 294 }, Text); 295 Text.pop(); 296 Row.pop(); 297 }); 298 } 299 else { 300 this.ifElseBranchUpdateFunction(1, () => { 301 }); 302 } 303 }, If); 304 If.pop(); 305 Column.pop(); 306 Row.pop(); 307 Row.pop(); 308 this.observeComponentCreation2((p19, q19) => { 309 If.create(); 310 if (this.menuItems !== undefined && this.menuItems.length > 0) { 311 this.ifElseBranchUpdateFunction(0, () => { 312 { 313 this.observeComponentCreation2((r19, s19) => { 314 if (s19) { 315 let t19 = new CollapsibleMenuSection(this, { menuItems: this.menuItems, index: 1 + ComposeTitleBar.instanceCount++ }, undefined, r19, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 170, col: 9 }); 316 ViewPU.create(t19); 317 let i = () => { 318 return { 319 menuItems: this.menuItems, 320 index: 1 + ComposeTitleBar.instanceCount++ 321 }; 322 }; 323 t19.paramsGenerator_ = i; 324 } 325 else { 326 this.updateStateVarsOfChildByElmtId(r19, {}); 327 } 328 }, { name: 'CollapsibleMenuSection' }); 329 } 330 }); 331 } 332 else { 333 this.ifElseBranchUpdateFunction(1, () => { 334 }); 335 } 336 }, If); 337 If.pop(); 338 Flex.pop(); 339 } 340 rerender() { 341 this.updateDirtyElements(); 342 } 343} 344ComposeTitleBar.totalHeight = 56; 345ComposeTitleBar.leftPadding = 12; 346ComposeTitleBar.rightPadding = 12; 347ComposeTitleBar.portraitImageSize = 40; 348ComposeTitleBar.portraitImageLeftPadding = 4; 349ComposeTitleBar.portraitImageRightPadding = 16; 350ComposeTitleBar.instanceCount = 0; 351class CollapsibleMenuSection extends ViewPU { 352 constructor(h19, i19, j19, k19 = -1, l19 = undefined, m19) { 353 super(h19, j19, k19, m19); 354 if (typeof l19 === 'function') { 355 this.paramsGenerator_ = l19; 356 } 357 this.menuItems = []; 358 this.item = { 359 value: PUBLIC_MORE, 360 label: { 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 361 }; 362 this.index = 0; 363 this.minFontSize = 1.75; 364 this.isFollowingSystemFontScale = false; 365 this.maxFontScale = 1; 366 this.systemFontScale = 1; 367 this.firstFocusableIndex = -1; 368 this.__isPopupShown = new ObservedPropertySimplePU(false, this, 'isPopupShown'); 369 this.__isMoreIconOnFocus = new ObservedPropertySimplePU(false, this, 'isMoreIconOnFocus'); 370 this.__isMoreIconOnHover = new ObservedPropertySimplePU(false, this, 'isMoreIconOnHover'); 371 this.__isMoreIconOnClick = new ObservedPropertySimplePU(false, this, 'isMoreIconOnClick'); 372 this.__fontSize = new SynchedPropertySimpleOneWayPU(i19.fontSize, this, 'fontSize'); 373 this.dialogController = new CustomDialogController({ 374 builder: () => { 375 let n19 = new ComposeTitleBarDialog(this, { 376 cancel: () => { 377 }, 378 confirm: () => { 379 }, 380 itemComposeTitleDialog: this.item, 381 composeTitleBarDialog: this.item.label ? this.item.label : '', 382 fontSize: this.fontSize, 383 }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 224, col: 14 }); 384 n19.setController(this.dialogController); 385 ViewPU.create(n19); 386 let h = () => { 387 return { 388 cancel: () => { 389 }, 390 confirm: () => { 391 }, 392 itemComposeTitleDialog: this.item, 393 composeTitleBarDialog: this.item.label ? this.item.label : '', 394 fontSize: this.fontSize 395 }; 396 }; 397 n19.paramsGenerator_ = h; 398 }, 399 maskColor: Color.Transparent, 400 isModal: true, 401 customStyle: true 402 }, this); 403 this.__buttonGestureModifier = new ObservedPropertyObjectPU(new ButtonGestureModifier(this.dialogController), this, 'buttonGestureModifier'); 404 this.setInitiallyProvidedValue(i19); 405 this.declareWatch('fontSize', this.onFontSizeUpdated); 406 this.finalizeConstruction(); 407 } 408 setInitiallyProvidedValue(g19) { 409 if (g19.menuItems !== undefined) { 410 this.menuItems = g19.menuItems; 411 } 412 if (g19.item !== undefined) { 413 this.item = g19.item; 414 } 415 if (g19.index !== undefined) { 416 this.index = g19.index; 417 } 418 if (g19.minFontSize !== undefined) { 419 this.minFontSize = g19.minFontSize; 420 } 421 if (g19.isFollowingSystemFontScale !== undefined) { 422 this.isFollowingSystemFontScale = g19.isFollowingSystemFontScale; 423 } 424 if (g19.maxFontScale !== undefined) { 425 this.maxFontScale = g19.maxFontScale; 426 } 427 if (g19.systemFontScale !== undefined) { 428 this.systemFontScale = g19.systemFontScale; 429 } 430 if (g19.firstFocusableIndex !== undefined) { 431 this.firstFocusableIndex = g19.firstFocusableIndex; 432 } 433 if (g19.isPopupShown !== undefined) { 434 this.isPopupShown = g19.isPopupShown; 435 } 436 if (g19.isMoreIconOnFocus !== undefined) { 437 this.isMoreIconOnFocus = g19.isMoreIconOnFocus; 438 } 439 if (g19.isMoreIconOnHover !== undefined) { 440 this.isMoreIconOnHover = g19.isMoreIconOnHover; 441 } 442 if (g19.isMoreIconOnClick !== undefined) { 443 this.isMoreIconOnClick = g19.isMoreIconOnClick; 444 } 445 if (g19.fontSize === undefined) { 446 this.__fontSize.set(1); 447 } 448 if (g19.dialogController !== undefined) { 449 this.dialogController = g19.dialogController; 450 } 451 if (g19.buttonGestureModifier !== undefined) { 452 this.buttonGestureModifier = g19.buttonGestureModifier; 453 } 454 } 455 updateStateVars(f19) { 456 this.__fontSize.reset(f19.fontSize); 457 } 458 purgeVariableDependenciesOnElmtId(e19) { 459 this.__isPopupShown.purgeDependencyOnElmtId(e19); 460 this.__isMoreIconOnFocus.purgeDependencyOnElmtId(e19); 461 this.__isMoreIconOnHover.purgeDependencyOnElmtId(e19); 462 this.__isMoreIconOnClick.purgeDependencyOnElmtId(e19); 463 this.__fontSize.purgeDependencyOnElmtId(e19); 464 this.__buttonGestureModifier.purgeDependencyOnElmtId(e19); 465 } 466 aboutToBeDeleted() { 467 this.__isPopupShown.aboutToBeDeleted(); 468 this.__isMoreIconOnFocus.aboutToBeDeleted(); 469 this.__isMoreIconOnHover.aboutToBeDeleted(); 470 this.__isMoreIconOnClick.aboutToBeDeleted(); 471 this.__fontSize.aboutToBeDeleted(); 472 this.__buttonGestureModifier.aboutToBeDeleted(); 473 SubscriberManager.Get().delete(this.id__()); 474 this.aboutToBeDeletedInternal(); 475 } 476 get isPopupShown() { 477 return this.__isPopupShown.get(); 478 } 479 set isPopupShown(d19) { 480 this.__isPopupShown.set(d19); 481 } 482 get isMoreIconOnFocus() { 483 return this.__isMoreIconOnFocus.get(); 484 } 485 set isMoreIconOnFocus(c19) { 486 this.__isMoreIconOnFocus.set(c19); 487 } 488 get isMoreIconOnHover() { 489 return this.__isMoreIconOnHover.get(); 490 } 491 set isMoreIconOnHover(b19) { 492 this.__isMoreIconOnHover.set(b19); 493 } 494 get isMoreIconOnClick() { 495 return this.__isMoreIconOnClick.get(); 496 } 497 set isMoreIconOnClick(a19) { 498 this.__isMoreIconOnClick.set(a19); 499 } 500 get fontSize() { 501 return this.__fontSize.get(); 502 } 503 set fontSize(z18) { 504 this.__fontSize.set(z18); 505 } 506 get buttonGestureModifier() { 507 return this.__buttonGestureModifier.get(); 508 } 509 set buttonGestureModifier(y18) { 510 this.__buttonGestureModifier.set(y18); 511 } 512 getMoreIconFgColor() { 513 return this.isMoreIconOnClick ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon_pressed'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 514 } 515 getMoreIconBgColor() { 516 if (this.isMoreIconOnClick) { 517 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 518 } 519 else if (this.isMoreIconOnHover) { 520 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 521 } 522 else { 523 return Color.Transparent; 524 } 525 } 526 aboutToAppear() { 527 try { 528 let x18 = this.getUIContext(); 529 this.isFollowingSystemFontScale = x18.isFollowingSystemFontScale(); 530 this.maxFontScale = x18.getMaxFontScale(); 531 } 532 catch (u18) { 533 let v18 = u18.code; 534 let w18 = u18.message; 535 hilog.error(0x3900, 'ComposeTitleBar', `Failed to init fontsizescale info, cause, code: ${v18}, message: ${w18}`); 536 } 537 if (this.menuItems) { 538 this.menuItems.forEach((s18, t18) => { 539 if (s18.isEnabled && this.firstFocusableIndex === -1 && 540 t18 > CollapsibleMenuSection.maxCountOfVisibleItems - 2) { 541 this.firstFocusableIndex = this.index * 1000 + t18 + 1; 542 } 543 }); 544 } 545 this.fontSize = this.decideFontScale(); 546 } 547 decideFontScale() { 548 try { 549 let r18 = this.getUIContext(); 550 this.systemFontScale = r18.getHostContext()?.config?.fontSizeScale ?? 1; 551 if (!this.isFollowingSystemFontScale) { 552 return 1; 553 } 554 return Math.min(this.systemFontScale, this.maxFontScale); 555 } 556 catch (o18) { 557 let p18 = o18.code; 558 let q18 = o18.message; 559 hilog.error(0x3900, 'ComposeTitleBar', `Faild to decideFontScale,cause, code: ${p18}, message: ${q18}`); 560 return 1; 561 } 562 } 563 onFontSizeUpdated() { 564 this.buttonGestureModifier.fontSize = this.fontSize; 565 } 566 initialRender() { 567 this.observeComponentCreation2((m18, n18) => { 568 Column.create(); 569 Column.height('100%'); 570 Column.margin({ right: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_default_padding_end'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } }); 571 Column.justifyContent(FlexAlign.Center); 572 }, Column); 573 this.observeComponentCreation2((k18, l18) => { 574 Row.create(); 575 }, Row); 576 this.observeComponentCreation2((e17, f17) => { 577 If.create(); 578 if (this.menuItems) { 579 this.ifElseBranchUpdateFunction(0, () => { 580 this.observeComponentCreation2((g17, h17) => { 581 If.create(); 582 if (this.menuItems.length <= CollapsibleMenuSection.maxCountOfVisibleItems) { 583 this.ifElseBranchUpdateFunction(0, () => { 584 this.observeComponentCreation2((a18, b18) => { 585 ForEach.create(); 586 const f = (d18, e18) => { 587 const f18 = d18; 588 { 589 this.observeComponentCreation2((g18, h18) => { 590 if (h18) { 591 let i18 = new ImageMenuItem(this, { item: f18, index: this.index * 1000 + e18 + 1, itemIndex: e18 }, undefined, g18, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 304, col: 15 }); 592 ViewPU.create(i18); 593 let g = () => { 594 return { 595 item: f18, 596 index: this.index * 1000 + e18 + 1, 597 itemIndex: e18 598 }; 599 }; 600 i18.paramsGenerator_ = g; 601 } 602 else { 603 this.updateStateVarsOfChildByElmtId(g18, {}); 604 } 605 }, { name: 'ImageMenuItem' }); 606 } 607 }; 608 this.forEachUpdateFunction(a18, this.menuItems, f, undefined, true, false); 609 }, ForEach); 610 ForEach.pop(); 611 }); 612 } 613 else { 614 this.ifElseBranchUpdateFunction(1, () => { 615 this.observeComponentCreation2((q17, r17) => { 616 ForEach.create(); 617 const d = (t17, u17) => { 618 const v17 = t17; 619 { 620 this.observeComponentCreation2((w17, x17) => { 621 if (x17) { 622 let y17 = new ImageMenuItem(this, { item: v17, index: this.index * 1000 + u17 + 1, itemIndex: u17 }, undefined, w17, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 309, col: 17 }); 623 ViewPU.create(y17); 624 let e = () => { 625 return { 626 item: v17, 627 index: this.index * 1000 + u17 + 1, 628 itemIndex: u17 629 }; 630 }; 631 y17.paramsGenerator_ = e; 632 } 633 else { 634 this.updateStateVarsOfChildByElmtId(w17, {}); 635 } 636 }, { name: 'ImageMenuItem' }); 637 } 638 }; 639 this.forEachUpdateFunction(q17, this.menuItems.slice(0, CollapsibleMenuSection.maxCountOfVisibleItems - 1), d, undefined, true, false); 640 }, ForEach); 641 ForEach.pop(); 642 this.observeComponentCreation2((k17, l17) => { 643 Button.createWithChild({ type: ButtonType.Normal, stateEffect: true }); 644 Button.accessibilityText({ 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 645 Button.width(ImageMenuItem.imageHotZoneWidth); 646 Button.height(ImageMenuItem.imageHotZoneWidth); 647 Button.borderRadius(ImageMenuItem.buttonBorderRadius); 648 Button.foregroundColor(this.getMoreIconFgColor()); 649 Button.backgroundColor(this.getMoreIconBgColor()); 650 ViewStackProcessor.visualState('focused'); 651 Button.border({ 652 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 653 width: ImageMenuItem.focusBorderWidth, 654 color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 655 style: BorderStyle.Solid 656 }); 657 ViewStackProcessor.visualState('normal'); 658 Button.border({ 659 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 660 width: 0 661 }); 662 ViewStackProcessor.visualState(); 663 Button.onFocus(() => this.isMoreIconOnFocus = true); 664 Button.onBlur(() => this.isMoreIconOnFocus = false); 665 Button.onHover((p17) => this.isMoreIconOnHover = p17); 666 Button.onKeyEvent((o17) => { 667 if (o17.keyCode !== KeyCode.KEYCODE_ENTER && 668 o17.keyCode !== KeyCode.KEYCODE_SPACE) { 669 return; 670 } 671 if (o17.type === KeyType.Down) { 672 this.isMoreIconOnClick = true; 673 } 674 if (o17.type === KeyType.Up) { 675 this.isMoreIconOnClick = false; 676 } 677 }); 678 Button.onTouch((n17) => { 679 if (n17.type === TouchType.Down) { 680 this.isMoreIconOnClick = true; 681 } 682 if (n17.type === TouchType.Up || n17.type === TouchType.Cancel) { 683 this.isMoreIconOnClick = false; 684 if (this.fontSize >= this.minFontSize) { 685 this.dialogController?.close(); 686 } 687 } 688 }); 689 Button.onClick(() => this.isPopupShown = true); 690 Button.gestureModifier(ObservedObject.GetRawObject(this.buttonGestureModifier)); 691 Button.bindPopup(this.isPopupShown, { 692 builder: { builder: this.popupBuilder.bind(this) }, 693 placement: Placement.Bottom, 694 popupColor: Color.White, 695 enableArrow: false, 696 onStateChange: (m17) => { 697 this.isPopupShown = m17.isVisible; 698 if (!m17.isVisible) { 699 this.isMoreIconOnClick = false; 700 } 701 } 702 }); 703 }, Button); 704 this.observeComponentCreation2((i17, j17) => { 705 SymbolGlyph.create(PUBLIC_MORE); 706 SymbolGlyph.fontSize(`${ImageMenuItem.imageSize}vp`); 707 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 708 SymbolGlyph.draggable(false); 709 SymbolGlyph.focusable(true); 710 }, SymbolGlyph); 711 Button.pop(); 712 }); 713 } 714 }, If); 715 If.pop(); 716 }); 717 } 718 else { 719 this.ifElseBranchUpdateFunction(1, () => { 720 }); 721 } 722 }, If); 723 If.pop(); 724 Row.pop(); 725 Column.pop(); 726 } 727 onPlaceChildren(a17, b17, c17) { 728 b17.forEach((d17) => { 729 d17.layout({ x: 0, y: 0 }); 730 }); 731 this.fontSize = this.decideFontScale(); 732 } 733 popupBuilder(l16 = null) { 734 this.observeComponentCreation2((y16, z16) => { 735 Column.create(); 736 Column.width(ImageMenuItem.imageHotZoneWidth + 737 CollapsibleMenuSection.focusPadding * CollapsibleMenuSection.marginsNum); 738 Column.margin({ top: CollapsibleMenuSection.focusPadding, bottom: CollapsibleMenuSection.focusPadding }); 739 Column.onAppear(() => { 740 focusControl.requestFocus(ImageMenuItem.focusablePrefix + 741 this.firstFocusableIndex); 742 }); 743 }, Column); 744 this.observeComponentCreation2((m16, n16) => { 745 If.create(); 746 if (this.menuItems) { 747 this.ifElseBranchUpdateFunction(0, () => { 748 this.observeComponentCreation2((o16, p16) => { 749 ForEach.create(); 750 const b = (r16, s16) => { 751 const t16 = r16; 752 { 753 this.observeComponentCreation2((u16, v16) => { 754 if (v16) { 755 let w16 = new ImageMenuItem(this, { 756 item: t16, index: this.index * 1000 + 757 CollapsibleMenuSection.maxCountOfVisibleItems + s16, 758 isPopup: false 759 }, undefined, u16, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 404, col: 13 }); 760 ViewPU.create(w16); 761 let c = () => { 762 return { 763 item: t16, 764 index: this.index * 1000 + 765 CollapsibleMenuSection.maxCountOfVisibleItems + s16, 766 isPopup: false 767 }; 768 }; 769 w16.paramsGenerator_ = c; 770 } 771 else { 772 this.updateStateVarsOfChildByElmtId(u16, {}); 773 } 774 }, { name: 'ImageMenuItem' }); 775 } 776 }; 777 this.forEachUpdateFunction(o16, this.menuItems.slice(CollapsibleMenuSection.maxCountOfVisibleItems - 1, this.menuItems.length), b, undefined, true, false); 778 }, ForEach); 779 ForEach.pop(); 780 }); 781 } 782 else { 783 this.ifElseBranchUpdateFunction(1, () => { 784 }); 785 } 786 }, If); 787 If.pop(); 788 Column.pop(); 789 } 790 rerender() { 791 this.updateDirtyElements(); 792 } 793} 794CollapsibleMenuSection.maxCountOfVisibleItems = 3; 795CollapsibleMenuSection.focusPadding = 4; 796CollapsibleMenuSection.marginsNum = 2; 797class ImageMenuItem extends ViewPU { 798 constructor(d16, e16, f16, g16 = -1, h16 = undefined, i16) { 799 super(d16, f16, g16, i16); 800 if (typeof h16 === 'function') { 801 this.paramsGenerator_ = h16; 802 } 803 this.item = {}; 804 this.index = 0; 805 this.itemIndex = 0; 806 this.minFontSize = 1.75; 807 this.isFollowingSystemFontScale = false; 808 this.maxFontScale = 1; 809 this.systemFontScale = 1; 810 this.isPopup = true; 811 this.__isOnFocus = new ObservedPropertySimplePU(false, this, 'isOnFocus'); 812 this.__isOnHover = new ObservedPropertySimplePU(false, this, 'isOnHover'); 813 this.__isOnClick = new ObservedPropertySimplePU(false, this, 'isOnClick'); 814 this.__fontSize = new SynchedPropertySimpleOneWayPU(e16.fontSize, this, 'fontSize'); 815 this.__parentParentUniqueId = this.initializeConsume('uniqueId', 'parentParentUniqueId'); 816 this.dialogController = new CustomDialogController({ 817 builder: () => { 818 let j16 = new ComposeTitleBarDialog(this, { 819 cancel: () => { 820 }, 821 confirm: () => { 822 }, 823 itemComposeTitleDialog: this.item, 824 composeTitleBarDialog: this.item.label ? this.item.label : this.textDialog(), 825 fontSize: this.fontSize, 826 }, undefined, -1, () => { }, { page: 'library/src/main/ets/components/ComposeTitleBar.ets', line: 442, col: 14 }); 827 j16.setController(this.dialogController); 828 ViewPU.create(j16); 829 let a = () => { 830 return { 831 cancel: () => { 832 }, 833 confirm: () => { 834 }, 835 itemComposeTitleDialog: this.item, 836 composeTitleBarDialog: this.item.label ? this.item.label : this.textDialog(), 837 fontSize: this.fontSize 838 }; 839 }; 840 j16.paramsGenerator_ = a; 841 }, 842 maskColor: Color.Transparent, 843 isModal: true, 844 customStyle: true 845 }, this); 846 this.__buttonGestureModifier = new ObservedPropertyObjectPU(new ButtonGestureModifier(this.dialogController), this, 'buttonGestureModifier'); 847 this.setInitiallyProvidedValue(e16); 848 this.declareWatch('fontSize', this.onFontSizeUpdated); 849 this.finalizeConstruction(); 850 } 851 setInitiallyProvidedValue(c16) { 852 if (c16.item !== undefined) { 853 this.item = c16.item; 854 } 855 if (c16.index !== undefined) { 856 this.index = c16.index; 857 } 858 if (c16.itemIndex !== undefined) { 859 this.itemIndex = c16.itemIndex; 860 } 861 if (c16.minFontSize !== undefined) { 862 this.minFontSize = c16.minFontSize; 863 } 864 if (c16.isFollowingSystemFontScale !== undefined) { 865 this.isFollowingSystemFontScale = c16.isFollowingSystemFontScale; 866 } 867 if (c16.maxFontScale !== undefined) { 868 this.maxFontScale = c16.maxFontScale; 869 } 870 if (c16.systemFontScale !== undefined) { 871 this.systemFontScale = c16.systemFontScale; 872 } 873 if (c16.isPopup !== undefined) { 874 this.isPopup = c16.isPopup; 875 } 876 if (c16.isOnFocus !== undefined) { 877 this.isOnFocus = c16.isOnFocus; 878 } 879 if (c16.isOnHover !== undefined) { 880 this.isOnHover = c16.isOnHover; 881 } 882 if (c16.isOnClick !== undefined) { 883 this.isOnClick = c16.isOnClick; 884 } 885 if (c16.fontSize === undefined) { 886 this.__fontSize.set(1); 887 } 888 if (c16.dialogController !== undefined) { 889 this.dialogController = c16.dialogController; 890 } 891 if (c16.buttonGestureModifier !== undefined) { 892 this.buttonGestureModifier = c16.buttonGestureModifier; 893 } 894 } 895 updateStateVars(b16) { 896 this.__fontSize.reset(b16.fontSize); 897 } 898 purgeVariableDependenciesOnElmtId(a16) { 899 this.__isOnFocus.purgeDependencyOnElmtId(a16); 900 this.__isOnHover.purgeDependencyOnElmtId(a16); 901 this.__isOnClick.purgeDependencyOnElmtId(a16); 902 this.__fontSize.purgeDependencyOnElmtId(a16); 903 this.__parentParentUniqueId.purgeDependencyOnElmtId(a16); 904 this.__buttonGestureModifier.purgeDependencyOnElmtId(a16); 905 } 906 aboutToBeDeleted() { 907 this.__isOnFocus.aboutToBeDeleted(); 908 this.__isOnHover.aboutToBeDeleted(); 909 this.__isOnClick.aboutToBeDeleted(); 910 this.__fontSize.aboutToBeDeleted(); 911 this.__parentParentUniqueId.aboutToBeDeleted(); 912 this.__buttonGestureModifier.aboutToBeDeleted(); 913 SubscriberManager.Get().delete(this.id__()); 914 this.aboutToBeDeletedInternal(); 915 } 916 get isOnFocus() { 917 return this.__isOnFocus.get(); 918 } 919 set isOnFocus(z15) { 920 this.__isOnFocus.set(z15); 921 } 922 get isOnHover() { 923 return this.__isOnHover.get(); 924 } 925 set isOnHover(y15) { 926 this.__isOnHover.set(y15); 927 } 928 get isOnClick() { 929 return this.__isOnClick.get(); 930 } 931 set isOnClick(x15) { 932 this.__isOnClick.set(x15); 933 } 934 get fontSize() { 935 return this.__fontSize.get(); 936 } 937 set fontSize(w15) { 938 this.__fontSize.set(w15); 939 } 940 get parentParentUniqueId() { 941 return this.__parentParentUniqueId.get(); 942 } 943 set parentParentUniqueId(v15) { 944 this.__parentParentUniqueId.set(v15); 945 } 946 get buttonGestureModifier() { 947 return this.__buttonGestureModifier.get(); 948 } 949 set buttonGestureModifier(u15) { 950 this.__buttonGestureModifier.set(u15); 951 } 952 textDialog() { 953 if (this.item.value === PUBLIC_MORE) { 954 return { 'id': -1, 'type': 10003, params: ['sys.string.ohos_toolbar_more'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 955 } 956 else if (this.item.value === PUBLIC_BACK) { 957 return { 'id': -1, 'type': 10003, params: ['sys.string.icon_back'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 958 } 959 else { 960 return this.item.label ? this.item.label : ''; 961 } 962 } 963 toStringFormat(p15) { 964 if (typeof p15 === 'string') { 965 return p15; 966 } 967 else if (typeof p15 === 'undefined') { 968 return ''; 969 } 970 else { 971 let q15 = ''; 972 try { 973 if (p15.id === -1) { 974 q15 = getContext()?.resourceManager?.getStringByNameSync(p15.params?.[0].split('.').pop()); 975 } 976 else { 977 q15 = getContext()?.resourceManager?.getStringSync(p15); 978 } 979 } 980 catch (r15) { 981 let s15 = r15?.code; 982 let t15 = r15?.message; 983 hilog.error(0x3900, 'Ace', `Faild to ComposeTitleBar toStringFormat,code: ${s15},message:${t15}`); 984 } 985 return q15; 986 } 987 } 988 getAccessibilityReadText() { 989 if (this.item.value === PUBLIC_BACK) { 990 return getContext()?.resourceManager?.getStringByNameSync('icon_back'); 991 } 992 else if (this.item.value === PUBLIC_MORE) { 993 return getContext()?.resourceManager?.getStringByNameSync('ohos_toolbar_more'); 994 } 995 else if (this.item.accessibilityText) { 996 return this.toStringFormat(this.item.accessibilityText); 997 } 998 else if (this.item.label) { 999 return this.toStringFormat(this.item.label); 1000 } 1001 return ' '; 1002 } 1003 onPlaceChildren(l15, m15, n15) { 1004 m15.forEach((o15) => { 1005 o15.layout({ x: 0, y: 0 }); 1006 }); 1007 this.fontSize = this.decideFontScale(); 1008 } 1009 getFgColor() { 1010 return this.isOnClick 1011 ? { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon_pressed'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' } : { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_titlebar_icon'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 1012 } 1013 getBgColor() { 1014 if (this.isOnClick) { 1015 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_click_effect'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 1016 } 1017 else if (this.isOnHover) { 1018 return { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_hover'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }; 1019 } 1020 else { 1021 return Color.Transparent; 1022 } 1023 } 1024 aboutToAppear() { 1025 try { 1026 let k15 = this.getUIContext(); 1027 this.isFollowingSystemFontScale = k15.isFollowingSystemFontScale(); 1028 this.maxFontScale = k15.getMaxFontScale(); 1029 } 1030 catch (h15) { 1031 let i15 = h15.code; 1032 let j15 = h15.message; 1033 hilog.error(0x3900, 'ComposeTitleBar', `Failed to init fontsizescale info, cause, code: ${i15}, message: ${j15}`); 1034 } 1035 this.fontSize = this.decideFontScale(); 1036 } 1037 onFontSizeUpdated() { 1038 this.buttonGestureModifier.fontSize = this.fontSize; 1039 } 1040 decideFontScale() { 1041 try { 1042 let g15 = this.getUIContext(); 1043 this.systemFontScale = g15.getHostContext()?.config?.fontSizeScale ?? 1; 1044 if (!this.isFollowingSystemFontScale) { 1045 return 1; 1046 } 1047 return Math.min(this.systemFontScale, this.maxFontScale); 1048 } 1049 catch (d15) { 1050 let e15 = d15.code; 1051 let f15 = d15.message; 1052 hilog.error(0x3900, 'ComposeTitleBar', `Faild to decideFontScale,cause, code: ${e15}, message: ${f15}`); 1053 return 1; 1054 } 1055 } 1056 initialRender() { 1057 this.observeComponentCreation2((x13, y13) => { 1058 If.create(); 1059 if (this.isPopup) { 1060 this.ifElseBranchUpdateFunction(0, () => { 1061 if (!If.canRetake(`ComposeTitleBar_ImageMenuItem_${this.parentParentUniqueId}_${this.itemIndex}`)) { 1062 this.observeComponentCreation2((y14, z14) => { 1063 Button.createWithChild({ type: ButtonType.Normal, stateEffect: this.item.isEnabled }); 1064 Button.id(`ComposeTitleBar_ImageMenuItem_${this.parentParentUniqueId}_${this.itemIndex}`); 1065 Button.accessibilityText(this.getAccessibilityReadText()); 1066 Button.accessibilityLevel(this.item?.accessibilityLevel ?? 'auto'); 1067 Button.accessibilityDescription(this.toStringFormat(this.item?.accessibilityDescription)); 1068 Button.enabled(this.item.isEnabled ? this.item.isEnabled : false); 1069 Button.width(ImageMenuItem.imageHotZoneWidth); 1070 Button.height(ImageMenuItem.imageHotZoneWidth); 1071 Button.borderRadius(ImageMenuItem.buttonBorderRadius); 1072 Button.foregroundColor(this.getFgColor()); 1073 Button.backgroundColor(this.getBgColor()); 1074 ViewStackProcessor.visualState('focused'); 1075 Button.border({ 1076 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1077 width: ImageMenuItem.focusBorderWidth, 1078 color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1079 style: BorderStyle.Solid 1080 }); 1081 ViewStackProcessor.visualState('normal'); 1082 Button.border({ 1083 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1084 width: 0 1085 }); 1086 ViewStackProcessor.visualState(); 1087 Button.onFocus(() => { 1088 if (!this.item?.isEnabled) { 1089 return; 1090 } 1091 this.isOnFocus = true; 1092 }); 1093 Button.onBlur(() => this.isOnFocus = false); 1094 Button.onHover((c15) => { 1095 if (!this.item?.isEnabled) { 1096 return; 1097 } 1098 this.isOnHover = c15; 1099 }); 1100 Button.onKeyEvent((b15) => { 1101 if (!this.item?.isEnabled) { 1102 return; 1103 } 1104 if (b15.keyCode !== KeyCode.KEYCODE_ENTER && 1105 b15.keyCode !== KeyCode.KEYCODE_SPACE) { 1106 return; 1107 } 1108 if (b15.type === KeyType.Down) { 1109 this.isOnClick = true; 1110 } 1111 if (b15.type === KeyType.Up) { 1112 this.isOnClick = false; 1113 } 1114 }); 1115 Button.onTouch((a15) => { 1116 if (!this.item?.isEnabled) { 1117 return; 1118 } 1119 if (a15.type === TouchType.Down) { 1120 this.isOnClick = true; 1121 } 1122 if (a15.type === TouchType.Up || a15.type === TouchType.Cancel) { 1123 this.isOnClick = false; 1124 if (this.fontSize >= this.minFontSize) { 1125 this.dialogController?.close(); 1126 } 1127 } 1128 }); 1129 Button.onClick(() => { 1130 if (this.item) { 1131 return this.item.isEnabled && this.item.action?.(); 1132 } 1133 }); 1134 Button.gestureModifier(ObservedObject.GetRawObject(this.buttonGestureModifier)); 1135 }, Button); 1136 this.observeComponentCreation2((o14, p14) => { 1137 If.create(); 1138 if (this.item?.symbolStyle) { 1139 this.ifElseBranchUpdateFunction(0, () => { 1140 this.observeComponentCreation2((w14, x14) => { 1141 SymbolGlyph.create(); 1142 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1143 SymbolGlyph.attributeModifier.bind(this)(this.item?.symbolStyle); 1144 SymbolGlyph.fontSize(`${ImageMenuItem.imageSize}vp`); 1145 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1146 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1147 SymbolGlyph.draggable(false); 1148 SymbolGlyph.focusable(this.item?.isEnabled); 1149 SymbolGlyph.key(ImageMenuItem.focusablePrefix + this.index); 1150 }, SymbolGlyph); 1151 }); 1152 } 1153 else { 1154 this.ifElseBranchUpdateFunction(1, () => { 1155 this.observeComponentCreation2((q14, r14) => { 1156 If.create(); 1157 if (Util.isSymbolResource(this.item.value)) { 1158 this.ifElseBranchUpdateFunction(0, () => { 1159 this.observeComponentCreation2((u14, v14) => { 1160 SymbolGlyph.create(this.item.value); 1161 SymbolGlyph.fontSize(`${ImageMenuItem.imageSize}vp`); 1162 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1163 SymbolGlyph.draggable(false); 1164 SymbolGlyph.focusable(this.item?.isEnabled); 1165 SymbolGlyph.key(ImageMenuItem.focusablePrefix + this.index); 1166 }, SymbolGlyph); 1167 }); 1168 } 1169 else { 1170 this.ifElseBranchUpdateFunction(1, () => { 1171 this.observeComponentCreation2((s14, t14) => { 1172 Image.create(this.item?.value); 1173 Image.matchTextDirection(this.item?.value === PUBLIC_BACK ? true : false); 1174 Image.width(ImageMenuItem.imageSize); 1175 Image.draggable(false); 1176 Image.height(ImageMenuItem.imageSize); 1177 Image.focusable(this.item?.isEnabled); 1178 Image.key(ImageMenuItem.focusablePrefix + this.index); 1179 Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1180 }, Image); 1181 }); 1182 } 1183 }, If); 1184 If.pop(); 1185 }); 1186 } 1187 }, If); 1188 If.pop(); 1189 Button.pop(); 1190 } 1191 }); 1192 } 1193 else { 1194 this.ifElseBranchUpdateFunction(1, () => { 1195 if (!If.canRetake(`ComposeTitleBar_ImageMenuItem_${this.parentParentUniqueId}_${this.itemIndex}`)) { 1196 this.observeComponentCreation2((j14, k14) => { 1197 Button.createWithChild({ type: ButtonType.Normal, stateEffect: this.item.isEnabled }); 1198 Button.id(`ComposeTitleBar_ImageMenuItem_${this.parentParentUniqueId}_${this.itemIndex}`); 1199 Button.accessibilityText(this.getAccessibilityReadText()); 1200 Button.accessibilityLevel(this.item?.accessibilityLevel ?? 'auto'); 1201 Button.accessibilityDescription(this.toStringFormat(this.item?.accessibilityDescription)); 1202 Button.enabled(this.item.isEnabled ? this.item.isEnabled : false); 1203 Button.width(ImageMenuItem.imageHotZoneWidth); 1204 Button.height(ImageMenuItem.imageHotZoneWidth); 1205 Button.borderRadius(ImageMenuItem.buttonBorderRadius); 1206 Button.foregroundColor(this.getFgColor()); 1207 Button.backgroundColor(this.getBgColor()); 1208 ViewStackProcessor.visualState('focused'); 1209 Button.border({ 1210 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1211 width: ImageMenuItem.focusBorderWidth, 1212 color: { 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_focused_outline'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1213 style: BorderStyle.Solid 1214 }); 1215 ViewStackProcessor.visualState('normal'); 1216 Button.border({ 1217 radius: { 'id': -1, 'type': 10002, params: ['sys.float.ohos_id_corner_radius_clicked'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1218 width: 0 1219 }); 1220 ViewStackProcessor.visualState(); 1221 Button.onFocus(() => { 1222 if (!this.item?.isEnabled) { 1223 return; 1224 } 1225 this.isOnFocus = true; 1226 }); 1227 Button.onBlur(() => this.isOnFocus = false); 1228 Button.onHover((n14) => { 1229 if (!this.item?.isEnabled) { 1230 return; 1231 } 1232 this.isOnHover = n14; 1233 }); 1234 Button.onKeyEvent((m14) => { 1235 if (!this.item?.isEnabled) { 1236 return; 1237 } 1238 if (m14.keyCode !== KeyCode.KEYCODE_ENTER && 1239 m14.keyCode !== KeyCode.KEYCODE_SPACE) { 1240 return; 1241 } 1242 if (m14.type === KeyType.Down) { 1243 this.isOnClick = true; 1244 } 1245 if (m14.type === KeyType.Up) { 1246 this.isOnClick = false; 1247 } 1248 }); 1249 Button.onTouch((l14) => { 1250 if (!this.item?.isEnabled) { 1251 return; 1252 } 1253 if (l14.type === TouchType.Down) { 1254 this.isOnClick = true; 1255 } 1256 if (l14.type === TouchType.Up || l14.type === TouchType.Cancel) { 1257 this.isOnClick = false; 1258 if (this.fontSize >= this.minFontSize) { 1259 this.dialogController?.close(); 1260 } 1261 } 1262 }); 1263 Button.onClick(() => { 1264 if (this.item) { 1265 return this.item.isEnabled && this.item.action?.(); 1266 } 1267 }); 1268 }, Button); 1269 this.observeComponentCreation2((z13, a14) => { 1270 If.create(); 1271 if (this.item?.symbolStyle) { 1272 this.ifElseBranchUpdateFunction(0, () => { 1273 this.observeComponentCreation2((h14, i14) => { 1274 SymbolGlyph.create(); 1275 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1276 SymbolGlyph.attributeModifier.bind(this)(this.item?.symbolStyle); 1277 SymbolGlyph.fontSize(`${ImageMenuItem.imageSize}vp`); 1278 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1279 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1280 SymbolGlyph.draggable(false); 1281 SymbolGlyph.focusable(this.item?.isEnabled); 1282 SymbolGlyph.key(ImageMenuItem.focusablePrefix + this.index); 1283 }, SymbolGlyph); 1284 }); 1285 } 1286 else { 1287 this.ifElseBranchUpdateFunction(1, () => { 1288 this.observeComponentCreation2((b14, c14) => { 1289 If.create(); 1290 if (Util.isSymbolResource(this.item.value)) { 1291 this.ifElseBranchUpdateFunction(0, () => { 1292 this.observeComponentCreation2((f14, g14) => { 1293 SymbolGlyph.create(this.item.value); 1294 SymbolGlyph.fontSize(`${ImageMenuItem.imageSize}vp`); 1295 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1296 SymbolGlyph.draggable(false); 1297 SymbolGlyph.focusable(this.item?.isEnabled); 1298 SymbolGlyph.key(ImageMenuItem.focusablePrefix + this.index); 1299 }, SymbolGlyph); 1300 }); 1301 } 1302 else { 1303 this.ifElseBranchUpdateFunction(1, () => { 1304 this.observeComponentCreation2((d14, e14) => { 1305 Image.create(this.item?.value); 1306 Image.matchTextDirection(this.item?.value === PUBLIC_BACK ? true : false); 1307 Image.width(ImageMenuItem.imageSize); 1308 Image.draggable(false); 1309 Image.height(ImageMenuItem.imageSize); 1310 Image.focusable(this.item?.isEnabled); 1311 Image.key(ImageMenuItem.focusablePrefix + this.index); 1312 Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.ohos_id_color_text_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1313 }, Image); 1314 }); 1315 } 1316 }, If); 1317 If.pop(); 1318 }); 1319 } 1320 }, If); 1321 If.pop(); 1322 Button.pop(); 1323 } 1324 }); 1325 } 1326 }, If); 1327 If.pop(); 1328 } 1329 rerender() { 1330 this.updateDirtyElements(); 1331 } 1332} 1333ImageMenuItem.imageSize = 24; 1334ImageMenuItem.imageHotZoneWidth = 48; 1335ImageMenuItem.buttonBorderRadius = 8; 1336ImageMenuItem.focusBorderWidth = 2; 1337ImageMenuItem.focusablePrefix = 'Id-ComposeTitleBar-ImageMenuItem-'; 1338class ComposeTitleBarDialog extends ViewPU { 1339 constructor(r13, s13, t13, u13 = -1, v13 = undefined, w13) { 1340 super(r13, t13, u13, w13); 1341 if (typeof v13 === 'function') { 1342 this.paramsGenerator_ = v13; 1343 } 1344 this.itemComposeTitleDialog = {}; 1345 this.callbackId = undefined; 1346 this.composeTitleBarDialog = ''; 1347 this.mainWindowStage = undefined; 1348 this.controller = undefined; 1349 this.minFontSize = 1.75; 1350 this.maxFontSize = 3.2; 1351 this.screenWidth = 640; 1352 this.verticalScreenLines = 6; 1353 this.horizontalsScreenLines = 1; 1354 this.__mainWindow = this.createStorageLink('mainWindow', undefined, 'mainWindow'); 1355 this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize'); 1356 this.__maxLines = new ObservedPropertySimplePU(1, this, 'maxLines'); 1357 this.__windowStandardHeight = this.createStorageProp('windowStandardHeight', 0, 'windowStandardHeight'); 1358 this.cancel = () => { 1359 }; 1360 this.confirm = () => { 1361 }; 1362 this.setInitiallyProvidedValue(s13); 1363 this.finalizeConstruction(); 1364 } 1365 setInitiallyProvidedValue(q13) { 1366 if (q13.itemComposeTitleDialog !== undefined) { 1367 this.itemComposeTitleDialog = q13.itemComposeTitleDialog; 1368 } 1369 if (q13.callbackId !== undefined) { 1370 this.callbackId = q13.callbackId; 1371 } 1372 if (q13.composeTitleBarDialog !== undefined) { 1373 this.composeTitleBarDialog = q13.composeTitleBarDialog; 1374 } 1375 if (q13.mainWindowStage !== undefined) { 1376 this.mainWindowStage = q13.mainWindowStage; 1377 } 1378 if (q13.controller !== undefined) { 1379 this.controller = q13.controller; 1380 } 1381 if (q13.minFontSize !== undefined) { 1382 this.minFontSize = q13.minFontSize; 1383 } 1384 if (q13.maxFontSize !== undefined) { 1385 this.maxFontSize = q13.maxFontSize; 1386 } 1387 if (q13.screenWidth !== undefined) { 1388 this.screenWidth = q13.screenWidth; 1389 } 1390 if (q13.verticalScreenLines !== undefined) { 1391 this.verticalScreenLines = q13.verticalScreenLines; 1392 } 1393 if (q13.horizontalsScreenLines !== undefined) { 1394 this.horizontalsScreenLines = q13.horizontalsScreenLines; 1395 } 1396 if (q13.fontSize !== undefined) { 1397 this.fontSize = q13.fontSize; 1398 } 1399 if (q13.maxLines !== undefined) { 1400 this.maxLines = q13.maxLines; 1401 } 1402 if (q13.cancel !== undefined) { 1403 this.cancel = q13.cancel; 1404 } 1405 if (q13.confirm !== undefined) { 1406 this.confirm = q13.confirm; 1407 } 1408 } 1409 updateStateVars(p13) { 1410 } 1411 purgeVariableDependenciesOnElmtId(o13) { 1412 this.__mainWindow.purgeDependencyOnElmtId(o13); 1413 this.__fontSize.purgeDependencyOnElmtId(o13); 1414 this.__maxLines.purgeDependencyOnElmtId(o13); 1415 this.__windowStandardHeight.purgeDependencyOnElmtId(o13); 1416 } 1417 aboutToBeDeleted() { 1418 this.__mainWindow.aboutToBeDeleted(); 1419 this.__fontSize.aboutToBeDeleted(); 1420 this.__maxLines.aboutToBeDeleted(); 1421 this.__windowStandardHeight.aboutToBeDeleted(); 1422 SubscriberManager.Get().delete(this.id__()); 1423 this.aboutToBeDeletedInternal(); 1424 } 1425 setController(n13) { 1426 this.controller = n13; 1427 } 1428 get mainWindow() { 1429 return this.__mainWindow.get(); 1430 } 1431 set mainWindow(m13) { 1432 this.__mainWindow.set(m13); 1433 } 1434 get fontSize() { 1435 return this.__fontSize.get(); 1436 } 1437 set fontSize(l13) { 1438 this.__fontSize.set(l13); 1439 } 1440 get maxLines() { 1441 return this.__maxLines.get(); 1442 } 1443 set maxLines(k13) { 1444 this.__maxLines.set(k13); 1445 } 1446 get windowStandardHeight() { 1447 return this.__windowStandardHeight.get(); 1448 } 1449 set windowStandardHeight(j13) { 1450 this.__windowStandardHeight.set(j13); 1451 } 1452 initialRender() { 1453 this.observeComponentCreation2((f12, g12) => { 1454 If.create(); 1455 if (this.composeTitleBarDialog) { 1456 this.ifElseBranchUpdateFunction(0, () => { 1457 this.observeComponentCreation2((h13, i13) => { 1458 Column.create(); 1459 Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 1460 Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 1461 Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); 1462 Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 1463 Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1464 }, Column); 1465 this.observeComponentCreation2((x12, y12) => { 1466 If.create(); 1467 if (this.itemComposeTitleDialog.symbolStyle) { 1468 this.ifElseBranchUpdateFunction(0, () => { 1469 this.observeComponentCreation2((f13, g13) => { 1470 SymbolGlyph.create(); 1471 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1472 SymbolGlyph.attributeModifier.bind(this)(this.itemComposeTitleDialog.symbolStyle); 1473 SymbolGlyph.fontSize(IMAGE_SIZE); 1474 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1475 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1476 SymbolGlyph.margin({ 1477 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1478 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1479 }); 1480 }, SymbolGlyph); 1481 }); 1482 } 1483 else { 1484 this.ifElseBranchUpdateFunction(1, () => { 1485 this.observeComponentCreation2((z12, a13) => { 1486 If.create(); 1487 if (Util.isSymbolResource(this.itemComposeTitleDialog.value)) { 1488 this.ifElseBranchUpdateFunction(0, () => { 1489 this.observeComponentCreation2((d13, e13) => { 1490 SymbolGlyph.create(this.itemComposeTitleDialog.value); 1491 SymbolGlyph.fontSize(IMAGE_SIZE); 1492 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1493 SymbolGlyph.margin({ 1494 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1495 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1496 }); 1497 }, SymbolGlyph); 1498 }); 1499 } 1500 else { 1501 this.ifElseBranchUpdateFunction(1, () => { 1502 this.observeComponentCreation2((b13, c13) => { 1503 Image.create(this.itemComposeTitleDialog.value); 1504 Image.width(IMAGE_SIZE); 1505 Image.height(IMAGE_SIZE); 1506 Image.margin({ 1507 top: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level24'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1508 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level8'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1509 }); 1510 Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1511 }, Image); 1512 }); 1513 } 1514 }, If); 1515 If.pop(); 1516 }); 1517 } 1518 }, If); 1519 If.pop(); 1520 this.observeComponentCreation2((v12, w12) => { 1521 Column.create(); 1522 Column.width('100%'); 1523 Column.padding({ 1524 left: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1525 right: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level4'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1526 bottom: { 'id': -1, 'type': 10002, params: ['sys.float.padding_level12'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }, 1527 }); 1528 }, Column); 1529 this.observeComponentCreation2((t12, u12) => { 1530 Text.create(this.composeTitleBarDialog); 1531 Text.fontSize(TEXT_EDITABLE_DIALOG); 1532 Text.textOverflow({ overflow: TextOverflow.Ellipsis }); 1533 Text.maxLines(this.maxLines); 1534 Text.width('100%'); 1535 Text.textAlign(TextAlign.Center); 1536 Text.fontColor({ 'id': -1, 'type': 10001, params: ['sys.color.font_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1537 }, Text); 1538 Text.pop(); 1539 Column.pop(); 1540 Column.pop(); 1541 }); 1542 } 1543 else { 1544 this.ifElseBranchUpdateFunction(1, () => { 1545 this.observeComponentCreation2((r12, s12) => { 1546 Column.create(); 1547 Column.width(this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG); 1548 Column.constraintSize({ minHeight: this.fontSize === this.maxFontSize ? MAX_DIALOG : MIN_DIALOG }); 1549 Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK); 1550 Column.shadow(ShadowStyle.OUTER_DEFAULT_LG); 1551 Column.borderRadius({ 'id': -1, 'type': 10002, params: ['sys.float.corner_radius_level10'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1552 Column.justifyContent(FlexAlign.Center); 1553 }, Column); 1554 this.observeComponentCreation2((h12, i12) => { 1555 If.create(); 1556 if (this.itemComposeTitleDialog.symbolStyle) { 1557 this.ifElseBranchUpdateFunction(0, () => { 1558 this.observeComponentCreation2((p12, q12) => { 1559 SymbolGlyph.create(); 1560 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1561 SymbolGlyph.attributeModifier.bind(this)(this.itemComposeTitleDialog.symbolStyle); 1562 SymbolGlyph.fontSize(IMAGE_SIZE); 1563 SymbolGlyph.effectStrategy(SymbolEffectStrategy.NONE); 1564 SymbolGlyph.symbolEffect(new SymbolEffect(), false); 1565 }, SymbolGlyph); 1566 }); 1567 } 1568 else { 1569 this.ifElseBranchUpdateFunction(1, () => { 1570 this.observeComponentCreation2((j12, k12) => { 1571 If.create(); 1572 if (Util.isSymbolResource(this.itemComposeTitleDialog.value)) { 1573 this.ifElseBranchUpdateFunction(0, () => { 1574 this.observeComponentCreation2((n12, o12) => { 1575 SymbolGlyph.create(this.itemComposeTitleDialog.value); 1576 SymbolGlyph.fontSize(IMAGE_SIZE); 1577 SymbolGlyph.fontColor([{ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }]); 1578 }, SymbolGlyph); 1579 }); 1580 } 1581 else { 1582 this.ifElseBranchUpdateFunction(1, () => { 1583 this.observeComponentCreation2((l12, m12) => { 1584 Image.create(this.itemComposeTitleDialog.value); 1585 Image.width(IMAGE_SIZE); 1586 Image.height(IMAGE_SIZE); 1587 Image.fillColor({ 'id': -1, 'type': 10001, params: ['sys.color.icon_primary'], 'bundleName': '__harDefaultBundleName__', 'moduleName': '__harDefaultModuleName__' }); 1588 }, Image); 1589 }); 1590 } 1591 }, If); 1592 If.pop(); 1593 }); 1594 } 1595 }, If); 1596 If.pop(); 1597 Column.pop(); 1598 }); 1599 } 1600 }, If); 1601 If.pop(); 1602 } 1603 async aboutToAppear() { 1604 let c12 = this.getUIContext().getHostContext(); 1605 this.mainWindowStage = c12.windowStage.getMainWindowSync(); 1606 let d12 = this.mainWindowStage.getWindowProperties(); 1607 let e12 = d12.windowRect; 1608 if (px2vp(e12.height) > this.screenWidth) { 1609 this.maxLines = this.verticalScreenLines; 1610 } 1611 else { 1612 this.maxLines = this.horizontalsScreenLines; 1613 } 1614 } 1615 rerender() { 1616 this.updateDirtyElements(); 1617 } 1618} 1619export default { ComposeTitleBar };