1 /*
2  * Copyright (c) 2020-2021 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 /**
17  * @addtogroup UI_Layout
18  * @{
19  *
20  * @brief Defines UI layouts such as <b>FlexLayout</b> and <b>GridLayout</b>.
21  *
22  * @since 1.0
23  * @version 1.0
24  */
25 
26 #ifndef GRAPHIC_LITE_LIST_LAYOUT_H
27 #define GRAPHIC_LITE_LIST_LAYOUT_H
28 
29 #include "flex_layout.h"
30 
31 namespace OHOS {
32 class ListLayout : public FlexLayout {
33 public:
34     /** @brief Default constructor */
35     ListLayout(const uint8_t direction = VERTICAL);
36 
37     /**
38      * @brief Destructor
39      */
~ListLayout()40     virtual ~ListLayout() {}
41 
42     /**
43      * @brief set list direction, HORIZONTAL list view will recount X position, VERTICAL recount Y.
44      *
45      * @param [in] direction the direction, @see HORIZONTAL, VERTICAL.
46      */
47     void SetDirection(uint8_t direction);
48 
49     /**
50      * @brief get list direction.
51      *
52      * @param [in] null.
53      */
GetDirection()54     uint8_t GetDirection()
55     {
56         return listDirection_;
57     }
58 
59     static constexpr uint8_t HORIZONTAL = 0;
60     static constexpr uint8_t VERTICAL = 1;
61 
62 protected:
63     void SetLayoutDirect(uint8_t direction);
64     void OnChildChanged() override;
65     uint8_t listDirection_;
66 };
67 } // namespace OHOS
68 #endif // GRAPHIC_LITE_LIST_LAYOUT_H
69