1 /* 2 * Copyright (c) 2025 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_INTERFACES_INNER_API_ACE_KIT_SRC_VIEW_SCROLLER_IMPL_H 17 #define FOUNDATION_ACE_INTERFACES_INNER_API_ACE_KIT_SRC_VIEW_SCROLLER_IMPL_H 18 19 #include "interfaces/inner_api/ace_kit/include/ui/view/scroller.h" 20 #include "bridge/declarative_frontend/jsview/js_scroller.h" 21 22 namespace OHOS::Ace::Kit { 23 24 class ScrollerImpl : public Scroller { 25 DECLARE_ACE_TYPE(ScrollerImpl, Scroller); 26 27 public: 28 ScrollerImpl(const RefPtr<Framework::JSScroller>& jsScroller); 29 ~ScrollerImpl() = default; 30 31 void AddObserver(const Observer& observer, int32_t id) override; 32 void RemoveObserver(int32_t id) override; 33 double GetCurrentOffsetX() override; 34 double GetCurrentOffsetY() override; 35 bool IsAtEnd() override; 36 bool IsAtStart() override; 37 double GetContentBottom(const RefPtr<FrameNode>& node) override; 38 double GetContentTop(const RefPtr<FrameNode>& node) override; 39 bool AnimateTo(const Dimension& position, float duration, 40 const RefPtr<Curve>& curve, bool smooth, bool canOverScroll) override; 41 42 bool operator==(const Ace::RefPtr<Scroller>& other) const override; 43 RefPtr<FrameNode> GetBindingFrameNode() override; 44 45 private: 46 RefPtr<Framework::JSScroller> jsScroller_; 47 }; 48 } // namespace OHOS::Ace::Kit 49 50 #endif // FOUNDATION_ACE_INTERFACES_INNER_API_ACE_KIT_SRC_VIEW_SCROLLER_IMPL_H