1 /* 2 * Copyright (c) 2021-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_V2_INSPECTOR_GRID_COMPOSED_ELEMENT_H 17 #define FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_INSPECTOR_GRID_COMPOSED_ELEMENT_H 18 19 #include "core/components/common/properties/scroll_bar.h" 20 #include "core/components/grid_layout/grid_layout_component.h" 21 #include "core/components/grid_layout/grid_layout_element.h" 22 #include "core/components/grid_layout/render_grid_layout.h" 23 #include "core/components_v2/grid/grid_element.h" 24 #include "core/components_v2/inspector/inspector_composed_element.h" 25 #include "core/pipeline/base/composed_element.h" 26 27 namespace OHOS::Ace::V2 { 28 29 class ACE_EXPORT GridComposedElement : public InspectorComposedElement { DECLARE_ACE_TYPE(GridComposedElement,InspectorComposedElement)30 DECLARE_ACE_TYPE(GridComposedElement, InspectorComposedElement) 31 32 public: 33 explicit GridComposedElement(const ComposeId& id) : InspectorComposedElement(id) {} 34 ~GridComposedElement() override = default; 35 36 void Dump() override; 37 38 std::unique_ptr<JsonValue> ToJsonObject() const override; 39 std::string GetColumnsTemplate() const; 40 std::string GetRowsTemplate() const; 41 std::string GetColumnsGap() const; 42 std::string GetRowsGap() const; 43 std::string GetScrollBarWidth() const; 44 std::string GetScrollBarColor() const; 45 std::string GetScrollBar() const; 46 std::string GetGridEditMode() const; 47 std::string GetGridMaxCount() const; 48 std::string GetGridMinCount() const; 49 std::string GetGridCellLength() const; 50 std::string GetSupportAnimation() const; 51 std::string GetMultiSelectable() const; 52 GetTargetTypeId()53 AceType::IdType GetTargetTypeId() const override 54 { 55 return GridLayoutElement::TypeId(); 56 } 57 GetRenderElement()58 RefPtr<Element> GetRenderElement() const override 59 { 60 return GetContentElement<GridLayoutElement>(GridLayoutElement::TypeId()); 61 } 62 63 private: 64 std::string DisplayModeToString(DisplayMode displayMode) const; 65 }; 66 67 } // namespace OHOS::Ace::V2 68 69 #endif // FOUNDATION_ACE_FRAMEWORKS_CORE_COMPONENTS_V2_INSPECTOR_GRID_COMPOSED_ELEMENT_H