From 6a7f00d482e2dc65ff12d1661ceff837a0cbf9f7 Mon Sep 17 00:00:00 2001 From: "sr.shashank" Date: Wed, 20 Mar 2013 17:36:20 +0530 Subject: [PATCH] Addition of Seperate Panes with VisualElement animations for SplitPanel. Change-Id: Id6f9772fcc9728359cc3f9806564d0ffd36e425d Signed-off-by: sr.shashank --- src/ui/controls/FUiCtrl_SplitPanel.cpp | 202 +++++-- src/ui/controls/FUiCtrl_SplitPanelPresenter.cpp | 746 ++++++++++++++---------- src/ui/inc/FUiCtrl_SplitPanel.h | 6 +- src/ui/inc/FUiCtrl_SplitPanelPresenter.h | 8 +- 4 files changed, 590 insertions(+), 372 deletions(-) diff --git a/src/ui/controls/FUiCtrl_SplitPanel.cpp b/src/ui/controls/FUiCtrl_SplitPanel.cpp index 4de73f1..573b1e1 100644 --- a/src/ui/controls/FUiCtrl_SplitPanel.cpp +++ b/src/ui/controls/FUiCtrl_SplitPanel.cpp @@ -45,6 +45,8 @@ namespace Tizen { namespace Ui { namespace Controls _SplitPanel::_SplitPanel() : __pSplitPanelPresenter(null) , __pTapGesture(null) + , __pFirstPaneParent(null) + , __pSecondPaneParent(null) , __pFirstPane(null) , __pSecondPane(null) , __splitPanelDividerDirection(SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) @@ -70,7 +72,7 @@ _SplitPanel::CreateSplitPanelN(const FloatRectangle& rect, SplitPanelDividerStyl _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT; pSplitPanel = new (std::nothrow) _SplitPanel; - SysTryReturn(NID_UI_CTRL, pSplitPanel, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); + SysTryReturn(NID_UI_CTRL, pSplitPanel, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); r = pSplitPanel->Construct(splitPanelDividerStyle, splitPanelDividerDirection); if (r != E_SUCCESS) @@ -104,7 +106,7 @@ _SplitPanel::CreateSplitPanelN(const FloatRectangle& rect, SplitPanelDividerStyl pSplitPanel->__dividerPosition[_SPLIT_PANEL_HORIZONTAL_DIVIDER_ORIENTATION_LANDSCAPE] = rect.height / 2.0f; pSplitPanel->__pTapGesture = new (std::nothrow) _TouchTapGestureDetector; - SysTryCatch(NID_UI_CTRL, pSplitPanel->__pTapGesture, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); + SysTryCatch(NID_UI_CTRL, pSplitPanel->__pTapGesture, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); pSplitPanel->AddGestureDetector(*(pSplitPanel->__pTapGesture)); r = pSplitPanel->__pTapGesture->AddGestureListener(*pSplitPanel); @@ -139,7 +141,7 @@ _SplitPanel::Construct(SplitPanelDividerStyle splitPanelDividerStyle, SplitPanel result r = E_SUCCESS; __pDividerVisualElement = new (std::nothrow) VisualElement(); - SysTryReturnResult(NID_UI_CTRL, __pDividerVisualElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); + SysTryReturnResult(NID_UI_CTRL, __pDividerVisualElement, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); r = __pDividerVisualElement->Construct(); SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct divider visual element.", GetErrorMessage(r)); @@ -151,11 +153,28 @@ _SplitPanel::Construct(SplitPanelDividerStyle splitPanelDividerStyle, SplitPanel SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to attach divider visual element.", GetErrorMessage(r)); __pSplitPanelPresenter = new (std::nothrow) _SplitPanelPresenter; - SysTryCatch(NID_UI_CTRL, __pSplitPanelPresenter != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] The memory is insufficient."); + SysTryCatch(NID_UI_CTRL, __pSplitPanelPresenter != null, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); r = __pSplitPanelPresenter->Construct(*this, splitPanelDividerStyle, splitPanelDividerDirection); SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to construct presenter.", GetErrorMessage(r)); + __pFirstPaneParent = _Control::CreateControlN(); + r = GetLastResult(); + SysTryCatch(NID_UI_CTRL, __pFirstPaneParent != null, , r, "[%s] Propagating.", GetErrorMessage(r)); + + __pSecondPaneParent = _Control::CreateControlN(); + r = GetLastResult(); + SysTryCatch(NID_UI_CTRL, __pSecondPaneParent != null, , r, "[%s] Propagating.", GetErrorMessage(r)); + + __pFirstPaneParent->SetBackgroundColor(Color(0,0,0,0)); + __pSecondPaneParent->SetBackgroundColor(Color(0,0,0,0)); + + r = AttachChild(*__pFirstPaneParent); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); + + r = AttachChild(*__pSecondPaneParent); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r)); + return r; CATCH: @@ -165,8 +184,37 @@ CATCH: __pDividerVisualElement = null; } - delete __pSplitPanelPresenter; - __pSplitPanelPresenter = null; + if (__pSplitPanelPresenter) + { + delete __pSplitPanelPresenter; + __pSplitPanelPresenter = null; + } + + if (__pFirstPaneParent) + { + if (__pFirstPane) + { + __pFirstPaneParent->DetachChild(*__pFirstPane); + } + + DetachChild(*__pFirstPaneParent); + + delete __pFirstPaneParent; + __pFirstPaneParent = null; + } + + if (__pSecondPaneParent) + { + if (__pSecondPane) + { + __pSecondPaneParent->DetachChild(*__pSecondPane); + } + + DetachChild(*__pSecondPaneParent); + + delete __pSecondPaneParent; + __pSecondPaneParent = null; + } return r; } @@ -202,10 +250,28 @@ _SplitPanel::~_SplitPanel(void) if (__pDividerVisualElement) { + GetVisualElement()->DetachChild(*__pDividerVisualElement); + __pDividerVisualElement->Destroy(); __pDividerVisualElement = null; } + if (__pFirstPaneParent) + { + DetachChild(*__pFirstPaneParent); + + delete __pFirstPaneParent; + __pFirstPaneParent = null; + } + + if (__pSecondPaneParent) + { + DetachChild(*__pSecondPaneParent); + + delete __pSecondPaneParent; + __pSecondPaneParent = null; + } + ClearLastResult(); } @@ -225,7 +291,7 @@ _SplitPanel::AddSplitPanelEventListener(const _ISplitPanelEventListener& listene { __pSplitPanelEvent = _SplitPanelEvent::CreateInstanceN(*this); r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, __pSplitPanelEvent, r, r, "[%s] Propagating.", GetErrorMessage(r)) + SysTryReturn(NID_UI_CTRL, __pSplitPanelEvent, r, r, "[%s] Propagating.", GetErrorMessage(r)); __pSplitPanelEvent->AddListener(listener); } @@ -237,7 +303,7 @@ result _SplitPanel::RemoveSplitPanelEventListener(const _ISplitPanelEventListener& listener) { SysTryReturn(NID_UI_CTRL, __pSplitPanelEvent, E_SYSTEM, E_SYSTEM, - "[E_SYSTEM] System error occurred.") + "[E_SYSTEM] System error occurred."); __pSplitPanelEvent->RemoveListener(listener); @@ -341,14 +407,14 @@ _SplitPanel::SetPane(_Control* pControl, SplitPanelPaneOrder paneOrder) if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST) { - r = AttachChild(*pControl); + r = __pFirstPaneParent->AttachChild(*pControl); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); __pFirstPane = pControl; } else { - r = AttachChild(*pControl); + r = __pSecondPaneParent->AttachChild(*pControl); SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r)); __pSecondPane = pControl; @@ -360,25 +426,28 @@ _SplitPanel::SetPane(_Control* pControl, SplitPanelPaneOrder paneOrder) _Control* _SplitPanel::GetPane(SplitPanelPaneOrder paneOrder) const { - SysTryReturn(NID_UI_CTRL, __pSplitPanelPresenter != null, null, E_SYSTEM, - "[E_SYSTEM] System error occurred."); - if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST) { return const_cast <_Control*>(__pFirstPane); } - else + + return const_cast <_Control*>(__pSecondPane); +} + +_Control* +_SplitPanel::GetPaneParent(SplitPanelPaneOrder paneOrder) const +{ + if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST) { - return const_cast <_Control*>(__pSecondPane); + return const_cast <_Control*>(__pFirstPaneParent); } + + return const_cast <_Control*>(__pSecondPaneParent); } result _SplitPanel::SetDividerStyle(SplitPanelDividerStyle splitPanelDividerStyle) { - SysTryReturn(NID_UI_CTRL, __pSplitPanelPresenter != null, E_SYSTEM, E_SYSTEM, - "[E_SYSTEM] System error occurred."); - __pSplitPanelPresenter->SetDividerStyle(splitPanelDividerStyle); return E_SUCCESS; @@ -394,8 +463,25 @@ result _SplitPanel::SetDividerPosition(float position) { const float width = GetBoundsF().width; + const float height = GetBoundsF().height; + int configValue = 0; + float margin = 0.0f; + _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation(); + + if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE) + { + GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, configValue); + } + else + { + GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, configValue); + } - if ((0.0f > position) || (width < position)) + margin = _CoordinateSystemUtils::ConvertToFloat(configValue); + + if ((0.0f > position) || + ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) && ((width - margin) < position)) || + ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_HORIZONTAL) && ((height - margin) < position))) { return E_OUT_OF_RANGE; } @@ -408,8 +494,6 @@ _SplitPanel::SetDividerPosition(float position) } } - _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation(); - if (orientation == _CONTROL_ORIENTATION_LANDSCAPE) { if (GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) @@ -472,24 +556,31 @@ _SplitPanel::SetMaximumDividerPosition(float position) { if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_FIXED) { - SysLog(NID_UI_CTRL, "[E_SYSTEM] System error occurred. This functionality is not supported for divider style fixed"); + SysLog(NID_UI_CTRL, "[E_SYSTEM] System error occurred. This functionality is not supported for divider style fixed."); return E_SUCCESS; } - _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation(); - const float width = GetBoundsF().width; + const float height = GetBoundsF().height; + int configValue = 0; float margin = 0.0f; + _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation(); + if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE) { - GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, margin); + GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, configValue); } else { - GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, margin); + GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, configValue); } - if ((0.0f > position) || ((width - margin) < position) || (position < GetMinimumDividerPosition())) + margin = _CoordinateSystemUtils::ConvertToFloat(configValue); + + if ((0.0f > position) || + ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) && ((width - margin) < position)) || + ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_HORIZONTAL) && ((height - margin) < position)) || + (position < GetMinimumDividerPosition())) { return E_OUT_OF_RANGE; } @@ -570,13 +661,29 @@ _SplitPanel::SetMinimumDividerPosition(float position) } const float width = GetBoundsF().width; + const float height = GetBoundsF().height; + int configValue = 0; + float margin = 0.0f; + _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation(); - if ((0.0f > position) || (width < position) || (position > GetMaximumDividerPosition())) + if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE) { - return E_OUT_OF_RANGE; + GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, configValue); + } + else + { + GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, configValue); } - _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation(); + margin = _CoordinateSystemUtils::ConvertToFloat(configValue); + + if ((0.0f > position) || + ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) && ((width - margin) < position)) || + ((GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_HORIZONTAL) && ((height - margin) < position)) || + (position > GetMaximumDividerPosition())) + { + return E_OUT_OF_RANGE; + } if (orientation == _CONTROL_ORIENTATION_LANDSCAPE) { @@ -663,42 +770,30 @@ _SplitPanel::GetDividerDirection(void) const result _SplitPanel::MaximizePane(SplitPanelPaneOrder paneOrder) { - SysTryReturn(NID_UI_CTRL, __pSplitPanelPresenter != null, E_SYSTEM, E_SYSTEM, - "[E_SYSTEM] System error occurred."); - - __pSplitPanelPresenter->MaximizePane(paneOrder); - - return E_SUCCESS; + return __pSplitPanelPresenter->MaximizePane(paneOrder); } bool _SplitPanel::IsPaneMaximized(SplitPanelPaneOrder paneOrder) const { - SysTryReturn(NID_UI_CTRL, __pSplitPanelPresenter != null, false, E_SYSTEM, - "[E_SYSTEM] System error occurred."); - return __pSplitPanelPresenter->IsPaneMaximized(paneOrder); } result _SplitPanel::RestorePane(void) { - SysTryReturn(NID_UI_CTRL, __pSplitPanelPresenter != null, E_SYSTEM, E_SYSTEM, - "[E_SYSTEM] System error occurred."); - - __pSplitPanelPresenter->RestorePane(); - - return E_SUCCESS; + return __pSplitPanelPresenter->RestorePane(); } result _SplitPanel::SendSplitPanelEvent(_SplitPanelEventStatus status) { result r = E_SUCCESS; + IEventArg* pEventArg = null; if (__pSplitPanelEvent) { - IEventArg* pEventArg = _SplitPanelEvent::CreateSplitPanelEventArgN(status); + pEventArg = _SplitPanelEvent::CreateSplitPanelEventArgN(status); r = GetLastResult(); SysTryReturn(NID_UI_CTRL, pEventArg, r, r, "[%s] Propagating.", GetErrorMessage(r)); @@ -725,19 +820,22 @@ _SplitPanel::GetTapCount(void) const result _SplitPanel::OnAttachedToMainTree(void) { + String hintText = L""; + FloatRectangle dividerRect(0.0f, 0.0f, 0.0f, 0.0f); + _AccessibilityContainer* pContainer = null; + if (likely(!(_AccessibilityManager::IsActivated()))) { return E_SUCCESS; } - _AccessibilityContainer* pContainer = GetAccessibilityContainer(); + pContainer = GetAccessibilityContainer(); if (pContainer) { if (__pDividerVisualElement) { - FloatRectangle dividerRect = __pSplitPanelPresenter->GetDividerRectangle(); - String hintText = L""; + dividerRect = __pSplitPanelPresenter->GetDividerRectangle(); if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_FIXED) { @@ -748,7 +846,7 @@ _SplitPanel::OnAttachedToMainTree(void) hintText = String(L"Drag scroll, double tap and move to adjust split area"); } - __pAccessibilityElement = new _AccessibilityElement(true); + __pAccessibilityElement = new (std::nothrow) _AccessibilityElement(true); SysTryReturn(NID_UI_CTRL, __pAccessibilityElement, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); __pAccessibilityElement->SetBounds(_CoordinateSystemUtils::ConvertToInteger(dividerRect)); @@ -790,7 +888,7 @@ _SplitPanel::SetDividerVisualElementBounds(FloatRectangle& bounds) bool _SplitPanel::OnAccessibilityValueIncreased(const _AccessibilityContainer& control, const _AccessibilityElement& element) { - SetDividerPosition(GetDividerPosition() + 5); + SetDividerPosition(GetDividerPosition() + ACCESSIBILITY_DIVIDER_POSITION_OFFSET); Invalidate(); return true; @@ -800,7 +898,7 @@ bool _SplitPanel::OnAccessibilityValueDecreased(const _AccessibilityContainer& control, const _AccessibilityElement& element) { - SetDividerPosition(GetDividerPosition() - 5); + SetDividerPosition(GetDividerPosition() - ACCESSIBILITY_DIVIDER_POSITION_OFFSET); Invalidate(); return true; diff --git a/src/ui/controls/FUiCtrl_SplitPanelPresenter.cpp b/src/ui/controls/FUiCtrl_SplitPanelPresenter.cpp index 7957001..397e014 100644 --- a/src/ui/controls/FUiCtrl_SplitPanelPresenter.cpp +++ b/src/ui/controls/FUiCtrl_SplitPanelPresenter.cpp @@ -37,6 +37,7 @@ using namespace Tizen::Ui; using namespace Tizen::Graphics; using namespace Tizen::Ui::Animations; +using namespace Tizen::Base; namespace Tizen { namespace Ui { namespace Controls { @@ -56,8 +57,8 @@ _SplitPanelPresenter::_SplitPanelPresenter(void) , __pDividerThumbBitmap(null) , __transactionIdMaximize(0) , __transactionIdRestore(0) - , __controlAnimatorAnimationInterpolator(ANIMATION_INTERPOLATOR_LINEAR) - , __visualElementAnimationInterpolator(L"Linear") + , __controlAnimatorInterpolator(ANIMATION_INTERPOLATOR_LINEAR) + , __visualElementInterpolator(L"Linear") { GET_COLOR_CONFIG(SPLITPANEL::DIVIDER_BG_NORMAL, __dividerBackgroundColor); GET_COLOR_CONFIG(SPLITPANEL::DIVIDER_BG_PRESSED, __dividerPressedBackgroundColor); @@ -106,8 +107,8 @@ _SplitPanelPresenter::Construct(const _SplitPanel& splitPanel, SplitPanelDivider AdjustDividerRectangle(); - __controlAnimatorAnimationInterpolator = ANIMATION_INTERPOLATOR_EASE_IN; - __visualElementAnimationInterpolator = L"EaseIn"; + __controlAnimatorInterpolator = ANIMATION_INTERPOLATOR_EASE_IN; + __visualElementInterpolator = L"EaseIn"; return E_SUCCESS; @@ -125,10 +126,10 @@ _SplitPanelPresenter::CheckDividerTouchRegion(float positionX, float positionY) Bitmap* pThumbBitmap = null; dividerPosition = __pSplitPanel->GetDividerPosition(); + pThumbBitmap = __pDividerThumbBitmap; if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) { - pThumbBitmap = __pDividerThumbBitmap; if ((positionX >= dividerPosition) && (positionX <= dividerPosition + pThumbBitmap->GetWidthF())) { @@ -137,7 +138,6 @@ _SplitPanelPresenter::CheckDividerTouchRegion(float positionX, float positionY) } else { - pThumbBitmap = __pDividerThumbBitmap; if ((positionY >= dividerPosition) && (positionY <= dividerPosition + pThumbBitmap->GetHeightF())) { @@ -195,6 +195,7 @@ _SplitPanelPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& tou } point = touchinfo.GetCurrentPosition(); + pThumbBitmap = __pDividerThumbBitmap; if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) { @@ -205,8 +206,6 @@ _SplitPanelPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& tou return false; } - pThumbBitmap = __pDividerThumbBitmap; - if (point.x <= __pSplitPanel->GetBoundsF().width - pThumbBitmap->GetWidthF()) { __pSplitPanel->SetDividerPosition(point.x); @@ -221,8 +220,6 @@ _SplitPanelPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& tou return false; } - pThumbBitmap = __pDividerThumbBitmap; - if (point.y <= __pSplitPanel->GetBoundsF().height - pThumbBitmap->GetHeightF()) { __pSplitPanel->SetDividerPosition(point.y); @@ -242,6 +239,7 @@ _SplitPanelPresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& if (__splitPanelDividerPressed == true) { __splitPanelDividerPressed = false; + Draw(); } @@ -296,7 +294,7 @@ _SplitPanelPresenter::MaximizePane(SplitPanelPaneOrder paneOrder) { return E_SUCCESS; } - else if (GetAnimationStatus() == ANIMATOR_STATUS_PLAYING) + else if (GetTransactionStatus() == ANIMATION_TRANSACTION_STATUS_PLAYING) { AnimationTransaction::Stop(__transactionIdMaximize); AnimationTransaction::Stop(__transactionIdRestore); @@ -304,8 +302,6 @@ _SplitPanelPresenter::MaximizePane(SplitPanelPaneOrder paneOrder) RecalcSplitPanel(); - ChangePaneOrder(paneOrder); - AnimationTransaction::Begin(__transactionIdMaximize); if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) @@ -315,6 +311,9 @@ _SplitPanelPresenter::MaximizePane(SplitPanelPaneOrder paneOrder) r = AnimateDivider(_SPLIT_PANEL_ANIMATION_RIGHT); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_RIGHT); + SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePane(_SPLIT_PANEL_ANIMATION_RIGHT); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); } @@ -323,6 +322,9 @@ _SplitPanelPresenter::MaximizePane(SplitPanelPaneOrder paneOrder) r = AnimateDivider(_SPLIT_PANEL_ANIMATION_LEFT); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_LEFT); + SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePane(_SPLIT_PANEL_ANIMATION_LEFT); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); } @@ -334,6 +336,9 @@ _SplitPanelPresenter::MaximizePane(SplitPanelPaneOrder paneOrder) r = AnimateDivider(_SPLIT_PANEL_ANIMATION_BOTTOM); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_BOTTOM); + SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePane(_SPLIT_PANEL_ANIMATION_BOTTOM); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); } @@ -342,6 +347,9 @@ _SplitPanelPresenter::MaximizePane(SplitPanelPaneOrder paneOrder) r = AnimateDivider(_SPLIT_PANEL_ANIMATION_TOP); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_TOP); + SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePane(_SPLIT_PANEL_ANIMATION_TOP); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); } @@ -381,7 +389,7 @@ _SplitPanelPresenter::RestorePane(void) { return E_SUCCESS; } - else if (GetAnimationStatus() == ANIMATOR_STATUS_PLAYING) + else if (GetTransactionStatus() == ANIMATION_TRANSACTION_STATUS_PLAYING) { AnimationTransaction::Stop(__transactionIdMaximize); AnimationTransaction::Stop(__transactionIdRestore); @@ -396,6 +404,9 @@ _SplitPanelPresenter::RestorePane(void) r = AnimateDivider(_SPLIT_PANEL_ANIMATION_RESTORE_VERTICAL); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_RESTORE_VERTICAL); + SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePane(_SPLIT_PANEL_ANIMATION_RESTORE_VERTICAL); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); } @@ -404,6 +415,9 @@ _SplitPanelPresenter::RestorePane(void) r = AnimateDivider(_SPLIT_PANEL_ANIMATION_RESTORE_HORIZONTAL); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_RESTORE_HORIZONTAL); + SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); + r = AnimatePane(_SPLIT_PANEL_ANIMATION_RESTORE_HORIZONTAL); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r)); } @@ -423,55 +437,59 @@ CATCH: result _SplitPanelPresenter::Draw(void) { - if (__pSplitPanelModel->GetPaneMaximumState() == false && GetAnimationStatus() == ANIMATOR_STATUS_STOPPED) + if (__pSplitPanelModel->GetPaneMaximumState() == false && GetTransactionStatus() == ANIMATION_TRANSACTION_STATUS_STOPPED) { FloatRectangle dividerBounds(0.0f, 0.0f, 0.0f, 0.0f); FloatRectangle dividerThumbBounds(0.0f, 0.0f, 0.0f, 0.0f); + Canvas* pCanvas = null; //adjust divider rectangle AdjustDividerRectangle(); - Canvas* pCanvas = __pSplitPanel->GetDividerVisualElement()->GetCanvasN(); + pCanvas = __pSplitPanel->GetDividerVisualElement()->GetCanvasN(); SysTryReturnResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "Propagating."); - pCanvas->Clear(); - - //resize pane - SetPaneBounds(); - - dividerBounds = __dividerRectangle; - dividerBounds.x = 0.0f; - dividerBounds.y = 0.0f; - - if (__splitPanelDividerPressed == true) + if (pCanvas) { - pCanvas->DrawNinePatchedBitmap(dividerBounds, *__pDividerPressedBackgroundBitmap); - } - else - { - pCanvas->DrawNinePatchedBitmap(dividerBounds, *__pDividerBackgroundBitmap); - } + pCanvas->Clear(); - //draw divider - pCanvas->DrawNinePatchedBitmap(dividerBounds, *__pDividerBackgroundEffectBitmap); + //resize pane + SetPaneBounds(); - //draw divider thumb - if (__pSplitPanelModel->GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE) - { - dividerThumbBounds = __dividerThumbRectangle; - if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) + dividerBounds = __dividerRectangle; + dividerBounds.x = 0.0f; + dividerBounds.y = 0.0f; + + if (__splitPanelDividerPressed == true) { - dividerThumbBounds.x = 0.0f; + pCanvas->DrawNinePatchedBitmap(dividerBounds, *__pDividerPressedBackgroundBitmap); } else { - dividerThumbBounds.y = 0.0f; + pCanvas->DrawNinePatchedBitmap(dividerBounds, *__pDividerBackgroundBitmap); } - pCanvas->DrawBitmap(dividerThumbBounds, *__pDividerThumbBitmap); - } + //draw divider + pCanvas->DrawNinePatchedBitmap(dividerBounds, *__pDividerBackgroundEffectBitmap); + + //draw divider thumb + if (__pSplitPanelModel->GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE) + { + dividerThumbBounds = __dividerThumbRectangle; + if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) + { + dividerThumbBounds.x = 0.0f; + } + else + { + dividerThumbBounds.y = 0.0f; + } + + pCanvas->DrawBitmap(dividerThumbBounds, *__pDividerThumbBitmap); + } - delete pCanvas; + delete pCanvas; + } } return E_SUCCESS; @@ -491,6 +509,7 @@ _SplitPanelPresenter::LoadBitmap(SplitPanelDividerDirection splitPanelDividerDir { r = GET_BITMAP_CONFIG_N(SPLITPANEL::VERTICAL_DIVIDER_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pDividerBackgroundEffectBitmap); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Failed to load bitmap.", GetErrorMessage(r)); + r = GET_BITMAP_CONFIG_N(SPLITPANEL::VERTICAL_DIVIDER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDividerThumbBitmap); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Failed to load bitmap.", GetErrorMessage(r)); } @@ -498,17 +517,16 @@ _SplitPanelPresenter::LoadBitmap(SplitPanelDividerDirection splitPanelDividerDir { r = GET_BITMAP_CONFIG_N(SPLITPANEL::HORIZONTAL_DIVIDER_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pDividerBackgroundEffectBitmap); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Failed to load bitmap.", GetErrorMessage(r)); + r = GET_BITMAP_CONFIG_N(SPLITPANEL::HORIZONTAL_DIVIDER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDividerThumbBitmap); SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Failed to load bitmap.", GetErrorMessage(r)); } __pDividerPressedBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pDividerBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), __dividerPressedBackgroundColor); - r = GetLastResult(); - SysTryCatch(NID_UI_CTRL, (__pDividerPressedBackgroundBitmap != null), , r, "[%s] Failed to get replacement color bitmap.", GetErrorMessage(r)); + SysTryCatch(NID_UI_CTRL, (__pDividerPressedBackgroundBitmap != null), , r, "[%s] Failed to get replacement color bitmap.", GetErrorMessage(GetLastResult())); __pDividerBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pDividerBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), __dividerBackgroundColor); - r = GetLastResult(); - SysTryCatch(NID_UI_CTRL, (__pDividerBackgroundBitmap != null), , r, "[%s] Failed to get replacement color bitmap.", GetErrorMessage(r)); + SysTryCatch(NID_UI_CTRL, (__pDividerBackgroundBitmap != null), , r, "[%s] Failed to get replacement color bitmap.", GetErrorMessage(GetLastResult())); delete pDividerBackgroundBitmap; @@ -548,6 +566,7 @@ void _SplitPanelPresenter::OnBoundsChanged(void) { RecalcSplitPanel(); + return; } @@ -569,13 +588,17 @@ _SplitPanelPresenter::SetPaneBounds(void) FloatPoint panePostion(0.0f, 0.0f); _Control* pFirstPane = null; _Control* pSecondPane = null; + _Control* pFirstPaneParent = null; + _Control* pSecondPaneParent = null; clientBounds = __pSplitPanel->GetBoundsF(); pFirstPane = __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_FIRST); - pSecondPane = __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_SECOND); + pFirstPaneParent = __pSplitPanel->GetPaneParent(SPLIT_PANEL_PANE_ORDER_FIRST); + pSecondPaneParent = __pSplitPanel->GetPaneParent(SPLIT_PANEL_PANE_ORDER_SECOND); + clientBounds.x = clientBounds.y = 0.0f; if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_FIRST)) @@ -618,34 +641,40 @@ _SplitPanelPresenter::SetPaneBounds(void) } } + if (pFirstPaneParent != null) + { + r = pFirstPaneParent->SetBounds(firstPaneBounds); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + } + + if (pSecondPaneParent != null) + { + r = pSecondPaneParent->SetBounds(secondPaneBounds); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + } + //set Pane bounds if (pFirstPane != null) { - r = pFirstPane->SetBounds(firstPaneBounds); - - if (r != E_SUCCESS) + if (pFirstPane->IsResizable()) { - panePostion.x = firstPaneBounds.x; - panePostion.y = firstPaneBounds.y; - - r = pFirstPane->SetPosition(panePostion); + r = pFirstPane->SetBounds(firstPaneBounds); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); } - + + r = pFirstPane->SetPosition(Point(0.0f, 0.0f)); SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); } if (pSecondPane != null) { - r = pSecondPane->SetBounds(secondPaneBounds); - - if (r != E_SUCCESS) + if (pSecondPane->IsResizable()) { - panePostion.x = secondPaneBounds.x; - panePostion.y = secondPaneBounds.y; - - r = pSecondPane->SetPosition(panePostion); + r = pSecondPane->SetBounds(secondPaneBounds); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); } - + + r = pSecondPane->SetPosition(Point(0.0f, 0.0f)); SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); } @@ -656,6 +685,9 @@ _SplitPanelPresenter::SetPaneBounds(void) __setFirstDividerPositionChangeEvent = false; __pSplitPanel->SendSplitPanelEvent(_SPLIT_PANEL_EVENT_DIVIDER_POSITION_CHANGE); } + + pFirstPane->Invalidate(true); + pSecondPane->Invalidate(true); } return r; @@ -676,22 +708,24 @@ _SplitPanelPresenter::AdjustDividerRectangle(void) dividerPosition = __pSplitPanel->GetDividerPosition(); clientBounds = __pSplitPanel->GetBoundsF(); - if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) - { - pThumbBitmap = __pDividerThumbBitmap; + pThumbBitmap = __pDividerThumbBitmap; - if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE) - { - GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, width); - } - else - { - GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, width); - } + if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE) + { + GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, width); + GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, height); + } + else + { + GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, width); + GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, height); + } + if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) + { height = clientBounds.height; - if (height > 0) + if (height > 0.0f) { __dividerRectangle = FloatRectangle(dividerPosition, 0.0f, width, height); __dividerThumbRectangle = FloatRectangle(dividerPosition, ((height - pThumbBitmap->GetHeightF()) / 2.0f), pThumbBitmap->GetWidthF(), pThumbBitmap->GetHeightF()); @@ -699,17 +733,6 @@ _SplitPanelPresenter::AdjustDividerRectangle(void) } else { - pThumbBitmap = __pDividerThumbBitmap; - - if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE) - { - GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, height); - } - else - { - GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, height); - } - width = clientBounds.width; if (width > 0.0f) @@ -722,84 +745,34 @@ _SplitPanelPresenter::AdjustDividerRectangle(void) __pSplitPanel->SetDividerVisualElementBounds(__dividerRectangle); } -void -_SplitPanelPresenter::ChangePaneOrder(SplitPanelPaneOrder paneOrder) -{ - result r = E_SUCCESS; - _Control* pFirstPane = null; - _Control* pSecondPane = null; - - if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST) - { - pFirstPane = __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_FIRST); - SysTryReturnVoidResult(NID_UI_CTRL, pFirstPane != null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r)); - - r = __pSplitPanel->DetachChild(*pFirstPane); - SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); - - r = __pSplitPanel->AttachChild(*pFirstPane); - SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); - } - else - { - pSecondPane = __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_SECOND); - SysTryReturnVoidResult(NID_UI_CTRL, pSecondPane != null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(r)); - - r = __pSplitPanel->DetachChild(*pSecondPane); - SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); - - r = __pSplitPanel->AttachChild(*pSecondPane); - SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); - } - - return; -} - result _SplitPanelPresenter::AnimateDivider(int destination) { result r = E_SUCCESS; FloatRectangle dividerBoundsStart(0.0f, 0.0f, 0.0f, 0.0f); FloatRectangle dividerBoundsEnd(0.0f, 0.0f, 0.0f, 0.0f); - FloatRectangle dividerBounds(0, 0, 0, 0); - FloatRectangle clientBounds(0, 0, 0, 0); - FloatRectangle firstPaneBounds(0, 0, 0, 0); - Control* pFirstPanelControl = null; + FloatRectangle dividerBounds(0.0f, 0.0f, 0.0f, 0.0f); + FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f); + FloatRectangle firstPaneBounds(0.0f, 0.0f, 0.0f, 0.0f); + _Control* pFirstPaneParent = null; VisualElement* pVisualElementDivider = null; VisualElementPropertyAnimation* pAnimationDivider = null; - const IVisualElementAnimationTimingFunction* pTimingFunction = VisualElementAnimation::GetTimingFunctionByName(__visualElementAnimationInterpolator); - r = GetLastResult(); - SysTryReturnResult(NID_UI_CTRL, pTimingFunction != null, r, "Propagating."); - - pFirstPanelControl = GetPaneControl(SPLIT_PANEL_PANE_ORDER_FIRST); - r = GetLastResult(); - SysTryReturnResult(NID_UI_CTRL, pFirstPanelControl != null, r, "Propagating."); + pFirstPaneParent = __pSplitPanel->GetPaneParent(SPLIT_PANEL_PANE_ORDER_FIRST); + SysTryReturnResult(NID_UI_CTRL, pFirstPaneParent != null, GetLastResult(), "Propagating."); pVisualElementDivider = __pSplitPanel->GetDividerVisualElement(); - r = GetLastResult(); - SysTryReturnResult(NID_UI_CTRL, pVisualElementDivider != null, r, "Propagating."); + SysTryReturnResult(NID_UI_CTRL, pVisualElementDivider != null, GetLastResult(), "Propagating."); pVisualElementDivider->RemoveAllAnimations(); - r = GetLastResult(); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); - - pAnimationDivider = new (std::nothrow) VisualElementPropertyAnimation(); - SysTryReturnResult(NID_UI_CTRL, pAnimationDivider != null, E_OUT_OF_MEMORY, " Memory allocation failed.") - - r = pAnimationDivider->SetPropertyName(L"bounds"); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating."); - - r = pAnimationDivider->SetDuration(ANIMATION_DURATION); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating."); + SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, GetLastResult(), "Propagating."); - pAnimationDivider->SetTimingFunction(pTimingFunction); - r = GetLastResult(); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating."); + pAnimationDivider = GetVisualElementAnimation(L"bounds"); + SysTryReturnResult(NID_UI_CTRL, pAnimationDivider != null, GetLastResult(), "Propagating."); dividerBounds = pVisualElementDivider->GetBounds(); clientBounds = __pSplitPanel->GetBoundsF(); - firstPaneBounds = pFirstPanelControl->GetBoundsF(); + firstPaneBounds = pFirstPaneParent->GetBoundsF(); dividerBoundsStart = dividerBounds; clientBounds.x = clientBounds.y = 0.0f; @@ -880,51 +853,39 @@ _SplitPanelPresenter::AnimateDivider(int destination) SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating."); pVisualElementDivider->AddAnimation(L"Bounds", *pAnimationDivider); - r = GetLastResult(); - SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating."); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , GetLastResult(), "Propagating."); CATCH: delete pAnimationDivider; - return r; + return r; } result _SplitPanelPresenter::AnimatePane(int destination) { - result r = E_SUCCESS; Rectangle clientBounds(0, 0, 0, 0); Rectangle firstPaneBounds(0, 0, 0, 0); Rectangle secondPaneBounds(0, 0, 0, 0); Rectangle dividerRectangle(0, 0, 0, 0); - Control* pFirstPanelControl = null; - Control* pSecondPanelControl = null; + Control* pFirstPaneControl = null; + Control* pSecondPaneControl = null; ControlAnimator* pControlAnimatorFirstPane = null; ControlAnimator* pControlAnimatorSecondPane = null; - FloatAnimation animationHidePane = FloatAnimation(ANIMATION_ALPHA_SHOW, ANIMATION_ALPHA_HIDE, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); - FloatAnimation animationShowPane = FloatAnimation(ANIMATION_ALPHA_HIDE, ANIMATION_ALPHA_SHOW, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); + FloatAnimation hidePane(ANIMATION_ALPHA_SHOW, ANIMATION_ALPHA_HIDE, ANIMATION_DURATION, __controlAnimatorInterpolator); + FloatAnimation showPane(ANIMATION_ALPHA_HIDE, ANIMATION_ALPHA_SHOW, ANIMATION_DURATION, __controlAnimatorInterpolator); - pFirstPanelControl = GetPaneControl(SPLIT_PANEL_PANE_ORDER_FIRST); - r = GetLastResult(); - SysTryReturnResult(NID_UI_CTRL, pFirstPanelControl != null, r, "Propagating."); + pFirstPaneControl = GetPaneControl(SPLIT_PANEL_PANE_ORDER_FIRST); + pSecondPaneControl = GetPaneControl(SPLIT_PANEL_PANE_ORDER_SECOND); - pSecondPanelControl = GetPaneControl(SPLIT_PANEL_PANE_ORDER_SECOND); - r = GetLastResult(); - SysTryReturnResult(NID_UI_CTRL, pSecondPanelControl != null, r, "Propagating."); - - pControlAnimatorFirstPane = pFirstPanelControl->GetControlAnimator(); - r = GetLastResult(); - SysTryReturnResult(NID_UI_CTRL, pControlAnimatorFirstPane != null, r, "Propagating."); - - pControlAnimatorSecondPane = pSecondPanelControl->GetControlAnimator(); - r = GetLastResult(); - SysTryReturnResult(NID_UI_CTRL, pControlAnimatorSecondPane != null, r, "Propagating."); + pControlAnimatorFirstPane = pFirstPaneControl->GetControlAnimator(); + pControlAnimatorSecondPane = pSecondPaneControl->GetControlAnimator(); clientBounds = __pSplitPanel->GetBounds(); - firstPaneBounds = pFirstPanelControl->GetBounds(); - secondPaneBounds = pSecondPanelControl->GetBounds(); + firstPaneBounds = pFirstPaneControl->GetBounds(); + secondPaneBounds = pSecondPaneControl->GetBounds(); clientBounds.x = clientBounds.y = 0; @@ -935,108 +896,92 @@ _SplitPanelPresenter::AnimatePane(int destination) case _SPLIT_PANEL_ANIMATION_RIGHT: { Rectangle secondPaneEndBounds = secondPaneBounds; - secondPaneEndBounds.x = clientBounds.x + clientBounds.width + dividerRectangle.width; + secondPaneEndBounds.x = clientBounds.width + dividerRectangle.width; - RectangleAnimation animationMaximizeFirstPane = RectangleAnimation(firstPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); - RectangleAnimation animationMinimizeSecondPane = RectangleAnimation(secondPaneBounds, secondPaneEndBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); - - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationMaximizeFirstPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + RectangleAnimation maximizeFirstPane = RectangleAnimation(firstPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorInterpolator); - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationMaximizeFirstPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); - - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationMinimizeSecondPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorFirstPane && pFirstPaneControl->IsResizable()) + { + pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, maximizeFirstPane); + } - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationHidePane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == false) + { + pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane); + } - if (pFirstPanelControl->GetShowState() == false) + if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == true) { - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationShowPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, hidePane); } } break; case _SPLIT_PANEL_ANIMATION_LEFT: { Rectangle firstPaneEndBounds = firstPaneBounds; - firstPaneEndBounds.x = clientBounds.x - firstPaneBounds.width - dividerRectangle.width; - - RectangleAnimation animationMaximizeSecondPane = RectangleAnimation(secondPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); - RectangleAnimation animationMinimizeFirstPane = RectangleAnimation(firstPaneBounds, firstPaneEndBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); + firstPaneEndBounds.x = -(firstPaneBounds.width + dividerRectangle.width); - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationMaximizeSecondPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); - - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationMaximizeSecondPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + RectangleAnimation animationMaximizeSecondPane = RectangleAnimation(secondPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorInterpolator); - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationMinimizeFirstPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorSecondPane && pSecondPaneControl->IsResizable()) + { + pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationMaximizeSecondPane); + } - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationHidePane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == false) + { + pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane); + } - if (pSecondPanelControl->GetShowState() == false) + if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == true) { - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationShowPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, hidePane); } } break; case _SPLIT_PANEL_ANIMATION_TOP: { Rectangle firstPaneEndBounds = firstPaneBounds; - firstPaneEndBounds.y = clientBounds.y - firstPaneBounds.height - dividerRectangle.height; + firstPaneEndBounds.y = -(firstPaneBounds.height + dividerRectangle.height); - RectangleAnimation animationMaximizeSecondPane = RectangleAnimation(secondPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); - RectangleAnimation animationMinimizeFirstPane = RectangleAnimation(firstPaneBounds, firstPaneEndBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); + RectangleAnimation animationMaximizeSecondPane = RectangleAnimation(secondPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorInterpolator); - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationMaximizeSecondPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); - - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationMaximizeSecondPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); - - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationMinimizeFirstPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorSecondPane && pSecondPaneControl->IsResizable()) + { + pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationMaximizeSecondPane); + } - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationHidePane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == false) + { + pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane); + } - if (pSecondPanelControl->GetShowState() == false) + if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == true) { - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationShowPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, hidePane); } } break; case _SPLIT_PANEL_ANIMATION_BOTTOM: { Rectangle secondPaneEndBounds = secondPaneBounds; - secondPaneEndBounds.y = clientBounds.y + clientBounds.height + dividerRectangle.height; - - RectangleAnimation animationMaximizeFirstPane = RectangleAnimation(firstPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); - RectangleAnimation animationMinimizeSecondPane = RectangleAnimation(secondPaneBounds, secondPaneEndBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); + secondPaneEndBounds.y = clientBounds.height + dividerRectangle.height; - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationMaximizeFirstPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); - - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationMaximizeFirstPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + RectangleAnimation maximizeFirstPane = RectangleAnimation(firstPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorInterpolator); - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationMinimizeSecondPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorFirstPane && pFirstPaneControl->IsResizable()) + { + pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, maximizeFirstPane); + } - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationHidePane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == false) + { + pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane); + } - if (pFirstPanelControl->GetShowState() == false) + if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == true) { - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationShowPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, hidePane); } } break; @@ -1045,32 +990,34 @@ _SplitPanelPresenter::AnimatePane(int destination) Rectangle firstPaneEndBounds = _CoordinateSystemUtils::ConvertToInteger(GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST)); Rectangle secondPaneEndBounds = _CoordinateSystemUtils::ConvertToInteger(GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND)); - RectangleAnimation animationRestoreFirstPane = RectangleAnimation(firstPaneBounds, firstPaneEndBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); - RectangleAnimation animationRestoreSecondPane = RectangleAnimation(secondPaneBounds, secondPaneEndBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); + secondPaneEndBounds.x = secondPaneEndBounds.y = 0; - // Restore Pane 1 - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreFirstPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); - - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationRestoreFirstPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + RectangleAnimation animationRestoreFirstPane = RectangleAnimation(firstPaneBounds, firstPaneEndBounds, ANIMATION_DURATION, __controlAnimatorInterpolator); + RectangleAnimation animationRestoreSecondPane = RectangleAnimation(secondPaneBounds, secondPaneEndBounds, ANIMATION_DURATION, __controlAnimatorInterpolator); - // Restore Pane 2 - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreSecondPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorFirstPane && pFirstPaneControl->IsResizable()) + { + pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreFirstPane); + } - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationRestoreSecondPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorSecondPane && pSecondPaneControl->IsResizable()) + { + pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreSecondPane); + } if (__pSplitPanelModel->GetMaximizedPaneOrder() == SPLIT_PANEL_PANE_ORDER_FIRST) { - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationShowPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == false) + { + pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane); + } } else { - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationShowPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == false) + { + pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane); + } } } break; @@ -1079,32 +1026,34 @@ _SplitPanelPresenter::AnimatePane(int destination) Rectangle firstPaneEndBounds = _CoordinateSystemUtils::ConvertToInteger(GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST)); Rectangle secondPaneEndBounds = _CoordinateSystemUtils::ConvertToInteger(GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND)); - RectangleAnimation animationRestoreFirstPane = RectangleAnimation(firstPaneBounds, firstPaneEndBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); - RectangleAnimation animationRestoreSecondPane = RectangleAnimation(secondPaneBounds, secondPaneEndBounds, ANIMATION_DURATION, __controlAnimatorAnimationInterpolator); + secondPaneEndBounds.x = secondPaneEndBounds.y = 0; - // Restore Pane 1 - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreFirstPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + RectangleAnimation animationRestoreFirstPane = RectangleAnimation(firstPaneBounds, firstPaneEndBounds, ANIMATION_DURATION, __controlAnimatorInterpolator); + RectangleAnimation animationRestoreSecondPane = RectangleAnimation(secondPaneBounds, secondPaneEndBounds, ANIMATION_DURATION, __controlAnimatorInterpolator); - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationRestoreFirstPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); - - // Restore Pane 2 - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreSecondPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorFirstPane && pFirstPaneControl->IsResizable()) + { + pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreFirstPane); + } - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_POSITION, animationRestoreSecondPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorSecondPane && pSecondPaneControl->IsResizable()) + { + pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreSecondPane); + } if (__pSplitPanelModel->GetMaximizedPaneOrder() == SPLIT_PANEL_PANE_ORDER_FIRST) { - r = pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationShowPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == false) + { + pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane); + } } else { - r = pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, animationShowPane); - SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating."); + if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == false) + { + pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane); + } } } break; @@ -1113,6 +1062,163 @@ _SplitPanelPresenter::AnimatePane(int destination) return E_SUCCESS; } +result +_SplitPanelPresenter::AnimatePaneParent(int destination) +{ + result r = E_SUCCESS; + _Control* pFirstPane = null; + _Control* pSecondPane = null; + VisualElement* pVEFirstPane = null; + VisualElement* pVESecondPane = null; + VisualElementPropertyAnimation* pAnimationFirstPane = null; + VisualElementPropertyAnimation* pAnimationSecondPane = null; + + FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f); + FloatRectangle firstPaneBounds(0.0f, 0.0f, 0.0f, 0.0f); + FloatRectangle secondPaneBounds(0.0f, 0.0f, 0.0f, 0.0f); + FloatRectangle dividerRectangle(0.0f, 0.0f, 0.0f, 0.0f); + FloatRectangle firstPaneStartBounds(0.0f, 0.0f, 0.0f, 0.0f); + FloatRectangle firstPaneEndBounds(0.0f, 0.0f, 0.0f, 0.0f); + FloatRectangle secondPaneStartBounds(0.0f, 0.0f, 0.0f, 0.0f); + FloatRectangle secondPaneEndBounds(0.0f, 0.0f, 0.0f, 0.0f); + + pFirstPane = __pSplitPanel->GetPaneParent(SPLIT_PANEL_PANE_ORDER_FIRST); + pSecondPane = __pSplitPanel->GetPaneParent(SPLIT_PANEL_PANE_ORDER_SECOND); + + if (pFirstPane) + { + pVEFirstPane = pFirstPane->GetVisualElement(); + SysTryReturnResult(NID_UI_CTRL, pVEFirstPane != null, GetLastResult(), "Propagating."); + + pVEFirstPane->RemoveAllAnimations(); + } + + if (pSecondPane) + { + pVESecondPane = pSecondPane->GetVisualElement(); + SysTryReturnResult(NID_UI_CTRL, pVESecondPane != null, GetLastResult(), "Propagating."); + + pVESecondPane->RemoveAllAnimations(); + } + + pAnimationFirstPane = GetVisualElementAnimation(L"bounds"); + SysTryReturnResult(NID_UI_CTRL, pAnimationFirstPane != null, GetLastResult(), "Propagating."); + + pAnimationSecondPane = GetVisualElementAnimation(L"bounds"); + SysTryReturnResult(NID_UI_CTRL, pAnimationSecondPane != null, GetLastResult(), "Propagating."); + + clientBounds = __pSplitPanel->GetBoundsF(); + firstPaneBounds = pFirstPane->GetBoundsF(); + secondPaneBounds = pSecondPane->GetBoundsF(); + + clientBounds.x = clientBounds.y = 0.0f; + + dividerRectangle = __dividerRectangle; + + switch (destination) + { + case _SPLIT_PANEL_ANIMATION_RIGHT: + { + firstPaneStartBounds = firstPaneBounds; + firstPaneEndBounds = clientBounds; + + secondPaneStartBounds = secondPaneBounds; + secondPaneEndBounds = secondPaneBounds; + secondPaneEndBounds.x = clientBounds.width + dividerRectangle.width; + } + break; + case _SPLIT_PANEL_ANIMATION_LEFT: + { + firstPaneStartBounds = firstPaneBounds; + firstPaneEndBounds = firstPaneBounds; + firstPaneEndBounds.x = -(firstPaneBounds.width + dividerRectangle.width); + + secondPaneStartBounds = secondPaneBounds; + secondPaneEndBounds = clientBounds; + } + break; + case _SPLIT_PANEL_ANIMATION_TOP: + { + firstPaneStartBounds = firstPaneBounds; + firstPaneEndBounds = firstPaneBounds; + firstPaneEndBounds.y = -(firstPaneBounds.height + dividerRectangle.height); + + secondPaneStartBounds = secondPaneBounds; + secondPaneEndBounds = clientBounds; + } + break; + case _SPLIT_PANEL_ANIMATION_BOTTOM: + { + firstPaneStartBounds = firstPaneBounds; + firstPaneEndBounds = clientBounds; + + secondPaneStartBounds = secondPaneBounds; + secondPaneEndBounds = secondPaneBounds; + secondPaneEndBounds.y = clientBounds.height + dividerRectangle.height; + } + break; + case _SPLIT_PANEL_ANIMATION_RESTORE_HORIZONTAL: + { + firstPaneStartBounds = firstPaneBounds; + firstPaneEndBounds = GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST); + + secondPaneStartBounds = secondPaneBounds; + secondPaneEndBounds = GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND); + } + break; + case _SPLIT_PANEL_ANIMATION_RESTORE_VERTICAL: + { + firstPaneStartBounds = firstPaneBounds; + firstPaneEndBounds = GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST); + + secondPaneStartBounds = secondPaneBounds; + secondPaneEndBounds = GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND); + } + break; + } + + if (pFirstPane) + { + r = pAnimationFirstPane->SetStartValue(firstPaneStartBounds); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating."); + + r = pAnimationFirstPane->SetEndValue(firstPaneEndBounds); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating."); + + pFirstPane->SetBounds(firstPaneEndBounds); + + if (pVEFirstPane) + { + pVEFirstPane->AddAnimation(L"Bounds", *pAnimationFirstPane); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , GetLastResult(), "Propagating."); + } + } + + if (pSecondPane) + { + r = pAnimationSecondPane->SetStartValue(secondPaneStartBounds); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating."); + + r = pAnimationSecondPane->SetEndValue(secondPaneEndBounds); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating."); + + pSecondPane->SetBounds(secondPaneEndBounds); + + if (pVESecondPane) + { + pVESecondPane->AddAnimation(L"Bounds", *pAnimationSecondPane); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , GetLastResult(), "Propagating."); + } + } + +CATCH: + + delete pAnimationFirstPane; + delete pAnimationSecondPane; + + return r; +} + Control* _SplitPanelPresenter::GetPaneControl(SplitPanelPaneOrder paneOrder) { @@ -1129,38 +1235,21 @@ _SplitPanelPresenter::GetPaneControl(SplitPanelPaneOrder paneOrder) SplitPanel& splitPanelPublic = pSplitPanelImpl->GetPublic(); pControl = splitPanelPublic.GetPane(paneOrder); - SysTryReturn(NID_UI_CTRL, pControl != null, null, E_SYSTEM, "[%s] Propagating.", GetErrorMessage(GetLastResult())); + SysTryReturn(NID_UI_CTRL, pControl != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); return pControl; } -AnimatorStatus -_SplitPanelPresenter::GetAnimationStatus(void) +AnimationTransactionStatus +_SplitPanelPresenter::GetTransactionStatus(void) { - result r = E_SUCCESS; - - Control* pFirstPanelControl = GetPaneControl(SPLIT_PANEL_PANE_ORDER_FIRST); - r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, pFirstPanelControl != null, ANIMATOR_STATUS_STOPPED, r, "[%s] Propagating.", GetErrorMessage(r)); - - Control* pSecondPanelControl = GetPaneControl(SPLIT_PANEL_PANE_ORDER_SECOND); - r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, pSecondPanelControl != null, ANIMATOR_STATUS_STOPPED, r, "[%s] Propagating.", GetErrorMessage(r)); - - ControlAnimator* pControlAnimatorFirstPane = pFirstPanelControl->GetControlAnimator(); - r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, ANIMATOR_STATUS_STOPPED, r, "[%s] Propagating.", GetErrorMessage(r)); - - ControlAnimator* pControlAnimatorSecondPane = pSecondPanelControl->GetControlAnimator(); - r = GetLastResult(); - SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, ANIMATOR_STATUS_STOPPED, r, "[%s] Propagating.", GetErrorMessage(r)); - - if (pControlAnimatorFirstPane->GetStatus() == ANIMATOR_STATUS_STOPPED && pControlAnimatorSecondPane->GetStatus() == ANIMATOR_STATUS_STOPPED) + if (AnimationTransaction::GetStatus(__transactionIdMaximize) == ANIMATION_TRANSACTION_STATUS_STOPPED && + AnimationTransaction::GetStatus(__transactionIdRestore) == ANIMATION_TRANSACTION_STATUS_STOPPED) { - return ANIMATOR_STATUS_STOPPED; + return ANIMATION_TRANSACTION_STATUS_STOPPED; } - return ANIMATOR_STATUS_PLAYING; + return ANIMATION_TRANSACTION_STATUS_PLAYING; } FloatRectangle @@ -1168,27 +1257,32 @@ _SplitPanelPresenter::GetRestorePaneBounds(SplitPanelPaneOrder paneOrder) { float width = 0.0f; float height = 0.0f; + float dividerPosition = 0.0f; + FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f); FloatRectangle firstPaneBounds(0.0f, 0.0f, 0.0f, 0.0f); FloatRectangle secondPaneBounds(0.0f, 0.0f, 0.0f, 0.0f); + _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT; - float dividerPosition = __pSplitPanel->GetDividerPosition(); + dividerPosition = __pSplitPanel->GetDividerPosition(); - FloatRectangle clientBounds = __pSplitPanel->GetBoundsF(); + clientBounds = __pSplitPanel->GetBoundsF(); - _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation(); + orientation = _ControlManager::GetInstance()->GetOrientation(); - if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) + if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE) { - if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE) - { - GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, width); - } - else - { - GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, width); - } + GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, width); + GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, height); + } + else + { + GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, width); + GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, height); + } + if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL) + { height = clientBounds.height; if (height > 0.0f) @@ -1198,15 +1292,6 @@ _SplitPanelPresenter::GetRestorePaneBounds(SplitPanelPaneOrder paneOrder) } else { - if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE) - { - GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, height); - } - else - { - GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, height); - } - width = clientBounds.width; if (width > 0.0f) @@ -1234,4 +1319,33 @@ _SplitPanelPresenter::GetRestorePaneBounds(SplitPanelPaneOrder paneOrder) return secondPaneBounds; } +VisualElementPropertyAnimation* +_SplitPanelPresenter::GetVisualElementAnimation(Tizen::Base::String propertyName) +{ + result r = E_SUCCESS; + VisualElementPropertyAnimation* pAnimation = null; + + const IVisualElementAnimationTimingFunction* pTimingFunction = VisualElementAnimation::GetTimingFunctionByName(__visualElementInterpolator); + SysTryReturn(NID_UI_CTRL, pTimingFunction != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult())); + + pAnimation = new (std::nothrow) VisualElementPropertyAnimation(); + SysTryReturn(NID_UI_CTRL, pAnimation != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed."); + + r = pAnimation->SetPropertyName(propertyName); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating."); + + r = pAnimation->SetDuration(ANIMATION_DURATION); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating."); + + pAnimation->SetTimingFunction(pTimingFunction); + SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , GetLastResult(), "Propagating."); + + return pAnimation; + +CATCH: + delete pAnimation; + + return null; +} + }}} // Tizen::Ui::Controls diff --git a/src/ui/inc/FUiCtrl_SplitPanel.h b/src/ui/inc/FUiCtrl_SplitPanel.h index 41d3135..f42eac2 100644 --- a/src/ui/inc/FUiCtrl_SplitPanel.h +++ b/src/ui/inc/FUiCtrl_SplitPanel.h @@ -105,13 +105,13 @@ public: virtual bool OnAccessibilityValueIncreased(const Tizen::Ui::_AccessibilityContainer& control, const Tizen::Ui::_AccessibilityElement& element); virtual bool OnAccessibilityValueDecreased(const Tizen::Ui::_AccessibilityContainer& control, const Tizen::Ui::_AccessibilityElement& element); - public: result AddSplitPanelEventListener(const _ISplitPanelEventListener& listener); result RemoveSplitPanelEventListener(const _ISplitPanelEventListener& listener); result SetPane(_Control* pControl, SplitPanelPaneOrder paneOrder); _Control* GetPane(SplitPanelPaneOrder paneOrder) const; + _Control* GetPaneParent(SplitPanelPaneOrder paneOrder) const; result SetDividerStyle(SplitPanelDividerStyle splitPanelDividerStyle); SplitPanelDividerStyle GetDividerStyle(void) const; @@ -153,10 +153,14 @@ private: _SplitPanel& operator =(const _SplitPanel& rhs); private: + static const float ACCESSIBILITY_DIVIDER_POSITION_OFFSET = 5.0f; + _SplitPanelPresenter* __pSplitPanelPresenter; _TouchTapGestureDetector* __pTapGesture; + Tizen::Ui::_Control* __pFirstPaneParent; + Tizen::Ui::_Control* __pSecondPaneParent; Tizen::Ui::_Control* __pFirstPane; Tizen::Ui::_Control* __pSecondPane; diff --git a/src/ui/inc/FUiCtrl_SplitPanelPresenter.h b/src/ui/inc/FUiCtrl_SplitPanelPresenter.h index d6fb447..8b4ea6b 100644 --- a/src/ui/inc/FUiCtrl_SplitPanelPresenter.h +++ b/src/ui/inc/FUiCtrl_SplitPanelPresenter.h @@ -101,9 +101,11 @@ private: void ChangePaneOrder(SplitPanelPaneOrder paneOrder); result AnimateDivider(int destination); result AnimatePane(int destination); + result AnimatePaneParent(int destination); Tizen::Ui::Control* GetPaneControl(SplitPanelPaneOrder paneOrder); - Tizen::Ui::Animations::AnimatorStatus GetAnimationStatus(void); + Tizen::Ui::Animations::AnimationTransactionStatus GetTransactionStatus(void); Tizen::Graphics::FloatRectangle GetRestorePaneBounds(SplitPanelPaneOrder paneOrder); + Tizen::Ui::Animations::VisualElementPropertyAnimation* GetVisualElementAnimation(Tizen::Base::String propertyName); private: _SplitPanelPresenter(const _SplitPanelPresenter& value); @@ -131,8 +133,8 @@ private: int __transactionIdMaximize; int __transactionIdRestore; - Tizen::Ui::Animations::AnimationInterpolatorType __controlAnimatorAnimationInterpolator; - Tizen::Base::String __visualElementAnimationInterpolator; + Tizen::Ui::Animations::AnimationInterpolatorType __controlAnimatorInterpolator; + Tizen::Base::String __visualElementInterpolator; }; // _SplitPanelPresenter; -- 2.7.4