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.
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. @n
117 * For full construction, the %Construct() method must be called right after calling this constructor.
125 * This destructor overrides Tizen::Base::Object::~Object().
130 virtual ~Panel(void);
133 * Initializes this instance of %Panel with the specified parameters.
137 * @return An error code
138 * @param[in] rect The location and size of the %Panel control as an instance of Rectangle
139 * @param[in] groupStyle The group style of the %Panel control
140 * @exception E_SUCCESS The method is successful.
141 * @exception E_INVALID_ARG A specified input parameter is invalid.
142 * @exception E_SYSTEM A system error has occurred.
143 * @remarks The specified group style determines the border look of the %Panel control.
144 * @see Tizen::Ui::Container
146 result Construct(const Tizen::Graphics::Rectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
149 * Initializes this instance of %Panel with the specified parameters.
153 * @return An error code
154 * @param[in] rect The location and size of the %Panel control as an instance of FloatRectangle
155 * @param[in] groupStyle The group style of the %Panel control
156 * @exception E_SUCCESS The method is successful.
157 * @exception E_INVALID_ARG A specified input parameter is invalid.
158 * @exception E_SYSTEM A system error has occurred.
159 * @remarks The specified group style determines the border look of the %Panel control.
160 * @see Tizen::Ui::Container
162 result Construct(const Tizen::Graphics::FloatRectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
165 * Initializes this instance of %Panel and child controls with the specified resource ID @n
167 * This method first attempts to find the resource file in the folder that corresponds to the current screen resolution. @n
168 * 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
169 * the density folder that corresponds to the current screen size category "res/screen-size-normal/" folder.
173 * @return An error code
174 * @param[in] resourceId The resource ID describing the %Panel control
175 * @exception E_SUCCESS The method is successful.
176 * @exception E_FILE_NOT_FOUND The specified file cannot be found.
177 * @exception E_INVALID_FORMAT The specified XML format is invalid.
178 * @exception E_OPERATION_FAILED The operation has failed.
179 * @remarks If SetBounds(), SetSize(), SetPosition() methods are called before the control is added to the parent via AddControl(), then the new value is applied
180 * to both orientations because the current orientation is not known. After AddControl() is called, then the values are applied only to the current orientation.
182 result Construct(const Tizen::Base::String& resourceId);
185 * Initializes this instance of %Panel with the specified parameters.
189 * @return An error code
190 * @param[in] layout The layout for both the portrait and landscape modes
191 * @param[in] rect The location and size of the %Panel control as an instance of Rectangle
192 * @param[in] groupStyle The table view style of the %Panel control
193 * @exception E_SUCCESS The method is successful.
194 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
195 * The specified layout is already bound to another container.
196 * @exception E_SYSTEM A system error has occurred.
197 * @remarks The specified group style determines the border look of the %Panel control.
198 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
200 result Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::Rectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
203 * Initializes this instance of %Panel with the specified parameters.
207 * @return An error code
208 * @param[in] layout The layout for both the portrait and landscape modes
209 * @param[in] rect The location and size of the %Panel control as an instance of FloatRectangle
210 * @param[in] groupStyle The table view style of the %Panel control
211 * @exception E_SUCCESS The method is successful.
212 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
213 * The specified layout is already bound to another container.
214 * @exception E_SYSTEM A system error has occurred.
215 * @remarks The specified group style determines the border look of the %Panel control.
216 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
218 result Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::FloatRectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
221 * Initializes this instance of %Panel with the specified layouts, rectangular region, and group style.
225 * @return An error code
226 * @param[in] portraitLayout The layout for the portrait mode
227 * @param[in] landscapeLayout The layout for the landscape mode
228 * @param[in] rect The location and size of the %Panel control as an instance of Rectangle
229 * @param[in] groupStyle The table view style of the %Panel control
230 * @exception E_SUCCESS The method is successful.
231 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
232 * The specified layout is already bound to another container.
233 * @exception E_SYSTEM A system error has occurred.
234 * @remarks The specified group style determines the border look of the %Panel control.
235 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
237 result Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, const Tizen::Graphics::Rectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
240 * Initializes this instance of %Panel with the specified layouts, rectangular region, and group style.
244 * @return An error code
245 * @param[in] portraitLayout The layout for the portrait mode
246 * @param[in] landscapeLayout The layout for the landscape mode
247 * @param[in] rect The location and size of the %Panel control as an instance of FloatRectangle
248 * @param[in] groupStyle The table view style of the %Panel control
249 * @exception E_SUCCESS The method is successful.
250 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
251 * The specified layout is already bound to another container.
252 * @exception E_SYSTEM A system error has occurred.
253 * @remarks The specified group style determines the border look of the %Panel control.
254 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
256 result Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, const Tizen::Graphics::FloatRectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
259 * Gets the background color of the %Panel control.
263 * @return The background color
265 Tizen::Graphics::Color GetBackgroundColor(void) const;
268 * Sets the background color of this control.
272 * @param[in] color The background color
274 void SetBackgroundColor(const Tizen::Graphics::Color& color);
278 * Enables the %Panel control to be composited to the screen buffer.
280 * @brief <i> [Deprecated] </i>
281 * @deprecated This method is deprecated because changing composition mode is not allowed any more.
284 * @return An error code
285 * @param[in] composite Set to @c true to make the %Panel control composited to the screen buffer, @n
287 * @exception E_SUCCESS The method is successful.
288 * @exception E_SYSTEM A system error has occurred.
289 * @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
290 * compositing of the %Panel control to the screen buffer is disabled. @n
291 * By default, compositing is enabled. For example, if a Form control has a %Panel that has a List, by disabling the compositing of the
292 * %Panel, the scroll performance of the %List will improve.
295 result SetCompositeEnabled(bool composite);
299 * Checks whether the %Panel control is composite to the screen buffer.
301 * @brief <i> [Deprecated] </i>
302 * @deprecated This method is deprecated because changing composition mode is not allowed any more.
305 * @return @c true if the %Panel control is composite to the screen buffer, @n
309 bool IsCompositeEnabled(void) const;
312 * Gets the data binding context.
316 * @return The data binding context
317 * @exception E_SUCCESS The method is successful.
318 * @exception E_SYSTEM A system error has occurred.
319 * @remarks The specific error code can be accessed using the GetLastResult() method.
321 DataBindingContext* GetDataBindingContextN(void) const;
325 friend class _PanelImpl;
327 // Reserved virtual methods for later extension
329 // The following methods are reserved and may change its name at any time without prior notice.
330 virtual void Panel_Reserved1(void) {}
332 virtual void Panel_Reserved2(void) {}
334 virtual void Panel_Reserved3(void) {}
337 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
338 Panel(const Panel& rhs);
340 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
341 Panel& operator =(const Panel& rhs);
345 }}} //Tizen::Ui::Controls
347 #endif // _FUI_CTRL_PANEL_H_