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 FUiCtrlSplitPanel.h
20 * @brief This is the header file for the %SplitPanel class.
22 * This header file contains the declarations of the %SplitPanel class.
24 #ifndef _FUI_CTRL_SPLIT_PANEL_H_
25 #define _FUI_CTRL_SPLIT_PANEL_H_
27 #include <FBaseTypes.h>
28 #include <FGrpRectangle.h>
29 #include <FUiControl.h>
30 #include <FUiCtrlSplitPanelTypes.h>
33 namespace Tizen { namespace Ui { namespace Controls
36 class ISplitPanelEventListener;
37 class ISplitPanelEventListenerF;
41 * @brief This class is an implementation of a %SplitPanel control.
44 * @final This class is not intended for extension.
46 * The %SplitPanel class provides the functionality of a %SplitPanel which is a control that contains two panes.
48 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/ui/implementing_splitpanel.htm">SplitPanel</a>.
50 * The following example demonstrates how to use the %SplitPanel class.
53 // Sample code for SplitPanel.h
56 class SplitPanelSample
57 : public Tizen::Ui::Controls::Form
58 , public Tizen::Ui::Controls::ISplitPanelEventListener
61 SplitPanelSample(void)
64 , __pSecondPanel(null){}
66 bool Initialize(void);
67 virtual result OnInitializing(void);
68 virtual result OnTerminating(void);
71 Tizen::Ui::Controls::SplitPanel* __pSplitPanel;
72 Tizen::Ui::Controls::Panel* __pFirstPanel;
73 Tizen::Ui::Controls::Panel* __pSecondPanel;
78 // Sample code for SplitPanelSample.cpp
79 #include <FGraphics.h>
81 #include "SplitPanelSample.h"
83 using namespace Tizen::Graphics;
84 using namespace Tizen::Ui;
85 using namespace Tizen::Ui::Controls;
88 SplitPanelSample::Initialize(void)
90 Construct(FORM_STYLE_NORMAL);
95 SplitPanelSample::OnInitializing(void)
97 // Creates an instance of SplitPanel
98 __pSplitPanel = new (std::nothrow) SplitPanel();
99 __pSplitPanel->Construct(Rectangle(0, 0, 800, 400),
100 SPLIT_PANEL_DIVIDER_STYLE_MOVABLE, SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL);
102 // Creates instances of Panel
103 __pFirstPanel = new (std::nothrow) Panel();
104 __pFirstPanel->Construct(Rectangle(0, 0, 400, 480));
106 __pSecondPanel = new (std::nothrow) Panel();
107 __pSecondPanel->Construct(Rectangle(0, 0, 400, 480));
109 //Sets the divider position to the slit panel
110 __pSplitPanel->SetDividerPosition(400);
112 //Sets panes to the split panel
113 __pSplitPanel->SetPane(__pFirstPanel, SPLIT_PANEL_PANE_ORDER_FIRST);
114 __pSplitPanel->SetPane(__pSecondPanel, SPLIT_PANEL_PANE_ORDER_SECOND);
116 // Adds the split panel to the form
117 AddControl(__pSplitPanel);
123 SplitPanelSample::OnTerminating(void)
125 // Sets null panes to the split panel
126 __pSplitPanel->SetPane(null, SPLIT_PANEL_PANE_ORDER_FIRST);
127 __pSplitPanel->SetPane(null, SPLIT_PANEL_PANE_ORDER_SECOND);
129 //Deallocates the control
130 __pFirstPanel->Destroy();
131 __pSecondPanel->Destroy();
140 class _OSP_EXPORT_ SplitPanel
141 : public Tizen::Ui::Control
145 * The object is not fully constructed after this constructor is called. @n
146 * For full construction, the %Construct() method must be called right after calling this constructor.
153 * This polymorphic destructor should be overridden if required.@n
154 * This way, the destructors of the derived classes are called when the destructor of this interface is called.
158 virtual ~SplitPanel(void);
161 * Initializes this instance of %SplitPanel with the specified parameters.
165 * @return An error code
166 * @param[in] rect The location and size of the %SplitPanel control as a Tizen::Graphics::Rectangle instance.
167 * @param[in] splitPanelDividerStyle The divider style of the %SplitPanel control
168 * @param[in] splitPanelDividerDirection The divider direction of the %SplitPanel control @n
169 * The specified divider direction determines the divider is vertical or horizontal.
170 * @exception E_SUCCESS The method is successful.
171 * @exception E_INVALID_ARG A specified input parameter is invalid.
173 result Construct(const Tizen::Graphics::Rectangle& rect, SplitPanelDividerStyle splitPanelDividerStyle, SplitPanelDividerDirection splitPanelDividerDirection);
176 * Initializes this instance of %SplitPanel with the specified parameters.
180 * @return An error code
181 * @param[in] rect The location and size of the %SplitPanel control as a Tizen::Graphics::FloatRectangle instance.
182 * @param[in] splitPanelDividerStyle The divider style of the %SplitPanel control
183 * @param[in] splitPanelDividerDirection The divider direction of the %SplitPanel control @n
184 * The specified divider direction determines the divider is vertical or horizontal.
185 * @exception E_SUCCESS The method is successful.
186 * @exception E_INVALID_ARG A specified input parameter is invalid.
188 result Construct(const Tizen::Graphics::FloatRectangle& rect, SplitPanelDividerStyle splitPanelDividerStyle, SplitPanelDividerDirection splitPanelDividerDirection);
192 * Adds a ISplitPanelEventListener instance. @n
193 * The added listener listens to events on the context of the specified event dispatcher when they are fired.
197 * @param[in] listener The event listener to add
198 * @exception E_SUCCESS The method is successful.
199 * @exception E_OBJ_ALREADY_EXIST The event listener already exists.
201 result AddSplitPanelEventListener(ISplitPanelEventListener& listener);
204 * Adds a ISplitPanelEventListenerF instance. @n
205 * The added listener listens to events on the context of the specified event dispatcher when they are fired.
209 * @param[in] listener The event listener to add
210 * @exception E_SUCCESS The method is successful.
211 * @exception E_OBJ_ALREADY_EXIST The event listener already exists.
213 result AddSplitPanelEventListener(ISplitPanelEventListenerF& listener);
216 * Removes a ISplitPanelEventListener instance. @n
217 * The removed listener cannot listen to events when they are fired.
221 * @param[in] listener The event listener to remove
222 * @exception E_SUCCESS The method is successful.
223 * @exception E_OBJ_NOT_FOUND The event listener is not found.
225 result RemoveSplitPanelEventListener(ISplitPanelEventListener& listener);
228 * Removes a ISplitPanelEventListenerF instance. @n
229 * The removed listener cannot listen to events when they are fired.
233 * @param[in] listener The event listener to remove
234 * @exception E_SUCCESS The method is successful.
235 * @exception E_OBJ_NOT_FOUND The event listener is not found.
237 result RemoveSplitPanelEventListener(ISplitPanelEventListenerF& listener);
240 * Sets the pane to the %SplitPanel control.
244 * @return An error code
245 * @param[in] pControl The control to set
246 * @param[in] paneOrder The order of pane. @c SPLIT_PANEL_PANE_FIRST is displayed on the left side @n
247 * and @c SPLIT_PANEL_PANE_SECOND is displayed on the right side of the %SplitPanel when its direction is
248 * @c SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL.
249 * @exception E_SUCCESS The method is successful.
250 * @exception E_INVALID_ARG A specified input parameter is invalid.
251 * @remarks The %SplitPanel control must contain exactly two panes and the user can change their relative sizes.
253 result SetPane(Control* pControl, SplitPanelPaneOrder paneOrder);
256 * Gets the control at the specified pane order of the %SplitPanel.
260 * @return The control at the specified pane order of the %SplitPanel @n
261 * @c null, if there is no panel.
262 * @param[in] paneOrder The order of pane. @c SPLIT_PANEL_PANE_FIRST is displayed on the left side @n
263 * and @c SPLIT_PANEL_PANE_SECOND is displayed on the right side of the %SplitPanel when
264 * its direction is @c SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL.
265 * @exception E_SUCCESS The method is successful.
266 * @exception E_INVALID_ARG A specified input parameter is invalid.
267 * @remarks The specific error code can be accessed using the GetLastResult() method.
269 Control* GetPane(SplitPanelPaneOrder paneOrder) const;
272 * Sets the divider position of the control.
276 * @return An error code
277 * @param[in] position The position of divider
278 * @exception E_SUCCESS The method is successful.
279 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
280 * @remarks This Api sets the value to current orientation. The divider position must be reset when the orientation of the form is changed.
281 * @see GetDividerPosition()
282 * @see SetMaximumDividerPosition()
283 * @see GetMaximumDividerPosition()
284 * @see SetMinimumDividerPosition()
285 * @see GetMinimumDividerPosition()
287 result SetDividerPosition(int position);
290 * Sets the divider position of the control.
294 * @return An error code
295 * @param[in] position The position of divider
296 * @exception E_SUCCESS The method is successful.
297 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
298 * @remarks This Api sets the value to current orientation. The divider position must be reset when the orientation of the form is changed.
299 * @see GetDividerPosition()
300 * @see SetMaximumDividerPosition()
301 * @see GetMaximumDividerPosition()
302 * @see SetMinimumDividerPosition()
303 * @see GetMinimumDividerPosition()
305 result SetDividerPosition(float position);
308 * Gets the current divider position of the control.
312 * @return The current divider position
313 * @remarks The specific error code can be accessed using the GetLastResult() method.
314 * @see SetDividerPosition()
315 * @see SetMaximumDividerPosition()
316 * @see GetMaximumDividerPosition()
317 * @see SetMinimumDividerPosition()
318 * @see GetMinimumDividerPosition()
320 int GetDividerPosition(void) const;
323 * Gets the current divider position of the control.
327 * @return The current divider position
328 * @remarks The specific error code can be accessed using the GetLastResult() method.
329 * @see SetDividerPosition()
330 * @see SetMaximumDividerPosition()
331 * @see GetMaximumDividerPosition()
332 * @see SetMinimumDividerPosition()
333 * @see GetMinimumDividerPosition()
335 float GetDividerPositionF(void) const;
338 * Sets the divider maximum position of the control.
342 * @return An error code
343 * @param[in] position The position of divider.
344 * @exception E_SUCCESS The method is successful.
345 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
346 * @remarks This Api sets the value to current orientation. The maximum divider position must be reset when the orientation of the form is changed.
347 * @see GetMaximumDividerPosition()
348 * @see SetMinimumDividerPosition()
349 * @see GetMinimumDividerPosition()
351 result SetMaximumDividerPosition(int position);
354 * Sets the divider maximum position of the control.
358 * @return An error code
359 * @param[in] position The position of divider.
360 * @exception E_SUCCESS The method is successful.
361 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
362 * @remarks This Api sets the value to current orientation. The maximum divider position must be reset when the orientation of the form is changed.
363 * @see GetMaximumDividerPosition()
364 * @see SetMinimumDividerPosition()
365 * @see GetMinimumDividerPosition()
367 result SetMaximumDividerPosition(float position);
370 * Gets the maximum divider position.
374 * @return The maximum divider position of the control.
375 * @see SetMaximumDividerPosition()
376 * @see SetMinimumDividerPosition()
377 * @see GetMinimumDividerPosition()
379 int GetMaximumDividerPosition(void) const;
382 * Gets the maximum divider position.
386 * @return The maximum divider position of the control.
387 * @see SetMaximumDividerPosition()
388 * @see SetMinimumDividerPosition()
389 * @see GetMinimumDividerPosition()
391 float GetMaximumDividerPositionF(void) const;
394 * Sets the divider minimum position of the control.
398 * @return An error code
399 * @param[in] position The position of divider.
400 * @exception E_SUCCESS The method is successful.
401 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
402 * @remarks This Api sets the value to current orientation. The minimum divider position must be reset when the orientation of the form is changed.
403 * @see GetMinimumDividerPosition()
404 * @see SetMaximumDividerPosition()
405 * @see GetMaximumDividerPosition()
407 result SetMinimumDividerPosition(int position);
410 * Sets the divider minimum position of the control.
414 * @return An error code
415 * @param[in] position The position of divider.
416 * @exception E_SUCCESS The method is successful.
417 * @exception E_OUT_OF_RANGE A specified input parameter is invalid.
418 * @remarks This Api sets the value to current orientation. The minimum divider position must be reset when the orientation of the form is changed.
419 * @see GetMinimumDividerPosition()
420 * @see SetMaximumDividerPosition()
421 * @see GetMaximumDividerPosition()
423 result SetMinimumDividerPosition(float position);
426 * Gets the minimum divider position.
430 * @return The minimum divider position of the control.
431 * @see SetMinimumDividerPosition()
432 * @see SetMaximumDividerPosition()
433 * @see GetMaximumDividerPosition()
435 int GetMinimumDividerPosition(void) const;
438 * Gets the minimum divider position.
442 * @return The minimum divider position of the control.
443 * @see SetMinimumDividerPosition()
444 * @see SetMaximumDividerPosition()
445 * @see GetMaximumDividerPosition()
447 float GetMinimumDividerPositionF(void) const;
450 * Maximizes the specified pane.
454 * @return An error code
455 * @param[in] paneOrder The order of pane.
456 * @see IsPaneMaximized()
458 result MaximizePane(SplitPanelPaneOrder paneOrder);
461 * Checks whether the specified pane is maximized.
464 * @return @c true if the pane is maximized, @n
467 bool IsPaneMaximized(SplitPanelPaneOrder paneOrder) const;
470 * Restores the previous pane size if the specified pane is maximized.
474 * @return An error code
475 * @see MaximizePane()
477 result RestorePane(void);
481 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
483 SplitPanel(const SplitPanel& rhs);
486 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
488 SplitPanel& operator =(const SplitPanel& rhs);
490 friend class _SplitPanelImpl;
494 }}} //Tizen::Ui::Controls
496 #endif // _FUI_CTRL_SPLIT_PANEL_H_