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_OVERLAY_SHEET_DRAG_BAR_PAINT_PROPERTY_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_SHEET_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 struct DragBarProperty { 30 ACE_DEFINE_PROPERTY_GROUP_ITEM(DragBarWidth, Dimension); 31 ACE_DEFINE_PROPERTY_GROUP_ITEM(DragBarHeight, Dimension); 32 }; 33 34 class ACE_EXPORT SheetDragBarPaintProperty : public PaintProperty { 35 DECLARE_ACE_TYPE(SheetDragBarPaintProperty, PaintProperty); 36 37 public: 38 SheetDragBarPaintProperty() = default; 39 ~SheetDragBarPaintProperty() override = default; 40 Clone()41 RefPtr<PaintProperty> Clone() const override 42 { 43 auto paintProperty = MakeRefPtr<SheetDragBarPaintProperty>(); 44 paintProperty->PaintProperty::UpdatePaintProperty(AceType::DynamicCast<PaintProperty>(this)); 45 paintProperty->propBarLeftPoint_ = CloneBarLeftPoint(); 46 paintProperty->propBarCenterPoint_ = CloneBarCenterPoint(); 47 paintProperty->propBarRightPoint_ = CloneBarRightPoint(); 48 paintProperty->propDragOffset_ = CloneDragOffset(); 49 paintProperty->propOpacity_ = CloneOpacity(); 50 paintProperty->propBarWidth_ = CloneBarWidth(); 51 return paintProperty; 52 } 53 Reset()54 void Reset() override 55 { 56 PaintProperty::Reset(); 57 ResetBarLeftPoint(); 58 ResetBarCenterPoint(); 59 ResetBarRightPoint(); 60 ResetDragOffset(); 61 ResetOpacity(); 62 ResetBarWidth(); 63 } 64 65 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BarLeftPoint, OffsetT<Dimension>, PROPERTY_UPDATE_RENDER); 66 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BarCenterPoint, OffsetT<Dimension>, PROPERTY_UPDATE_RENDER); 67 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BarRightPoint, OffsetT<Dimension>, PROPERTY_UPDATE_RENDER); 68 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(DragOffset, OffsetF, PROPERTY_UPDATE_RENDER); 69 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(Opacity, float, PROPERTY_UPDATE_RENDER); 70 ACE_DEFINE_PROPERTY_ITEM_WITHOUT_GROUP(BarWidth, Dimension, PROPERTY_UPDATE_RENDER); 71 72 private: 73 ACE_DISALLOW_COPY_AND_MOVE(SheetDragBarPaintProperty); 74 }; 75 } // namespace OHOS::Ace::NG 76 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_OVERLAY_SHEET_DRAG_BAR_PAINT_PROPERTY_H 77