fbf420277b27ac6917f7701ef28276babad373de
[platform/core/uifw/dali-toolkit.git] / dali-toolkit / internal / layouting / layout-base-data-impl.h
1 #ifndef DALI_TOOLKIT_INTERNAL_LAYOUTING_LAYOUT_BASE_DATA_IMPL_H_H
2 #define DALI_TOOLKIT_INTERNAL_LAYOUTING_LAYOUT_BASE_DATA_IMPL_H_H
3
4 /*
5  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
6  *
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
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
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.
18  */
19
20 #include <dali-toolkit/devel-api/layouting/layout-base-impl.h>
21 #include <dali-toolkit/devel-api/layouting/layout-controller.h>
22 #include <dali-toolkit/devel-api/layouting/layout-size.h>
23
24 namespace Dali
25 {
26 namespace Toolkit
27 {
28 namespace Internal
29 {
30 class LayoutParent;
31
32
33 class LayoutBase::Impl
34 {
35 public:
36   Impl();
37
38 public:
39   BaseObject* mOwner; ///< Control or Visual that owns this layout. Raw pointer to prevent cyclic references
40   LayoutParent* mLayoutParent; ///< The containing layout parent.
41
42   MeasureSpec mOldWidthMeasureSpec;
43   MeasureSpec mOldHeightMeasureSpec;
44   LayoutSize mMinimumSize;
45
46   MeasuredSize mMeasuredWidth;
47   MeasuredSize mMeasuredHeight;
48
49   Extents mMargin; ///< Distances in pixels from the edges of this view to this view's parent.
50   Extents mPadding; ///< Distances in pixels from the edges of this view to this view's content.
51
52   LayoutLength mLeft;
53   LayoutLength mRight;
54   LayoutLength mTop;
55   LayoutLength mBottom;
56
57   /**
58    * This view is visible.
59    * Use with {@link #setVisibility} and <a href="#attr_android:visibility">{@code
60    * android:visibility}.
61    */
62   static const int VISIBLE = 0x00000000;
63
64   /**
65    * This view is invisible, but it still takes up space for layout purposes.
66    * Use with {@link #setVisibility} and <a href="#attr_android:visibility">{@code
67    * android:visibility}.
68    */
69   static const int INVISIBLE = 0x00000004;
70
71   /**
72    * This view is invisible, and it doesn't take any space for layout
73    * purposes. Use with {@link #setVisibility} and <a href="#attr_android:visibility">{@code
74    * android:visibility}.
75    */
76   static const int GONE = 0x00000008;
77
78   /**
79    * Mask for use with setFlags indicating bits used for visibility.
80    * {@hide}
81    */
82   static const int VISIBILITY_MASK = 0x0000000C;
83
84   static const int PRIVATE_FLAG_MEASURED_DIMENSION_SET        = 0x00000001;
85   static const int PRIVATE_FLAG_FORCE_LAYOUT                  = 0x00000002;
86   static const int PRIVATE_FLAG_LAYOUT_REQUIRED               = 0x00000004;
87   static const int PRIVATE_FLAG_IS_LAID_OUT                   = 0x00000008;
88   static const int PRIVATE_FLAG_MEASURE_NEEDED_BEFORE_LAYOUT  = 0x00000010; ///< Flag indicating that a call to measure() was skipped and should be done instead when layout() is invoked.
89   static const int PRIVATE_FLAG_HAS_BOUNDS                    = 0x00000020;
90
91   int mViewFlags;
92   int mPrivateFlags;
93
94   bool mAnimated;
95
96   inline void ClearPrivateFlag( int flag )
97   {
98     mPrivateFlags &= ~flag;
99   }
100
101   inline void SetPrivateFlag( int flag )
102   {
103     mPrivateFlags |= flag;
104   }
105
106   inline bool GetPrivateFlag( int flag )
107   {
108     return ( mPrivateFlags & flag ) != 0;
109   }
110
111   static bool sUseZeroUnspecifiedMeasureSpec;
112
113 };
114
115 } // namespace Internal
116 } // namespace Toolkit
117 } // namespace Dali
118
119 #endif //DALI_TOOLKIT_INTERNAL_LAYOUTING_LAYOUT_BASE_DATA_IMPL_H_H