• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1/*
2 * Copyright (c) 2023-2025 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
16let i = (this && this.i) || function (t1, target, key, desc) {
17  let c = arguments.length;
18  let r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc;
19  let d;
20  if (typeof Reflect === 'object' && typeof Reflect.v1 === 'function') {
21    r = Reflect.v1(t1, target, key, desc);
22  } else {
23    for (let u1 = t1.length - 1; u1 >= 0; u1--) {
24      (d = t1[u1]) && (r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r);
25    }
26  }
27  return c > 3 && r && Object.defineProperty(target, key, r), r;
28};
29if (!('finalizeConstruction' in ViewPU.prototype)) {
30  Reflect.set(ViewPU.prototype, 'finalizeConstruction', () => { });
31}
32const LengthMetrics = requireNapi('arkui.node').LengthMetrics;
33const LengthUnit = requireNapi('arkui.node').LengthUnit;
34const ColorMetrics = requireNapi('arkui.node').ColorMetrics;
35const DividerModifier = requireNapi('arkui.modifier').DividerModifier;
36const hilog = requireNapi('hilog');
37export let ItemState;
38(function (ItemState) {
39  ItemState[ItemState.ENABLE = 1] = 'ENABLE';
40  ItemState[ItemState.DISABLE = 2] = 'DISABLE';
41  ItemState[ItemState.ACTIVATE = 3] = 'ACTIVATE';
42})(ItemState || (ItemState = {}));
43const j = {
44  'id': -1,
45  'type': 40000,
46  params: ['sys.symbol.dot_grid_2x2'],
47  'bundleName': '__harDefaultBundleName__',
48  'moduleName': '__harDefaultModuleName__'
49};
50const m = '24vp';
51const o = 56;
52const t = 5;
53const u = 3.2;
54const a1 = '64vp';
55const b1 = '256vp';
56const c1 = '216vp';
57const d1 = '18.3fp';
58const e1 = -2;
59const f1 = 2;
60const g1 = 40000;
61
62class h1 {
63  constructor(controller) {
64    this.fontSize = 1;
65    this.controller = null;
66    this.controller = controller;
67  }
68
69  applyGesture(event) {
70    if (this.fontSize >= h1.minFontSize) {
71      event.addGesture(new LongPressGestureHandler({ repeat: false, duration: h1.w1 })
72        .onAction(() => {
73          if (event) {
74            this.controller?.open();
75          }
76        })
77        .onActionEnd(() => {
78          this.controller?.close();
79        })
80        .onActionCancel(() => {
81          this.controller?.close();
82        }));
83    } else {
84      event.clearGestures();
85    }
86  }
87}
88
89h1.w1 = 500;
90h1.minFontSize = 1.75;
91class Util {
92  static z1(s1) {
93    if (!Util.a2(s1)) {
94      return false;
95    }
96    let resource = s1;
97    return resource.type === g1;
98  }
99  static a2(resource) {
100    if (!resource) {
101      return false;
102    }
103    if (typeof resource === 'string' || typeof resource === 'undefined') {
104      return false;
105    }
106    return true;
107  }
108}
109let ToolBarOption = class ToolBarOption {
110  constructor() {
111    this.content = '';
112    this.action = undefined;
113    this.icon = undefined;
114    this.state = 1;
115    this.iconColor = {
116      'id': -1,
117      'type': 10001,
118      params: ['sys.color.icon_primary'],
119      'bundleName': '__harDefaultBundleName__',
120      'moduleName': '__harDefaultModuleName__'
121    };
122    this.activatedIconColor = {
123      'id': -1,
124      'type': 10001,
125      params: ['sys.color.icon_emphasize'],
126      'bundleName': '__harDefaultBundleName__',
127      'moduleName': '__harDefaultModuleName__'
128    };
129    this.textColor = {
130      'id': -1,
131      'type': 10001,
132      params: ['sys.color.font_primary'],
133      'bundleName': '__harDefaultBundleName__',
134      'moduleName': '__harDefaultModuleName__'
135    };
136    this.activatedTextColor = {
137      'id': -1,
138      'type': 10001,
139      params: ['sys.color.font_emphasize'],
140      'bundleName': '__harDefaultBundleName__',
141      'moduleName': '__harDefaultModuleName__'
142    };
143    this.toolBarSymbolOptions = undefined;
144    this.accessibilityText = '';
145    this.accessibilityDescription = '';
146    this.accessibilityLevel = 'auto';
147  }
148};
149ToolBarOption = i([
150  Observed
151], ToolBarOption);
152export { ToolBarOption };
153let ToolBarOptions = class ToolBarOptions extends Array {
154};
155ToolBarOptions = i([
156  Observed
157], ToolBarOptions);
158export { ToolBarOptions };
159export class ToolBarModifier {
160  constructor() {
161    this.b2 = {
162      'id': -1,
163      'type': 10001,
164      params: ['sys.color.ohos_id_color_toolbar_bg'],
165      'bundleName': '__harDefaultBundleName__',
166      'moduleName': '__harDefaultModuleName__'
167    };
168    this.c2 = LengthMetrics.vp(o);
169    this.d2 = true;
170    this.paddingValue = LengthMetrics.resource({
171      'id': -1,
172      'type': 10002,
173      params: ['sys.float.padding_level12'],
174      'bundleName': '__harDefaultBundleName__',
175      'moduleName': '__harDefaultModuleName__'
176    });
177  }
178
179  applyNormalAttribute(instance) {
180    instance.backgroundColor(this.b2);
181  }
182
183  backgroundColor(backgroundColor) {
184    this.b2 = backgroundColor;
185    return this;
186  }
187
188  height(height) {
189    this.c2 = height;
190    return this;
191  }
192
193  stateEffect(stateEffect) {
194    this.d2 = stateEffect;
195    return this;
196  }
197
198  padding(padding) {
199    this.paddingValue = padding;
200    return this;
201  }
202}
203
204class g2 {
205  constructor() {
206    this.i2 = {
207      'id': -1,
208      'type': 10001,
209      params: ['sys.color.icon_primary'],
210      'bundleName': '__harDefaultBundleName__',
211      'moduleName': '__harDefaultModuleName__'
212    };
213    this.j2 = {
214      'id': -1,
215      'type': 10001,
216      params: ['sys.color.icon_emphasize'],
217      'bundleName': '__harDefaultBundleName__',
218      'moduleName': '__harDefaultModuleName__'
219    };
220    this.l2 = {
221      'id': -1,
222      'type': 10001,
223      params: ['sys.color.font_primary'],
224      'bundleName': '__harDefaultBundleName__',
225      'moduleName': '__harDefaultModuleName__'
226    };
227    this.m2 = {
228      'id': -1,
229      'type': 10001,
230      params: ['sys.color.font_emphasize'],
231      'bundleName': '__harDefaultBundleName__',
232      'moduleName': '__harDefaultModuleName__'
233    };
234  }
235}
236
237export class ToolBar extends ViewPU {
238  constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
239    super(parent, __localStorage, elmtId, extraInfo);
240    if (typeof paramsLambda === 'function') {
241      this.paramsGenerator_ = paramsLambda;
242    }
243    this.__toolBarList = new SynchedPropertyNesedObjectPU(params.toolBarList, this, 'toolBarList');
244    this.controller = new TabsController();
245    this.__activateIndex = new SynchedPropertySimpleOneWayPU(params.activateIndex, this, 'activateIndex');
246    this.__dividerModifier = new SynchedPropertyObjectOneWayPU(params.dividerModifier, this, 'dividerModifier');
247    this.__toolBarModifier = new SynchedPropertyObjectOneWayPU(params.toolBarModifier, this, 'toolBarModifier');
248    this.__moreText = new SynchedPropertyObjectOneWayPU(params.moreText, this, 'moreText');
249    this.__menuContent = new ObservedPropertyObjectPU([], this, 'menuContent');
250    this.__toolBarItemBackground = new ObservedPropertyObjectPU([], this, 'toolBarItemBackground');
251    this.__toolBarTheme = new ObservedPropertyObjectPU(new g2(), this, 'toolBarTheme');
252    this.__fontSize = new ObservedPropertySimplePU(1, this, 'fontSize');
253    this.isFollowSystem = false;
254    this.maxFontSizeScale = 3.2;
255    this.moreIndex = 4;
256    this.moreItem = {
257      content: {
258        'id': -1,
259        'type': 10003,
260        params: ['sys.string.ohos_toolbar_more'],
261        'bundleName': '__harDefaultBundleName__',
262        'moduleName': '__harDefaultModuleName__'
263      },
264      icon: j,
265    };
266    this.setInitiallyProvidedValue(params);
267    this.finalizeConstruction();
268  }
269
270  setInitiallyProvidedValue(params) {
271    this.__toolBarList.set(params.toolBarList);
272    if (params.controller !== undefined) {
273      this.controller = params.controller;
274    }
275    if (params.activateIndex === undefined) {
276      this.__activateIndex.set(-1);
277    }
278    if (params.moreText === undefined) {
279      this.__moreText.set({
280        'id': -1,
281        'type': 10003,
282        params: ['sys.string.ohos_toolbar_more'],
283        'bundleName': '__harDefaultBundleName__',
284        'moduleName': '__harDefaultModuleName__'
285      });
286    }
287    if (params.menuContent !== undefined) {
288      this.menuContent = params.menuContent;
289    }
290    if (params.toolBarItemBackground !== undefined) {
291      this.toolBarItemBackground = params.toolBarItemBackground;
292    }
293    if (params.toolBarTheme !== undefined) {
294      this.toolBarTheme = params.toolBarTheme;
295    }
296    if (params.fontSize !== undefined) {
297      this.fontSize = params.fontSize;
298    }
299    if (params.isFollowSystem !== undefined) {
300      this.isFollowSystem = params.isFollowSystem;
301    }
302    if (params.maxFontSizeScale !== undefined) {
303      this.maxFontSizeScale = params.maxFontSizeScale;
304    }
305    if (params.moreIndex !== undefined) {
306      this.moreIndex = params.moreIndex;
307    }
308    if (params.moreItem !== undefined) {
309      this.moreItem = params.moreItem;
310    }
311  }
312
313  updateStateVars(params) {
314    this.__toolBarList.set(params.toolBarList);
315    this.__activateIndex.reset(params.activateIndex);
316    this.__dividerModifier.reset(params.dividerModifier);
317    this.__toolBarModifier.reset(params.toolBarModifier);
318    this.__moreText.reset(params.moreText);
319  }
320
321  purgeVariableDependenciesOnElmtId(rmElmtId) {
322    this.__toolBarList.purgeDependencyOnElmtId(rmElmtId);
323    this.__activateIndex.purgeDependencyOnElmtId(rmElmtId);
324    this.__dividerModifier.purgeDependencyOnElmtId(rmElmtId);
325    this.__toolBarModifier.purgeDependencyOnElmtId(rmElmtId);
326    this.__moreText.purgeDependencyOnElmtId(rmElmtId);
327    this.__menuContent.purgeDependencyOnElmtId(rmElmtId);
328    this.__toolBarItemBackground.purgeDependencyOnElmtId(rmElmtId);
329    this.__toolBarTheme.purgeDependencyOnElmtId(rmElmtId);
330    this.__fontSize.purgeDependencyOnElmtId(rmElmtId);
331  }
332  aboutToBeDeleted() {
333    this.__toolBarList.aboutToBeDeleted();
334    this.__activateIndex.aboutToBeDeleted();
335    this.__dividerModifier.aboutToBeDeleted();
336    this.__toolBarModifier.aboutToBeDeleted();
337    this.__moreText.aboutToBeDeleted();
338    this.__menuContent.aboutToBeDeleted();
339    this.__toolBarItemBackground.aboutToBeDeleted();
340    this.__toolBarTheme.aboutToBeDeleted();
341    this.__fontSize.aboutToBeDeleted();
342    SubscriberManager.Get().delete(this.id__());
343    this.aboutToBeDeletedInternal();
344  }
345  get toolBarList() {
346    return this.__toolBarList.get();
347  }
348  get activateIndex() {
349    return this.__activateIndex.get();
350  }
351
352  set activateIndex(newValue) {
353    this.__activateIndex.set(newValue);
354  }
355  get dividerModifier() {
356    return this.__dividerModifier.get();
357  }
358
359  set dividerModifier(newValue) {
360    this.__dividerModifier.set(newValue);
361  }
362  get toolBarModifier() {
363    return this.__toolBarModifier.get();
364  }
365
366  set toolBarModifier(newValue) {
367    this.__toolBarModifier.set(newValue);
368  }
369  get moreText() {
370    return this.__moreText.get();
371  }
372
373  set moreText(newValue) {
374    this.__moreText.set(newValue);
375  }
376  get menuContent() {
377    return this.__menuContent.get();
378  }
379
380  set menuContent(newValue) {
381    this.__menuContent.set(newValue);
382  }
383  get toolBarItemBackground() {
384    return this.__toolBarItemBackground.get();
385  }
386
387  set toolBarItemBackground(newValue) {
388    this.__toolBarItemBackground.set(newValue);
389  }
390
391  get toolBarTheme() {
392    return this.__toolBarTheme.get();
393  }
394
395  set toolBarTheme(newValue) {
396    this.__toolBarTheme.set(newValue);
397  }
398  get fontSize() {
399    return this.__fontSize.get();
400  }
401
402  set fontSize(newValue) {
403    this.__fontSize.set(newValue);
404  }
405
406  onWillApplyTheme(theme) {
407    this.toolBarTheme.i2 = theme.colors.iconPrimary;
408    this.toolBarTheme.j2 = theme.colors.iconEmphasize;
409    this.toolBarTheme.l2 = theme.colors.fontPrimary;
410    this.toolBarTheme.m2 = theme.colors.fontEmphasize;
411  }
412  MoreTabBuilder(index, parent = null) {
413    this.observeComponentCreation2((elmtId, isInitialRender) => {
414      Button.createWithChild({ type: ButtonType.Normal, stateEffect: false });
415      Button.accessibilityGroup(true);
416      Button.focusable(true);
417      Button.focusOnTouch(true);
418      Button.focusBox({
419        margin: LengthMetrics.vp(e1),
420        strokeWidth: LengthMetrics.vp(f1),
421        strokeColor: ColorMetrics.resourceColor({
422          'id': -1,
423          'type': 10001,
424          params: ['sys.color.ohos_id_color_focused_outline'],
425          'bundleName': '__harDefaultBundleName__',
426          'moduleName': '__harDefaultModuleName__'
427        })
428      });
429      Button.width('100%');
430      Button.height('100%');
431      Button.bindMenu(ObservedObject.GetRawObject(this.menuContent),
432        { placement: Placement.TopRight, offset: { x: -12, y: -10 } });
433      Button.borderRadius({
434        'id': -1,
435        'type': 10002,
436        params: ['sys.float.ohos_id_corner_radius_clicked'],
437        'bundleName': '__harDefaultBundleName__',
438        'moduleName': '__harDefaultModuleName__'
439      });
440      Button.backgroundColor(this.toolBarItemBackground[index]);
441      Button.onHover((isHover) => {
442        if (isHover) {
443          this.toolBarItemBackground[index] = {
444            'id': -1,
445            'type': 10001,
446            params: ['sys.color.ohos_id_color_hover'],
447            'bundleName': '__harDefaultBundleName__',
448            'moduleName': '__harDefaultModuleName__'
449          };
450        }
451        else {
452          this.toolBarItemBackground[index] = Color.Transparent;
453        }
454      });
455      ViewStackProcessor.visualState('pressed');
456      Button.backgroundColor((!this.toolBarModifier?.d2) ?
457      this.toolBarItemBackground[index] : {
458          'id': -1,
459          'type': 10001,
460          params: ['sys.color.ohos_id_color_click_effect'],
461          'bundleName': '__harDefaultBundleName__',
462          'moduleName': '__harDefaultModuleName__'
463        });
464      ViewStackProcessor.visualState();
465      Button.gestureModifier(this.getItemGestureModifier(this.moreItem, index));
466    }, Button);
467    this.observeComponentCreation2((elmtId, isInitialRender) => {
468      Column.create();
469      Column.width('100%');
470      Column.height('100%');
471      Column.justifyContent(FlexAlign.Center);
472      Column.padding({
473        start: LengthMetrics.resource({
474          'id': -1,
475          'type': 10002,
476          params: ['sys.float.padding_level2'],
477          'bundleName': '__harDefaultBundleName__',
478          'moduleName': '__harDefaultModuleName__'
479        }),
480        end: LengthMetrics.resource({
481          'id': -1,
482          'type': 10002,
483          params: ['sys.float.padding_level2'],
484          'bundleName': '__harDefaultBundleName__',
485          'moduleName': '__harDefaultModuleName__'
486        }),
487      });
488      Column.borderRadius({
489        'id': -1,
490        'type': 10002,
491        params: ['sys.float.ohos_id_corner_radius_clicked'],
492        'bundleName': '__harDefaultBundleName__',
493        'moduleName': '__harDefaultModuleName__'
494      });
495    }, Column);
496    this.observeComponentCreation2((elmtId, isInitialRender) => {
497      SymbolGlyph.create(j);
498      SymbolGlyph.fontSize(m);
499      SymbolGlyph.fontColor([this.toolBarTheme.i2]);
500      SymbolGlyph.draggable(false);
501      SymbolGlyph.margin({
502        bottom: {
503          'id': -1,
504          'type': 10002,
505          params: ['sys.float.padding_level1'],
506          'bundleName': '__harDefaultBundleName__',
507          'moduleName': '__harDefaultModuleName__'
508        }
509      });
510    }, SymbolGlyph);
511    this.observeComponentCreation2((elmtId, isInitialRender) => {
512      Text.create(this.moreText);
513      Text.fontColor(this.toolBarTheme.l2);
514      Text.fontSize({
515        'id': -1,
516        'type': 10002,
517        params: ['sys.float.ohos_id_text_size_caption'],
518        'bundleName': '__harDefaultBundleName__',
519        'moduleName': '__harDefaultModuleName__'
520      });
521      Text.fontWeight(FontWeight.Medium);
522      Text.maxLines(1);
523      Text.textOverflow({ overflow: TextOverflow.Ellipsis });
524      Text.textAlign(TextAlign.Center);
525      Text.focusable(true);
526      Text.focusOnTouch(true);
527    }, Text);
528    Text.pop();
529    Column.pop();
530    Button.pop();
531  }
532  TabBuilder(index, parent = null) {
533    this.observeComponentCreation2((elmtId, isInitialRender) => {
534      Button.createWithChild({ type: ButtonType.Normal, stateEffect: false });
535      Button.accessibilityGroup(true);
536      Button.accessibilityText(this.toolBarList[index]?.accessibilityText ??
537        this.toolBarList[index]?.content);
538      Button.accessibilityDescription(this.toolBarList[index]?.accessibilityDescription ?? '');
539      Button.accessibilityLevel(this.toolBarList[index]?.accessibilityLevel ?? 'auto');
540      Button.enabled(this.toolBarList[index]?.state !== ItemState.DISABLE);
541      Button.width('100%');
542      Button.height('100%');
543      Button.borderRadius({
544        'id': -1,
545        'type': 10002,
546        params: ['sys.float.ohos_id_corner_radius_clicked'],
547        'bundleName': '__harDefaultBundleName__',
548        'moduleName': '__harDefaultModuleName__'
549      });
550      Button.focusable(!(this.toolBarList[index]?.state === ItemState.DISABLE));
551      Button.focusOnTouch(!(this.toolBarList[index]?.state === ItemState.DISABLE));
552      Button.focusBox({
553        margin: LengthMetrics.vp(e1),
554        strokeWidth: LengthMetrics.vp(f1),
555        strokeColor: ColorMetrics.resourceColor({
556          'id': -1,
557          'type': 10001,
558          params: ['sys.color.ohos_id_color_focused_outline'],
559          'bundleName': '__harDefaultBundleName__',
560          'moduleName': '__harDefaultModuleName__'
561        })
562      });
563      Button.backgroundColor(this.toolBarItemBackground[index]);
564      Button.onHover((isHover) => {
565        if (isHover && this.toolBarList[index]?.state !== ItemState.DISABLE) {
566          this.toolBarItemBackground[index] = {
567            'id': -1,
568            'type': 10001,
569            params: ['sys.color.ohos_id_color_hover'],
570            'bundleName': '__harDefaultBundleName__',
571            'moduleName': '__harDefaultModuleName__'
572          };
573        } else {
574          this.toolBarItemBackground[index] = Color.Transparent;
575        }
576      });
577      ViewStackProcessor.visualState('pressed');
578      Button.backgroundColor((this.toolBarList[index]?.state === ItemState.DISABLE) ||
579        (!this.toolBarModifier?.d2) ?
580      this.toolBarItemBackground[index] : {
581          'id': -1,
582          'type': 10001,
583          params: ['sys.color.ohos_id_color_click_effect'],
584          'bundleName': '__harDefaultBundleName__',
585          'moduleName': '__harDefaultModuleName__'
586        });
587      ViewStackProcessor.visualState();
588      Button.onClick(() => {
589        this.clickEventAction(index);
590      });
591      Button.gestureModifier(this.getItemGestureModifier(this.toolBarList[index], index));
592    }, Button);
593    this.observeComponentCreation2((elmtId, isInitialRender) => {
594      Column.create();
595      Column.justifyContent(FlexAlign.Center);
596      Column.width('100%');
597      Column.height('100%');
598      Column.borderRadius({
599        'id': -1,
600        'type': 10002,
601        params: ['sys.float.ohos_id_corner_radius_clicked'],
602        'bundleName': '__harDefaultBundleName__',
603        'moduleName': '__harDefaultModuleName__'
604      });
605      Column.padding({
606        start: LengthMetrics.resource({
607          'id': -1,
608          'type': 10002,
609          params: ['sys.float.padding_level2'],
610          'bundleName': '__harDefaultBundleName__',
611          'moduleName': '__harDefaultModuleName__'
612        }),
613        end: LengthMetrics.resource({
614          'id': -1,
615          'type': 10002,
616          params: ['sys.float.padding_level2'],
617          'bundleName': '__harDefaultBundleName__',
618          'moduleName': '__harDefaultModuleName__'
619        }),
620      });
621    }, Column);
622    this.observeComponentCreation2((elmtId, isInitialRender) => {
623      If.create();
624      if (this.toolBarList[index]?.toolBarSymbolOptions?.normal ||
625        this.toolBarList[index]?.toolBarSymbolOptions?.activated) {
626        this.ifElseBranchUpdateFunction(0, () => {
627          this.observeComponentCreation2((elmtId, isInitialRender) => {
628            SymbolGlyph.create();
629            SymbolGlyph.fontSize(m);
630            SymbolGlyph.symbolEffect(new SymbolEffect(), false);
631            SymbolGlyph.attributeModifier.bind(this)(this.getToolBarSymbolModifier(index));
632            SymbolGlyph.margin({
633              bottom: {
634                'id': -1,
635                'type': 10002,
636                params: ['sys.float.padding_level1'],
637                'bundleName': '__harDefaultBundleName__',
638                'moduleName': '__harDefaultModuleName__'
639              }
640            });
641          }, SymbolGlyph);
642        });
643      } else if (Util.z1(this.toolBarList[index]?.icon)) {
644        this.ifElseBranchUpdateFunction(1, () => {
645          this.observeComponentCreation2((elmtId, isInitialRender) => {
646            SymbolGlyph.create(this.toolBarList[index]?.icon);
647            SymbolGlyph.fontSize(m);
648            SymbolGlyph.fontColor([this.getIconColor(index)]);
649            SymbolGlyph.margin({
650              bottom: {
651                'id': -1,
652                'type': 10002,
653                params: ['sys.float.padding_level1'],
654                'bundleName': '__harDefaultBundleName__',
655                'moduleName': '__harDefaultModuleName__'
656              }
657            });
658          }, SymbolGlyph);
659        });
660      }
661      else {
662        this.ifElseBranchUpdateFunction(2, () => {
663          this.observeComponentCreation2((elmtId, isInitialRender) => {
664            Image.create(this.toolBarList[index]?.icon);
665            Image.width(m);
666            Image.height(m);
667            Image.fillColor(this.getIconColor(index));
668            Image.margin({
669              bottom: {
670                'id': -1,
671                'type': 10002,
672                params: ['sys.float.padding_level1'],
673                'bundleName': '__harDefaultBundleName__',
674                'moduleName': '__harDefaultModuleName__'
675              }
676            });
677            Image.objectFit(ImageFit.Contain);
678            Image.draggable(false);
679          }, Image);
680        });
681      }
682    }, If);
683    If.pop();
684    this.observeComponentCreation2((elmtId, isInitialRender) => {
685      Text.create(this.toolBarList[index]?.content);
686      Text.fontColor(this.getTextColor(index));
687      Text.fontSize({
688        'id': -1,
689        'type': 10002,
690        params: ['sys.float.ohos_id_text_size_caption'],
691        'bundleName': '__harDefaultBundleName__',
692        'moduleName': '__harDefaultModuleName__'
693      });
694      Text.maxFontSize({
695        'id': -1,
696        'type': 10002,
697        params: ['sys.float.ohos_id_text_size_caption'],
698        'bundleName': '__harDefaultBundleName__',
699        'moduleName': '__harDefaultModuleName__'
700      });
701      Text.minFontSize(9);
702      Text.fontWeight(FontWeight.Medium);
703      Text.maxLines(1);
704      Text.textOverflow({ overflow: TextOverflow.Ellipsis });
705      Text.textAlign(TextAlign.Center);
706      Text.focusable(!(this.toolBarList[index]?.state === ItemState.DISABLE));
707      Text.focusOnTouch(!(this.toolBarList[index]?.state === ItemState.DISABLE));
708    }, Text);
709    Text.pop();
710    Column.pop();
711    Button.pop();
712  }
713  getFontSizeScale() {
714    let context = this.getUIContext();
715    let q1 = context.getHostContext()?.config?.fontSizeScale ?? 1;
716    if (!this.isFollowSystem) {
717      return 1;
718    }
719    else {
720      return Math.min(q1, this.maxFontSizeScale);
721    }
722  }
723
724  getToolBarSymbolModifier(index) {
725    if ((!this.toolBarList[index]?.toolBarSymbolOptions?.activated) &&
726      (!this.toolBarList[index]?.toolBarSymbolOptions?.normal)) {
727      return undefined;
728    }
729    if (this.activateIndex === index && (this.toolBarList[index]?.state === ItemState.ACTIVATE)) {
730      return this.toolBarList[index]?.toolBarSymbolOptions?.activated;
731    }
732    return this.toolBarList[index]?.toolBarSymbolOptions?.normal;
733  }
734
735  getIconColor(index) {
736    if (this.activateIndex === index && (this.toolBarList[index]?.state === ItemState.ACTIVATE)) {
737      return this.toolBarList[index]?.activatedIconColor ?? this.toolBarTheme.j2;
738    }
739    return this.toolBarList[index]?.iconColor ?? this.toolBarTheme.i2;
740  }
741
742  getTextColor(index) {
743    if (this.activateIndex === index && (this.toolBarList[index]?.state === ItemState.ACTIVATE)) {
744      return this.toolBarList[index]?.activatedTextColor ?? this.toolBarTheme.m2;
745    }
746    return this.toolBarList[index]?.textColor ?? this.toolBarTheme.l2;
747  }
748
749  toLengthString(value) {
750    if (value === void (0)) {
751      return '';
752    }
753    const length = value.value;
754    let o1 = '';
755    switch (value.unit) {
756      case LengthUnit.PX:
757        o1 = `${length}px`;
758        break;
759      case LengthUnit.FP:
760        o1 = `${length}fp`;
761        break;
762      case LengthUnit.LPX:
763        o1 = `${length}lpx`;
764        break;
765      case LengthUnit.PERCENT:
766        o1 = `${length * 100}%`;
767        break;
768      case LengthUnit.VP:
769        o1 = `${length}vp`;
770        break;
771      default:
772        o1 = `${length}vp`;
773        break;
774    }
775    return o1;
776  }
777
778  clickEventAction(index) {
779    let n1 = this.toolBarList[index];
780    if (n1.state === ItemState.ACTIVATE) {
781      if (this.activateIndex === index) {
782        this.activateIndex = -1;
783      }
784      else {
785        this.activateIndex = index;
786      }
787    }
788    if (!(n1.state === ItemState.DISABLE)) {
789      n1.action && n1.action();
790    }
791  }
792
793  getItemGestureModifier(item, index) {
794    let m1 = new h1(null);
795    if (item?.icon || item?.toolBarSymbolOptions?.activated || item?.toolBarSymbolOptions?.normal) {
796      m1 = new h1(new CustomDialogController({
797        builder: () => {
798          let jsDialog = new i1(this, {
799            itemDialog: item,
800            fontSize: this.fontSize,
801            itemSymbolModifier: this.getToolBarSymbolModifier(index),
802          }, undefined, -1, () => {
803          },
804            { page: 'toolbar/src/main/ets/components/MainPage.ets', line: 430, e2: 18 });
805          jsDialog.setController();
806          ViewPU.create(jsDialog);
807          let paramsLambda = () => {
808            return {
809              itemDialog: item,
810              fontSize: this.fontSize,
811              itemSymbolModifier: this.getToolBarSymbolModifier(index)
812            };
813          };
814          jsDialog.paramsGenerator_ = paramsLambda;
815        },
816        maskColor: Color.Transparent,
817        isModal: true,
818        customStyle: true
819      }, this));
820      m1.fontSize = this.fontSize;
821    }
822    return m1;
823  }
824  refreshData() {
825    this.dividerModifier = this.dividerModifier ? this.dividerModifier : new DividerModifier();
826    this.toolBarModifier = this.toolBarModifier ? this.toolBarModifier : new ToolBarModifier()
827      .padding(LengthMetrics.resource({
828        'id': -1,
829        'type': 10002,
830        params: ['sys.float.padding_level12'],
831        'bundleName': '__harDefaultBundleName__',
832        'moduleName': '__harDefaultModuleName__'
833      }))
834      .stateEffect(true)
835      .height(LengthMetrics.vp(o))
836      .backgroundColor('sys.color.ohos_id_color_toolbar_bg');
837    this.menuContent = [];
838    for (let h2 = 0; h2 < this.toolBarList.length; h2++) {
839      if (h2 >= this.moreIndex && this.toolBarList.length > t) {
840        this.menuContent[h2 - this.moreIndex] = {
841          value: this.toolBarList[h2].content,
842          action: this.toolBarList[h2].action ? this.toolBarList[h2].action : () => {
843          },
844          enabled: this.toolBarList[h2].state !== ItemState.DISABLE,
845        };
846      }
847      else {
848        this.menuContent = [];
849      }
850      this.toolBarItemBackground[h2] = this.toolBarItemBackground[h2] ?? Color.Transparent;
851    }
852    return true;
853  }
854
855  onMeasureSize(selfLayoutInfo, children, constraint) {
856    this.fontSize = this.getFontSizeScale();
857    let j1 = { height: 0, width: 0 };
858    children.forEach((child) => {
859      let k1 = child.measure(constraint);
860      j1.width = k1.width;
861      j1.height = k1.height;
862    });
863    return j1;
864  }
865  aboutToAppear() {
866    this.refreshData();
867    try {
868      this.isFollowSystem = this.getUIContext()?.isFollowingSystemFontScale();
869      this.maxFontSizeScale = this.getUIContext()?.getMaxFontScale();
870    } catch (err) {
871      let code = err?.code;
872      let message = err?.message;
873      hilog.error(0x3900, 'Ace', `Faild to toolBar getMaxFontScale, code: ${code}, message: ${message}`);
874    }
875  }
876  initialRender() {
877    this.observeComponentCreation2((elmtId, isInitialRender) => {
878      Column.create();
879      Column.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.toolBarModifier));
880    }, Column);
881    this.observeComponentCreation2((elmtId, isInitialRender) => {
882      Tabs.create({ controller: this.controller });
883      Tabs.visibility(Visibility.None);
884    }, Tabs);
885    Tabs.pop();
886    this.observeComponentCreation2((elmtId, isInitialRender) => {
887      Divider.create();
888      Divider.width('100%');
889      Divider.height(1);
890      Divider.attributeModifier.bind(this)(ObservedObject.GetRawObject(this.dividerModifier));
891    }, Divider);
892    this.observeComponentCreation2((elmtId, isInitialRender) => {
893      Row.create();
894      Row.justifyContent(FlexAlign.Center);
895      Row.constraintSize({
896        minHeight: this.toLengthString(this.toolBarModifier?.c2),
897        maxHeight: this.toLengthString(this.toolBarModifier?.c2),
898      });
899      Row.width('100%');
900      Row.height(this.toLengthString(this.toolBarModifier?.c2));
901      Row.padding({
902        start: this.toolBarList.length < t ?
903          this.toolBarModifier?.paddingValue : LengthMetrics.resource({
904          'id': -1,
905          'type': 10002,
906          params: ['sys.float.padding_level0'],
907          'bundleName': '__harDefaultBundleName__',
908          'moduleName': '__harDefaultModuleName__'
909        }),
910        end: this.toolBarList.length < t ?
911          this.toolBarModifier?.paddingValue : LengthMetrics.resource({
912          'id': -1,
913          'type': 10002,
914          params: ['sys.float.padding_level0'],
915          'bundleName': '__harDefaultBundleName__',
916          'moduleName': '__harDefaultModuleName__'
917        }),
918      });
919    }, Row);
920    this.observeComponentCreation2((elmtId, isInitialRender) => {
921      ForEach.create();
922      const forEachItemGenFunction = (_item, index) => {
923        const item = _item;
924        this.observeComponentCreation2((elmtId, isInitialRender) => {
925          If.create();
926          if (this.toolBarList.length <= t || index < this.moreIndex) {
927            this.ifElseBranchUpdateFunction(0, () => {
928              this.observeComponentCreation2((elmtId, isInitialRender) => {
929                Row.create();
930                Row.height('100%');
931                Row.flexShrink(1);
932              }, Row);
933              this.TabBuilder.bind(this)(index);
934              Row.pop();
935            });
936          }
937          else {
938            this.ifElseBranchUpdateFunction(1, () => {
939            });
940          }
941        }, If);
942        If.pop();
943      };
944      this.forEachUpdateFunction(elmtId, this.toolBarList, forEachItemGenFunction, (item, index) => {
945        return `${this.getUniqueId()}__${index}}`;
946      }, true, true);
947    }, ForEach);
948    ForEach.pop();
949    this.observeComponentCreation2((elmtId, isInitialRender) => {
950      If.create();
951      if (this.refreshData() && this.toolBarList.length > t) {
952        this.ifElseBranchUpdateFunction(0, () => {
953          this.observeComponentCreation2((elmtId, isInitialRender) => {
954            Row.create();
955            Row.height('100%');
956            Row.flexShrink(1);
957          }, Row);
958          this.MoreTabBuilder.bind(this)(this.moreIndex);
959          Row.pop();
960        });
961      }
962      else {
963        this.ifElseBranchUpdateFunction(1, () => {
964        });
965      }
966    }, If);
967    If.pop();
968    Row.pop();
969    Column.pop();
970  }
971  rerender() {
972    this.updateDirtyElements();
973  }
974}
975
976class i1 extends ViewPU {
977  constructor(parent, params, __localStorage, elmtId = -1, paramsLambda = undefined, extraInfo) {
978    super(parent, __localStorage, elmtId, extraInfo);
979    if (typeof paramsLambda === 'function') {
980      this.paramsGenerator_ = paramsLambda;
981    }
982    this.itemDialog = {
983      icon: undefined,
984      content: '',
985    };
986    this.itemSymbolModifier = undefined;
987    this.mainWindowStage = undefined;
988    this.controller = undefined;
989    this.screenWidth = 640;
990    this.verticalScreenLines = 6;
991    this.horizontalsScreenLines = 1;
992    this.cancel = () => {
993    };
994    this.confirm = () => {
995    };
996    this.__mainWindow = this.createStorageLink('mainWindow', undefined, 'mainWindow');
997    this.__fontSize = new SynchedPropertySimpleOneWayPU(params.fontSize, this, 'fontSize');
998    this.__maxLines = new ObservedPropertySimplePU(1, this, 'maxLines');
999    this.__windowStandardHeight = this.createStorageProp('windowStandardHeight', 0, 'windowStandardHeight');
1000    this.__symbolEffect = new ObservedPropertyObjectPU(new SymbolEffect(), this, 'symbolEffect');
1001    this.setInitiallyProvidedValue(params);
1002    this.finalizeConstruction();
1003  }
1004
1005  setInitiallyProvidedValue(params) {
1006    if (params.itemDialog !== undefined) {
1007      this.itemDialog = params.itemDialog;
1008    }
1009    if (params.itemSymbolModifier !== undefined) {
1010      this.itemSymbolModifier = params.itemSymbolModifier;
1011    }
1012    if (params.mainWindowStage !== undefined) {
1013      this.mainWindowStage = params.mainWindowStage;
1014    }
1015    if (params.controller !== undefined) {
1016      this.controller = params.controller;
1017    }
1018    if (params.screenWidth !== undefined) {
1019      this.screenWidth = params.screenWidth;
1020    }
1021    if (params.verticalScreenLines !== undefined) {
1022      this.verticalScreenLines = params.verticalScreenLines;
1023    }
1024    if (params.horizontalsScreenLines !== undefined) {
1025      this.horizontalsScreenLines = params.horizontalsScreenLines;
1026    }
1027    if (params.cancel !== undefined) {
1028      this.cancel = params.cancel;
1029    }
1030    if (params.confirm !== undefined) {
1031      this.confirm = params.confirm;
1032    }
1033    if (params.fontSize === undefined) {
1034      this.__fontSize.set(1);
1035    }
1036    if (params.maxLines !== undefined) {
1037      this.maxLines = params.maxLines;
1038    }
1039    if (params.symbolEffect !== undefined) {
1040      this.symbolEffect = params.symbolEffect;
1041    }
1042  }
1043
1044  updateStateVars(params) {
1045    this.__fontSize.reset(params.fontSize);
1046  }
1047
1048  purgeVariableDependenciesOnElmtId(rmElmtId) {
1049    this.__mainWindow.purgeDependencyOnElmtId(rmElmtId);
1050    this.__fontSize.purgeDependencyOnElmtId(rmElmtId);
1051    this.__maxLines.purgeDependencyOnElmtId(rmElmtId);
1052    this.__windowStandardHeight.purgeDependencyOnElmtId(rmElmtId);
1053    this.__symbolEffect.purgeDependencyOnElmtId(rmElmtId);
1054  }
1055  aboutToBeDeleted() {
1056    this.__mainWindow.aboutToBeDeleted();
1057    this.__fontSize.aboutToBeDeleted();
1058    this.__maxLines.aboutToBeDeleted();
1059    this.__windowStandardHeight.aboutToBeDeleted();
1060    this.__symbolEffect.aboutToBeDeleted();
1061    SubscriberManager.Get().delete(this.id__());
1062    this.aboutToBeDeletedInternal();
1063  }
1064
1065  setController(ctr) {
1066    this.controller = ctr;
1067  }
1068  get mainWindow() {
1069    return this.__mainWindow.get();
1070  }
1071
1072  set mainWindow(newValue) {
1073    this.__mainWindow.set(newValue);
1074  }
1075  get fontSize() {
1076    return this.__fontSize.get();
1077  }
1078
1079  set fontSize(newValue) {
1080    this.__fontSize.set(newValue);
1081  }
1082  get maxLines() {
1083    return this.__maxLines.get();
1084  }
1085
1086  set maxLines(newValue) {
1087    this.__maxLines.set(newValue);
1088  }
1089  get windowStandardHeight() {
1090    return this.__windowStandardHeight.get();
1091  }
1092
1093  set windowStandardHeight(newValue) {
1094    this.__windowStandardHeight.set(newValue);
1095  }
1096  get symbolEffect() {
1097    return this.__symbolEffect.get();
1098  }
1099
1100  set symbolEffect(newValue) {
1101    this.__symbolEffect.set(newValue);
1102  }
1103  initialRender() {
1104    this.observeComponentCreation2((elmtId, isInitialRender) => {
1105      If.create();
1106      if (this.itemDialog.content) {
1107        this.ifElseBranchUpdateFunction(0, () => {
1108          this.observeComponentCreation2((elmtId, isInitialRender) => {
1109            Column.create();
1110            Column.width(this.fontSize === u ? b1 : c1);
1111            Column.constraintSize({ minHeight: this.fontSize === u ? b1 : c1 });
1112            Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK, undefined, { disableSystemAdaptation: true });
1113            Column.shadow(ShadowStyle.OUTER_DEFAULT_LG);
1114            Column.borderRadius(({
1115              'id': -1,
1116              'type': 10002,
1117              params: ['sys.float.corner_radius_level10'],
1118              'bundleName': '__harDefaultBundleName__',
1119              'moduleName': '__harDefaultModuleName__'
1120            }));
1121          }, Column);
1122          this.observeComponentCreation2((elmtId, isInitialRender) => {
1123            If.create();
1124            if (this.itemDialog.toolBarSymbolOptions?.normal ||
1125              this.itemDialog.toolBarSymbolOptions?.activated) {
1126              this.ifElseBranchUpdateFunction(0, () => {
1127                this.observeComponentCreation2((elmtId, isInitialRender) => {
1128                  SymbolGlyph.create();
1129                  SymbolGlyph.attributeModifier.bind(this)(this.itemSymbolModifier);
1130                  SymbolGlyph.symbolEffect(ObservedObject.GetRawObject(this.symbolEffect), false);
1131                  SymbolGlyph.fontColor([{
1132                    'id': -1,
1133                    'type': 10001,
1134                    params: ['sys.color.icon_primary'],
1135                    'bundleName': '__harDefaultBundleName__',
1136                    'moduleName': '__harDefaultModuleName__'
1137                  }]);
1138                  SymbolGlyph.fontSize(a1);
1139                  SymbolGlyph.margin({
1140                    top: {
1141                      'id': -1,
1142                      'type': 10002,
1143                      params: ['sys.float.padding_level24'],
1144                      'bundleName': '__harDefaultBundleName__',
1145                      'moduleName': '__harDefaultModuleName__'
1146                    },
1147                    bottom: {
1148                      'id': -1,
1149                      'type': 10002,
1150                      params: ['sys.float.padding_level8'],
1151                      'bundleName': '__harDefaultBundleName__',
1152                      'moduleName': '__harDefaultModuleName__'
1153                    },
1154                  });
1155                }, SymbolGlyph);
1156              });
1157            } else if (Util.z1(this.itemDialog.icon)) {
1158              this.ifElseBranchUpdateFunction(1, () => {
1159                this.observeComponentCreation2((elmtId, isInitialRender) => {
1160                  SymbolGlyph.create(this.itemDialog?.icon);
1161                  SymbolGlyph.fontColor([{
1162                    'id': -1,
1163                    'type': 10001,
1164                    params: ['sys.color.icon_primary'],
1165                    'bundleName': '__harDefaultBundleName__',
1166                    'moduleName': '__harDefaultModuleName__'
1167                  }]);
1168                  SymbolGlyph.fontSize(a1);
1169                  SymbolGlyph.margin({
1170                    top: {
1171                      'id': -1,
1172                      'type': 10002,
1173                      params: ['sys.float.padding_level24'],
1174                      'bundleName': '__harDefaultBundleName__',
1175                      'moduleName': '__harDefaultModuleName__'
1176                    },
1177                    bottom: {
1178                      'id': -1,
1179                      'type': 10002,
1180                      params: ['sys.float.padding_level8'],
1181                      'bundleName': '__harDefaultBundleName__',
1182                      'moduleName': '__harDefaultModuleName__'
1183                    },
1184                  });
1185                }, SymbolGlyph);
1186              });
1187            } else {
1188              this.ifElseBranchUpdateFunction(2, () => {
1189                this.observeComponentCreation2((elmtId, isInitialRender) => {
1190                  Image.create(this.itemDialog.icon);
1191                  Image.width(a1);
1192                  Image.height(a1);
1193                  Image.margin({
1194                    top: {
1195                      'id': -1,
1196                      'type': 10002,
1197                      params: ['sys.float.padding_level24'],
1198                      'bundleName': '__harDefaultBundleName__',
1199                      'moduleName': '__harDefaultModuleName__'
1200                    },
1201                    bottom: {
1202                      'id': -1,
1203                      'type': 10002,
1204                      params: ['sys.float.padding_level8'],
1205                      'bundleName': '__harDefaultBundleName__',
1206                      'moduleName': '__harDefaultModuleName__'
1207                    },
1208                  });
1209                  Image.fillColor({
1210                    'id': -1,
1211                    'type': 10001,
1212                    params: ['sys.color.icon_primary'],
1213                    'bundleName': '__harDefaultBundleName__',
1214                    'moduleName': '__harDefaultModuleName__'
1215                  });
1216                }, Image);
1217              });
1218            }
1219          }, If);
1220          If.pop();
1221          this.observeComponentCreation2((elmtId, isInitialRender) => {
1222            Column.create();
1223            Column.width('100%');
1224            Column.padding({
1225              left: {
1226                'id': -1,
1227                'type': 10002,
1228                params: ['sys.float.padding_level4'],
1229                'bundleName': '__harDefaultBundleName__',
1230                'moduleName': '__harDefaultModuleName__'
1231              },
1232              right: {
1233                'id': -1,
1234                'type': 10002,
1235                params: ['sys.float.padding_level4'],
1236                'bundleName': '__harDefaultBundleName__',
1237                'moduleName': '__harDefaultModuleName__'
1238              },
1239              bottom: {
1240                'id': -1,
1241                'type': 10002,
1242                params: ['sys.float.padding_level12'],
1243                'bundleName': '__harDefaultBundleName__',
1244                'moduleName': '__harDefaultModuleName__'
1245              },
1246            });
1247          }, Column);
1248          this.observeComponentCreation2((elmtId, isInitialRender) => {
1249            Text.create(this.itemDialog.content);
1250            Text.fontSize(d1);
1251            Text.textOverflow({ overflow: TextOverflow.Ellipsis });
1252            Text.maxLines(this.maxLines);
1253            Text.width('100%');
1254            Text.textAlign(TextAlign.Center);
1255            Text.fontColor({
1256              'id': -1,
1257              'type': 10001,
1258              params: ['sys.color.font_primary'],
1259              'bundleName': '__harDefaultBundleName__',
1260              'moduleName': '__harDefaultModuleName__'
1261            });
1262          }, Text);
1263          Text.pop();
1264          Column.pop();
1265          Column.pop();
1266        });
1267      }
1268      else {
1269        this.ifElseBranchUpdateFunction(1, () => {
1270          this.observeComponentCreation2((elmtId, isInitialRender) => {
1271            Column.create();
1272            Column.width(this.fontSize === u ? b1 : c1);
1273            Column.constraintSize({ minHeight: this.fontSize === u ? b1 : c1 });
1274            Column.backgroundBlurStyle(BlurStyle.COMPONENT_ULTRA_THICK, undefined, { disableSystemAdaptation: true });
1275            Column.shadow(ShadowStyle.OUTER_DEFAULT_LG);
1276            Column.borderRadius(({
1277              'id': -1,
1278              'type': 10002,
1279              params: ['sys.float.corner_radius_level10'],
1280              'bundleName': '__harDefaultBundleName__',
1281              'moduleName': '__harDefaultModuleName__'
1282            }));
1283            Column.justifyContent(FlexAlign.Center);
1284          }, Column);
1285          this.observeComponentCreation2((elmtId, isInitialRender) => {
1286            If.create();
1287            if (this.itemDialog.toolBarSymbolOptions?.normal ||
1288              this.itemDialog.toolBarSymbolOptions?.activated) {
1289              this.ifElseBranchUpdateFunction(0, () => {
1290                this.observeComponentCreation2((elmtId, isInitialRender) => {
1291                  SymbolGlyph.create();
1292                  SymbolGlyph.attributeModifier.bind(this)(this.itemSymbolModifier);
1293                  SymbolGlyph.symbolEffect(ObservedObject.GetRawObject(this.symbolEffect), false);
1294                  SymbolGlyph.fontColor([{
1295                    'id': -1,
1296                    'type': 10001,
1297                    params: ['sys.color.icon_primary'],
1298                    'bundleName': '__harDefaultBundleName__',
1299                    'moduleName': '__harDefaultModuleName__'
1300                  }]);
1301                  SymbolGlyph.fontSize(a1);
1302                }, SymbolGlyph);
1303              });
1304            } else if (Util.z1(this.itemDialog.icon)) {
1305              this.ifElseBranchUpdateFunction(1, () => {
1306                this.observeComponentCreation2((elmtId, isInitialRender) => {
1307                  SymbolGlyph.create(this.itemDialog?.icon);
1308                  SymbolGlyph.fontColor([{
1309                    'id': -1,
1310                    'type': 10001,
1311                    params: ['sys.color.icon_primary'],
1312                    'bundleName': '__harDefaultBundleName__',
1313                    'moduleName': '__harDefaultModuleName__'
1314                  }]);
1315                  SymbolGlyph.fontSize(a1);
1316                }, SymbolGlyph);
1317              });
1318            }
1319            else {
1320              this.ifElseBranchUpdateFunction(2, () => {
1321                this.observeComponentCreation2((elmtId, isInitialRender) => {
1322                  Image.create(this.itemDialog.icon);
1323                  Image.width(a1);
1324                  Image.height(a1);
1325                  Image.fillColor({
1326                    'id': -1,
1327                    'type': 10001,
1328                    params: ['sys.color.icon_primary'],
1329                    'bundleName': '__harDefaultBundleName__',
1330                    'moduleName': '__harDefaultModuleName__'
1331                  });
1332                }, Image);
1333              });
1334            }
1335          }, If);
1336          If.pop();
1337          Column.pop();
1338        });
1339      }
1340    }, If);
1341    If.pop();
1342  }
1343  async aboutToAppear() {
1344    try {
1345      let context = this.getUIContext().getHostContext();
1346      this.mainWindowStage = context.windowStage.getMainWindowSync();
1347      let properties = this.mainWindowStage.getWindowProperties();
1348      let rect = properties.windowRect;
1349      if (px2vp(rect.height) > this.screenWidth) {
1350        this.maxLines = this.verticalScreenLines;
1351      }
1352      else {
1353        this.maxLines = this.horizontalsScreenLines;
1354      }
1355    } catch (err) {
1356      let code = err?.code;
1357      let message = err?.message;
1358      hilog.error(0x3900, 'Ace', `Faild to ToolBarDialog aboutToAppear, code: ${code}, message: ${message}`);
1359    }
1360  }
1361  rerender() {
1362    this.updateDirtyElements();
1363  }
1364}
1365
1366export default { ToolBarOptions, ToolBar, ItemState, ToolBarOption, ToolBarModifier };