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_PANEL_DRAG_BAR_PAINT_PROPERTY_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_PANEL_DRAG_BAR_PAINT_PROPERTY_H 18 19 #include "base/geometry/axis.h" 20 #include "base/geometry/dimension.h" 21 #include "base/geometry/ng/offset_t.h" 22 #include "base/utils/macros.h" 23 #include "core/components/common/layout/constants.h" 24 #include "core/components_ng/layout/layout_property.h" 25 #include "core/components_ng/property/property.h" 26 #include "core/components_ng/render/paint_property.h" 27 28 namespace OHOS::Ace::NG { 29 30 struct DragBarProperty { 31 ACE_DEFINE_PROPERTY_GROUP_ITEM(DragBarWidth, Dimension); 32 ACE_DEFINE_PROPERTY_GROUP_ITEM(DragBarHeight, Dimension); 33 }; 34 35 class ACE_EXPORT DragBarPaintProperty : public PaintProperty { 36 DECLARE_ACE_TYPE(DragBarPaintProperty, PaintProperty); 37 38 public: 39 DragBarPaintProperty() = default; 40 ~DragBarPaintProperty() override = default; 41 Clone()42 RefPtr<PaintProperty> Clone() const override 43 { 44 auto paintProperty = MakeRefPtr<DragBarPaintProperty>(); 45 paintProperty->PaintProperty::UpdatePaintProperty(AceType::DynamicCast<PaintProperty>(this)); 46 paintProperty->propPanelMode_ = ClonePanelMode(); 47 paintProperty->propBarLeftPoint_ = CloneBarLeftPoint(); 48 paintProperty->propBarCenterPoint_ = CloneBarCenterPoint(); 49 paintProperty->propBarRightPoint_ = CloneBarRightPoint(); 50 paintProperty->propDragOffset_ = CloneDragOffset(); 51 paintProperty->propOpacity_ = CloneOpacity(); 52 return paintProperty; 53 } 54 Reset()55 void Reset() override 56 { 57 PaintProperty::Reset(); 58 ResetPanelMode(); 59 ResetBarLeftPoint(); 60 ResetBarCenterPoint(); 61 ResetBarRightPoint(); 62 ResetDragOffset(); 63 ResetOpacity(); 64 } 65 66 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(PanelMode, PanelMode, PROPERTY_UPDATE_RENDER); 67 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BarLeftPoint, OffsetT<Dimension>, PROPERTY_UPDATE_RENDER); 68 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BarCenterPoint, OffsetT<Dimension>, PROPERTY_UPDATE_RENDER); 69 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BarRightPoint, OffsetT<Dimension>, PROPERTY_UPDATE_RENDER); 70 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(DragOffset, OffsetF, PROPERTY_UPDATE_RENDER); 71 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(Opacity, float, PROPERTY_UPDATE_RENDER); 72 73 private: 74 ACE_DISALLOW_COPY_AND_MOVE(DragBarPaintProperty); 75 }; 76 77 } // namespace OHOS::Ace::NG 78 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_PANEL_DRAG_BAR_PAINT_PROPERTY_H 79