• 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 FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_GRID_MODEL_IMPL_H
17 #define FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_GRID_MODEL_IMPL_H
18 
19 #include "core/components_ng/pattern/grid/grid_model.h"
20 #include "frameworks/bridge/declarative_frontend/jsview/js_interactable_view.h"
21 
22 namespace OHOS::Ace::Framework {
23 
24 class GridModelImpl : public OHOS::Ace::GridModel {
25 public:
26     void Create(
27         const RefPtr<ScrollControllerBase>& positionController, const RefPtr<ScrollProxy>& scrollBarProxy) override;
28     void Pop() override;
SetLayoutOptions(GridLayoutOptions options)29     void SetLayoutOptions(GridLayoutOptions options) override {};
30     void SetColumnsTemplate(const std::string& value) override;
31     void SetRowsTemplate(const std::string& value) override;
32     void SetColumnsGap(const Dimension& value) override;
33     void SetRowsGap(const Dimension& value) override;
34     void SetGridHeight(const Dimension& value) override;
35     void SetScrollBarMode(int32_t value) override;
36     void SetScrollBarColor(const std::string& value) override;
37     void SetScrollBarWidth(const std::string& value) override;
38     void SetCachedCount(int32_t value) override;
39     void SetIsRTL(TextDirection direction) override;
40     void SetLayoutDirection(FlexDirection value) override;
41     void SetMaxCount(int32_t value) override;
42     void SetMinCount(int32_t value) override;
43     void SetCellLength(int32_t value) override;
44     void SetEditable(bool value) override;
45     void SetMultiSelectable(bool value) override;
46     void SetSupportAnimation(bool value) override;
47     void SetSupportDragAnimation(bool value) override;
48     void SetEdgeEffect(EdgeEffect edgeEffect) override;
SetNestedScroll(const NestedScrollOptions & nestedOpt)49     void SetNestedScroll(const NestedScrollOptions& nestedOpt) override {};
SetScrollEnabled(bool scrollEnabled)50     void SetScrollEnabled(bool scrollEnabled) override {};
SetFriction(double friction)51     void SetFriction(double friction) override {};
52     void SetOnScrollToIndex(std::function<void(const BaseEventInfo*)>&& value) override;
53     void SetOnScrollBarUpdate(
54         std::function<std::pair<std::optional<float>, std::optional<float>>(int32_t, Dimension)>&& value) override;
55     void SetOnItemDragStart(std::function<void(const ItemDragInfo&, int32_t)>&& value) override;
56     void SetOnItemDragEnter(std::function<void(const ItemDragInfo&)>&& value) override;
57     void SetOnItemDragMove(std::function<void(const ItemDragInfo&, int32_t, int32_t)>&& value) override;
58     void SetOnItemDragLeave(std::function<void(const ItemDragInfo&, int32_t)>&& value) override;
59     void SetOnItemDrop(std::function<void(const ItemDragInfo&, int32_t, int32_t, bool)>&& value) override;
60 
SetOnScroll(std::function<void (Dimension,ScrollState)> && onScroll)61     void SetOnScroll(std::function<void(Dimension, ScrollState)>&& onScroll) override {};
SetOnScrollIndex(std::function<void (int32_t,int32_t)> && onScrollIndex)62     void SetOnScrollIndex(std::function<void(int32_t, int32_t)>&& onScrollIndex) override {};
SetOnScrollFrameBegin(std::function<ScrollFrameResult (Dimension,ScrollState)> && onScrollFrameBegin)63     void SetOnScrollFrameBegin(
64         std::function<ScrollFrameResult(Dimension, ScrollState)>&& onScrollFrameBegin) override {};
SetOnScrollStart(std::function<void ()> && onScrollStart)65     void SetOnScrollStart(std::function<void()>&& onScrollStart) override {};
SetOnScrollStop(std::function<void ()> && onScrollStop)66     void SetOnScrollStop(std::function<void()>&& onScrollStop) override {};
SetOnReachStart(std::function<void ()> && onReachStart)67     void SetOnReachStart(std::function<void()>&& onReachStart) override {};
SetOnReachEnd(std::function<void ()> && onReachEnd)68     void SetOnReachEnd(std::function<void()>&& onReachEnd) override {};
69 
70     RefPtr<ScrollControllerBase> CreatePositionController() override;
71     RefPtr<ScrollProxy> CreateScrollBarProxy() override;
72 };
73 
74 } // namespace OHOS::Ace::Framework
75 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_GRID_MODEL_IMPL_H
76