1 #ifndef DALI_TOOLKIT_INTERNAL_LAYOUTING_LINEAR_LAYOUT_H
2 #define DALI_TOOLKIT_INTERNAL_LAYOUTING_LINEAR_LAYOUT_H
5 * Copyright (c) 2018 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
20 #include <dali/public-api/common/intrusive-ptr.h>
21 #include <dali/public-api/object/base-object.h>
22 #include <dali-toolkit/devel-api/layouting/layout-group-impl.h>
23 #include <dali-toolkit/devel-api/layouting/linear-layout.h>
33 using LinearLayoutPtr = IntrusivePtr<LinearLayout>;
35 class LinearLayout final : public LayoutGroup
38 static LinearLayoutPtr New();
41 void SetCellPadding( LayoutSize size );
42 LayoutSize GetCellPadding();
43 void SetOrientation( Dali::Toolkit::LinearLayout::Orientation orientation );
44 Dali::Toolkit::LinearLayout::Orientation GetOrientation();
48 virtual ~LinearLayout();
51 * @copydoc LayoutItem::OnMeasure
53 virtual void OnMeasure( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec ) override;
56 * @copydoc LayoutItem::OnLayout
58 virtual void OnLayout( bool changed, LayoutLength l, LayoutLength t, LayoutLength r, LayoutLength b ) override;
61 LinearLayout( const LinearLayout& other ) = delete;
62 LinearLayout& operator=( const LinearLayout& other ) = delete;
65 * Measure children for horizontal orientation
67 void MeasureHorizontal( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec );
70 * Apply a uniform height to the children
72 void ForceUniformHeight( int count, MeasureSpec widthMeasureSpec );
75 * Layout the children horizontally
77 void LayoutHorizontal( LayoutLength l, LayoutLength t, LayoutLength r, LayoutLength b );
80 * Measure children for horizontal orientation
82 void MeasureVertical( MeasureSpec widthMeasureSpec, MeasureSpec heightMeasureSpec );
85 * Apply a uniform width to the children
87 void ForceUniformWidth( int count, MeasureSpec heightMeasureSpec );
90 * Layout the children vertically
92 void LayoutVertical( LayoutLength l, LayoutLength t, LayoutLength r, LayoutLength b );
95 LayoutSize mCellPadding;
96 Dali::Toolkit::LinearLayout::Orientation mOrientation;
97 LayoutLength mTotalLength;
100 } // namespace Internal
102 inline Internal::LinearLayout& GetImplementation( Dali::Toolkit::LinearLayout& handle )
104 DALI_ASSERT_ALWAYS( handle && "LinearLayout handle is empty" );
105 BaseObject& object = handle.GetBaseObject();
106 return static_cast<Internal::LinearLayout&>( object );
109 inline const Internal::LinearLayout& GetImplementation( const Dali::Toolkit::LinearLayout& handle )
111 DALI_ASSERT_ALWAYS( handle && "LinearLayout handle is empty" );
112 const BaseObject& object = handle.GetBaseObject();
113 return static_cast<const Internal::LinearLayout&>( object );
116 } // namespace Toolkit
119 #endif // DALI_TOOLKIT_INTERNAL_LAYOUTING_LINEAR_LAYOUT_H