Merge "Fix nested layout issue" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / layouting / flex-layout.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16
17 //CLASS HEADER
18 #include "flex-layout.h"
19
20 //INTERNAL INCLUDES
21 #include <dali-toolkit/internal/layouting/flex-layout-impl.h>
22
23 namespace Dali
24 {
25 namespace Toolkit
26 {
27
28 FlexLayout::FlexLayout()
29 {
30 }
31
32 FlexLayout FlexLayout::New()
33 {
34   Internal::FlexLayoutPtr internal = Internal::FlexLayout::New();
35   return FlexLayout( internal.Get() );
36 }
37
38 FlexLayout FlexLayout::DownCast( BaseHandle handle )
39 {
40   return FlexLayout( dynamic_cast< Dali::Toolkit::Internal::FlexLayout*>( handle.GetObjectPtr() ) );
41 }
42
43 FlexLayout::FlexLayout( const FlexLayout& other )
44 : LayoutGroup( other )
45 {
46 }
47
48 FlexLayout& FlexLayout::operator=( const FlexLayout& other )
49 {
50   if( &other != this )
51   {
52     LayoutGroup::operator=( other );
53   }
54   return *this;
55 }
56
57 void FlexLayout::SetFlexDirection( Dali::Toolkit::FlexLayout::FlexDirection flexDirection )
58 {
59   if( GetImplementation(*this).GetFlexDirection() != flexDirection )
60   {
61     GetImplementation(*this).SetFlexDirection( flexDirection );
62     GetImplementation(*this).RequestLayout();
63   }
64 }
65
66 Dali::Toolkit::FlexLayout::FlexDirection FlexLayout::GetFlexDirection() const
67 {
68   return GetImplementation(*this).GetFlexDirection();
69 }
70
71 void FlexLayout::SetFlexJustification( Dali::Toolkit::FlexLayout::Justification flexJustification )
72 {
73   if( GetImplementation(*this).GetFlexJustification() != flexJustification )
74   {
75     GetImplementation(*this).SetFlexJustification( flexJustification );
76     GetImplementation(*this).RequestLayout();
77   }
78 }
79
80 Dali::Toolkit::FlexLayout::Justification FlexLayout::GetFlexJustification() const
81 {
82   return GetImplementation(*this).GetFlexJustification();
83 }
84
85 void FlexLayout::SetFlexWrap( Dali::Toolkit::FlexLayout::WrapType flexWrap )
86 {
87   if( GetImplementation(*this).GetFlexWrap() != flexWrap )
88   {
89     GetImplementation(*this).SetFlexWrap( flexWrap );
90     GetImplementation(*this).RequestLayout();
91   }
92 }
93
94 Dali::Toolkit::FlexLayout::WrapType FlexLayout::GetFlexWrap() const
95 {
96   return GetImplementation(*this).GetFlexWrap();
97 }
98
99 void FlexLayout::SetFlexAlignment( Dali::Toolkit::FlexLayout::Alignment::Type flexAlignment )
100 {
101   if( GetImplementation(*this).GetFlexAlignment() != flexAlignment )
102   {
103     GetImplementation(*this).SetFlexAlignment( flexAlignment );
104     GetImplementation(*this).RequestLayout();
105   }
106 }
107
108 Dali::Toolkit::FlexLayout::Alignment::Type FlexLayout::GetFlexAlignment() const
109 {
110   return GetImplementation(*this).GetFlexAlignment();
111 }
112
113 void FlexLayout::SetFlexItemsAlignment( Dali::Toolkit::FlexLayout::Alignment::Type flexAlignment )
114 {
115   if( GetImplementation(*this).GetFlexItemsAlignment() != flexAlignment )
116   {
117     GetImplementation(*this).SetFlexItemsAlignment( flexAlignment );
118     GetImplementation(*this).RequestLayout();
119   }
120 }
121
122 Dali::Toolkit::FlexLayout::Alignment::Type FlexLayout::GetFlexItemsAlignment() const
123 {
124   return GetImplementation(*this).GetFlexItemsAlignment();
125 }
126
127 FlexLayout::FlexLayout( Dali::Toolkit::Internal::FlexLayout* object )
128 : LayoutGroup( object )
129 {
130 }
131
132 } // namespace Toolkit
133 } // namespace Dali