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_SplitPanelPresenter.cpp
20 * @brief This is the header file for the _SplitPanelPresenter class.
22 * This header file contains the declarations of the %_SplitPanelPresenter class.
25 #include <FBaseErrorDefine.h>
26 #include <FGrpCanvas.h>
27 #include <FUiCtrlSplitPanelTypes.h>
28 #include <FBaseSysLog.h>
29 #include <FGrp_BitmapImpl.h>
30 #include <FGrp_CoordinateSystemUtils.h>
31 #include "FUi_ResourceManager.h"
32 #include "FUi_UiTouchEvent.h"
33 #include "FUiCtrl_SplitPanelPresenter.h"
34 #include "FUiCtrl_SplitPanel.h"
35 #include "FUiCtrl_SplitPanelImpl.h"
37 using namespace Tizen::Ui;
38 using namespace Tizen::Graphics;
39 using namespace Tizen::Ui::Animations;
40 using namespace Tizen::Base;
42 namespace Tizen { namespace Ui { namespace Controls
45 _SplitPanelPresenter::_SplitPanelPresenter(void)
47 , __pSplitPanelModel(null)
48 , __dividerMaximumPosition(0.0f)
49 , __dividerMinimumPosition(0.0f)
50 , __splitPanelDividerPressed(false)
51 , __setFirstDividerPositionChangeEvent(true)
52 , __isChangeBounds(false)
53 , __dividerRectangle(0.0f, 0.0f ,0.0f, 0.0f)
54 , __dividerThumbRectangle(0.0f, 0.0f, 0.0f, 0.0f)
55 , __pDividerPressedBackgroundBitmap(null)
56 , __pDividerBackgroundBitmap(null)
57 , __pDividerBackgroundEffectBitmap(null)
58 , __pDividerThumbBitmap(null)
59 , __transactionIdMaximize(0)
60 , __transactionIdRestore(0)
61 , __controlAnimatorInterpolator(ANIMATION_INTERPOLATOR_LINEAR)
62 , __visualElementInterpolator(L"Linear")
64 GET_COLOR_CONFIG(SPLITPANEL::DIVIDER_BG_NORMAL, __dividerBackgroundColor);
65 GET_COLOR_CONFIG(SPLITPANEL::DIVIDER_BG_PRESSED, __dividerPressedBackgroundColor);
68 _SplitPanelPresenter::~_SplitPanelPresenter(void)
70 delete __pSplitPanelModel;
71 __pSplitPanelModel = null;
73 delete __pDividerPressedBackgroundBitmap;
74 __pDividerPressedBackgroundBitmap = null;
76 delete __pDividerBackgroundBitmap;
77 __pDividerBackgroundBitmap = null;
79 delete __pDividerThumbBitmap;
80 __pDividerThumbBitmap = null;
82 delete __pDividerBackgroundEffectBitmap;
83 __pDividerBackgroundEffectBitmap = null;
87 _SplitPanelPresenter::Construct(const _SplitPanel& splitPanel, SplitPanelDividerStyle splitPanelDividerStyle, SplitPanelDividerDirection splitPanelDividerDirection)
90 _SplitPanelModel* pModel = null;
92 pModel = new (std::nothrow) _SplitPanelModel;
93 SysTryReturnResult(NID_UI_CTRL, pModel, E_OUT_OF_MEMORY, "Memory allocation failed.");
95 r = SetModel(*pModel);
96 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to set the model.");
98 r = pModel->Construct();
99 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error has occurred. Failed to construct _SplitPanelModel instance.");
101 __pSplitPanel = const_cast <_SplitPanel*>(&splitPanel);
102 SysTryCatch(NID_UI_CTRL, __pSplitPanel != null, , E_SYSTEM, "[E_SYSTEM] A system error has occurred. _SplitPanel instance is null.");
104 __pSplitPanelModel->SetDividerStyle(splitPanelDividerStyle);
106 r = LoadBitmap(splitPanelDividerDirection);
107 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Failed to load bitmap.", GetErrorMessage(r));
109 AdjustDividerRectangle();
111 __controlAnimatorInterpolator = ANIMATION_INTERPOLATOR_EASE_IN;
112 __visualElementInterpolator = L"EaseIn";
124 _SplitPanelPresenter::CheckDividerTouchRegion(float positionX, float positionY)
126 float dividerPosition = 0.0f;
127 float extendedDividerTouchMargin = 0.0f;
128 Bitmap* pThumbBitmap = null;
130 _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
132 dividerPosition = __pSplitPanel->GetDividerPosition();
133 pThumbBitmap = __pDividerThumbBitmap;
135 GET_SHAPE_CONFIG(SPLITPANEL::EXTENDED_MOVABLE_DIVIDER_TOUCH_MARGIN, orientation, extendedDividerTouchMargin);
137 if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
139 if ((positionX >= dividerPosition - extendedDividerTouchMargin)
140 && (positionX <= dividerPosition + pThumbBitmap->GetWidthF() + extendedDividerTouchMargin))
147 if ((positionY >= dividerPosition - extendedDividerTouchMargin)
148 && (positionY <= dividerPosition + pThumbBitmap->GetHeightF() + extendedDividerTouchMargin))
158 _SplitPanelPresenter::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
160 FloatPoint point(0.0f, 0.0f);
162 point = touchinfo.GetCurrentPosition();
164 if (CheckDividerTouchRegion(point.x, point.y) == true)
166 __splitPanelDividerPressed = true;
167 __pSplitPanel->Invalidate();
175 _SplitPanelPresenter::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
177 if (__splitPanelDividerPressed == true)
179 PLAY_FEEDBACK(_RESOURCE_FEEDBACK_PATTERN_TAP, __pSplitPanel);
180 __splitPanelDividerPressed = false;
181 __pSplitPanel->Invalidate();
186 if (__isChangeBounds == true)
188 __isChangeBounds = false;
195 _SplitPanelPresenter::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
197 FloatPoint point(0.0f, 0.0f);
198 Bitmap* pThumbBitmap = null;
200 if (__splitPanelDividerPressed == false )
205 if (__pSplitPanelModel->GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_FIXED)
210 if (CheckDividerTouchRegion(point.x, point.y) == true)
212 __isChangeBounds = true;
215 point = touchinfo.GetCurrentPosition();
216 pThumbBitmap = __pDividerThumbBitmap;
218 if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
220 // Min, Max Position Check.
221 if ((__pSplitPanel->GetMinimumDividerPosition() > point.x)
222 || (__pSplitPanel->GetMaximumDividerPosition() < point.x))
227 if (point.x <= __pSplitPanel->GetBoundsF().width - pThumbBitmap->GetWidthF())
229 __pSplitPanel->SetDividerPosition(point.x);
234 // Min, Max Position Check.
235 if ((__pSplitPanel->GetMinimumDividerPosition() > point.y)
236 || (__pSplitPanel->GetMaximumDividerPosition() < point.y))
241 if (point.y <= __pSplitPanel->GetBoundsF().height - pThumbBitmap->GetHeightF())
243 __pSplitPanel->SetDividerPosition(point.y);
247 __pSplitPanel->SendSplitPanelEvent(_SPLIT_PANEL_EVENT_DIVIDER_POSITION_CHANGE);
249 __pSplitPanel->Invalidate();
255 _SplitPanelPresenter::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
257 if (__splitPanelDividerPressed == true)
259 __splitPanelDividerPressed = false;
261 __pSplitPanel->Invalidate();
266 if (__isChangeBounds == true)
268 __isChangeBounds = false;
275 _SplitPanelPresenter::OnTapGestureDetected(_TouchTapGestureDetector& gesture)
277 if (__pSplitPanelModel->GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_FIXED)
282 __pSplitPanel->SendSplitPanelEvent(_SPLIT_PANEL_EVENT_DIVIDER_DOUBLE_PRESSED);
288 _SplitPanelPresenter::OnTapGestureCanceled(_TouchTapGestureDetector& gesture)
294 _SplitPanelPresenter::SetDividerStyle(SplitPanelDividerStyle splitPanelDividerStyle)
296 __pSplitPanelModel->SetDividerStyle(splitPanelDividerStyle);
301 SplitPanelDividerStyle
302 _SplitPanelPresenter::GetDividerStyle(void) const
304 return __pSplitPanelModel->GetDividerStyle();
308 _SplitPanelPresenter::GetDividerRectangle(void) const
310 return __dividerRectangle;
314 _SplitPanelPresenter::MaximizePane(SplitPanelPaneOrder paneOrder)
316 result r = E_SUCCESS;
318 if (IsPaneMaximized(paneOrder))
322 else if (GetTransactionStatus() == ANIMATION_TRANSACTION_STATUS_PLAYING)
324 AnimationTransaction::Stop(__transactionIdMaximize);
325 AnimationTransaction::Stop(__transactionIdRestore);
330 AnimationTransaction::Begin(__transactionIdMaximize);
332 if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
334 if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST)
336 r = AnimateDivider(_SPLIT_PANEL_ANIMATION_RIGHT);
337 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
339 r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_RIGHT);
340 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
342 r = AnimatePane(_SPLIT_PANEL_ANIMATION_RIGHT);
343 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
347 r = AnimateDivider(_SPLIT_PANEL_ANIMATION_LEFT);
348 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
350 r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_LEFT);
351 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
353 r = AnimatePane(_SPLIT_PANEL_ANIMATION_LEFT);
354 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
359 if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST)
361 r = AnimateDivider(_SPLIT_PANEL_ANIMATION_BOTTOM);
362 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
364 r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_BOTTOM);
365 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
367 r = AnimatePane(_SPLIT_PANEL_ANIMATION_BOTTOM);
368 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
372 r = AnimateDivider(_SPLIT_PANEL_ANIMATION_TOP);
373 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
375 r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_TOP);
376 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
378 r = AnimatePane(_SPLIT_PANEL_ANIMATION_TOP);
379 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
383 AnimationTransaction::Commit();
385 __pSplitPanelModel->SetPaneMaximumState(true);
386 __pSplitPanelModel->SetMaximizedPaneOrder(paneOrder);
391 AnimationTransaction::Discard();
397 _SplitPanelPresenter::IsPaneMaximized(SplitPanelPaneOrder paneOrder) const
399 if ((__pSplitPanelModel->GetPaneMaximumState() == true)
400 && (__pSplitPanelModel->GetMaximizedPaneOrder() == paneOrder))
409 _SplitPanelPresenter::RestorePane(void)
411 result r = E_SUCCESS;
413 if (__pSplitPanelModel->GetPaneMaximumState() == false)
417 else if (GetTransactionStatus() == ANIMATION_TRANSACTION_STATUS_PLAYING)
419 AnimationTransaction::Stop(__transactionIdMaximize);
420 AnimationTransaction::Stop(__transactionIdRestore);
425 AnimationTransaction::Begin(__transactionIdRestore);
427 if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
429 r = AnimateDivider(_SPLIT_PANEL_ANIMATION_RESTORE_VERTICAL);
430 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
432 r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_RESTORE_VERTICAL);
433 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
435 r = AnimatePane(_SPLIT_PANEL_ANIMATION_RESTORE_VERTICAL);
436 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
440 r = AnimateDivider(_SPLIT_PANEL_ANIMATION_RESTORE_HORIZONTAL);
441 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
443 r = AnimatePaneParent(_SPLIT_PANEL_ANIMATION_RESTORE_HORIZONTAL);
444 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
446 r = AnimatePane(_SPLIT_PANEL_ANIMATION_RESTORE_HORIZONTAL);
447 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Propagating.", GetErrorMessage(r));
450 AnimationTransaction::Commit();
452 __pSplitPanelModel->SetPaneMaximumState(false);
457 AnimationTransaction::Discard();
463 _SplitPanelPresenter::Draw(void)
465 if (GetTransactionStatus() == ANIMATION_TRANSACTION_STATUS_STOPPED &&
466 __pSplitPanelModel->GetPaneMaximumState() == false)
468 FloatRectangle dividerBounds(0.0f, 0.0f, 0.0f, 0.0f);
469 FloatRectangle dividerThumbBounds(0.0f, 0.0f, 0.0f, 0.0f);
470 Canvas* pCanvas = null;
472 //adjust divider rectangle
473 AdjustDividerRectangle();
475 pCanvas = __pSplitPanel->GetDividerVisualElement()->GetCanvasN();
476 SysTryReturnResult(NID_UI_CTRL, pCanvas != null, GetLastResult(), "Propagating.");
483 if (__isChangeBounds)
487 __isChangeBounds = false;
490 dividerBounds = __dividerRectangle;
491 dividerBounds.x = 0.0f;
492 dividerBounds.y = 0.0f;
494 if (__splitPanelDividerPressed == true)
496 pCanvas->DrawNinePatchedBitmap(dividerBounds, *__pDividerPressedBackgroundBitmap);
500 pCanvas->DrawNinePatchedBitmap(dividerBounds, *__pDividerBackgroundBitmap);
504 pCanvas->DrawNinePatchedBitmap(dividerBounds, *__pDividerBackgroundEffectBitmap);
507 if (__pSplitPanelModel->GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE)
509 dividerThumbBounds = __dividerThumbRectangle;
510 if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
512 dividerThumbBounds.x = 0.0f;
516 dividerThumbBounds.y = 0.0f;
519 pCanvas->DrawBitmap(dividerThumbBounds, *__pDividerThumbBitmap);
530 _SplitPanelPresenter::LoadBitmap(SplitPanelDividerDirection splitPanelDividerDirection)
532 result r = E_SUCCESS;
533 Bitmap *pDividerBackgroundBitmap = null;
535 // Modified - Changeable Color / Resource ( Fixed Style )
536 r = GET_BITMAP_CONFIG_N(SPLITPANEL::DIVIDER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, pDividerBackgroundBitmap);
537 SysTryReturnResult(NID_UI_CTRL, (r == E_SUCCESS), r, "Failed to load bitmap.");
539 if (splitPanelDividerDirection == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
541 r = GET_BITMAP_CONFIG_N(SPLITPANEL::VERTICAL_DIVIDER_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pDividerBackgroundEffectBitmap);
542 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Failed to load bitmap.", GetErrorMessage(r));
544 r = GET_BITMAP_CONFIG_N(SPLITPANEL::VERTICAL_DIVIDER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDividerThumbBitmap);
545 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Failed to load bitmap.", GetErrorMessage(r));
549 r = GET_BITMAP_CONFIG_N(SPLITPANEL::HORIZONTAL_DIVIDER_BG_EFFECT, BITMAP_PIXEL_FORMAT_ARGB8888, __pDividerBackgroundEffectBitmap);
550 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Failed to load bitmap.", GetErrorMessage(r));
552 r = GET_BITMAP_CONFIG_N(SPLITPANEL::HORIZONTAL_DIVIDER_BG_NORMAL, BITMAP_PIXEL_FORMAT_ARGB8888, __pDividerThumbBitmap);
553 SysTryCatch(NID_UI_CTRL, (r == E_SUCCESS), , r, "[%s] Failed to load bitmap.", GetErrorMessage(r));
556 __pDividerPressedBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pDividerBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), __dividerPressedBackgroundColor);
557 SysTryCatch(NID_UI_CTRL, (__pDividerPressedBackgroundBitmap != null), , r, "[%s] Failed to get replacement color bitmap.", GetErrorMessage(GetLastResult()));
559 __pDividerBackgroundBitmap = _BitmapImpl::GetColorReplacedBitmapN(*pDividerBackgroundBitmap, Color::GetColor(COLOR_ID_MAGENTA), __dividerBackgroundColor);
560 SysTryCatch(NID_UI_CTRL, (__pDividerBackgroundBitmap != null), , r, "[%s] Failed to get replacement color bitmap.", GetErrorMessage(GetLastResult()));
562 delete pDividerBackgroundBitmap;
567 delete pDividerBackgroundBitmap;
568 delete __pDividerBackgroundEffectBitmap;
569 delete __pDividerPressedBackgroundBitmap;
570 delete __pDividerThumbBitmap;
576 _SplitPanelPresenter::RecalcSplitPanel(void)
578 //adjust divider rectangle
579 AdjustDividerRectangle();
588 _SplitPanelPresenter::OnChangeLayout(_ControlOrientation orientation)
590 __isChangeBounds = true;
592 AnimationTransaction::Stop(__transactionIdMaximize);
593 AnimationTransaction::Stop(__transactionIdRestore);
599 _SplitPanelPresenter::OnBoundsChanged(void)
601 __isChangeBounds = true;
603 AnimationTransaction::Stop(__transactionIdMaximize);
604 AnimationTransaction::Stop(__transactionIdRestore);
610 _SplitPanelPresenter::SetModel(const _SplitPanelModel& splitPanelModel)
612 __pSplitPanelModel = const_cast<_SplitPanelModel*>(&splitPanelModel);
618 _SplitPanelPresenter::SetPaneBounds(void)
620 result r = E_SUCCESS;
621 FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f);
622 FloatRectangle firstPaneBounds(0.0f, 0.0f, 0.0f, 0.0f);
623 FloatRectangle secondPaneBounds(0.0f, 0.0f, 0.0f, 0.0f);
624 FloatRectangle dividerBounds(0.0f, 0.0f, 0.0f, 0.0f);
625 FloatPoint panePostion(0.0f, 0.0f);
626 _Control* pFirstPane = null;
627 _Control* pSecondPane = null;
628 _Control* pFirstPaneParent = null;
629 _Control* pSecondPaneParent = null;
631 clientBounds = __pSplitPanel->GetBoundsF();
633 pFirstPane = __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_FIRST);
634 pSecondPane = __pSplitPanel->GetPane(SPLIT_PANEL_PANE_ORDER_SECOND);
636 pFirstPaneParent = __pSplitPanel->GetPaneParent(SPLIT_PANEL_PANE_ORDER_FIRST);
637 pSecondPaneParent = __pSplitPanel->GetPaneParent(SPLIT_PANEL_PANE_ORDER_SECOND);
639 clientBounds.x = clientBounds.y = 0.0f;
641 if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_FIRST))
643 firstPaneBounds = clientBounds;
645 if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
647 secondPaneBounds = FloatRectangle(clientBounds.width + __dividerRectangle.width, 0.0f, clientBounds.width - __dividerRectangle.x - __dividerRectangle.width, clientBounds.height);
651 secondPaneBounds = FloatRectangle(0.0f, clientBounds.height + __dividerRectangle.height, clientBounds.width, clientBounds.height - __dividerRectangle.y - __dividerRectangle.height);
654 dividerBounds = __dividerRectangle;
655 dividerBounds.x = clientBounds.width;
657 __pSplitPanel->SetDividerVisualElementBounds(dividerBounds);
659 else if (IsPaneMaximized(SPLIT_PANEL_PANE_ORDER_SECOND))
661 secondPaneBounds = clientBounds;
663 if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
665 firstPaneBounds = FloatRectangle(clientBounds.x -__dividerRectangle.x - __dividerRectangle.width, 0.0f, __dividerRectangle.x, clientBounds.height);
669 firstPaneBounds = FloatRectangle(0.0f, clientBounds.y -__dividerRectangle.y - __dividerRectangle.height, clientBounds.width, __dividerRectangle.y);
672 dividerBounds = __dividerRectangle;
673 dividerBounds.x = -__dividerRectangle.width;
675 __pSplitPanel->SetDividerVisualElementBounds(dividerBounds);
679 if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
681 firstPaneBounds = FloatRectangle(0.0f, 0.0f, __dividerRectangle.x, clientBounds.height);
682 secondPaneBounds = FloatRectangle(__dividerRectangle.x + __dividerRectangle.width, 0.0f, clientBounds.width - __dividerRectangle.x - __dividerRectangle.width,clientBounds.height);
686 firstPaneBounds = FloatRectangle(0.0f, 0.0f, clientBounds.width, __dividerRectangle.y);
687 secondPaneBounds = FloatRectangle(0.0f, __dividerRectangle.y + __dividerRectangle.height, clientBounds.width, clientBounds.height - __dividerRectangle.y - __dividerRectangle.height);
691 if (pFirstPaneParent != null)
693 r = pFirstPaneParent->SetBounds(firstPaneBounds);
694 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
697 if (pSecondPaneParent != null)
699 r = pSecondPaneParent->SetBounds(secondPaneBounds);
700 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
704 if (pFirstPane != null)
706 if (pFirstPane->IsResizable())
708 r = pFirstPane->SetBounds(firstPaneBounds);
711 SysLog(NID_UI_CTRL, "[%s] SetBounds failed.", GetErrorMessage(r));
715 r = pFirstPane->SetPosition(Point(0.0f, 0.0f));
716 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
719 if (pSecondPane != null)
721 if (pSecondPane->IsResizable())
723 r = pSecondPane->SetBounds(secondPaneBounds);
726 SysLog(NID_UI_CTRL, "[%s] SetBounds failed.", GetErrorMessage(r));
730 r = pSecondPane->SetPosition(Point(0.0f, 0.0f));
731 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "Propagating.");
734 if ((pFirstPane != null) && (pSecondPane != null))
736 if (__setFirstDividerPositionChangeEvent == true)
738 __setFirstDividerPositionChangeEvent = false;
739 __pSplitPanel->SendSplitPanelEvent(_SPLIT_PANEL_EVENT_DIVIDER_POSITION_CHANGE);
742 pFirstPane->Invalidate(true);
743 pSecondPane->Invalidate(true);
750 _SplitPanelPresenter::AdjustDividerRectangle(void)
752 float dividerPosition = 0.0f;
755 FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f);
756 _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
757 Bitmap* pThumbBitmap = null;
759 orientation = _ControlManager::GetInstance()->GetOrientation();
761 dividerPosition = __pSplitPanel->GetDividerPosition();
762 clientBounds = __pSplitPanel->GetBoundsF();
764 pThumbBitmap = __pDividerThumbBitmap;
766 if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE)
768 GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, width);
769 GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, height);
773 GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, width);
774 GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, height);
777 if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
779 height = clientBounds.height;
783 __dividerRectangle = FloatRectangle(dividerPosition, 0.0f, width, height);
784 __dividerThumbRectangle = FloatRectangle(dividerPosition, ((height - pThumbBitmap->GetHeightF()) / 2.0f), pThumbBitmap->GetWidthF(), pThumbBitmap->GetHeightF());
789 width = clientBounds.width;
793 __dividerRectangle = FloatRectangle(0.0f, dividerPosition, width, height);
794 __dividerThumbRectangle = FloatRectangle(((width - pThumbBitmap->GetWidth()) / 2.0f), dividerPosition, pThumbBitmap->GetWidthF(), pThumbBitmap->GetHeightF());
798 __pSplitPanel->SetDividerVisualElementBounds(__dividerRectangle);
802 _SplitPanelPresenter::AnimateDivider(int destination)
804 result r = E_SUCCESS;
805 FloatRectangle dividerBoundsStart(0.0f, 0.0f, 0.0f, 0.0f);
806 FloatRectangle dividerBoundsEnd(0.0f, 0.0f, 0.0f, 0.0f);
807 FloatRectangle dividerBounds(0.0f, 0.0f, 0.0f, 0.0f);
808 FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f);
809 FloatRectangle firstPaneBounds(0.0f, 0.0f, 0.0f, 0.0f);
810 _Control* pFirstPaneParent = null;
812 VisualElement* pVisualElementDivider = null;
813 VisualElementPropertyAnimation* pAnimationDivider = null;
815 pFirstPaneParent = __pSplitPanel->GetPaneParent(SPLIT_PANEL_PANE_ORDER_FIRST);
816 SysTryReturnResult(NID_UI_CTRL, pFirstPaneParent != null, GetLastResult(), "Propagating.");
818 pVisualElementDivider = __pSplitPanel->GetDividerVisualElement();
819 SysTryReturnResult(NID_UI_CTRL, pVisualElementDivider != null, GetLastResult(), "Propagating.");
821 pVisualElementDivider->RemoveAllAnimations();
822 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, GetLastResult(), "Propagating.");
824 pAnimationDivider = GetVisualElementAnimation(L"bounds");
825 SysTryReturnResult(NID_UI_CTRL, pAnimationDivider != null, GetLastResult(), "Propagating.");
827 dividerBounds = pVisualElementDivider->GetBounds();
828 clientBounds = __pSplitPanel->GetBoundsF();
829 firstPaneBounds = pFirstPaneParent->GetBoundsF();
830 dividerBoundsStart = dividerBounds;
832 clientBounds.x = clientBounds.y = 0.0f;
836 case _SPLIT_PANEL_ANIMATION_RIGHT:
838 dividerBoundsStart.x = firstPaneBounds.x + firstPaneBounds.width;
840 dividerBoundsEnd = dividerBounds;
841 dividerBoundsEnd.x = clientBounds.width;
844 case _SPLIT_PANEL_ANIMATION_LEFT:
846 dividerBoundsStart.x = firstPaneBounds.x + firstPaneBounds.width;
848 dividerBoundsEnd = dividerBounds;
849 dividerBoundsEnd.x = clientBounds.x - dividerBounds.width;
852 case _SPLIT_PANEL_ANIMATION_TOP:
854 dividerBoundsStart.y = firstPaneBounds.y + firstPaneBounds.height;
856 dividerBoundsEnd = dividerBounds;
857 dividerBoundsEnd.y = clientBounds.y - dividerBounds.height;
860 case _SPLIT_PANEL_ANIMATION_BOTTOM:
862 dividerBoundsStart.y = firstPaneBounds.y + firstPaneBounds.height;
864 dividerBoundsEnd = dividerBounds;
865 dividerBoundsEnd.y = clientBounds.height;
868 case _SPLIT_PANEL_ANIMATION_RESTORE_HORIZONTAL:
870 dividerBounds = __dividerRectangle;
872 dividerBoundsStart = dividerBounds;
873 dividerBoundsEnd = dividerBounds;
875 if (__pSplitPanelModel->GetMaximizedPaneOrder() == SPLIT_PANEL_PANE_ORDER_FIRST)
877 dividerBoundsStart.y = clientBounds.height;
881 dividerBoundsStart.y = clientBounds.y - dividerBounds.height;
885 case _SPLIT_PANEL_ANIMATION_RESTORE_VERTICAL:
887 dividerBounds = __dividerRectangle;
889 dividerBoundsStart = dividerBoundsEnd = dividerBounds;
891 if (__pSplitPanelModel->GetMaximizedPaneOrder() == SPLIT_PANEL_PANE_ORDER_FIRST)
893 dividerBoundsStart.x = clientBounds.width;
897 dividerBoundsStart.x = clientBounds.x - dividerBounds.width;
903 r = pAnimationDivider->SetStartValue(dividerBoundsStart);
904 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating.");
906 r = pAnimationDivider->SetEndValue(dividerBoundsEnd);
907 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating.");
909 pVisualElementDivider->AddAnimation(L"Bounds", *pAnimationDivider);
910 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , GetLastResult(), "Propagating.");
914 delete pAnimationDivider;
920 _SplitPanelPresenter::AnimatePane(int destination)
922 Rectangle clientBounds(0, 0, 0, 0);
923 Rectangle firstPaneBounds(0, 0, 0, 0);
924 Rectangle secondPaneBounds(0, 0, 0, 0);
925 Rectangle dividerRectangle(0, 0, 0, 0);
926 Control* pFirstPaneControl = null;
927 Control* pSecondPaneControl = null;
928 ControlAnimator* pControlAnimatorFirstPane = null;
929 ControlAnimator* pControlAnimatorSecondPane = null;
931 FloatAnimation hidePane(ANIMATION_ALPHA_SHOW, ANIMATION_ALPHA_HIDE, ANIMATION_DURATION, __controlAnimatorInterpolator);
932 FloatAnimation showPane(ANIMATION_ALPHA_HIDE, ANIMATION_ALPHA_SHOW, ANIMATION_DURATION, __controlAnimatorInterpolator);
934 pFirstPaneControl = GetPaneControl(SPLIT_PANEL_PANE_ORDER_FIRST);
935 pSecondPaneControl = GetPaneControl(SPLIT_PANEL_PANE_ORDER_SECOND);
937 pControlAnimatorFirstPane = pFirstPaneControl->GetControlAnimator();
938 pControlAnimatorSecondPane = pSecondPaneControl->GetControlAnimator();
940 clientBounds = __pSplitPanel->GetBounds();
941 firstPaneBounds = pFirstPaneControl->GetBounds();
942 secondPaneBounds = pSecondPaneControl->GetBounds();
944 clientBounds.x = clientBounds.y = 0;
946 dividerRectangle = _CoordinateSystemUtils::ConvertToInteger(__dividerRectangle);
950 case _SPLIT_PANEL_ANIMATION_RIGHT:
952 Rectangle secondPaneEndBounds = secondPaneBounds;
953 secondPaneEndBounds.x = clientBounds.width + dividerRectangle.width;
955 RectangleAnimation maximizeFirstPane = RectangleAnimation(firstPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorInterpolator);
957 if (pControlAnimatorFirstPane && pFirstPaneControl->IsResizable())
959 pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, maximizeFirstPane);
962 if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == false)
964 pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane);
967 if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == true)
969 pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, hidePane);
973 case _SPLIT_PANEL_ANIMATION_LEFT:
975 Rectangle firstPaneEndBounds = firstPaneBounds;
976 firstPaneEndBounds.x = -(firstPaneBounds.width + dividerRectangle.width);
978 RectangleAnimation animationMaximizeSecondPane = RectangleAnimation(secondPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorInterpolator);
980 if (pControlAnimatorSecondPane && pSecondPaneControl->IsResizable())
982 pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationMaximizeSecondPane);
985 if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == false)
987 pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane);
990 if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == true)
992 pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, hidePane);
996 case _SPLIT_PANEL_ANIMATION_TOP:
998 Rectangle firstPaneEndBounds = firstPaneBounds;
999 firstPaneEndBounds.y = -(firstPaneBounds.height + dividerRectangle.height);
1001 RectangleAnimation animationMaximizeSecondPane = RectangleAnimation(secondPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorInterpolator);
1003 if (pControlAnimatorSecondPane && pSecondPaneControl->IsResizable())
1005 pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationMaximizeSecondPane);
1008 if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == false)
1010 pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane);
1013 if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == true)
1015 pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, hidePane);
1019 case _SPLIT_PANEL_ANIMATION_BOTTOM:
1021 Rectangle secondPaneEndBounds = secondPaneBounds;
1022 secondPaneEndBounds.y = clientBounds.height + dividerRectangle.height;
1024 RectangleAnimation maximizeFirstPane = RectangleAnimation(firstPaneBounds, clientBounds, ANIMATION_DURATION, __controlAnimatorInterpolator);
1026 if (pControlAnimatorFirstPane && pFirstPaneControl->IsResizable())
1028 pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, maximizeFirstPane);
1031 if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == false)
1033 pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane);
1036 if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == true)
1038 pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, hidePane);
1042 case _SPLIT_PANEL_ANIMATION_RESTORE_HORIZONTAL:
1044 Rectangle firstPaneEndBounds = _CoordinateSystemUtils::ConvertToInteger(GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST));
1045 Rectangle secondPaneEndBounds = _CoordinateSystemUtils::ConvertToInteger(GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND));
1047 secondPaneEndBounds.x = secondPaneEndBounds.y = 0;
1049 RectangleAnimation animationRestoreFirstPane = RectangleAnimation(firstPaneBounds, firstPaneEndBounds, ANIMATION_DURATION, __controlAnimatorInterpolator);
1050 RectangleAnimation animationRestoreSecondPane = RectangleAnimation(secondPaneBounds, secondPaneEndBounds, ANIMATION_DURATION, __controlAnimatorInterpolator);
1052 if (pControlAnimatorFirstPane && pFirstPaneControl->IsResizable())
1054 pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreFirstPane);
1057 if (pControlAnimatorSecondPane && pSecondPaneControl->IsResizable())
1059 pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreSecondPane);
1062 if (__pSplitPanelModel->GetMaximizedPaneOrder() == SPLIT_PANEL_PANE_ORDER_FIRST)
1064 if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == false)
1066 pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane);
1071 if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == false)
1073 pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane);
1078 case _SPLIT_PANEL_ANIMATION_RESTORE_VERTICAL:
1080 Rectangle firstPaneEndBounds = _CoordinateSystemUtils::ConvertToInteger(GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST));
1081 Rectangle secondPaneEndBounds = _CoordinateSystemUtils::ConvertToInteger(GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND));
1083 secondPaneEndBounds.x = secondPaneEndBounds.y = 0;
1085 RectangleAnimation animationRestoreFirstPane = RectangleAnimation(firstPaneBounds, firstPaneEndBounds, ANIMATION_DURATION, __controlAnimatorInterpolator);
1086 RectangleAnimation animationRestoreSecondPane = RectangleAnimation(secondPaneBounds, secondPaneEndBounds, ANIMATION_DURATION, __controlAnimatorInterpolator);
1088 if (pControlAnimatorFirstPane && pFirstPaneControl->IsResizable())
1090 pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreFirstPane);
1093 if (pControlAnimatorSecondPane && pSecondPaneControl->IsResizable())
1095 pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_SIZE, animationRestoreSecondPane);
1098 if (__pSplitPanelModel->GetMaximizedPaneOrder() == SPLIT_PANEL_PANE_ORDER_FIRST)
1100 if (pControlAnimatorSecondPane && pSecondPaneControl->GetShowState() == false)
1102 pControlAnimatorSecondPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane);
1107 if (pControlAnimatorFirstPane && pFirstPaneControl->GetShowState() == false)
1109 pControlAnimatorFirstPane->StartUserAnimation(ANIMATION_TARGET_ALPHA, showPane);
1120 _SplitPanelPresenter::AnimatePaneParent(int destination)
1122 result r = E_SUCCESS;
1123 _Control* pFirstPane = null;
1124 _Control* pSecondPane = null;
1125 VisualElement* pVEFirstPane = null;
1126 VisualElement* pVESecondPane = null;
1127 VisualElementPropertyAnimation* pAnimationFirstPane = null;
1128 VisualElementPropertyAnimation* pAnimationSecondPane = null;
1130 FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f);
1131 FloatRectangle firstPaneBounds(0.0f, 0.0f, 0.0f, 0.0f);
1132 FloatRectangle secondPaneBounds(0.0f, 0.0f, 0.0f, 0.0f);
1133 FloatRectangle dividerRectangle(0.0f, 0.0f, 0.0f, 0.0f);
1134 FloatRectangle firstPaneStartBounds(0.0f, 0.0f, 0.0f, 0.0f);
1135 FloatRectangle firstPaneEndBounds(0.0f, 0.0f, 0.0f, 0.0f);
1136 FloatRectangle secondPaneStartBounds(0.0f, 0.0f, 0.0f, 0.0f);
1137 FloatRectangle secondPaneEndBounds(0.0f, 0.0f, 0.0f, 0.0f);
1139 pFirstPane = __pSplitPanel->GetPaneParent(SPLIT_PANEL_PANE_ORDER_FIRST);
1140 SysTryReturnResult(NID_UI_CTRL, pFirstPane != null, GetLastResult(), "Propagating.");
1142 pSecondPane = __pSplitPanel->GetPaneParent(SPLIT_PANEL_PANE_ORDER_SECOND);
1143 SysTryReturnResult(NID_UI_CTRL, pSecondPane != null, GetLastResult(), "Propagating.");
1145 pVEFirstPane = pFirstPane->GetVisualElement();
1146 SysTryReturnResult(NID_UI_CTRL, pVEFirstPane != null, GetLastResult(), "Propagating.");
1148 pVEFirstPane->RemoveAllAnimations();
1150 pVESecondPane = pSecondPane->GetVisualElement();
1151 SysTryReturnResult(NID_UI_CTRL, pVESecondPane != null, GetLastResult(), "Propagating.");
1153 pVESecondPane->RemoveAllAnimations();
1155 pAnimationFirstPane = GetVisualElementAnimation(L"bounds");
1156 SysTryReturnResult(NID_UI_CTRL, pAnimationFirstPane != null, GetLastResult(), "Propagating.");
1158 pAnimationSecondPane = GetVisualElementAnimation(L"bounds");
1159 r = GetLastResult();
1160 SysTryCatch(NID_UI_CTRL, pAnimationSecondPane != null, , r, "[%s] Propagating.", GetErrorMessage(r));
1162 clientBounds = __pSplitPanel->GetBoundsF();
1163 firstPaneBounds = pFirstPane->GetBoundsF();
1164 secondPaneBounds = pSecondPane->GetBoundsF();
1166 clientBounds.x = clientBounds.y = 0.0f;
1168 dividerRectangle = __dividerRectangle;
1170 switch (destination)
1172 case _SPLIT_PANEL_ANIMATION_RIGHT:
1174 firstPaneStartBounds = firstPaneBounds;
1175 firstPaneEndBounds = clientBounds;
1177 secondPaneStartBounds = secondPaneBounds;
1178 secondPaneEndBounds = secondPaneBounds;
1179 secondPaneEndBounds.x = clientBounds.width + dividerRectangle.width;
1182 case _SPLIT_PANEL_ANIMATION_LEFT:
1184 firstPaneStartBounds = firstPaneBounds;
1185 firstPaneEndBounds = firstPaneBounds;
1186 firstPaneEndBounds.x = -(firstPaneBounds.width + dividerRectangle.width);
1188 secondPaneStartBounds = secondPaneBounds;
1189 secondPaneEndBounds = clientBounds;
1192 case _SPLIT_PANEL_ANIMATION_TOP:
1194 firstPaneStartBounds = firstPaneBounds;
1195 firstPaneEndBounds = firstPaneBounds;
1196 firstPaneEndBounds.y = -(firstPaneBounds.height + dividerRectangle.height);
1198 secondPaneStartBounds = secondPaneBounds;
1199 secondPaneEndBounds = clientBounds;
1202 case _SPLIT_PANEL_ANIMATION_BOTTOM:
1204 firstPaneStartBounds = firstPaneBounds;
1205 firstPaneEndBounds = clientBounds;
1207 secondPaneStartBounds = secondPaneBounds;
1208 secondPaneEndBounds = secondPaneBounds;
1209 secondPaneEndBounds.y = clientBounds.height + dividerRectangle.height;
1212 case _SPLIT_PANEL_ANIMATION_RESTORE_HORIZONTAL:
1214 firstPaneStartBounds = firstPaneBounds;
1215 firstPaneEndBounds = GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST);
1217 secondPaneStartBounds = secondPaneBounds;
1218 secondPaneEndBounds = GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND);
1221 case _SPLIT_PANEL_ANIMATION_RESTORE_VERTICAL:
1223 firstPaneStartBounds = firstPaneBounds;
1224 firstPaneEndBounds = GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_FIRST);
1226 secondPaneStartBounds = secondPaneBounds;
1227 secondPaneEndBounds = GetRestorePaneBounds(SPLIT_PANEL_PANE_ORDER_SECOND);
1232 //Animate first pane
1233 r = pAnimationFirstPane->SetStartValue(firstPaneStartBounds);
1234 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating.");
1236 r = pAnimationFirstPane->SetEndValue(firstPaneEndBounds);
1237 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating.");
1239 pFirstPane->SetBounds(firstPaneEndBounds);
1241 pVEFirstPane->AddAnimation(L"Bounds", *pAnimationFirstPane);
1242 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , GetLastResult(), "Propagating.");
1244 //Animate second pane
1245 r = pAnimationSecondPane->SetStartValue(secondPaneStartBounds);
1246 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating.");
1248 r = pAnimationSecondPane->SetEndValue(secondPaneEndBounds);
1249 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating.");
1251 pSecondPane->SetBounds(secondPaneEndBounds);
1253 pVESecondPane->AddAnimation(L"Bounds", *pAnimationSecondPane);
1254 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , GetLastResult(), "Propagating.");
1258 delete pAnimationFirstPane;
1259 delete pAnimationSecondPane;
1265 _SplitPanelPresenter::GetPaneControl(SplitPanelPaneOrder paneOrder)
1267 _ControlImpl* pControlImpl = null;
1268 _SplitPanelImpl* pSplitPanelImpl = null;
1269 Control* pControl = null;
1271 pControlImpl = static_cast<_ControlImpl*>(__pSplitPanel->GetUserData());
1272 SysTryReturn(NID_UI_CTRL, pControlImpl != null, null, E_SYSTEM, "[E_SYSTEM] A system error has occurred. _ControlImpl is null.");
1274 pSplitPanelImpl = dynamic_cast<_SplitPanelImpl*>(pControlImpl);
1275 SysTryReturn(NID_UI_CTRL, pSplitPanelImpl != null, null, E_SYSTEM, "[E_SYSTEM]A system error has occurred. _SplitPanelImpl is null.");
1277 SplitPanel& splitPanelPublic = pSplitPanelImpl->GetPublic();
1279 pControl = splitPanelPublic.GetPane(paneOrder);
1280 SysTryReturn(NID_UI_CTRL, pControl != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1285 AnimationTransactionStatus
1286 _SplitPanelPresenter::GetTransactionStatus(void)
1288 if (AnimationTransaction::GetStatus(__transactionIdMaximize) == ANIMATION_TRANSACTION_STATUS_STOPPED &&
1289 AnimationTransaction::GetStatus(__transactionIdRestore) == ANIMATION_TRANSACTION_STATUS_STOPPED)
1291 return ANIMATION_TRANSACTION_STATUS_STOPPED;
1294 return ANIMATION_TRANSACTION_STATUS_PLAYING;
1298 _SplitPanelPresenter::GetRestorePaneBounds(SplitPanelPaneOrder paneOrder)
1301 float height = 0.0f;
1302 float dividerPosition = 0.0f;
1304 FloatRectangle clientBounds(0.0f, 0.0f, 0.0f, 0.0f);
1305 FloatRectangle firstPaneBounds(0.0f, 0.0f, 0.0f, 0.0f);
1306 FloatRectangle secondPaneBounds(0.0f, 0.0f, 0.0f, 0.0f);
1307 _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
1309 dividerPosition = __pSplitPanel->GetDividerPosition();
1311 clientBounds = __pSplitPanel->GetBoundsF();
1313 orientation = _ControlManager::GetInstance()->GetOrientation();
1315 if (GetDividerStyle() == SPLIT_PANEL_DIVIDER_STYLE_MOVABLE)
1317 GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, width);
1318 GET_SHAPE_CONFIG(SPLITPANEL::MOVABLE_DIVIDER_THICKNESS, orientation, height);
1322 GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, width);
1323 GET_SHAPE_CONFIG(SPLITPANEL::FIXED_DIVIDER_THICKNESS, orientation, height);
1326 if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
1328 height = clientBounds.height;
1332 __dividerRectangle = FloatRectangle(dividerPosition, 0.0f, width, height);
1337 width = clientBounds.width;
1341 __dividerRectangle = FloatRectangle(0.0f, dividerPosition, width, height);
1345 if (__pSplitPanel->GetDividerDirection() == SPLIT_PANEL_DIVIDER_DIRECTION_VERTICAL)
1347 firstPaneBounds = FloatRectangle(0.0f, 0.0f, __dividerRectangle.x, clientBounds.height);
1348 secondPaneBounds = FloatRectangle(__dividerRectangle.x + __dividerRectangle.width, 0.0f, clientBounds.width - __dividerRectangle.x - __dividerRectangle.width, clientBounds.height);
1352 firstPaneBounds = FloatRectangle(0.0f, 0.0f, clientBounds.width, __dividerRectangle.y);
1353 secondPaneBounds = FloatRectangle(0.0f, __dividerRectangle.y + __dividerRectangle.height, clientBounds.width, clientBounds.height - __dividerRectangle.y - __dividerRectangle.height);
1356 if (paneOrder == SPLIT_PANEL_PANE_ORDER_FIRST)
1358 return firstPaneBounds;
1361 return secondPaneBounds;
1364 VisualElementPropertyAnimation*
1365 _SplitPanelPresenter::GetVisualElementAnimation(Tizen::Base::String propertyName)
1367 result r = E_SUCCESS;
1368 VisualElementPropertyAnimation* pAnimation = null;
1370 const IVisualElementAnimationTimingFunction* pTimingFunction = VisualElementAnimation::GetTimingFunctionByName(__visualElementInterpolator);
1371 SysTryReturn(NID_UI_CTRL, pTimingFunction != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
1373 pAnimation = new (std::nothrow) VisualElementPropertyAnimation();
1374 SysTryReturn(NID_UI_CTRL, pAnimation != null, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
1376 r = pAnimation->SetPropertyName(propertyName);
1377 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating.");
1379 r = pAnimation->SetDuration(ANIMATION_DURATION);
1380 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "Propagating.");
1382 pAnimation->SetTimingFunction(pTimingFunction);
1383 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , GetLastResult(), "Propagating.");
1394 _SplitPanelPresenter::OnAnimationTransactionStarted(int transactionId)
1396 if (transactionId == __transactionIdRestore)
1398 VisualElement* pDividerVE = __pSplitPanel->GetDividerVisualElement();
1399 if (pDividerVE != null)
1401 pDividerVE->SetShowState(true);
1409 _SplitPanelPresenter::OnAnimationTransactionStopped(int transactionId)
1415 _SplitPanelPresenter::OnAnimationTransactionFinished(int transactionId)
1417 if (transactionId == __transactionIdMaximize)
1419 VisualElement* pDividerVE = __pSplitPanel->GetDividerVisualElement();
1420 if (pDividerVE != null)
1422 pDividerVE->SetShowState(false);
1429 }}} // Tizen::Ui::Controls