1/* 2 * Copyright (c) 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 */ 15import { CommonConstants } from '../common/CommonConstants'; 16 17/** 18 * 自定义页签条属性 19 * 20 */ 21export class TabBarAttribute { 22 // 页签项宽度 23 private innerBarItemWidth: Length | undefined; 24 // 页签条边缘滑动效果 25 private innerBarEdgeEffect: EdgeEffect; 26 // 页签条高度 27 private innerBarHeight: Length | undefined; 28 // 是否可以滚动页签条(false则所有页签均分屏幕宽度) 29 private innerScrollable: boolean; 30 // 页签条位置 31 private innerBarVertical: BarPosition; 32 // 页签条边距 33 private innerBarMargin: Margin | undefined; 34 // 页签条背景颜色 35 private innerBarBackgroundColor: ResourceColor; 36 37 constructor(barItemWidth: Length | undefined = undefined, barHeight: Length | undefined = undefined, 38 scrollable: boolean = true, barEdgeEffect: EdgeEffect = EdgeEffect.Spring, 39 barVertical: BarPosition = BarPosition.Start, 40 barMargin: Margin | undefined = undefined, barBackgroundColor: ResourceColor = Color.Transparent) { 41 this.innerBarItemWidth = barItemWidth; 42 this.innerBarHeight = barHeight; 43 this.innerScrollable = scrollable; 44 this.innerBarEdgeEffect = barEdgeEffect; 45 this.innerBarVertical = barVertical; 46 this.innerBarBackgroundColor = barBackgroundColor; 47 this.innerBarMargin = barMargin; 48 } 49 50 get barItemWidth(): Length | undefined { 51 return this.innerBarItemWidth; 52 } 53 54 get barHeight(): Length | undefined { 55 return this.innerBarHeight; 56 } 57 58 get scrollable(): boolean { 59 return this.innerScrollable; 60 } 61 62 get barEdgeEffect(): EdgeEffect { 63 return this.innerBarEdgeEffect; 64 } 65 66 get barVertical(): BarPosition { 67 return this.innerBarVertical; 68 } 69 70 get barBackgroundColor(): ResourceColor { 71 return this.innerBarBackgroundColor; 72 } 73 74 get barMargin(): Margin | undefined { 75 return this.innerBarMargin; 76 } 77}