2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 * Gets the margin of the specified item.
179 * @return An error code
180 * @param[in] item The item to get the margin
181 * @param[out] 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 GetMargin(const _ControlImpl& item, int& left, int& right, int& top, int& bottom) const;
189 * Sets the width of the specified item with the match policy.
191 * @return An error code
192 * @param[in] item The item for which the width is set
193 * @patam[in] matchMode The match policy
194 * @exception E_SUCCESS The method was successful.
195 * @exception E_INVALID_STATE This instance is in an invalid state.
198 result SetHorizontalFitPolicy(const _ControlImpl& item, const FitPolicy policy);
201 * Gets the width of the specified item with the match policy.
203 * @return An error code
204 * @param[in] item The item to get the match policy of the width
205 * @patam[out] matchMode The match policy
206 * @exception E_SUCCESS The method was successful.
207 * @exception E_INVALID_STATE This instance is in an invalid state.
210 result GetHorizontalFitPolicy(const _ControlImpl& item, FitPolicy& policy) const;
213 * Sets the height of the specified item with the match policy.
215 * @return An error code
216 * @param[in] item The item for which the height 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 SetVerticalFitPolicy(const _ControlImpl& item, const FitPolicy matchMode);
225 * Gets the height 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 height
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 GetVerticalFitPolicy(const _ControlImpl& item, FitPolicy& matchMode) const;
237 * Adds the item at the end of the list maintained by the layout
239 * @return An error code
244 result AddItem(_ControlImpl& addItem);
249 * @return An error code
250 * @param[in] removeItem
254 result RemoveItem(const _ControlImpl& removeItem);
259 * @return An error code
260 * @param[in] viewPosX The x coordinate
261 * @param[in] viewPosY The y coordinate
262 * @exception E_SUCCESS The method was successful.
263 * @exception E_INVALID_STATE The layout have a item instance that is in an invalid state.
266 result OnChangeViewPos(int viewPosX, int viewPosY);
269 * Sets the base location and dimension of the specified item.
271 * @return An error code
272 * @param[in] item The item for which the base location and dimension are set
273 * @patam[in] baseRect The rectangle value with the location and dimension
274 * @exception E_SUCCESS The method was successful.
275 * @exception E_INVALID_STATE This instance is in an invalid state.
278 result SetItemBaseRect(const _ControlImpl& item, const _Layout::LayoutRect baseRect);
281 * Gets the base location and dimension of the specified item.
283 * @return An error code
284 * @param[in] item The item to get the base location and dimension
285 * @patam[out] baseRect The rectangle value with the location and dimension
286 * @exception E_SUCCESS The method was successful.
287 * @exception E_INVALID_STATE This instance is in an invalid state.
290 result GetItemBaseRect(const _ControlImpl& item, _Layout::LayoutRect& baseRect) const;
293 _LayoutImpl& operator =(const _LayoutImpl&);
294 static void AllocateLayoutImpl(Layout* pPublicLayout, _SharedPtr <Tizen::Ui::_LayoutImpl> layoutImpl);
297 Layout* _pPublicLayout;
298 _Layout::Layout* _pCoreLayout;
302 struct LayoutImplHolder
304 _SharedPtr <Tizen::Ui::_LayoutImpl> layoutImpl;
309 #endif // _FUI_LAYOUT_IMPL_H_