• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2023-2024 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_SCROLLABLE_SCROLLABLE_MODEL_NG_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_SCROLLABLE_SCROLLABLE_MODEL_NG_H
18 
19 #include "base/utils/macros.h"
20 #include "core/components_ng/base/frame_node.h"
21 #include "core/components/common/layout/constants.h"
22 #include "core/components_ng/pattern/scrollable/scrollable_properties.h"
23 
24 namespace OHOS::Ace::NG {
25 class ACE_EXPORT ScrollableModelNG {
26 public:
27     static void SetEdgeEffect(EdgeEffect edgeEffect, bool alwaysEnabled);
28 
29     static void SetScrollBarMode(DisplayMode value);
30     static void SetScrollBarColor(const std::string& value);
31     static void SetScrollBarWidth(const std::string& value);
32 
33     static void SetOnScroll(OnScrollEvent&& onScroll);
34     static void SetOnWillScroll(OnWillScrollEvent&& onScroll);
35     static void SetOnDidScroll(OnScrollEvent&& onScroll);
36     static void SetOnScrollStart(OnScrollStartEvent&& onScrollStart);
37     static void SetOnScrollStop(OnScrollStopEvent&& onScrollStop);
38     static void SetOnReachStart(OnReachEvent&& onReachStart);
39     static void SetOnReachEnd(OnReachEvent&& onReachEnd);
40     static void SetOnScrollFrameBegin(OnScrollFrameBeginEvent&& ScrollFrameBegin);
41 
42     static void SetEdgeEffect(FrameNode* frameNode, EdgeEffect edgeEffect, bool alwaysEnabled);
43     static void SetScrollBarMode(FrameNode* frameNode, int32_t displayNumber);
44     static void SetScrollBarWidth(FrameNode* frameNode, const std::string& value);
45     static void SetScrollBarColor(FrameNode* frameNode, const std::string& value);
46     static void SetMaxFlingSpeed(double max);
47     static void SetOnWillScroll(FrameNode* frameNode, OnWillScrollEvent&& onScroll);
48     static void SetOnDidScroll(FrameNode* frameNode, OnScrollEvent&& onScroll);
49 
50     static int32_t GetEdgeEffect(FrameNode* frameNode);
51     static int32_t GetAlwaysEnabled(FrameNode* frameNode);
52     static void SetOnScroll(FrameNode* frameNode, OnScrollEvent&& onScroll);
53     static void SetOnScrollStart(FrameNode* frameNode, OnScrollStartEvent&& onScrollStart);
54     static void SetOnScrollStop(FrameNode* frameNode, OnScrollStopEvent&& onScrollStop);
55     static void SetOnReachStart(FrameNode* frameNode, OnReachEvent&& onReachStart);
56     static void SetOnReachEnd(FrameNode* frameNode, OnReachEvent&& onReachEnd);
57     static void SetOnScrollFrameBegin(FrameNode* frameNode, OnScrollFrameBeginEvent&& ScrollFrameBegin);
58     static void SetMaxFlingSpeed(FrameNode* frameNode, double max);
59 };
60 } // namespace OHOS::Ace::NG
61 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERN_SCROLLABLE_SCROLLABLE_MODEL_H
62