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 SetColumnsTemplate(const std::string& value) override; 36 void SetRowsTemplate(const std::string& value) override; 37 void SetColumnsGap(const Dimension& value) override; 38 void SetRowsGap(const Dimension& value) override; 39 void SetGridHeight(const Dimension& value) override; 40 void SetScrollBarMode(int32_t value) override; 41 void SetScrollBarColor(const std::string& value) override; 42 void SetScrollBarWidth(const std::string& value) override; 43 void SetCachedCount(int32_t value) override; 44 void SetIsRTL(bool rightToLeft) override; 45 void SetLayoutDirection(FlexDirection value) override; 46 void SetMaxCount(int32_t value) override; 47 void SetMinCount(int32_t value) override; 48 void SetCellLength(int32_t value) override; 49 void SetEditable(bool value) override; 50 void SetMultiSelectable(bool value) override; 51 void SetSupportAnimation(bool value) override; 52 void SetSupportDragAnimation(bool value) override; 53 void SetEdgeEffect(EdgeEffect edgeEffect) override; 54 void SetOnScrollToIndex(ScrollToIndexFunc&& value) override; 55 void SetOnItemDragStart(std::function<void(const ItemDragInfo&, int32_t)>&& value) override; 56 void SetOnItemDragEnter(ItemDragEnterFunc&& value) override; 57 void SetOnItemDragMove(ItemDragMoveFunc&& value) override; 58 void SetOnItemDragLeave(ItemDragLeaveFunc&& value) override; 59 void SetOnItemDrop(ItemDropFunc&& value) override; 60 RefPtr<ScrollControllerBase> CreatePositionController() override; 61 RefPtr<ScrollProxy> CreateScrollBarProxy() override; 62 63 private: 64 void AddDragFrameNodeToManager() const; 65 static bool CheckTemplate(const std::string& value); 66 }; 67 68 } // namespace OHOS::Ace::NG 69 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_NG_PATTERNS_GRID_GRID_MODEL_NG_H 70