Merge branch 'master' into tizen
[platform/core/uifw/dali-toolkit.git] / base / dali-toolkit / internal / controls / alignment / alignment-impl.h
1 #ifndef __DALI_TOOLKIT_INTERNAL_ALIGNMENT_H__
2 #define __DALI_TOOLKIT_INTERNAL_ALIGNMENT_H__
3
4 //
5 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
6 //
7 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 // INTERNAL INCLUDES
21 #include <dali-toolkit/public-api/controls/control-impl.h>
22 #include <dali-toolkit/public-api/controls/alignment/alignment.h>
23
24 namespace Dali
25 {
26
27 namespace Toolkit
28 {
29
30 class Alignment;
31
32 namespace Internal
33 {
34
35 /**
36  * Alignment is a control to position and resize actors inside other container actors.
37  * @see Dali::Toolkit::Alignment for more details.
38  */
39 class Alignment : public Control
40 {
41 public:
42
43   /**
44    * Create an initialized Alignment.
45    * @param type Type of alignment.
46    * @return A handle to a newly allocated Dali resource.
47    */
48   static Toolkit::Alignment New( Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical );
49
50   /**
51    * @copydoc Dali::Toolkit::Alignment::SetAlignmentType()
52    */
53   void SetAlignmentType( Toolkit::Alignment::Type type );
54
55   /**
56    * @copydoc Dali::Toolkit::Alignment::GetAlignmentType()
57    */
58   Toolkit::Alignment::Type GetAlignmentType() const;
59
60   /**
61    * @copydoc Dali::Toolkit::Alignment::SetScaling()
62    */
63   void SetScaling( Toolkit::Alignment::Scaling scaling );
64
65   /**
66    * @copydoc Dali::Toolkit::Alignment::GetScaling()
67    */
68   Toolkit::Alignment::Scaling GetScaling() const;
69
70   /**
71    * @copydoc Dali::Toolkit::Alignment::SetPadding()
72    */
73   void SetPadding( const Toolkit::Alignment::Padding& padding );
74
75   /**
76    * @copydoc Dali::Toolkit::Alignment::GetPadding()
77    */
78   const Toolkit::Alignment::Padding& GetPadding() const;
79
80
81 private: // From Control
82
83   /**
84    * @copydoc Control::OnRelaidOut()
85    */
86   virtual void OnRelaidOut( Vector2 size, ActorSizeContainer& container );
87
88 private:
89
90   /**
91    * Constructor.
92    * It initializes Alignment members.
93    */
94   Alignment( Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical );
95
96   /**
97    * A reference counted object may only be deleted by calling Unreference()
98    */
99   virtual ~Alignment();
100
101 private:
102
103   // Undefined
104   Alignment(const Alignment&);
105   Alignment& operator=(const Alignment&);
106
107 private:
108   Toolkit::Alignment::Type    mHorizontal; ///< Type of alignment.
109   Toolkit::Alignment::Type    mVertical;   ///< Type of alignment.
110   Toolkit::Alignment::Scaling mScaling;    ///< Stores the geometry scaling.
111   Toolkit::Alignment::Padding mPadding;    ///< Stores the padding values.
112 };
113
114 } // namespace Internal
115
116
117 // Helpers for public-api forwarding methods
118
119 inline Toolkit::Internal::Alignment& GetImpl( Toolkit::Alignment& alignment )
120 {
121   DALI_ASSERT_ALWAYS( alignment );
122
123   Dali::RefObject& handle = alignment.GetImplementation();
124
125   return static_cast<Toolkit::Internal::Alignment&>( handle );
126 }
127
128 inline const Toolkit::Internal::Alignment& GetImpl( const Toolkit::Alignment& alignment )
129 {
130   DALI_ASSERT_ALWAYS( alignment );
131
132   const Dali::RefObject& handle = alignment.GetImplementation();
133
134   return static_cast<const Toolkit::Internal::Alignment&>( handle );
135 }
136
137 } // namespace Toolkit
138
139 } // namespace Dali
140
141 #endif // __DALI_TOOLKIT_INTERNAL_ALIGNMENT_H__