1 /* 2 * Copyright (c) 2022 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_PATTERN_CHECKBOXGROUP_CHECKBOXGROUP_PAINT_PROPERTY_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_CHECKBOXGROUP_CHECKBOXGROUP_PAINT_PROPERTY_H 18 19 #include "core/animation/curve.h" 20 #include "core/components/common/layout/constants.h" 21 #include "core/components/common/properties/color.h" 22 #include "core/components_ng/render/paint_property.h" 23 24 namespace OHOS::Ace::NG { 25 26 class CheckBoxGroupPaintProperty : public PaintProperty { 27 DECLARE_ACE_TYPE(CheckBoxGroupPaintProperty, PaintProperty) 28 29 public: 30 CheckBoxGroupPaintProperty() = default; 31 ~CheckBoxGroupPaintProperty() override = default; 32 Clone()33 RefPtr<PaintProperty> Clone() const override 34 { 35 auto paintProperty = MakeRefPtr<CheckBoxGroupPaintProperty>(); 36 paintProperty->UpdatePaintProperty(this); 37 paintProperty->propCheckBoxGroupSelect_ = CloneCheckBoxGroupSelect(); 38 paintProperty->propCheckBoxGroupSelectedColor_ = CloneCheckBoxGroupSelectedColor(); 39 paintProperty->propStatus_ = propStatus_; 40 41 return paintProperty; 42 } 43 Reset()44 void Reset() override 45 { 46 PaintProperty::Reset(); 47 ResetCheckBoxGroupSelect(); 48 ResetCheckBoxGroupSelectedColor(); 49 50 propStatus_ = SelectStatus::NONE; 51 } 52 53 enum class SelectStatus { 54 ALL = 0, 55 PART, 56 NONE, 57 }; 58 GetSelectStatus()59 SelectStatus& GetSelectStatus() 60 { 61 return propStatus_; 62 } 63 SetSelectStatus(const SelectStatus & status)64 void SetSelectStatus(const SelectStatus& status) 65 { 66 propStatus_ = status; 67 } 68 GetIsCheckBoxCallbackDealed()69 bool GetIsCheckBoxCallbackDealed() 70 { 71 return isCheckBoxCallbackDealed_; 72 } 73 SetIsCheckBoxCallbackDealed(bool dealed)74 void SetIsCheckBoxCallbackDealed(bool dealed) 75 { 76 isCheckBoxCallbackDealed_ = true; 77 } 78 79 void ToJsonValue(std::unique_ptr<JsonValue>& json) const override; 80 81 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(CheckBoxGroupSelect, bool, PROPERTY_UPDATE_RENDER); 82 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(CheckBoxGroupSelectedColor, Color, PROPERTY_UPDATE_RENDER); 83 84 private: 85 SelectStatus propStatus_ = SelectStatus::NONE; 86 bool isCheckBoxCallbackDealed_ = false; 87 }; 88 89 } // namespace OHOS::Ace::NG 90 91 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_CHECKBOXGROUP_CHECKBOXGROUP_PAINT_PROPERTY_H 92