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_WATERFLOW_WATER_FLOW_CONTENT_MODIFIER_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_WATERFLOW_WATER_FLOW_CONTENT_MODIFIER_H 18 19 #include "core/components_ng/base/modifier.h" 20 #include "core/components_ng/property/property.h" 21 #include "core/components_ng/render/animation_utils.h" 22 #include "core/components_ng/render/drawing.h" 23 24 namespace OHOS::Ace::NG { 25 class WaterFlowContentModifier : public ContentModifier { 26 DECLARE_ACE_TYPE(WaterFlowContentModifier, ContentModifier); 27 28 public: 29 WaterFlowContentModifier(); 30 ~WaterFlowContentModifier() override = default; 31 void onDraw(DrawingContext& context) override; 32 SetClipOffset(OffsetF offset)33 void SetClipOffset(OffsetF offset) 34 { 35 clipOffset_->Set(offset); 36 } 37 SetClipSize(SizeF size)38 void SetClipSize(SizeF size) 39 { 40 clipSize_->Set(size); 41 } 42 SetClip(bool clip)43 void SetClip(bool clip) 44 { 45 clip_->Set(clip); 46 } 47 48 private: 49 RefPtr<AnimatablePropertyOffsetF> clipOffset_; 50 RefPtr<AnimatablePropertySizeF> clipSize_; 51 RefPtr<PropertyBool> clip_; 52 53 ACE_DISALLOW_COPY_AND_MOVE(WaterFlowContentModifier); 54 }; 55 } // namespace OHOS::Ace::NG 56 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_WATERFLOW_WATER_FLOW_CONTENT_MODIFIER_H 57