2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0/
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
18 * @file FUi_LayoutImpl.h
19 * @brief This is the header file for _LayoutImpl class.
21 * This header file contains the declaration of _LayoutImpl class.
24 #ifndef _FUI_LAYOUT_IMPL_H_
25 #define _FUI_LAYOUT_IMPL_H_
27 #include <FUiLayoutTypes.h>
28 #include <FBaseSysLog.h>
29 #include "FUi_ControlImpl.h"
30 #include "FUi_LayoutLayout.h"
31 #include "FUi_SharedPtr.h"
33 namespace Tizen { namespace Ui
39 : public Tizen::Base::Object
43 * This is the default constructor for this class.
47 _LayoutImpl(const _LayoutImpl&);
50 * This is the destructor for this class.
54 virtual ~_LayoutImpl(void);
57 * Gets the name of public class.
60 * @return The name of public class.
62 virtual const char* GetPublicClassName(void) const;
65 * Gets the public class.
68 * @return The public class.
70 virtual const Layout& GetPublic(void) const;
73 * Gets the public class.
76 * @return The public class.
78 virtual Layout& GetPublic(void);
81 * Gets the core class.
84 * @return The core class.
86 virtual const _Layout::Layout& GetCore(void) const;
89 * Gets the core class.
92 * @return The core class.
94 virtual _Layout::Layout& GetCore(void);
97 * Gets the _LayoutImpl instance for the Layout.
100 * @return The _LayoutImpl instance.
101 * @param[in] pLayout The Layout instance.
103 static const _LayoutImpl* GetInstance(const Layout& layout);
106 * Gets the _LayoutImpl instance for the Layout.
109 * @return The _LayoutImpl instance.
110 * @param[in] pLayout The Layout instance.
112 static _LayoutImpl* GetInstance(Layout& layout);
115 * Gets the type of the layout.
118 * @return The layout type
120 virtual LayoutType GetLayoutType(void) const = 0;
125 * @return An error code
129 result UpdateLayout(void);
131 static _SharedPtr <_LayoutImpl> GetLayoutImpl(Layout* pLayout);
132 static Layout* CreatePublicLayoutN(_SharedPtr <_LayoutImpl> layoutImpl);
133 static void SetLayoutImpl(Layout* pPublicLayout, _LayoutImpl* pImplLayout);
136 _LayoutImpl(Layout* pPublicLayout, _Layout::Layout* _pCoreLayout);
137 static result CheckConstruction(_Layout::Layout* pCoreLayout, _LayoutImpl* pImplLayout);
140 * Sets the alignment of the specified item.
142 * @return An error code
143 * @param[in] item The item for which the alignment is set
144 * @param[in] align The alignment
145 * @exception E_SUCCESS The method was successful.
146 * @exception E_INVALID_STATE This instance is in an invalid state.
147 * @exception E_INVALID_ARG The alignment parameter is invalid.
150 result SetAlignment(const _ControlImpl& item, const LayoutHorizontalAlignment horizontalAlign, const LayoutVerticalAlignment verticalAlign);
153 * Gets the alignment of the specified item.
155 * @return An error code
156 * @param[in] item The item to get the alignment
157 * @param[out] align The alignment
158 * @exception E_SUCCESS The method was successful.
159 * @exception E_INVALID_STATE This instance is in an invalid state.
162 result GetAlignment(const _ControlImpl& item, LayoutHorizontalAlignment& horizontalAlign, LayoutVerticalAlignment& verticalAlign) const;
165 * Sets the margin of the specified item.
167 * @return An error code
168 * @param[in] item The item for which the margin is set
169 * @param[in] margin The margin
170 * @exception E_SUCCESS The method was successful.
171 * @exception E_INVALID_STATE This instance is in an invalid state.
174 result SetMargin(const _ControlImpl& item, int left, int right, int top, int bottom);
177 * Sets the margin of the specified item.
179 * @return An error code
180 * @param[in] item The item for which the margin is set
181 * @param[in] margin The margin
182 * @exception E_SUCCESS The method was successful.
183 * @exception E_INVALID_STATE This instance is in an invalid state.
186 result SetMargin(const _ControlImpl& item, float left, float right, float top, float bottom);
189 * Gets the margin of the specified item.
191 * @return An error code
192 * @param[in] item The item to get the margin
193 * @param[out] margin The margin
194 * @exception E_SUCCESS The method was successful.
195 * @exception E_INVALID_STATE This instance is in an invalid state.
198 result GetMargin(const _ControlImpl& item, int& left, int& right, int& top, int& bottom) const;
201 * Gets the margin of the specified item.
203 * @return An error code
204 * @param[in] item The item to get the margin
205 * @param[out] margin The margin
206 * @exception E_SUCCESS The method was successful.
207 * @exception E_INVALID_STATE This instance is in an invalid state.
210 result GetMargin(const _ControlImpl& item, float& left, float& right, float& top, float& bottom) const;
213 * Sets the width of the specified item with the match policy.
215 * @return An error code
216 * @param[in] item The item for which the width is set
217 * @patam[in] matchMode The match policy
218 * @exception E_SUCCESS The method was successful.
219 * @exception E_INVALID_STATE This instance is in an invalid state.
222 result SetHorizontalFitPolicy(const _ControlImpl& item, const FitPolicy policy);
225 * Gets the width of the specified item with the match policy.
227 * @return An error code
228 * @param[in] item The item to get the match policy of the width
229 * @patam[out] matchMode The match policy
230 * @exception E_SUCCESS The method was successful.
231 * @exception E_INVALID_STATE This instance is in an invalid state.
234 result GetHorizontalFitPolicy(const _ControlImpl& item, FitPolicy& policy) const;
237 * Sets the height of the specified item with the match policy.
239 * @return An error code
240 * @param[in] item The item for which the height is set
241 * @patam[in] matchMode The match policy
242 * @exception E_SUCCESS The method was successful.
243 * @exception E_INVALID_STATE This instance is in an invalid state.
246 result SetVerticalFitPolicy(const _ControlImpl& item, const FitPolicy matchMode);
249 * Gets the height of the specified item with the match policy.
251 * @return An error code
252 * @param[in] item The item to get the match policy of the height
253 * @patam[out] matchMode The match policy
254 * @exception E_SUCCESS The method was successful.
255 * @exception E_INVALID_STATE This instance is in an invalid state.
258 result GetVerticalFitPolicy(const _ControlImpl& item, FitPolicy& matchMode) const;
261 * Adds the item at the end of the list maintained by the layout
263 * @return An error code
268 result AddItem(_ControlImpl& addItem);
273 * @return An error code
274 * @param[in] removeItem
278 result RemoveItem(const _ControlImpl& removeItem);
283 * @return An error code
284 * @param[in] viewPosX The x coordinate
285 * @param[in] viewPosY The y coordinate
286 * @exception E_SUCCESS The method was successful.
287 * @exception E_INVALID_STATE The layout have a item instance that is in an invalid state.
290 result OnChangeViewPos(int viewPosX, int viewPosY);
293 * Sets the base location and dimension of the specified item.
295 * @return An error code
296 * @param[in] item The item for which the base location and dimension are set
297 * @patam[in] baseRect The rectangle value with the location and dimension
298 * @exception E_SUCCESS The method was successful.
299 * @exception E_INVALID_STATE This instance is in an invalid state.
302 result SetItemBaseRect(const _ControlImpl& item, const _Layout::LayoutRect baseRect);
305 * Gets the base location and dimension of the specified item.
307 * @return An error code
308 * @param[in] item The item to get the base location and dimension
309 * @patam[out] baseRect The rectangle value with the location and dimension
310 * @exception E_SUCCESS The method was successful.
311 * @exception E_INVALID_STATE This instance is in an invalid state.
314 result GetItemBaseRect(const _ControlImpl& item, _Layout::LayoutRect& baseRect) const;
317 _LayoutImpl& operator =(const _LayoutImpl&);
318 static void AllocateLayoutImpl(Layout* pPublicLayout, _SharedPtr <Tizen::Ui::_LayoutImpl> layoutImpl);
321 Layout* _pPublicLayout;
322 _Layout::Layout* _pCoreLayout;
326 struct LayoutImplHolder
328 _SharedPtr <Tizen::Ui::_LayoutImpl> layoutImpl;
333 #endif // _FUI_LAYOUT_IMPL_H_