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.
19 * @file FUiCtrlPanel.h
20 * @brief This is the header file for the %Panel class.
22 * This header file contains the declarations of the %Panel class.
25 #ifndef _FUI_CTRL_PANEL_H_
26 #define _FUI_CTRL_PANEL_H_
28 #include <FBaseTypes.h>
29 #include <FBaseString.h>
30 #include <FUiContainer.h>
31 #include <FUiCtrlControlsTypes.h>
33 namespace Tizen {namespace Base
38 namespace Tizen { namespace Ui
40 class DataBindingContext;
43 namespace Tizen { namespace Ui { namespace Controls
48 * @brief This class provides a %Panel, that is the simplest container.
52 * The %Panel class displays a space where other UI elements can be placed. It is a concrete implementation of the Container class.
54 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_panels.htm">Panels</a>.
56 * The following example demonstrates how to use the %Panel class.
59 // Sample code for PanelSample.h
63 : public Tizen::Ui::Controls::Form
69 bool Initialize(void);
70 virtual result OnInitializing(void);
73 Tizen::Ui::Controls::Panel* __pPanel;
78 // Sample code for PanelSample.cpp
79 #include <FGraphics.h>
81 #include "PanelSample.h"
83 using namespace Tizen::Graphics;
84 using namespace Tizen::Ui::Controls;
87 PanelSample::Initialize(void)
89 Construct(FORM_STYLE_NORMAL);
94 PanelSample::OnInitializing(void)
98 // Creates an instance of Panel
99 __pPanel = new Panel();
100 __pPanel->Construct(Rectangle(100, 200, 300, 300));
101 __pPanel->SetBackgroundColor(Color(0x50, 0xFF, 0x38));
103 //Adds the panel to the form
104 AddControl(*__pPanel);
110 class _OSP_EXPORT_ Panel
111 : public Tizen::Ui::Container
116 * The object is not fully constructed after this constructor is called. For full construction, the Construct() method must be called right after calling this constructor.
124 * This destructor overrides Tizen::Base::Object::~Object().
129 virtual ~Panel(void);
132 * Initializes this instance of %Panel with the specified parameters.
136 * @return An error code
137 * @param[in] rect The location and size of the %Panel control as an instance of Rectangle
138 * @param[in] groupStyle The group style of the %Panel control
139 * @exception E_SUCCESS The method is successful.
140 * @exception E_INVALID_ARG A specified input parameter is invalid.
141 * @exception E_SYSTEM A system error has occurred.
142 * @remarks The specified group style determines the border look of the %Panel control.
143 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
145 result Construct(const Tizen::Graphics::Rectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
148 * Initializes this instance of %Panel with the specified parameters.
152 * @return An error code
153 * @param[in] rect The location and size of the %Panel control as an instance of FloatRectangle
154 * @param[in] groupStyle The group style of the %Panel control
155 * @exception E_SUCCESS The method is successful.
156 * @exception E_INVALID_ARG A specified input parameter is invalid.
157 * @exception E_SYSTEM A system error has occurred.
158 * @remarks The specified group style determines the border look of the %Panel control.
159 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
161 result Construct(const Tizen::Graphics::FloatRectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
164 * Initializes this instance of %Panel and child controls with the specified resource ID @n
166 * This method first attempts to find the resource file in the folder that corresponds to the current screen resolution. @n
167 * If it fails to find the resource file, it searches in other folders in the following order when CoordinateSystem is Logical in the application manifest file @n
168 * the density folder that corresponds to the current screen size category "res/screen-size-normal/" folder.
172 * @return An error code
173 * @param[in] resourceId The resource ID describing the %Panel control
174 * @exception E_SUCCESS The method is successful.
175 * @exception E_FILE_NOT_FOUND The specified file cannot be found.
176 * @exception E_INVALID_FORMAT The specified XML format is invalid.
177 * @exception E_OPERATION_FAILED The operation has failed.
179 result Construct(const Tizen::Base::String& resourceId);
182 * Initializes this instance of %Panel with the specified parameters.
186 * @return An error code
187 * @param[in] layout The layout for both the portrait and landscape modes
188 * @param[in] rect The location and size of the %Panel control as an instance of Rectangle
189 * @param[in] groupStyle The table view style of the %Panel control
190 * @exception E_SUCCESS The method is successful.
191 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
192 * The specified layout is already bound to another container.
193 * @exception E_SYSTEM A system error has occurred.
194 * @remarks The specified group style determines the border look of the %Panel control.
195 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
197 result Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::Rectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
200 * Initializes this instance of %Panel with the specified parameters.
204 * @return An error code
205 * @param[in] layout The layout for both the portrait and landscape modes
206 * @param[in] rect The location and size of the %Panel control as an instance of FloatRectangle
207 * @param[in] groupStyle The table view style of the %Panel control
208 * @exception E_SUCCESS The method is successful.
209 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
210 * The specified layout is already bound to another container.
211 * @exception E_SYSTEM A system error has occurred.
212 * @remarks The specified group style determines the border look of the %Panel control.
213 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
215 result Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::FloatRectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
218 * Initializes this instance of %Panel with the specified layouts, rectangular region, and group style.
222 * @return An error code
223 * @param[in] portraitLayout The layout for the portrait mode
224 * @param[in] landscapeLayout The layout for the landscape mode
225 * @param[in] rect The location and size of the %Panel control as an instance of Rectangle
226 * @param[in] groupStyle The table view style of the %Panel control
227 * @exception E_SUCCESS The method is successful.
228 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
229 * The specified layout is already bound to another container.
230 * @exception E_SYSTEM A system error has occurred.
231 * @remarks The specified group style determines the border look of the %Panel control.
232 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
234 result Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, const Tizen::Graphics::Rectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
237 * Initializes this instance of %Panel with the specified layouts, rectangular region, and group style.
241 * @return An error code
242 * @param[in] portraitLayout The layout for the portrait mode
243 * @param[in] landscapeLayout The layout for the landscape mode
244 * @param[in] rect The location and size of the %Panel control as an instance of FloatRectangle
245 * @param[in] groupStyle The table view style of the %Panel control
246 * @exception E_SUCCESS The method is successful.
247 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
248 * The specified layout is already bound to another container.
249 * @exception E_SYSTEM A system error has occurred.
250 * @remarks The specified group style determines the border look of the %Panel control.
251 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
253 result Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, const Tizen::Graphics::FloatRectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
256 * Gets the background color of the %Panel control.
260 * @return The background color
262 Tizen::Graphics::Color GetBackgroundColor(void) const;
265 * Sets the background color of this control.
269 * @param[in] color The background color
271 void SetBackgroundColor(const Tizen::Graphics::Color& color);
275 * Enables the %Panel control to be composited to the screen buffer.
277 * @brief <i> [Deprecated] </i>
278 * @deprecated This method is deprecated because changing composition mode is not allowed any more.
281 * @return An error code
282 * @param[in] composite Set to @c true to make the %Panel control composited to the screen buffer, @n
284 * @exception E_SUCCESS The method is successful.
285 * @exception E_SYSTEM A system error has occurred.
286 * @remarks In case a %Panel is transparent and nothing is drawn on the canvas of the %Panel control, the graphic performance can be improved if the
287 * compositing of the %Panel control to the screen buffer is disabled. @n
288 * By default, compositing is enabled. For example, if a Form control has a %Panel that has a List, by disabling the compositing of the
289 * %Panel, the scroll performance of the %List will improve.
292 result SetCompositeEnabled(bool composite);
296 * Checks whether the %Panel control is composite to the screen buffer.
298 * @brief <i> [Deprecated] </i>
299 * @deprecated This method is deprecated because changing composition mode is not allowed any more.
302 * @return @c true if the %Panel control is composite to the screen buffer, @n
306 bool IsCompositeEnabled(void) const;
309 * Gets the data binding context.
313 * @return The data binding context
314 * @exception E_SUCCESS The method is successful.
315 * @exception E_SYSTEM A system error has occurred.
316 * @remarks The specific error code can be accessed using the GetLastResult() method.
318 DataBindingContext* GetDataBindingContextN(void) const;
322 friend class _PanelImpl;
324 // Reserved virtual methods for later extension
326 // The following methods are reserved and may change its name at any time without prior notice.
327 virtual void Panel_Reserved1(void) {}
329 virtual void Panel_Reserved2(void) {}
331 virtual void Panel_Reserved3(void) {}
334 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
335 Panel(const Panel& rhs);
337 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
338 Panel& operator =(const Panel& rhs);
342 }}} //Tizen::Ui::Controls
344 #endif // _FUI_CTRL_PANEL_H_