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 <FUiCtrlGroupTypes.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);
149 * Initializes this instance of %Panel and child controls with the specified resource ID @n
151 * This method first attempts to find the resource file in the folder that corresponds to the current screen resolution. @n
152 * 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
153 * the density folder that corresponds to the current screen size category "res/screen-size-normal/" folder.
157 * @return An error code
158 * @param[in] resourceId The resource ID describing the %Panel control
159 * @exception E_SUCCESS The method is successful.
160 * @exception E_FILE_NOT_FOUND The specified file cannot be found.
161 * @exception E_INVALID_FORMAT The specified XML format is invalid.
162 * @exception E_OPERATION_FAILED The operation has failed.
164 result Construct(const Tizen::Base::String& resourceId);
167 * Initializes this instance of %Panel with the specified parameters.
171 * @return An error code
172 * @param[in] layout The layout for both the portrait and landscape modes
173 * @param[in] rect The location and size of the %Panel control as an instance of Rectangle
174 * @param[in] groupStyle The table view style of the %Panel control
175 * @exception E_SUCCESS The method is successful.
176 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
177 * The specified layout is already bound to another container.
178 * @exception E_SYSTEM A system error has occurred.
179 * @remarks The specified group style determines the border look of the %Panel control.
180 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
182 result Construct(const Tizen::Ui::Layout& layout, const Tizen::Graphics::Rectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
185 * Initializes this instance of %Panel with the specified layouts, rectangular region, and group style.
189 * @return An error code
190 * @param[in] portraitLayout The layout for the portrait mode
191 * @param[in] landscapeLayout The layout for the landscape mode
192 * @param[in] rect The location and size of the %Panel control as an instance of Rectangle
193 * @param[in] groupStyle The table view style of the %Panel control
194 * @exception E_SUCCESS The method is successful.
195 * @exception E_INVALID_ARG A specified input parameter is invalid. @n
196 * The specified layout is already bound to another container.
197 * @exception E_SYSTEM A system error has occurred.
198 * @remarks The specified group style determines the border look of the %Panel control.
199 * @see Tizen::Ui::Container, Tizen::Ui::GroupStyle
201 result Construct(const Tizen::Ui::Layout& portraitLayout, const Tizen::Ui::Layout& landscapeLayout, const Tizen::Graphics::Rectangle& rect, GroupStyle groupStyle = GROUP_STYLE_NONE);
204 * Gets the background color of the %Panel control.
208 * @return The background color
210 Tizen::Graphics::Color GetBackgroundColor(void) const;
213 * Sets the background color of this control.
217 * @param[in] color The background color
219 void SetBackgroundColor(const Tizen::Graphics::Color& color);
223 * Enables the %Panel control to be composited to the screen buffer.
225 * @brief <i> [Deprecated] </i>
226 * @deprecated This method is deprecated because changing composition mode is not allowed any more.
229 * @return An error code
230 * @param[in] composite Set to @c true to make the %Panel control composited to the screen buffer, @n
232 * @exception E_SUCCESS The method is successful.
233 * @exception E_SYSTEM A system error has occurred.
234 * @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
235 * compositing of the %Panel control to the screen buffer is disabled. @n
236 * By default, compositing is enabled. For example, if a Form control has a %Panel that has a List, by disabling the compositing of the
237 * %Panel, the scroll performance of the %List will improve.
240 result SetCompositeEnabled(bool composite);
244 * Checks whether the %Panel control is composite to the screen buffer.
246 * @brief <i> [Deprecated] </i>
247 * @deprecated This method is deprecated because changing composition mode is not allowed any more.
250 * @return @c true if the %Panel control is composite to the screen buffer, @n
254 bool IsCompositeEnabled(void) const;
257 * Gets the data binding context.
261 * @return The data binding context
262 * @exception E_SUCCESS The method is successful.
263 * @exception E_SYSTEM A system error has occurred.
264 * @remarks The specific error code can be accessed using the GetLastResult() method.
266 DataBindingContext* GetDataBindingContextN(void) const;
270 friend class _PanelImpl;
272 // Reserved virtual methods for later extension
274 // The following methods are reserved and may change its name at any time without prior notice.
275 virtual void Panel_Reserved1(void) {}
277 virtual void Panel_Reserved2(void) {}
279 virtual void Panel_Reserved3(void) {}
282 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
283 Panel(const Panel& rhs);
285 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
286 Panel& operator =(const Panel& rhs);
290 }}} //Tizen::Ui::Controls
292 #endif // _FUI_CTRL_PANEL_H_