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_PATTERN_MYCIRCLE_SECURITY_COMPONENT_LAYOUT_PROPERTY_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_MYCIRCLE_SECURITY_COMPONENT_LAYOUT_PROPERTY_H 18 19 #include "base/geometry/dimension.h" 20 #include "core/components_ng/layout/layout_property.h" 21 #include "core/components_ng/pattern/security_component/security_component_common.h" 22 #include "core/components_ng/property/property.h" 23 #include "core/components/common/properties/text_style.h" 24 25 namespace OHOS::Ace::NG { 26 class ACE_EXPORT SecurityComponentLayoutProperty : public LayoutProperty { 27 DECLARE_ACE_TYPE(SecurityComponentLayoutProperty, LayoutProperty); 28 29 public: 30 SecurityComponentLayoutProperty() = default; 31 32 ~SecurityComponentLayoutProperty() override = default; 33 Clone()34 RefPtr<LayoutProperty> Clone() const override 35 { 36 auto value = MakeRefPtr<SecurityComponentLayoutProperty>(); 37 value->LayoutProperty::UpdateLayoutProperty(DynamicCast<LayoutProperty>(this)); 38 value->propBackgroundLeftPadding_ = CloneBackgroundLeftPadding(); 39 value->propBackgroundRightPadding_ = CloneBackgroundRightPadding(); 40 value->propBackgroundTopPadding_ = CloneBackgroundTopPadding(); 41 value->propBackgroundBottomPadding_ = CloneBackgroundBottomPadding(); 42 value->propTextIconSpace_ = CloneTextIconSpace(); 43 value->propSecurityComponentDescription_ = CloneSecurityComponentDescription(); 44 value->propIconStyle_ = CloneIconStyle(); 45 value->propBackgroundType_ = CloneBackgroundType(); 46 value->propTextIconLayoutDirection_ = CloneTextIconLayoutDirection(); 47 return value; 48 } 49 Reset()50 void Reset() override 51 { 52 LayoutProperty::Reset(); 53 ResetBackgroundLeftPadding(); 54 ResetBackgroundRightPadding(); 55 ResetBackgroundTopPadding(); 56 ResetBackgroundBottomPadding(); 57 ResetTextIconSpace(); 58 ResetSecurityComponentDescription(); 59 ResetIconStyle(); 60 ResetBackgroundType(); 61 ResetTextIconLayoutDirection(); 62 } 63 64 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BackgroundLeftPadding, Dimension, PROPERTY_UPDATE_MEASURE); 65 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BackgroundRightPadding, Dimension, PROPERTY_UPDATE_MEASURE); 66 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BackgroundTopPadding, Dimension, PROPERTY_UPDATE_MEASURE); 67 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BackgroundBottomPadding, Dimension, PROPERTY_UPDATE_MEASURE); 68 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(TextIconSpace, Dimension, PROPERTY_UPDATE_MEASURE); 69 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(SecurityComponentDescription, int32_t, PROPERTY_UPDATE_NORMAL); 70 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(IconStyle, int32_t, PROPERTY_UPDATE_NORMAL); 71 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BackgroundType, int32_t, PROPERTY_UPDATE_NORMAL); 72 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(TextIconLayoutDirection, 73 SecurityComponentLayoutDirection, PROPERTY_UPDATE_MEASURE); 74 ACE_DISALLOW_COPY_AND_MOVE(SecurityComponentLayoutProperty); 75 }; 76 } // namespace OHOS::Ace::NG 77 78 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_MYCIRCLE_SECURITY_COMPONENT_LAYOUT_PROPERTY_H 79