1 /* 2 * Copyright (c) 2023 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TABS_TAB_BAR_MODIFIER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TABS_TAB_BAR_MODIFIER_H 18 19 #include "base/memory/ace_type.h" 20 #include "base/geometry/axis.h" 21 #include "core/components/common/properties/color.h" 22 #include "core/components_ng/base/modifier.h" 23 #include "core/components_ng/pattern/tabs/tab_content_model.h" 24 #include "core/components_ng/property/property.h" 25 #include "core/components_ng/render/animation_utils.h" 26 #include "core/components_ng/render/drawing.h" 27 28 namespace OHOS::Ace::NG { 29 class TabBarModifier : public ContentModifier { 30 DECLARE_ACE_TYPE(TabBarModifier, ContentModifier); 31 32 public: 33 TabBarModifier(); 34 35 ~TabBarModifier() override = default; 36 37 void SetIndicatorOffset(const OffsetF& indicatorOffset); 38 39 void SetIndicatorColor(const LinearColor& indicatorColor); 40 41 void SetIndicatorWidth(float indicatorWidth); 42 43 void SetIndicatorHeight(float indicatorHeight); 44 45 void SetIndicatorBorderRadius(float indicatorBorderRadius); 46 47 void SetIndicatorMarginTop(float indicatorMarginTop); 48 49 void SetHasIndicator(bool hasIndicator); 50 51 void onDraw(DrawingContext& context) override; 52 53 private: 54 55 void PaintIndicator(DrawingContext& context); 56 57 RefPtr<AnimatablePropertyColor> indicatorColor_; 58 RefPtr<AnimatablePropertyFloat> indicatorLeft_; 59 RefPtr<AnimatablePropertyFloat> indicatorTop_; 60 RefPtr<AnimatablePropertyFloat> indicatorWidth_; 61 RefPtr<AnimatablePropertyFloat> indicatorHeight_; 62 RefPtr<AnimatablePropertyFloat> indicatorBorderRadius_; 63 RefPtr<AnimatablePropertyFloat> indicatorMarginTop_; 64 RefPtr<PropertyBool> hasIndicator_; 65 66 ACE_DISALLOW_COPY_AND_MOVE(TabBarModifier); 67 }; 68 } // namespace OHOS::Ace::NG 69 70 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_TABS_TAB_BAR_MODIFIER_H 71