1a3e0fd82Sopenharmony_ci/* 2a3e0fd82Sopenharmony_ci * Copyright (c) 2020-2021 Huawei Device Co., Ltd. 3a3e0fd82Sopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 4a3e0fd82Sopenharmony_ci * you may not use this file except in compliance with the License. 5a3e0fd82Sopenharmony_ci * You may obtain a copy of the License at 6a3e0fd82Sopenharmony_ci * 7a3e0fd82Sopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 8a3e0fd82Sopenharmony_ci * 9a3e0fd82Sopenharmony_ci * Unless required by applicable law or agreed to in writing, software 10a3e0fd82Sopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 11a3e0fd82Sopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12a3e0fd82Sopenharmony_ci * See the License for the specific language governing permissions and 13a3e0fd82Sopenharmony_ci * limitations under the License. 14a3e0fd82Sopenharmony_ci */ 15a3e0fd82Sopenharmony_ci 16a3e0fd82Sopenharmony_ci/** 17a3e0fd82Sopenharmony_ci * @addtogroup UI_Layout 18a3e0fd82Sopenharmony_ci * @{ 19a3e0fd82Sopenharmony_ci * 20a3e0fd82Sopenharmony_ci * @brief Defines UI layouts such as <b>FlexLayout</b> and <b>GridLayout</b>. 21a3e0fd82Sopenharmony_ci * 22a3e0fd82Sopenharmony_ci * @since 1.0 23a3e0fd82Sopenharmony_ci * @version 1.0 24a3e0fd82Sopenharmony_ci */ 25a3e0fd82Sopenharmony_ci 26a3e0fd82Sopenharmony_ci/** 27a3e0fd82Sopenharmony_ci * @file layout.h 28a3e0fd82Sopenharmony_ci * 29a3e0fd82Sopenharmony_ci * @brief Declares the base class of the layout, which indicates the basic data types and operations that may be 30a3e0fd82Sopenharmony_ci * used in the layout. 31a3e0fd82Sopenharmony_ci * 32a3e0fd82Sopenharmony_ci * @since 1.0 33a3e0fd82Sopenharmony_ci * @version 1.0 34a3e0fd82Sopenharmony_ci */ 35a3e0fd82Sopenharmony_ci 36a3e0fd82Sopenharmony_ci#ifndef GRAPHIC_LITE_LAYOUT_H 37a3e0fd82Sopenharmony_ci#define GRAPHIC_LITE_LAYOUT_H 38a3e0fd82Sopenharmony_ci 39a3e0fd82Sopenharmony_ci#include "components/ui_view_group.h" 40a3e0fd82Sopenharmony_ci 41a3e0fd82Sopenharmony_cinamespace OHOS { 42a3e0fd82Sopenharmony_ciusing DirectionType = uint8_t; 43a3e0fd82Sopenharmony_ciusing AlignType = uint8_t; 44a3e0fd82Sopenharmony_ci/* Arranges child views by row from left to right. */ 45a3e0fd82Sopenharmony_ciconst DirectionType LAYOUT_HOR = 0; 46a3e0fd82Sopenharmony_ci/* Arranges child views by row from right to left. */ 47a3e0fd82Sopenharmony_ciconst DirectionType LAYOUT_HOR_R = 1; 48a3e0fd82Sopenharmony_ci/* Arranges child views by column from top to bottom. */ 49a3e0fd82Sopenharmony_ciconst DirectionType LAYOUT_VER = 2; 50a3e0fd82Sopenharmony_ci/* Arranges child views by column from bottom to top. */ 51a3e0fd82Sopenharmony_ciconst DirectionType LAYOUT_VER_R = 3; 52a3e0fd82Sopenharmony_ci 53a3e0fd82Sopenharmony_ci/* Places all child views from the start point to the end point. */ 54a3e0fd82Sopenharmony_ciconst AlignType ALIGN_START = 0; 55a3e0fd82Sopenharmony_ci/* Places all child views from the end point to the start point. */ 56a3e0fd82Sopenharmony_ciconst AlignType ALIGN_END = 1; 57a3e0fd82Sopenharmony_ci/* Places all child views in the center. */ 58a3e0fd82Sopenharmony_ciconst AlignType ALIGN_CENTER = 2; 59a3e0fd82Sopenharmony_ci/* Evenly places all child views between the start point and end point. The distance between the start point and 60a3e0fd82Sopenharmony_ci the end as well as the distance between the end point and the end is the same as that between child views. */ 61a3e0fd82Sopenharmony_ciconst AlignType ALIGN_EVENLY = 3; 62a3e0fd82Sopenharmony_ci/* Evenly places all child views between the start point and end point. The distance between the start point and 63a3e0fd82Sopenharmony_ci the end as well as the distance between the end point and the end is half of the distance between child views. */ 64a3e0fd82Sopenharmony_ciconst AlignType ALIGN_AROUND = 4; 65a3e0fd82Sopenharmony_ci/* Evenly places all child views between the start point and end point. No left or right margin is reserved. */ 66a3e0fd82Sopenharmony_ciconst AlignType ALIGN_BETWEEN = 5; 67a3e0fd82Sopenharmony_ci 68a3e0fd82Sopenharmony_ci/** 69a3e0fd82Sopenharmony_ci * @brief Defines the base class of the layout, which indicates the basic data types and operations that may be used in 70a3e0fd82Sopenharmony_ci * the layout. 71a3e0fd82Sopenharmony_ci * 72a3e0fd82Sopenharmony_ci * @since 1.0 73a3e0fd82Sopenharmony_ci * @version 1.0 74a3e0fd82Sopenharmony_ci */ 75a3e0fd82Sopenharmony_ciclass Layout : public UIViewGroup { 76a3e0fd82Sopenharmony_cipublic: 77a3e0fd82Sopenharmony_ci /** 78a3e0fd82Sopenharmony_ci * @brief A default constructor used to create a <b>Layout</b> instance. 79a3e0fd82Sopenharmony_ci * @since 1.0 80a3e0fd82Sopenharmony_ci * @version 1.0 81a3e0fd82Sopenharmony_ci */ 82a3e0fd82Sopenharmony_ci Layout() : direction_(LAYOUT_HOR) {} 83a3e0fd82Sopenharmony_ci 84a3e0fd82Sopenharmony_ci /** 85a3e0fd82Sopenharmony_ci * @brief A destructor used to delete the <b>Layout</b> instance. 86a3e0fd82Sopenharmony_ci * @since 1.0 87a3e0fd82Sopenharmony_ci * @version 1.0 88a3e0fd82Sopenharmony_ci */ 89a3e0fd82Sopenharmony_ci virtual ~Layout() {} 90a3e0fd82Sopenharmony_ci 91a3e0fd82Sopenharmony_ci /** 92a3e0fd82Sopenharmony_ci * @brief Sets the layout direction. 93a3e0fd82Sopenharmony_ci * @param direction Indicates the direction of the layout. Available values are as follows: 94a3e0fd82Sopenharmony_ci * LAYOUT_HOR: from left to right 95a3e0fd82Sopenharmony_ci * LAYOUT_HOR_R: from right to left 96a3e0fd82Sopenharmony_ci * LAYOUT_VER: from top to bottom 97a3e0fd82Sopenharmony_ci * LAYOUT_VER_R: from bottom to top 98a3e0fd82Sopenharmony_ci * @since 1.0 99a3e0fd82Sopenharmony_ci * @version 1.0 100a3e0fd82Sopenharmony_ci */ 101a3e0fd82Sopenharmony_ci void SetLayoutDirection(const DirectionType& direction) 102a3e0fd82Sopenharmony_ci { 103a3e0fd82Sopenharmony_ci direction_ = direction; 104a3e0fd82Sopenharmony_ci } 105a3e0fd82Sopenharmony_ci 106a3e0fd82Sopenharmony_ciprotected: 107a3e0fd82Sopenharmony_ci DirectionType direction_; 108a3e0fd82Sopenharmony_ci}; 109a3e0fd82Sopenharmony_ci} // namespace OHOS 110a3e0fd82Sopenharmony_ci#endif // GRAPHIC_LITE_LAYOUT_H 111