Merge "Controls are LayoutGroups instead of LayoutItems" into devel/master
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / devel-api / layouting / layout-group.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 #include <dali-toolkit/devel-api/layouting/layout-group.h>
18 #include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
19
20 namespace Dali
21 {
22 namespace Toolkit
23 {
24
25 LayoutGroup::LayoutGroup()
26 : LayoutItem()
27 {
28 }
29
30 LayoutGroup LayoutGroup::New( Handle& handle )
31 {
32   Internal::LayoutGroupPtr layout = Internal::LayoutGroup::New( handle );
33   return LayoutGroup( layout.Get() );
34 }
35
36 LayoutGroup LayoutGroup::DownCast( BaseHandle handle )
37 {
38   return LayoutGroup( dynamic_cast< Dali::Toolkit::Internal::LayoutGroup* >( handle.GetObjectPtr() ) );
39 }
40
41 LayoutGroup::LayoutId LayoutGroup::Add( LayoutItem& child )
42 {
43   return GetImplementation( *this ).Add( GetImplementation(child) );
44 }
45
46 void LayoutGroup::Remove( LayoutGroup::LayoutId childId )
47 {
48   GetImplementation( *this ).Remove( childId );
49 }
50
51 void LayoutGroup::Remove( LayoutItem& child )
52 {
53   GetImplementation( *this ).Remove( GetImplementation(child) );
54 }
55
56 LayoutItem LayoutGroup::GetChild( LayoutGroup::LayoutId childId ) const
57 {
58   Internal::LayoutItemPtr child = GetImplementation( *this ).GetChild( childId );
59   return LayoutItem( child.Get() );
60 }
61
62 LayoutItem LayoutGroup::GetChildAt( unsigned int childId ) const
63 {
64   Internal::LayoutItemPtr child = GetImplementation( *this ).GetChildAt( childId );
65   return LayoutItem( child.Get() );
66 }
67
68 unsigned int LayoutGroup::GetChildCount() const
69 {
70   return GetImplementation( *this ).GetChildCount();
71 }
72
73 LayoutGroup::LayoutGroup( Internal::LayoutGroup* layoutGroup )
74 : LayoutItem( layoutGroup )
75 {
76 }
77
78 } // namespace Toolkit
79 } // namespace Dali