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(DisplayMode value) override; 36 void SetScrollBarColor(const std::string& value) override; 37 void SetScrollBarWidth(const std::string& value) override; 38 void SetCachedCount(int32_t value, bool show) 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, bool alwaysEnabled) 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 {}; SetAlignItems(GridItemAlignment itemAlign)52 void SetAlignItems(GridItemAlignment itemAlign) override {}; 53 void SetOnScrollToIndex(std::function<void(const BaseEventInfo*)>&& value) override; 54 void SetOnScrollBarUpdate( 55 std::function<std::pair<std::optional<float>, std::optional<float>>(int32_t, Dimension)>&& value) override; 56 void SetOnItemDragStart(std::function<void(const ItemDragInfo&, int32_t)>&& value) override; 57 void SetOnItemDragEnter(std::function<void(const ItemDragInfo&)>&& value) override; 58 void SetOnItemDragMove(std::function<void(const ItemDragInfo&, int32_t, int32_t)>&& value) override; 59 void SetOnItemDragLeave(std::function<void(const ItemDragInfo&, int32_t)>&& value) override; 60 void SetOnItemDrop(std::function<void(const ItemDragInfo&, int32_t, int32_t, bool)>&& value) override; 61 SetOnScroll(std::function<void (Dimension,ScrollState)> && onScroll)62 void SetOnScroll(std::function<void(Dimension, ScrollState)>&& onScroll) override {}; SetOnScrollIndex(std::function<void (int32_t,int32_t)> && onScrollIndex)63 void SetOnScrollIndex(std::function<void(int32_t, int32_t)>&& onScrollIndex) override {}; SetOnScrollFrameBegin(std::function<ScrollFrameResult (Dimension,ScrollState)> && onScrollFrameBegin)64 void SetOnScrollFrameBegin( 65 std::function<ScrollFrameResult(Dimension, ScrollState)>&& onScrollFrameBegin) override {}; SetOnScrollStart(std::function<void ()> && onScrollStart)66 void SetOnScrollStart(std::function<void()>&& onScrollStart) override {}; SetOnScrollStop(std::function<void ()> && onScrollStop)67 void SetOnScrollStop(std::function<void()>&& onScrollStop) override {}; SetOnReachStart(std::function<void ()> && onReachStart)68 void SetOnReachStart(std::function<void()>&& onReachStart) override {}; SetOnReachEnd(std::function<void ()> && onReachEnd)69 void SetOnReachEnd(std::function<void()>&& onReachEnd) override {}; 70 GetDisplayMode()71 DisplayMode GetDisplayMode() const override 72 { 73 return DisplayMode::OFF; 74 }; 75 76 RefPtr<ScrollControllerBase> CreatePositionController() override; 77 RefPtr<ScrollProxy> CreateScrollBarProxy() override; 78 }; 79 80 } // namespace OHOS::Ace::Framework 81 #endif // FRAMEWORKS_BRIDGE_DECLARATIVE_FRONTEND_JS_VIEW_MODELS_GRID_MODEL_IMPL_H 82