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.
18 * @file FUiCtrl_Frame.cpp
19 * @brief This is the implementation file for the _Frame class.
23 #include <FBaseErrorDefine.h>
24 #include <FBaseInteger.h>
25 #include <FBaseSysLog.h>
26 #include <FApp_AppInfo.h>
27 #include "FUi_UiNotificationEvent.h"
28 #include "FUi_UiEventManager.h"
29 #include "FUi_ControlManager.h"
30 #include "FUi_EcoreEvasMgr.h"
31 #include "FUi_EcoreEvas.h"
32 #include "FUi_TouchManager.h"
33 #include "FUi_CoordinateSystemUtils.h"
34 #include "FUiCtrl_Frame.h"
35 #include "FUiCtrl_FramePresenter.h"
36 #include "FUiCtrl_FrameEvent.h"
37 #include "FUiCtrl_IFrameEventListener.h"
38 #include "FUiCtrl_IFormActivationChangeEventListener.h"
39 #include "FUiCtrl_Form.h"
40 #include "FUiCtrl_FormImpl.h"
41 #include "FUiCtrl_FrameImpl.h"
42 #include "FUiAnim_VisualElement.h"
43 #include "FUiAnim_RootVisualElement.h"
44 #include "FUiAnim_EflLayer.h"
45 #include "FUi_AccessibilityManager.h"
47 using namespace Tizen::App;
48 using namespace Tizen::Ui::Animations;
49 using namespace Tizen::Ui;
50 using namespace Tizen::Ui::Controls;
51 using namespace Tizen::Base;
52 using namespace Tizen::Base::Collection;
53 using namespace Tizen::Base::Runtime;
54 using namespace Tizen::Graphics;
56 namespace Tizen { namespace Ui { namespace Controls {
58 const wchar_t* _ACTIVATE_FRAME = L"ActivateFrame";
61 : __pFramePresenter(null)
63 , __floatingBounds(0.0f, 0.0f, 0.0f, 0.0f)
64 , __floatingOrientation(_CONTROL_ORIENTATION_PORTRAIT)
65 , __showMode(FRAME_SHOW_MODE_FULL_SCREEN)
69 , __constructed(false)
71 , __changingBoundsEnabled(true)
72 , __skipSetBounds(false)
73 , __pFormActivationChangeEventListener(null)
75 _FramePresenter* pPresenter = new (std::nothrow) _FramePresenter(*this);
76 SysTryReturnVoidResult(NID_UI_CTRL, pPresenter, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
78 FloatDimension screen = _ControlManager::GetInstance()->GetScreenSizeF();
79 __floatingBounds.width = screen.width;
80 __floatingBounds.height = screen.height;
82 __pFrameEvent = _FrameEvent::CreateInstanceN(*this);
83 SysTryCatch(NID_UI_CTRL, __pFrameEvent, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
85 SetPresenter(*pPresenter);
86 SetClipChildrenEnabled(false);
101 delete __pFrameEvent;
102 __pFrameEvent = null;
105 delete __pFramePresenter;
106 __pFramePresenter = null;
112 _Frame::CreateFrameN(void)
114 result r = E_SUCCESS;
115 _RootVisualElement* pRootVE = null;
116 _EflLayer* pLayer = null;
117 int appType = _AppInfo::GetAppType();
119 _Frame* pFrame = new (std::nothrow) _Frame;
120 SysTryCatch(NID_UI_CTRL, pFrame, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
121 SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
123 if (appType & _APP_TYPE_IME_APP)
125 SysLog(NID_UI_CTRL, "[Ime Rotation]");
126 r = pFrame->CreateRootVisualElement(_WINDOW_TYPE_SUB);
127 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
131 r = pFrame->CreateRootVisualElement();
132 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
135 pRootVE = pFrame->GetRootVisualElement();
138 pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer());
141 if (!(appType & _APP_TYPE_IME_APP))
143 pLayer->SetOpacity(1);
146 pFrame->AcquireHandle();
148 GetEcoreEvasMgr()->GetEcoreEvas()->SetDragAndDropEnabled(*pFrame);
149 #if defined(PARTIAL_SCREEN)
150 GetEcoreEvasMgr()->GetEcoreEvas()->SetPartialScreenEnabled(*pFrame);
153 SetLastResult(E_SUCCESS);
164 _Frame::SetPresenter(const _FramePresenter& framePresenter)
166 __pFramePresenter = const_cast <_FramePresenter*>(&framePresenter);
174 if (__pFramePresenter)
176 __pFramePresenter->Draw();
181 _Frame::OnActivated(void)
183 SysLog(NID_UI, "activated(%d)", __activated);
185 _Window::OnActivated();
187 _Form* pCurrentForm = GetCurrentForm();
188 if (pCurrentForm == null)
193 pCurrentForm->AddIndicatorObject();
194 pCurrentForm->ActivateIndicator();
196 SetFocusWindowActivationChecked(true);
197 _Control* pFocusControl = pCurrentForm->GetFocusControl();
200 pFocusControl->SetFocused();
204 pCurrentForm->SetFocused();
206 SetFocusWindowActivationChecked(false);
207 _AccessibilityManager::GetInstance()->RequestAutoReading(_ACCESSIBILITY_AUTO_READING_MODE_FIRST_ITEM);
212 _Frame::OnDeactivated(void)
214 SysLog(NID_UI, "deactivated(%d)", __activated);
216 _Window::OnDeactivated();
218 _Form* pCurrentForm = GetCurrentForm();
219 if (pCurrentForm == null)
224 pCurrentForm->DeactivateIndicator();
230 _Frame::OnNotifiedN(const _Control& source, IList* pArgs)
232 SysTryReturn(NID_UI_CTRL, pArgs, false, E_SYSTEM, "[E_SYSTEM] pArgs is null.")
234 String* pType = dynamic_cast <String*>(pArgs->GetAt(0));
235 SysTryReturn(NID_UI_CTRL, pType, false, E_SYSTEM, "[E_SYSTEM] pType is null.")
237 if (*pType == L"VisibilityEvent")
241 Integer* pObscured = dynamic_cast<Integer*>(pArgs->GetAt(1));
242 if (pObscured == null)
244 pArgs->RemoveAll(true);
250 obscured = pObscured->ToInt();
253 SetNativeWindowActivated(true);
259 SetNativeWindowActivated(false);
261 OnFrameDeactivated();
264 pArgs->RemoveAll(true);
269 else if (*pType == _ACTIVATE_FRAME)
271 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
274 pEcoreEvas->ActivateWindow(*this);
277 pArgs->RemoveAll(true);
287 _Frame::OnFrameActivated(void)
289 int childcount = GetChildCount();
291 for (int i = 0 ; i < childcount ; i++)
293 _Control* pChild = GetChild(i);
294 _Form* pForm = dynamic_cast<_Form*>(pChild);
297 pForm->MoveOverlayRegion(true);
302 IEventArg* pArg = _FrameEvent::CreateFrameEventArgN(*this, _FRAME_STATUS_ACTIVATED);
303 __pFrameEvent->Fire(*pArg);
305 if (GetChildCount() < 1)
307 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
308 SysTryReturnVoidResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas");
310 if (GetShowMode() == FRAME_SHOW_MODE_FULL_SCREEN)
312 pEcoreEvas->SetIndicatorShowState(*GetRootWindow(), false);
318 _Frame::OnFrameDeactivated(void)
320 int childcount = GetChildCount();
322 for (int i = 0 ; i < childcount ; i++)
324 _Control* pChild = GetChild(i);
325 _Form* pForm = dynamic_cast<_Form*>(pChild);
328 pForm->MoveOverlayRegion(false);
333 IEventArg* pArg = _FrameEvent::CreateFrameEventArgN(*this, _FRAME_STATUS_DEACTIVATED);
334 __pFrameEvent->Fire(*pArg);
336 _TouchManager* pTouchManager = _TouchManager::GetInstance();
339 pTouchManager->SetTouchCanceled(null);
344 _Frame::OnFrameMinimized(void)
346 IEventArg* pArg = _FrameEvent::CreateFrameEventArgN(*this, _FRAME_STATUS_MINIMIZED);
347 __pFrameEvent->Fire(*pArg);
351 _Frame::OnFrameRestored(void)
355 IEventArg* pArg = _FrameEvent::CreateFrameEventArgN(*this, _FRAME_STATUS_RESTORED);
356 __pFrameEvent->Fire(*pArg);
360 _Frame::SetCurrentForm(const _Form* pForm)
362 result r = E_SUCCESS;
364 SysTryReturnVoidResult(NID_UI_CTRL, pForm != null, E_INVALID_ARG, "[E_INVALID_ARG] Form to become a new current form is null");
365 _Form* pNewForm = const_cast<_Form*>(pForm);
367 _Form* pCurrentForm = GetCurrentForm();
368 pNewForm->AddIndicatorObject();
370 if (pCurrentForm != null)
372 if (pCurrentForm != pForm)
375 r = MoveChildToTop(*pForm);
376 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
377 pNewForm->MoveOverlayRegion(true);
379 pCurrentForm->SetVisibleState(false);
380 pCurrentForm->MoveOverlayRegion(false);
382 pCurrentForm->OnFormDeactivated();
384 if (__pFormActivationChangeEventListener)
386 __pFormActivationChangeEventListener->OnFormDeactivated(*pCurrentForm);
391 pNewForm->SetVisibleState(true);
392 pNewForm->OnFormActivated();
393 _Control* pFocus = pNewForm->GetFocusControl();
396 pFocus->SetFocused();
400 pNewForm->SetFocused();
402 _Control* pFocusTraversalControl = pNewForm->GetFocusTraversalControl();
403 if (pFocusTraversalControl)
405 pFocusTraversalControl->OnTraversalControlFocusGained();
407 pNewForm->SetUpdateLayoutState(true);
409 if (__pFormActivationChangeEventListener)
411 __pFormActivationChangeEventListener->OnFormActivated(*pNewForm);
414 SetLastResult(E_SUCCESS);
420 _Frame::GetCurrentForm(void) const
422 _Form* pCurrentForm = null;
423 int controlCount = GetChildCount();
425 if (controlCount > 0)
427 for (int i = controlCount; i > 0; i--)
429 pCurrentForm = dynamic_cast<_Form*>(GetChild(i - 1));
430 SysTryReturn(NID_UI_CTRL, pCurrentForm != null, null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
431 if (pCurrentForm->IsVisible())
442 _Frame::IsOrientationRoot(void) const
448 _Frame::SetRotation(bool rotation)
450 __rotation = rotation;
454 _Frame::AddFrameEventListener(const _IFrameEventListener& listener)
456 __constructed = true;
458 result r = __pFrameEvent->AddListener(listener);
459 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
463 _Frame::RemoveFrameEventListener(const _IFrameEventListener& listener)
465 result r = E_SUCCESS;
469 r = __pFrameEvent->RemoveListener(listener);
472 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
476 _Frame::SetFormActivationChangeEventListener(const _IFormActivationChangeEventListener* plistener)
478 __pFormActivationChangeEventListener = const_cast<_IFormActivationChangeEventListener*>(plistener);
483 _Frame::SetFloatingBounds(const FloatRectangle& rect)
485 __floatingBounds = rect;
489 _Frame::SetFloatingBounds(const Rectangle& rect)
491 __floatingBounds = _CoordinateSystemUtils::ConvertToFloat(rect);
495 _Frame::SetFloatingOrientation(_ControlOrientation orientation)
497 if ((__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
499 __floatingOrientation = orientation;
504 _Frame::SetShowMode(FrameShowMode showMode)
506 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
507 SysTryReturnResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "The method cannot proceed due to a severe system error.");
509 if (showMode == FRAME_SHOW_MODE_MINIMIZED)
511 if (__minimized == true)
516 pEcoreEvas->MinimizeWindow(*GetRootWindow());
523 if (__minimized == true)
529 bool changeMode = true;
531 if ((showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
533 _Form* pCurrentForm = GetCurrentForm();
537 if (pCurrentForm->GetFormStyle() & _FORM_STYLE_INDICATOR)
544 SysTryReturnResult(NID_UI_CTRL, changeMode == true, E_SYSTEM, "The method cannot proceed due to a severe system error.");
546 int oldShowMode = __showMode;
547 __showMode = showMode;
550 // App decides floating bounds directly.
552 if ((__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
554 _ControlOrientation orientation = _CONTROL_ORIENTATION_PORTRAIT;
555 _Form* pCurForm = GetCurrentForm();
558 orientation = pCurForm->GetOrientation();
562 orientation = GetOrientation();
565 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
567 if (__floatingOrientation == _CONTROL_ORIENTATION_LANDSCAPE)
569 FloatDimension screenSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
570 FloatPoint prevPoint(__floatingBounds.x, __floatingBounds.y);
571 FloatPoint curPoint(prevPoint.x, prevPoint.y);
572 float ratio = screenSize.width / screenSize.height;
574 if (prevPoint.x > 0.0f)
576 curPoint.x = prevPoint.x * ratio;
579 if (prevPoint.y > 0.0f)
581 curPoint.y = prevPoint.y / ratio;
584 __floatingBounds.x = curPoint.x;
585 __floatingBounds.y = curPoint.y;
590 if (__floatingOrientation == _CONTROL_ORIENTATION_PORTRAIT)
592 FloatDimension screenSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
593 FloatPoint prevPoint(__floatingBounds.x, __floatingBounds.y);
594 FloatPoint curPoint(prevPoint.x, prevPoint.y);
595 float ratio = screenSize.width / screenSize.height;
597 if (prevPoint.x > 0.0f)
599 curPoint.x = prevPoint.x / ratio;
602 if (prevPoint.y > 0.0f)
604 curPoint.y = prevPoint.y * ratio;
607 __floatingBounds.x = curPoint.x;
608 __floatingBounds.y = curPoint.y;
614 result r = E_SUCCESS;
615 Rectangle floatingBounds = _CoordinateSystemUtils::ConvertToInteger(__floatingBounds);
618 case FRAME_SHOW_MODE_FULL_SCREEN:
619 if (oldShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING)
621 r = pEcoreEvas->SetFloatingMode(*GetRootWindow(), false);
622 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
625 if (oldShowMode != FRAME_SHOW_MODE_FULL_SCREEN)
627 FloatDimension screen = _ControlManager::GetInstance()->GetScreenSizeF();
631 if (__skipSetBounds == false)
633 if (GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT)
635 SetBounds(FloatRectangle(0.0f, 0.0f, screen.width, screen.height));
639 SetBounds(FloatRectangle(0.0f, 0.0f, screen.height, screen.width));
646 SetChangedPositionByUser(false);
649 case FRAME_SHOW_MODE_PARTIAL_SCREEN:
650 SysLog(NID_UI, "[WM ROTATION]<M>[WIN 0x%x] Set floating bounds(%d, %d, %d, %d).",
651 GetNativeHandle(), floatingBounds.x, floatingBounds.y, floatingBounds.width, floatingBounds.height);
652 if (oldShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING)
654 r = pEcoreEvas->SetFloatingMode(*GetRootWindow(), false);
655 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
658 if (oldShowMode == FRAME_SHOW_MODE_FULL_SCREEN)
660 SetBounds(__floatingBounds);
662 else if (oldShowMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING)
664 pEcoreEvas->SetWindowBounds(*GetRootWindow(), _CoordinateSystemUtils::ConvertToInteger(__floatingBounds));
668 case FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING:
669 SysLog(NID_UI, "[WM ROTATION]<M>[WIN 0x%x] Set floating bounds(%d, %d, %d, %d).",
670 GetNativeHandle(), floatingBounds.x, floatingBounds.y, floatingBounds.width, floatingBounds.height);
671 if (oldShowMode != FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING)
673 r = pEcoreEvas->SetFloatingMode(*GetRootWindow(), true);
674 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
677 if (oldShowMode == FRAME_SHOW_MODE_FULL_SCREEN)
679 if (IsChangedPositionByUser() == true)
681 SetBounds(__floatingBounds);
685 SetSize(FloatDimension(__floatingBounds.width, __floatingBounds.height));
694 if ((__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN) || (__showMode == FRAME_SHOW_MODE_PARTIAL_SCREEN_FLOATING))
696 _Form* pCurForm = GetCurrentForm();
699 __floatingOrientation = pCurForm->GetOrientation();
703 __floatingOrientation = GetOrientation();
711 _Frame::GetShowMode(bool minimize) const
715 if (__minimized == true)
717 return FRAME_SHOW_MODE_MINIMIZED;
731 _Frame::IsFrameActivated(void) const
737 _Frame::OnChildAttached(const _Control& child)
739 _Form* pCurrentForm = GetCurrentForm();
741 if (pCurrentForm == &child)
743 int controlCount = GetChildCount();
745 if (controlCount > 1)
747 _Control* pOldCurrentForm = GetChild(controlCount - 2);
748 SysTryReturnVoidResult(NID_UI_CTRL, pOldCurrentForm != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
749 pOldCurrentForm->SetVisibleState(false);
755 _Frame::OnChildDetached(const _Control& child)
757 int controlCount = GetChildCount();
759 if (controlCount > 0)
761 _Control* pCurrentForm = GetChild(controlCount - 1);
762 SysTryReturnVoidResult(NID_UI_CTRL, pCurrentForm, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
763 pCurrentForm->SetVisibleState(true);
767 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
768 SysTryReturnVoidResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas");
769 pEcoreEvas->SetIndicatorShowState(*GetRootWindow(), false);
774 _Frame::OnBoundsChanging(const FloatRectangle& bounds)
776 int appType = _AppInfo::GetAppType();
777 if (appType & _APP_TYPE_IME_APP)
779 SysLog(NID_UI_CTRL, "[Ime Rotation]");
783 if (__restore == false)
785 __floatingBounds = bounds;
788 if ((__showMode == FRAME_SHOW_MODE_FULL_SCREEN) && (__restore == false))
790 if (__constructed == false)
796 if (__rotation == true)
802 return E_UNSUPPORTED_OPERATION;
807 if (__changingBoundsEnabled == false)
812 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
813 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
814 bool changePosition = IsChangedPositionByUser();
815 SysLog(NID_UI_CTRL, "[WM ROTATION]<M>[WIN 0x%x] IsChangedPositionByUser = %d", GetNativeHandle(), changePosition);
816 pEcoreEvas->SetWindowBounds(*GetRootWindow(), _CoordinateSystemUtils::ConvertToInteger(bounds), (changePosition ? false : true));
817 result r = GetLastResult();
818 SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
825 _Frame::OnAttached(void)
827 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
828 SysAssert(pEcoreEvas);
830 pEcoreEvas->SetWindowVisibleState(*GetRootWindow(), true);
836 _Frame::OnBackgroundColorChanged(Color& backgroundColor)
838 _RootVisualElement* pRootVE = GetRootVisualElement();
841 _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer());
844 byte alpha = backgroundColor.GetAlpha();
845 float opacity = static_cast<float>(alpha) / 255.0f;
847 pLayer->SetOpacity(opacity);
850 FrameShowMode showMode = GetShowMode(false);
851 __skipSetBounds = true;
852 SetShowMode(FRAME_SHOW_MODE_FULL_SCREEN);
853 __skipSetBounds = false;
855 SetShowMode(showMode);
857 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
863 Orientation mode = ORIENTATION_PORTRAIT;
865 _Form* pCurrentForm = GetCurrentForm();
868 _FormImpl* pFormImpl = static_cast<_FormImpl*>(pCurrentForm->GetUserData());
871 mode = pFormImpl->GetOrientation();
876 _FrameImpl* pFrameImpl = static_cast<_FrameImpl*>(GetUserData());
879 mode = pFrameImpl->GetOrientation();
885 case ORIENTATION_PORTRAIT:
886 pEcoreEvas->SetWindowPreferredRotation(*this, 0, true);
888 case ORIENTATION_LANDSCAPE:
889 pEcoreEvas->SetWindowPreferredRotation(*this, 270, true);
891 case ORIENTATION_PORTRAIT_REVERSE:
892 pEcoreEvas->SetWindowPreferredRotation(*this, 180, true);
894 case ORIENTATION_LANDSCAPE_REVERSE:
895 pEcoreEvas->SetWindowPreferredRotation(*this, 90, true);
897 case ORIENTATION_AUTOMATIC:
899 pEcoreEvas->SetWindowPreferredRotation(*this, -1);
900 int autoRotation[3] = {0, 90, 270};
901 pEcoreEvas->SetWindowAvailabledRotation(*this, autoRotation, 3, true);
904 case ORIENTATION_AUTOMATIC_FOUR_DIRECTION:
906 pEcoreEvas->SetWindowPreferredRotation(*this, -1);
907 int autoFourRotation[4] = {0, 90, 180, 270};
908 pEcoreEvas->SetWindowAvailabledRotation(*this, autoFourRotation, 4, true);
917 _Frame::ResetFocusList(void)
919 Tizen::Ui::Controls::_Form* pCurrentForm = GetCurrentForm();
922 pCurrentForm->ResetFocusList();
927 _Frame::GetFocusControl(const _Control* pControl) const
929 const _Form* pForm = null;
930 _Frame* pFrame = null;
931 const _Control* pTempControl = pControl;
934 pForm = dynamic_cast<_Form*>(const_cast<_Control*>(pTempControl));
938 pFrame = dynamic_cast<_Frame*>(pForm->GetParent());
945 pTempControl = pTempControl->GetParent();
950 pTempControl = pTempControl->GetParent();
955 return pForm->GetFocusControl();
961 _Frame::GetCurrentFocusControl(void) const
963 _Form* pForm = GetCurrentForm();
966 return pForm->GetFocusControl();
971 _Frame::SetFocusControl(const _Control* pControl , bool on)
973 SysTryReturnVoidResult(NID_UI, pControl, E_SYSTEM, "[E_SYSTEM] The pControl cannot be NULL.");
974 _ControlManager* pControlMgr = _ControlManager::GetInstance();
975 SysAssert(pControlMgr);
977 _Form* pCurrentForm = GetCurrentForm();
978 _Frame* pFrame = null;
979 const _Control* pTempControl = pControl;
980 bool isCurrentForm = false;
984 pForm = dynamic_cast<_Form*>(const_cast<_Control*>(pTempControl));
988 pFrame = dynamic_cast<_Frame*>(pForm->GetParent());
995 pTempControl = pTempControl->GetParent();
1000 pTempControl = pTempControl->GetParent();
1004 if (pForm == pCurrentForm)
1006 isCurrentForm = true;
1013 pForm->SetFocusControl(pControl);
1014 if (isCurrentForm && pFrame && pFrame->IsActivated())
1016 pControlMgr->SetFocusControl(*pControl);
1021 pControlMgr->SetFocusControl(*this, false);
1022 pForm->SetFocused();
1028 _Frame::SetChangingBoundsEnabled(bool enable)
1030 __changingBoundsEnabled = enable;
1034 _Frame::SetPartialScreenEnabled(bool enable)
1036 #if defined(PARTIAL_SCREEN)
1037 _RootVisualElement* pRootVE = GetRootVisualElement();
1040 _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer());
1043 pLayer->SetConfigured(true);
1044 SysLog(NID_UI_CTRL, "[WM ROTATION]<P>[WIN 0x%x] enable = %d", GetNativeHandle(), enable);
1051 __showMode = FRAME_SHOW_MODE_PARTIAL_SCREEN;
1055 SetShowMode(FRAME_SHOW_MODE_FULL_SCREEN);
1059 Tizen::Base::Collection::IListT<_Control*>*
1060 _Frame::GetFocusList(void) const
1062 _Form* pForm = GetCurrentForm();
1065 return pForm->GetFocusList();
1071 _Frame::GetFocusTraversalControl(_Control* pControl) const
1073 _Form* pForm = null;
1074 _Control* pTempControl = pControl;
1075 _Frame* pFrame = null;
1078 pForm = dynamic_cast<_Form*>(const_cast<_Control*>(pTempControl));
1082 pFrame = dynamic_cast<_Frame*>(pForm->GetParent());
1089 pTempControl = pTempControl->GetParent();
1094 pTempControl = pTempControl->GetParent();
1100 return pForm->GetFocusTraversalControl();
1106 _Frame::SetFocusTraversalControl(_Control* pControl, bool on)
1108 _Form* pForm = null;
1109 _Control* pTempControl = pControl;
1110 _Frame* pFrame = null;
1113 pForm = dynamic_cast<_Form*>(const_cast<_Control*>(pTempControl));
1117 pFrame = dynamic_cast<_Frame*>(pForm->GetParent());
1124 pTempControl = pTempControl->GetParent();
1129 pTempControl = pTempControl->GetParent();
1137 pForm->SetFocusTraversalControl(pControl);
1141 pForm->SetFocusTraversalControl(pForm);
1147 _Frame::IsChildAttachable(_Control& child) const
1149 return (dynamic_cast<_Form*>(&child) != null);
1152 }}} // Tizen::Ui::Controls