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_SCROLL_SCROLL_CONTROLLER_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_SCROLL_SCROLL_CONTROLLER_H
18 
19 #include "core/components/scroll/scroll_controller_base.h"
20 #include "core/pipeline/base/render_node.h"
21 
22 namespace OHOS::Ace {
23 
24 class ACE_EXPORT ScrollController : public ScrollControllerBase {
25     DECLARE_ACE_TYPE(ScrollController, ScrollControllerBase);
26 public:
27     ScrollController() = default;
28 
29     ~ScrollController() override = default;
30 
SetScrollNode(const WeakPtr<RenderNode> & scroll)31     void SetScrollNode(const WeakPtr<RenderNode>& scroll)
32     {
33         scroll_ = scroll;
34     }
35 
SetObserver(const ScrollerObserver & observer)36     void SetObserver(const ScrollerObserver& observer) override
37     {
38         observer_ = observer;
39     }
40 
GetObserver()41     ScrollerObserver GetObserver()
42     {
43         return observer_;
44     }
45 
46 protected:
47     WeakPtr<RenderNode> scroll_;
48     ScrollerObserver observer_;
49 };
50 
51 } // namespace OHOS::Ace
52 
53 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_SCROLL_SCROLL_CONTROLLER_H
54