Updated all header files to new format
[platform/core/uifw/dali-toolkit.git] / 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) 2021 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
21 // INTERNAL INCLUDES
22 #include <dali-toolkit/devel-api/controls/alignment/alignment.h>
23 #include <dali-toolkit/internal/controls/control/control-data-impl.h>
24 #include <dali-toolkit/public-api/controls/control-impl.h>
25
26 namespace Dali
27 {
28 namespace Toolkit
29 {
30 class Alignment;
31
32 namespace Internal
33 {
34 /**
35  * Alignment is a control to position and resize actors inside other container actors.
36  * @see Dali::Toolkit::Alignment for more details.
37  */
38 class Alignment : public Control
39 {
40 public:
41   /**
42    * Create an initialized Alignment.
43    * @param type Type of alignment.
44    * @return A handle to a newly allocated Dali resource.
45    */
46   static Toolkit::Alignment New(Toolkit::Alignment::Type horizontal, Toolkit::Alignment::Type vertical);
47
48   /**
49    * @copydoc Dali::Toolkit::Alignment::SetAlignmentType()
50    */
51   void SetAlignmentType(Toolkit::Alignment::Type type);
52
53   /**
54    * @copydoc Dali::Toolkit::Alignment::GetAlignmentType()
55    */
56   Toolkit::Alignment::Type GetAlignmentType() const;
57
58   /**
59    * @copydoc Dali::Toolkit::Alignment::SetScaling()
60    */
61   void SetScaling(Toolkit::Alignment::Scaling scaling);
62
63   /**
64    * @copydoc Dali::Toolkit::Alignment::GetScaling()
65    */
66   Toolkit::Alignment::Scaling GetScaling() const;
67
68   /**
69    * @copydoc Dali::Toolkit::Alignment::SetPadding()
70    */
71   void SetPadding(const Toolkit::Alignment::Padding& padding);
72
73   /**
74    * @copydoc Dali::Toolkit::Alignment::GetPadding()
75    */
76   const Toolkit::Alignment::Padding& GetPadding() const;
77
78 private: // From Control
79   /**
80    * @copydoc Control::OnInitialize()
81    */
82   virtual void OnInitialize() override;
83
84   /**
85    * @copydoc Control::OnRelayout()
86    */
87   void OnRelayout(const Vector2& size, RelayoutContainer& container) override;
88
89 private:
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   // Undefined
103   Alignment(const Alignment&);
104   Alignment& operator=(const Alignment&);
105
106 private:
107   Toolkit::Alignment::Type    mHorizontal; ///< Type of alignment.
108   Toolkit::Alignment::Type    mVertical;   ///< Type of alignment.
109   Toolkit::Alignment::Scaling mScaling;    ///< Stores the geometry scaling.
110   Toolkit::Alignment::Padding mPadding;    ///< Stores the padding values.
111 };
112
113 } // namespace Internal
114
115 // Helpers for public-api forwarding methods
116
117 inline Toolkit::Internal::Alignment& GetImpl(Toolkit::Alignment& alignment)
118 {
119   DALI_ASSERT_ALWAYS(alignment);
120
121   Dali::RefObject& handle = alignment.GetImplementation();
122
123   return static_cast<Toolkit::Internal::Alignment&>(handle);
124 }
125
126 inline const Toolkit::Internal::Alignment& GetImpl(const Toolkit::Alignment& alignment)
127 {
128   DALI_ASSERT_ALWAYS(alignment);
129
130   const Dali::RefObject& handle = alignment.GetImplementation();
131
132   return static_cast<const Toolkit::Internal::Alignment&>(handle);
133 }
134
135 } // namespace Toolkit
136
137 } // namespace Dali
138
139 #endif // DALI_TOOLKIT_INTERNAL_ALIGNMENT_H