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_PROPERTIES_PROGRESS_MASK_PROPERTY_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PROPERTIES_PROGRESS_MASK_PROPERTY_H 18 19 #include <vector> 20 21 #include "base/memory/ace_type.h" 22 #include "core/components/common/properties/color.h" 23 24 namespace OHOS::Ace::NG { 25 class ProgressMaskProperty : public AceType { 26 DECLARE_ACE_TYPE(ProgressMaskProperty, AceType); 27 28 public: 29 ProgressMaskProperty() = default; 30 ~ProgressMaskProperty() override = default; 31 GetValue()32 float GetValue() const 33 { 34 return value_; 35 } 36 GetMaxValue()37 float GetMaxValue() const 38 { 39 return maxValue_; 40 } 41 GetColor()42 Color GetColor() const 43 { 44 return color_; 45 } 46 GetEnableBreathe()47 bool GetEnableBreathe() const 48 { 49 return enableBreathe_; 50 } 51 SetValue(const float & value)52 void SetValue(const float& value) 53 { 54 value_ = value; 55 } 56 SetMaxValue(const float & value)57 void SetMaxValue(const float& value) 58 { 59 maxValue_ = value; 60 } 61 SetColor(const Color & color)62 void SetColor(const Color& color) 63 { 64 color_ = color; 65 } 66 SetEnableBreathe(bool enableBreathe)67 void SetEnableBreathe(bool enableBreathe) 68 { 69 enableBreathe_ = enableBreathe; 70 } 71 72 bool operator==(const ProgressMaskProperty& other) const 73 { 74 return (value_ == other.GetValue() && 75 maxValue_ == other.GetMaxValue() && 76 color_ == other.GetColor()); 77 } 78 79 ProgressMaskProperty& operator=(const ProgressMaskProperty& other) 80 { 81 if (this != &other) { 82 value_ = other.GetValue(); 83 maxValue_ = other.GetMaxValue(); 84 color_ = other.GetColor(); 85 } 86 return *this; 87 } 88 89 private: 90 float value_ = 0.0f; 91 float maxValue_ = 100.0f; 92 Color color_ = Color(0x99182431); 93 bool enableBreathe_ = false; 94 }; 95 } // namespace OHOS::Ace::NG { 96 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PROPERTIES_PROGRESS_MASK_PROPERTY_H 97