• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_NG_PATTERNS_GRID_GRID_MODEL_NG_H
17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_GRID_GRID_MODEL_NG_H
18 
19 #include <string>
20 
21 #include "base/geometry/dimension.h"
22 #include "base/utils/macros.h"
23 #include "core/components/common/layout/constants.h"
24 #include "core/components/common/properties/scroll_bar.h"
25 #include "core/components_ng/pattern/grid/grid_event_hub.h"
26 #include "core/components_ng/pattern/grid/grid_model.h"
27 
28 namespace OHOS::Ace::NG {
29 
30 class ACE_EXPORT GridModelNG : public OHOS::Ace::GridModel {
31 public:
32     void Create(
33         const RefPtr<ScrollControllerBase>& positionController, const RefPtr<ScrollProxy>& scrollProxy) override;
34     void Pop() override;
35     void SetLayoutOptions(GridLayoutOptions options) override;
36     void SetColumnsTemplate(const std::string& value) override;
37     void SetRowsTemplate(const std::string& value) override;
38     void SetColumnsGap(const Dimension& value) override;
39     void SetRowsGap(const Dimension& value) override;
40     void SetGridHeight(const Dimension& value) override;
41     void SetScrollBarMode(int32_t value) override;
42     void SetScrollBarColor(const std::string& value) override;
43     void SetScrollBarWidth(const std::string& value) override;
44     void SetCachedCount(int32_t value) override;
45     void SetIsRTL(TextDirection direction) override;
46     void SetLayoutDirection(FlexDirection value) override;
47     void SetMaxCount(int32_t value) override;
48     void SetMinCount(int32_t value) override;
49     void SetCellLength(int32_t value) override;
50     void SetEditable(bool value) override;
51     void SetMultiSelectable(bool value) override;
52     void SetSupportAnimation(bool value) override;
53     void SetSupportDragAnimation(bool value) override;
54     void SetEdgeEffect(EdgeEffect edgeEffect) override;
55     void SetNestedScroll(const NestedScrollOptions& nestedOpt) override;
56     void SetScrollEnabled(bool scrollEnabled) override;
57     void SetFriction(double friction) override;
58     void SetOnScrollToIndex(ScrollToIndexFunc&& value) override;
59     void SetOnScrollBarUpdate(ScrollBarUpdateFunc&& value) override;
60     void SetOnItemDragStart(std::function<void(const ItemDragInfo&, int32_t)>&& value) override;
61     void SetOnItemDragEnter(ItemDragEnterFunc&& value) override;
62     void SetOnItemDragMove(ItemDragMoveFunc&& value) override;
63     void SetOnItemDragLeave(ItemDragLeaveFunc&& value) override;
64     void SetOnItemDrop(ItemDropFunc&& value) override;
65     void SetOnScroll(OnScrollEvent&& onScroll) override;
66     void SetOnScrollFrameBegin(OnScrollFrameBeginEvent&& onScrollFrameBegin) override;
67     void SetOnScrollStart(OnScrollStartEvent&& onScrollStart) override;
68     void SetOnScrollStop(OnScrollStopEvent&& onScrollStop) override;
69     void SetOnScrollIndex(ScrollIndexFunc&& onScrollIndex) override;
70     void SetOnReachStart(OnReachEvent&& onReachStart) override;
71     void SetOnReachEnd(OnReachEvent&& onReachEnd) override;
72     RefPtr<ScrollControllerBase> CreatePositionController() override;
73     RefPtr<ScrollProxy> CreateScrollBarProxy() override;
74 
75 private:
76     void AddDragFrameNodeToManager() const;
77 };
78 
79 } // namespace OHOS::Ace::NG
80 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_GRID_GRID_MODEL_NG_H
81