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 FUiCtrl_SplitPanel.cpp
20 * @brief This is the implementation file for the _SplitPanel class.
23 #include <FBaseErrorDefine.h>
24 #include <FBaseString.h>
25 #include <FBaseSysLog.h>
26 #include <FGrp_BitmapImpl.h>
27 #include <FGrp_CoordinateSystemUtils.h>
28 #include "FUi_ResourceManager.h"
29 #include "FUi_UiTouchEvent.h"
30 #include "FUi_TouchTapGestureDetector.h"
31 #include "FUiCtrl_SplitPanel.h"
32 #include "FUiCtrl_SplitPanelPresenter.h"
34 using namespace Tizen::Ui;
35 using namespace Tizen::Graphics;
36 using namespace Tizen::Ui::Animations;
37 using namespace Tizen::Base;
38 using namespace Tizen::Base::Runtime;
40 namespace Tizen { namespace Ui { namespace Controls
43 _SplitPanel::_SplitPanel()
44 : __pSplitPanelPresenter(null)
46 , __pFirstPaneParent(null)
47 , __pSecondPaneParent(null)
50 , __splitPanelDividerDirection(SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
51 , __pSplitPanelEvent(null)
52 , __dividerTapCount(0)
53 , __pDividerVisualElement(null)
55 for (int i=0; i < _SPLIT_PANEL_DIVIDER_STATE; i++)
57 __dividerPosition[i] = 0.0f;
58 __minimumDividerPosition[i] = 0.0f;
59 __maximumDividerPosition[i] = 0.0f;
64 _SplitPanel::CreateSplitPanelN(const FloatRectangle& rect, SplitPanelDividerStyle splitPanelDividerStyle, SplitPanelDividerDirection splitPanelDividerDirection)
67 float dividerThickness = 0.0f;
68 _SplitPanel* pSplitPanel = null;
69 _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
71 pSplitPanel = new (std::nothrow) _SplitPanel;
72 SysTryReturn(NID_UI_CTRL, pSplitPanel, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
74 r = pSplitPanel->Construct(splitPanelDividerStyle, splitPanelDividerDirection);
81 pSplitPanel->AcquireHandle();
82 pSplitPanel->SetDividerDirection(splitPanelDividerDirection);
84 orientation = _ControlManager::GetInstance()->GetOrientation();
86 if (splitPanelDividerStyle == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE)
88 GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, dividerThickness);
92 GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, dividerThickness);
95 pSplitPanel->__maximumDividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_PORTRAIT] = rect.width - dividerThickness;
96 pSplitPanel->__maximumDividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_LANDSCAPE] = rect.width - dividerThickness;
97 pSplitPanel->__maximumDividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_PORTRAIT] = rect.height - dividerThickness;
98 pSplitPanel->__maximumDividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_LANDSCAPE] = rect.width - dividerThickness;
100 pSplitPanel->__dividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_PORTRAIT] = rect.width / 2.0f;
101 pSplitPanel->__dividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_LANDSCAPE] = rect.width / 2.0f;
102 pSplitPanel->__dividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_PORTRAIT] = rect.height / 2.0f;
103 pSplitPanel->__dividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_LANDSCAPE] = rect.height / 2.0f;
105 pSplitPanel->__pTapGesture = new (std::nothrow) _TouchTapGestureDetector;
106 SysTryCatch(NID_UI_CTRL, pSplitPanel->__pTapGesture, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
108 pSplitPanel->AddGestureDetector(*(pSplitPanel->__pTapGesture));
109 r = pSplitPanel->__pTapGesture->AddGestureListener(*pSplitPanel);
110 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
112 pSplitPanel->SetFocusable(false);
113 pSplitPanel->SetBackgroundColor(Color(0,0,0,0));
118 if (pSplitPanel->__pTapGesture != null)
120 pSplitPanel->__pTapGesture->RemoveGestureListener(*pSplitPanel);
121 pSplitPanel->RemoveGestureDetector(*pSplitPanel->__pTapGesture);
123 delete pSplitPanel->__pTapGesture;
124 pSplitPanel->__pTapGesture = null;
132 _SplitPanel::Construct(SplitPanelDividerStyle splitPanelDividerStyle, SplitPanelDividerDirection splitPanelDividerDirection)
134 result r = E_SUCCESS;
136 __pDividerVisualElement = new (std::nothrow) VisualElement();
137 SysTryReturnResult(NID_UI_CTRL, __pDividerVisualElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
138 r = __pDividerVisualElement->Construct();
139 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct divider visual element.", GetErrorMessage(r));
141 __pDividerVisualElement->SetShowState(true);
142 __pDividerVisualElement->SetImplicitAnimationEnabled(false);
143 __pDividerVisualElement->SetClipChildrenEnabled(false);
145 r = GetVisualElement()->AttachChild(*__pDividerVisualElement);
146 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to attach divider visual element.", GetErrorMessage(r));
148 __pSplitPanelPresenter = new (std::nothrow) _SplitPanelPresenter;
149 SysTryCatch(NID_UI_CTRL, __pSplitPanelPresenter != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
151 r = __pSplitPanelPresenter->Construct(*this, splitPanelDividerStyle, splitPanelDividerDirection);
152 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct presenter.", GetErrorMessage(r));
154 __pFirstPaneParent = _Control::CreateControlN();
156 SysTryCatch(NID_UI_CTRL, __pFirstPaneParent != null, , r, "[%s] Propagating.", GetErrorMessage(r));
158 __pSecondPaneParent = _Control::CreateControlN();
160 SysTryCatch(NID_UI_CTRL, __pSecondPaneParent != null, , r, "[%s] Propagating.", GetErrorMessage(r));
162 __pFirstPaneParent->SetFocusable(false);
163 __pSecondPaneParent->SetFocusable(false);
165 __pFirstPaneParent->SetBackgroundColor(Color(0,0,0,0));
166 __pSecondPaneParent->SetBackgroundColor(Color(0,0,0,0));
168 r = AttachChild(*__pFirstPaneParent);
169 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
171 r = AttachChild(*__pSecondPaneParent);
172 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
178 if (__pDividerVisualElement)
180 __pDividerVisualElement->Destroy();
181 __pDividerVisualElement = null;
184 if (__pSplitPanelPresenter)
186 delete __pSplitPanelPresenter;
187 __pSplitPanelPresenter = null;
190 if (__pFirstPaneParent)
192 DetachChild(*__pFirstPaneParent);
194 delete __pFirstPaneParent;
195 __pFirstPaneParent = null;
198 if (__pSecondPaneParent)
200 DetachChild(*__pSecondPaneParent);
202 delete __pSecondPaneParent;
203 __pSecondPaneParent = null;
209 _SplitPanel::~_SplitPanel(void)
211 if (__pSplitPanelPresenter)
213 delete __pSplitPanelPresenter;
214 __pSplitPanelPresenter = null;
217 if (__pSplitPanelEvent)
219 delete __pSplitPanelEvent;
220 __pSplitPanelEvent = null;
225 __pTapGesture->RemoveGestureListener(*this);
226 RemoveGestureDetector(*__pTapGesture);
228 delete __pTapGesture;
229 __pTapGesture = null;
232 if (__pDividerVisualElement)
234 GetVisualElement()->DetachChild(*__pDividerVisualElement);
236 __pDividerVisualElement->Destroy();
237 __pDividerVisualElement = null;
240 if (__pFirstPaneParent)
242 DetachChild(*__pFirstPaneParent);
244 delete __pFirstPaneParent;
245 __pFirstPaneParent = null;
248 if (__pSecondPaneParent)
250 DetachChild(*__pSecondPaneParent);
252 delete __pSecondPaneParent;
253 __pSecondPaneParent = null;
260 _SplitPanel::SetPresenter(const _SplitPanelPresenter& splitPanelPresenter)
262 __pSplitPanelPresenter = const_cast<_SplitPanelPresenter*>(&splitPanelPresenter);
267 _SplitPanel::AddSplitPanelEventListener(const _ISplitPanelEventListener& listener)
269 result r = E_SUCCESS;
271 if (__pSplitPanelEvent == null)
273 __pSplitPanelEvent = _SplitPanelEvent::CreateInstanceN(*this);
275 SysTryReturn(NID_UI_CTRL, __pSplitPanelEvent, r, r, "[%s] Propagating.", GetErrorMessage(r));
277 __pSplitPanelEvent->AddListener(listener);
284 _SplitPanel::RemoveSplitPanelEventListener(const _ISplitPanelEventListener& listener)
286 SysTryReturn(NID_UI_CTRL, __pSplitPanelEvent, E_SYSTEM, E_SYSTEM,
287 "[E_SYSTEM] System error occurred.");
289 __pSplitPanelEvent->RemoveListener(listener);
295 _SplitPanel::OnDraw(void)
297 __pSplitPanelPresenter->Draw();
303 _SplitPanel::OnChangeLayout(_ControlOrientation orientation)
305 __pSplitPanelPresenter->OnChangeLayout(orientation);
311 _SplitPanel::OnBoundsChanged(void)
313 FloatRectangle bounds = GetBoundsF();
314 float dividerThickness = 0.0f;
315 _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
317 orientation = _ControlManager::GetInstance()->GetOrientation();
319 GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, dividerThickness);
321 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
323 if (GetMaximumDividerPosition() > (bounds.width - dividerThickness))
325 SetMaximumDividerPosition(bounds.width - dividerThickness);
330 if (GetMaximumDividerPosition() > (bounds.height - dividerThickness))
332 SetMaximumDividerPosition(bounds.height - dividerThickness);
336 __pSplitPanelPresenter->OnBoundsChanged();
341 _UiTouchEventDelivery
342 _SplitPanel::OnPreviewTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
344 if (__pSplitPanelPresenter->OnTouchPressed(source, touchinfo) == true)
346 return _UI_TOUCH_EVENT_DELIVERY_NO;
349 return _UI_TOUCH_EVENT_DELIVERY_YES;
352 _UiTouchEventDelivery
353 _SplitPanel::OnPreviewTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
355 if (__pSplitPanelPresenter->OnTouchReleased(source, touchinfo) == true)
357 return _UI_TOUCH_EVENT_DELIVERY_NO;
360 return _UI_TOUCH_EVENT_DELIVERY_YES;
363 _UiTouchEventDelivery
364 _SplitPanel::OnPreviewTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
366 if (__pSplitPanelPresenter->OnTouchMoved(source, touchinfo) == true)
368 return _UI_TOUCH_EVENT_DELIVERY_NO;
371 return _UI_TOUCH_EVENT_DELIVERY_YES;
374 _UiTouchEventDelivery
375 _SplitPanel::OnPreviewTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
377 if (__pSplitPanelPresenter->OnTouchCanceled(source, touchinfo) == true)
379 return _UI_TOUCH_EVENT_DELIVERY_NO;
382 return _UI_TOUCH_EVENT_DELIVERY_YES;
386 _SplitPanel::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
392 return __pSplitPanelPresenter->OnTouchPressed(source, touchinfo);
396 _SplitPanel::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
402 return __pSplitPanelPresenter->OnTouchReleased(source, touchinfo);
406 _SplitPanel::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
412 return __pSplitPanelPresenter->OnTouchMoved(source, touchinfo);
416 _SplitPanel::OnTouchCanceled(const _Control & source, const _TouchInfo & touchinfo)
418 return __pSplitPanelPresenter->OnTouchCanceled(source, touchinfo);
422 _SplitPanel::OnTapGestureDetected(_TouchTapGestureDetector& gesture)
424 if (__pSplitPanelPresenter == null)
429 return __pSplitPanelPresenter->OnTapGestureDetected(gesture);
433 _SplitPanel::OnTapGestureCanceled(_TouchTapGestureDetector& gesture)
435 return __pSplitPanelPresenter->OnTapGestureCanceled(gesture);
439 _SplitPanel::SetPane(_Control* pControl, SplitPanelPaneOrder paneOrder)
441 result r = E_SUCCESS;
443 if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST)
445 if (pControl != null)
447 r = __pFirstPaneParent->AttachChild(*pControl);
448 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
451 __pFirstPane = pControl;
455 if (pControl != null)
457 r = __pSecondPaneParent->AttachChild(*pControl);
458 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
461 __pSecondPane = pControl;
464 __pSplitPanelPresenter->RecalcSplitPanel();
470 _SplitPanel::GetPane(SplitPanelPaneOrder paneOrder) const
472 if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST)
474 return const_cast <_Control*>(__pFirstPane);
477 return const_cast <_Control*>(__pSecondPane);
481 _SplitPanel::GetPaneParent(SplitPanelPaneOrder paneOrder) const
483 if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST)
485 return const_cast <_Control*>(__pFirstPaneParent);
488 return const_cast <_Control*>(__pSecondPaneParent);
492 _SplitPanel::SetDividerStyle(SplitPanelDividerStyle splitPanelDividerStyle)
494 __pSplitPanelPresenter->SetDividerStyle(splitPanelDividerStyle);
499 SplitPanelDividerStyle
500 _SplitPanel::GetDividerStyle(void) const
502 return __pSplitPanelPresenter->GetDividerStyle();
506 _SplitPanel::SetDividerPosition(float position)
508 const float width = GetBoundsF().width;
509 const float height = GetBoundsF().height;
512 _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
514 if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE)
516 GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, configValue);
520 GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, configValue);
523 margin = _CoordinateSystemUtils::ConvertToFloat(configValue);
525 if ((0.0f > position) ||
526 ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) && ((width - margin) < position)) ||
527 ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_HORIZONTAL) && ((height - margin) < position)))
529 return E_OUT_OF_RANGE;
532 if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE)
534 if ((GetMinimumDividerPosition() > position) || (GetMaximumDividerPosition() < position))
536 return E_OUT_OF_RANGE;
540 if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
542 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
544 __dividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_LANDSCAPE] = position;
548 __dividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_LANDSCAPE] = position;
553 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
555 __dividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_PORTRAIT] = position;
559 __dividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_PORTRAIT] = position;
563 __pSplitPanelPresenter->RecalcSplitPanel();
569 _SplitPanel::GetDividerPosition(void) const
571 _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
573 if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
575 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
577 return __dividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_LANDSCAPE];
581 return __dividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_LANDSCAPE];
586 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
588 return __dividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_PORTRAIT];
592 return __dividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_PORTRAIT];
598 _SplitPanel::SetMaximumDividerPosition(float position)
600 if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_FIXED)
602 SysLog(NID_UI_CTRL, "[E_SYSTEM] System error occurred. This functionality is not supported for divider style fixed.");
606 const float width = GetBoundsF().width;
607 const float height = GetBoundsF().height;
610 _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
612 if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE)
614 GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, configValue);
618 GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, configValue);
621 margin = _CoordinateSystemUtils::ConvertToFloat(configValue);
623 if ((0.0f > position) ||
624 ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) && ((width - margin) < position)) ||
625 ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_HORIZONTAL) && ((height - margin) < position)) ||
626 (position < GetMinimumDividerPosition()))
628 return E_OUT_OF_RANGE;
631 if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
633 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
635 __maximumDividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_LANDSCAPE] = position;
639 __maximumDividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_LANDSCAPE] = position;
644 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
646 __maximumDividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_PORTRAIT] = position;
650 __maximumDividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_PORTRAIT] = position;
654 if (GetDividerPosition() > position)
656 SetDividerPosition(position);
663 _SplitPanel::GetMaximumDividerPosition(void) const
665 if (GetDividerStyle() != SPLIT_PANEL_DIVIDER_STYLE_FIXED)
667 _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
669 if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
671 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
673 return __maximumDividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_LANDSCAPE];
677 return __maximumDividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_LANDSCAPE];
682 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
684 return __maximumDividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_PORTRAIT];
688 return __maximumDividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_PORTRAIT];
694 return GetBounds().width;
698 _SplitPanel::SetMinimumDividerPosition(float position)
700 if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_FIXED)
702 SysLog(NID_UI_CTRL, "[E_SYSTEM] System error occurred. This functionality is not supported for divider style fixed");
706 const float width = GetBoundsF().width;
707 const float height = GetBoundsF().height;
710 _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
712 if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE)
714 GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, configValue);
718 GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, configValue);
721 margin = _CoordinateSystemUtils::ConvertToFloat(configValue);
723 if ((0.0f > position) ||
724 ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) && ((width - margin) < position)) ||
725 ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_HORIZONTAL) && ((height - margin) < position)) ||
726 (position > GetMaximumDividerPosition()))
728 return E_OUT_OF_RANGE;
731 if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
733 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
735 __minimumDividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_LANDSCAPE] = position;
739 __minimumDividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_LANDSCAPE] = position;
744 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
746 __minimumDividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_PORTRAIT] = position;
750 __minimumDividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_PORTRAIT] = position;
754 if (GetDividerPosition() < position)
756 SetDividerPosition(position);
763 _SplitPanel::GetMinimumDividerPosition(void) const
765 if (GetDividerStyle() != SPLIT_PANEL_DIVIDER_STYLE_FIXED)
767 _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
769 if (orientation == _CONTROL_ORIENTATION_LANDSCAPE)
771 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
773 return __minimumDividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_LANDSCAPE];
777 return __minimumDividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_LANDSCAPE];
782 if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
784 return __minimumDividerPosition[_SPLIT_PANEL_VERTICAL_DIVIDER_ORIENTATION_PORTRAIT];
788 return __minimumDividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_PORTRAIT];
798 _SplitPanel::SetDividerDirection(SplitPanelDividerDirection dividerDirection)
800 __splitPanelDividerDirection = dividerDirection;
805 SplitPanelDividerDirection
806 _SplitPanel::GetDividerDirection(void) const
808 SetLastResult(E_SUCCESS);
810 return __splitPanelDividerDirection;
814 _SplitPanel::MaximizePane(SplitPanelPaneOrder paneOrder)
816 return __pSplitPanelPresenter->MaximizePane(paneOrder);
820 _SplitPanel::IsPaneMaximized(SplitPanelPaneOrder paneOrder) const
822 return __pSplitPanelPresenter->IsPaneMaximized(paneOrder);
826 _SplitPanel::RestorePane(void)
828 return __pSplitPanelPresenter->RestorePane();
832 _SplitPanel::SendSplitPanelEvent(_SplitPanelEventStatus status)
834 result r = E_SUCCESS;
835 IEventArg* pEventArg = null;
837 if (__pSplitPanelEvent)
839 pEventArg = _SplitPanelEvent::CreateSplitPanelEventArgN(status);
841 SysTryReturn(NID_UI_CTRL, pEventArg, r, r, "[%s] Propagating.", GetErrorMessage(r));
843 __pSplitPanelEvent->Fire(*pEventArg);
850 _SplitPanel::SetTapCount(int count)
852 __dividerTapCount = count;
858 _SplitPanel::GetTapCount(void) const
860 return __dividerTapCount;
864 _SplitPanel::GetDividerVisualElement(void)
866 return __pDividerVisualElement;
870 _SplitPanel::SetDividerVisualElementBounds(Tizen::Graphics::FloatRectangle& bounds)
872 if (__pDividerVisualElement)
874 __pDividerVisualElement->SetBounds(bounds);
880 }}} // Tizen::Ui::Controls