Add ImeOrientationAgent
authorChoi Munseok <ms47.choi@samsung.com>
Thu, 11 Apr 2013 10:05:38 +0000 (19:05 +0900)
committerChoi Munseok <ms47.choi@samsung.com>
Thu, 11 Apr 2013 10:05:38 +0000 (19:05 +0900)
Change-Id: Ic09f823b0fa8899c0812c5f2e84628491ba777b6
Signed-off-by: Choi Munseok <ms47.choi@samsung.com>
src/ui/CMakeLists.txt
src/ui/FUi_EcoreEvas.cpp
src/ui/FUi_ImeOrientationAgent.cpp [new file with mode: 0644]
src/ui/FUi_ImeOrientationAgent.h [new file with mode: 0644]
src/ui/controls/FUiCtrl_FormImpl.cpp
src/ui/controls/FUiCtrl_Frame.cpp
src/ui/controls/FUiCtrl_FrameImpl.cpp
src/ui/inc/FUiCtrl_FormImpl.h
src/ui/inc/FUiCtrl_FrameImpl.h
src/ui/inc/FUi_ControlImplManager.h

index 7e721eb..a08e633 100644 (file)
@@ -130,6 +130,7 @@ SET (${this_target}_SOURCE_FILES
        FUi_ControlImplManager.cpp
        FUi_ModalLoopManager.cpp
        FUi_OrientationAgent.cpp
+       FUi_ImeOrientationAgent.cpp
        FUiClipboard.cpp
        FUi_ClipboardImpl.cpp
        FUi_Clipboard.cpp
index 3a82037..55950a7 100644 (file)
@@ -51,6 +51,8 @@
 #include "FUiAnim_RootVisualElement.h"
 #include "FUiAnim_DisplayManager.h"
 #include "FUiCtrl_Frame.h"
+#include "FUiCtrl_FrameImpl.h"
+#include "FUiCtrl_FormImpl.h"
 #include "FUi_Clipboard.h"
 #include "FUi_TouchManager.h"
 #include "FUi_ControlManager.h"
@@ -485,6 +487,43 @@ OnClientMessageReceived(void* pData, int type, void* pEvent)
                }
        }
 
+       if (pClientEvent->message_type == ECORE_X_ATOM_E_WINDOW_ROTATION_CHANGE_REQUEST)
+       {
+               SysLog(NID_UI, "[Ime Rotation]");
+
+               _Window* pWindow = pControlManager->GetCurrentFrame();
+               if (pWindow)
+               {
+                       NativeWindowHandle handle = pWindow->GetNativeHandle();
+
+                       if (pClientEvent->win == handle)
+                       {
+                               int angle = pClientEvent->data.l[1];
+                               SysLog(NID_UI, "[Ime Rotation] Receive the client message(xid = 0x%x, angle = %d)", handle, angle);
+
+                               _Frame* pFrame = dynamic_cast<_Frame*>(pWindow);
+                               
+                               if (pFrame)
+                               {
+                                       _FrameImpl* pFrameImpl = static_cast<Controls::_FrameImpl*>(pFrame->GetUserData());
+                                       if (pFrameImpl)
+                                       {
+                                               _FormImpl* pCurrentFormImpl = pFrameImpl->GetCurrentForm();
+
+                                               if (pCurrentFormImpl)
+                                               {
+                                                       pCurrentFormImpl->UpdateOrientation(angle);
+                                               }
+                                               else
+                                               {
+                                                       pFrameImpl->UpdateOrientation(angle);
+                                               }
+                                       }
+                               }
+                       }
+               }
+       }
+
        return ECORE_CALLBACK_RENEW;
 }
 
diff --git a/src/ui/FUi_ImeOrientationAgent.cpp b/src/ui/FUi_ImeOrientationAgent.cpp
new file mode 100644 (file)
index 0000000..797e1ef
--- /dev/null
@@ -0,0 +1,211 @@
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file       FUi_ImeOrientationAgent.cpp
+ * @brief      This is the implementation file for the _ImeOrientationAgent class.
+ */
+
+#include <unique_ptr.h>
+#include <app.h>
+#include <Elementary.h>
+#include <FBaseSysLog.h>
+#include <FBaseColArrayList.h>
+#include "FUi_ImeOrientationAgent.h"
+#include "FUi_ControlManager.h"
+#include "FUi_ControlImplManager.h"
+#include "FUi_PublicOrientationEvent.h"
+#include "FUi_ControlImpl.h"
+#include "FUi_Window.h"
+#include "FUiCtrl_FormImpl.h"
+#include "FUiCtrl_FrameImpl.h"
+#include "FUiCtrl_Frame.h"
+#include "FUiCtrl_Form.h"
+#include "FUi_EcoreEvasMgr.h"
+#include "FUi_EcoreEvas.h"
+#include "FUi_ControlManager.h"
+#include "FUi_UiNotificationEvent.h"
+#include "FUi_UiEventManager.h"
+#include "FUiAnim_RootVisualElement.h"
+#include "FUiAnim_EflLayer.h"
+
+using namespace std;
+using namespace Tizen::Base;
+using namespace Tizen::Base::Collection;
+using namespace Tizen::Base::Runtime;
+using namespace Tizen::Ui::Controls;
+using namespace Tizen::Ui::Animations;
+using namespace Tizen::Graphics;
+
+namespace Tizen { namespace Ui {
+
+_ImeOrientationAgent*
+_ImeOrientationAgent::CreateInstanceN(Control& publicControl)
+{
+       SysLog(NID_UI, "[Ime Rotation]");
+
+       _ImeOrientationAgent* pAgent = new (std::nothrow) _ImeOrientationAgent(publicControl);
+       SysTryReturn(NID_UI, pAgent, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+
+       result r = GetLastResult();
+       SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+
+       SetLastResult(E_SUCCESS);
+
+       return pAgent;
+
+CATCH:
+       delete pAgent;
+       return null;
+}
+
+_ImeOrientationAgent::_ImeOrientationAgent(Control& publicControl)
+       : __publicControl(publicControl)
+       , __pPublicEvent(null)
+{
+       _PublicOrientationEvent* pPublicEvent = _PublicOrientationEvent::CreateInstanceN(publicControl);
+
+       result r = GetLastResult();
+       SysTryReturnVoidResult(NID_UI, pPublicEvent, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       __pPublicEvent = pPublicEvent;
+
+       SetLastResult(E_SUCCESS);
+}
+
+_ImeOrientationAgent::~_ImeOrientationAgent(void)
+{
+       if (__pPublicEvent)
+       {
+               delete __pPublicEvent;
+               __pPublicEvent = null;
+       }
+}
+
+void
+_ImeOrientationAgent::AddListener(IOrientationEventListener& listener)
+{
+       result r = __pPublicEvent->AddListener(listener);
+       SysTryReturnVoidResult(NID_UI, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       SetLastResult(E_SUCCESS);
+}
+
+void
+_ImeOrientationAgent::RemoveListener(IOrientationEventListener& listener)
+{
+       result r = __pPublicEvent->RemoveListener(listener);
+       SysTryReturnVoidResult(NID_UI, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
+
+       SetLastResult(E_SUCCESS);
+}
+
+void
+_ImeOrientationAgent::UpdateOrientation(int angle)
+{
+       SysLog(NID_UI, "[Ime Rotation]");
+
+       _ControlImpl* pImpl = _ControlImpl::GetInstance(__publicControl);
+       if (!pImpl)
+       {
+               return;
+       }
+
+       _Window* pRootWindow = pImpl->GetCore().GetRootWindow();
+       if (!pRootWindow)
+       {
+               return;
+       }
+
+       int rotation = angle;
+
+       OrientationStatus status = ORIENTATION_STATUS_NONE;
+       switch (rotation)
+       {
+       case 0:
+               status = ORIENTATION_STATUS_PORTRAIT;
+               break;
+       case 270:
+               status = ORIENTATION_STATUS_LANDSCAPE;
+               break;
+       case 180:
+               status = ORIENTATION_STATUS_PORTRAIT_REVERSE;
+               break;
+       case 90:
+               status = ORIENTATION_STATUS_LANDSCAPE_REVERSE;
+               break;
+       default:
+               break;
+       }
+
+       FireEvent(status);
+       pImpl->Invalidate(true);
+
+       _RootVisualElement* pRootVisualElement = pRootWindow->GetRootVisualElement();
+       if (!pRootVisualElement)
+       {
+               SysLog(NID_UI, "[Ime Rotation] The root visual element is null.");
+               return;
+       }
+
+       _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVisualElement->GetNativeLayer());
+       if (!pLayer)
+       {
+               SysLog(NID_UI, "[Ime Rotation] The efl layer is null.");
+               return;
+       }
+
+       Evas_Object* pWinObj = pLayer->GetElmWin();
+
+       if (pWinObj)
+       {
+               elm_win_rotation_with_resize_set(pWinObj, rotation);
+       }
+}
+
+void
+_ImeOrientationAgent::FireEvent(OrientationStatus status)
+{
+       ClearLastResult();
+
+       _ControlManager* pCoreManager = _ControlManager::GetInstance();
+       SysAssert(pCoreManager);
+
+       _ControlImpl* pImpl = _ControlImpl::GetInstance(__publicControl);
+       if (!pImpl)
+       {
+               return;
+       }
+
+       _ControlOrientation coreOrientation =
+               (status == ORIENTATION_STATUS_PORTRAIT || status == ORIENTATION_STATUS_PORTRAIT_REVERSE) ?
+               _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
+
+       _ControlImplManager* pImplManager = _ControlImplManager::GetInstance();
+       SysAssert(pImplManager);
+
+       // Core
+       pCoreManager->SetOrientation(coreOrientation);
+       pImplManager->SetOrientationStatus(status);
+       pImpl->GetCore().ChangeLayout(coreOrientation);
+
+       // Public
+       IEventArg* pArg = _PublicOrientationEvent::CreateOrientationEventArgN(*__pPublicEvent->GetSource(), status);
+       __pPublicEvent->Fire(*pArg);
+}
+
+}} // Tizen::Ui
diff --git a/src/ui/FUi_ImeOrientationAgent.h b/src/ui/FUi_ImeOrientationAgent.h
new file mode 100644 (file)
index 0000000..0e109da
--- /dev/null
@@ -0,0 +1,62 @@
+//
+// Open Service Platform
+// Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
+//
+// Licensed under the Flora License, Version 1.0 (the License);
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://floralicense.org/license/
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an AS IS BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+//
+
+/**
+ * @file       FUi_ImeOrientationAgent.h
+ * @brief      This is the header file for the _ImeOrientationAgent class.
+ *
+ * This header file contains the declarations of the %_ImeOrientationAgent class.
+ */
+
+#ifndef _FUI_INTERNAL_IME_ORIENTATION_AGENT_H_
+#define _FUI_INTERNAL_IME_ORIENTATION_AGENT_H_
+
+#include <FUiIOrientationEventListener.h>
+#include "FUi_Types.h"
+
+namespace Tizen { namespace Ui
+{
+
+class _PublicOrientationEvent;
+
+class _ImeOrientationAgent
+{
+public:
+       static _ImeOrientationAgent* CreateInstanceN(Control& publicControl);
+       ~_ImeOrientationAgent(void);
+
+       void AddListener(IOrientationEventListener& listener);
+       void RemoveListener(IOrientationEventListener& listener);
+
+       void UpdateOrientation(int angle);
+
+private:
+       void FireEvent(OrientationStatus status);
+
+       _ImeOrientationAgent(Control& publicControl);
+
+       _ImeOrientationAgent(const _ImeOrientationAgent& rhs);
+       _ImeOrientationAgent& operator =(const _ImeOrientationAgent& rhs);
+
+private:
+       Control& __publicControl;
+       _PublicOrientationEvent* __pPublicEvent;
+}; // _ImeOrientationAgent
+
+}} // Tizen::Ui
+
+#endif // _FUI_INTERNAL_IME_ORIENTATION_AGENT_H_
\ No newline at end of file
index f9975c6..fe12e1c 100644 (file)
@@ -33,6 +33,7 @@
 #include "FUi_EcoreEvas.h"
 #include "FUi_ControlImplManager.h"
 #include "FUi_OrientationAgent.h"
+#include "FUi_ImeOrientationAgent.h"
 #include "FUi_UiBuilder.h"
 #include "FUi_CoordinateSystemUtils.h"
 #include "FUi_DataBindingContextImpl.h"
@@ -100,20 +101,39 @@ _FormImpl::_FormImpl(Form* pPublic, _Form* pCore, Layout* pPublicPortraitLayout,
        , __pForm(null)
        , __pFormBackEventListener(null)
        , __pOriAgent(null)
+       , __pImeOriAgent(null)
        , __pLeftSoftkeyActionEvent(null)
        , __pRightSoftkeyActionEvent(null)
        , __pOptionMenuActionEvent(null)
 {
        __pForm = pCore;
 
-       __pOriAgent = _OrientationAgent::CreateInstanceN(*pPublic);
-       SysTryReturnVoidResult(NID_UI_CTRL, __pOriAgent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       int appType = _AppInfo::GetAppType();
+       if (appType == _APP_TYPE_IME_APP)
+       {
+               __pImeOriAgent = _ImeOrientationAgent::CreateInstanceN(*pPublic);
+               SysTryReturnVoidResult(NID_UI_CTRL, __pImeOriAgent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       }
+       else
+       {
+               __pOriAgent = _OrientationAgent::CreateInstanceN(*pPublic);
+               SysTryReturnVoidResult(NID_UI_CTRL, __pOriAgent != null, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       }
 }
 
 _FormImpl::~_FormImpl(void)
 {
-       delete __pOriAgent;
-       __pOriAgent = null;
+       if (__pImeOriAgent)
+       {
+               delete __pImeOriAgent;
+               __pImeOriAgent = null;
+       }
+
+       if (__pOriAgent)
+       {
+               delete __pOriAgent;
+               __pOriAgent = null;
+       }
 
        if (__pLeftSoftkeyActionEvent)
        {
@@ -685,7 +705,10 @@ _FormImpl::GetOverlayRegionN(const FloatRectangle& rect, OverlayRegionType regio
 void
 _FormImpl::OnDraw(void)
 {
-       __pOriAgent->FireOrientationEvent();
+       if (__pOriAgent)
+       {
+               __pOriAgent->FireOrientationEvent();
+       }
 
        _ContainerImpl::OnDraw();
 }
@@ -822,7 +845,14 @@ _FormImpl::SetFormBackEventListener(const IFormBackEventListener* pFormBackEvent
 void
 _FormImpl::AddOrientationEventListener(IOrientationEventListener& listener)
 {
-       __pOriAgent->AddListener(listener);
+       if (__pOriAgent)
+       {
+               __pOriAgent->AddListener(listener);
+       }
+       else if (__pImeOriAgent)
+       {
+               __pImeOriAgent->AddListener(listener);
+       }
 }
 
 void
@@ -875,7 +905,14 @@ _FormImpl::AddSoftkeyActionListener(Softkey softkey, const IActionEventListener&
 void
 _FormImpl::RemoveOrientationEventListener(IOrientationEventListener& listener)
 {
-       __pOriAgent->RemoveListener(listener);
+       if (__pOriAgent)
+       {
+               __pOriAgent->RemoveListener(listener);
+       }
+       else if (__pImeOriAgent)
+       {
+               __pImeOriAgent->RemoveListener(listener);
+       }
 }
 
 void
@@ -921,35 +958,65 @@ _FormImpl::RemoveSoftkeyActionListener(Softkey softkey, const IActionEventListen
 void
 _FormImpl::SetOrientation(Orientation orientation)
 {
-       __pOriAgent->SetMode(orientation);
+       if (__pOriAgent)
+       {
+               __pOriAgent->SetMode(orientation);
+       }
 }
 
 Orientation
 _FormImpl::GetOrientation(void) const
 {
-       return __pOriAgent->GetMode();
+       if (__pOriAgent)
+       {
+               return __pOriAgent->GetMode();
+       }
+
+       return ORIENTATION_NONE;
 }
 
 OrientationStatus
 _FormImpl::GetOrientationStatus(void) const
 {
-       return __pOriAgent->GetStatus();
+       if (__pOriAgent)
+       {
+               return __pOriAgent->GetStatus();
+       }
+
+       return ORIENTATION_STATUS_NONE;
 }
 
 void
 _FormImpl::UpdateOrientationStatus(bool draw)
 {
-       __pOriAgent->Update(draw);
+       if (__pOriAgent)
+       {
+               __pOriAgent->Update(draw);
+       }
 }
 
 #if defined(WINDOW_BASE_ROTATE)
 void
 _FormImpl::UpdateOrientation(void)
 {
-       __pOriAgent->UpdateOrientation();
+       if (__pOriAgent)
+       {
+               __pOriAgent->UpdateOrientation();
+       }
 }
 #endif
 
+void
+_FormImpl::UpdateOrientation(int angle)
+{
+       SysLog(NID_UI_CTRL, "[Ime Rotation]");
+
+       if (__pImeOriAgent)
+       {
+               __pImeOriAgent->UpdateOrientation(angle);
+       }
+}
+
 bool
 _FormImpl::HasOptionkey(void) const
 {
@@ -1434,7 +1501,10 @@ _FormImpl::OnAttachedToMainTree(void)
 
        UpdateOrientationStatus();
 
-       __pOriAgent->RequestOrientationEvent();
+       if (__pOriAgent)
+       {
+               __pOriAgent->RequestOrientationEvent();
+       }
 
        return r;
 }
@@ -1457,7 +1527,10 @@ _FormImpl::OnNotifiedN(const _ControlImpl& source, IList* pArgs)
        {
                if (*pString == _REQUEST_ORIENTATION_EVENT)
                {
-                       __pOriAgent->FireOrientationEvent();
+                       if (__pOriAgent)
+                       {
+                               __pOriAgent->FireOrientationEvent();
+                       }
 
                        pArgs->RemoveAll(true);
                        delete pArgs;
index 409506f..407763f 100644 (file)
@@ -23,6 +23,7 @@
 #include <FBaseErrorDefine.h>
 #include <FBaseInteger.h>
 #include <FBaseSysLog.h>
+#include <FApp_AppInfo.h>
 #include "FUi_UiNotificationEvent.h"
 #include "FUi_UiEventManager.h"
 #include "FUi_ControlManager.h"
@@ -40,6 +41,7 @@
 #include "FUiAnim_RootVisualElement.h"
 #include "FUiAnim_EflLayer.h"
 
+using namespace Tizen::App;
 using namespace Tizen::Ui::Animations;
 using namespace Tizen::Ui;
 using namespace Tizen::Base;
@@ -105,13 +107,23 @@ _Frame::CreateFrameN(void)
        result r = E_SUCCESS;
        _RootVisualElement* pRootVE = null;
        _EflLayer* pLayer = null;
+       int appType = _AppInfo::GetAppType();
 
        _Frame* pFrame = new (std::nothrow) _Frame;
        SysTryCatch(NID_UI_CTRL, pFrame, , E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
        SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
 
-       r = pFrame->CreateRootVisualElement();
-       SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+       if (appType == _APP_TYPE_IME_APP)
+       {
+               SysLog(NID_UI_CTRL, "[Ime Rotation]");
+               r = pFrame->CreateRootVisualElement(_WINDOW_TYPE_SUB);
+               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+       }
+       else
+       {
+               r = pFrame->CreateRootVisualElement();
+               SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
+       }
 
        pRootVE = pFrame->GetRootVisualElement();
        SysAssert(pRootVE);
@@ -622,6 +634,13 @@ _Frame::OnChildDetached(const _Control& child)
 result
 _Frame::OnBoundsChanging(const FloatRectangle& bounds)
 {
+       int appType = _AppInfo::GetAppType();
+       if (appType == _APP_TYPE_IME_APP)
+       {
+               SysLog(NID_UI_CTRL, "[Ime Rotation]");
+               return E_SUCCESS;
+       }
+
        if (__restore == false)
        {
                __floatingBounds = bounds;
index d50f9f9..b8b9d18 100644 (file)
 #include <FUiAnimFrameAnimator.h>
 #include <FUiCtrlIFrameEventListener.h>
 #include <FBaseSysLog.h>
+#include <FApp_AppInfo.h>
 #include "FUi_ControlManager.h"
 #include "FUi_OrientationAgent.h"
+#include "FUi_ImeOrientationAgent.h"
 #include "FUi_CoordinateSystemUtils.h"
 #include "FUiCtrlForm.h"
 #include "FUiCtrl_FrameImpl.h"
@@ -29,6 +31,7 @@
 #include "FUiCtrl_Frame.h"
 #include "FUiCtrl_PublicFrameEvent.h"
 
+using namespace Tizen::App;
 using namespace Tizen::Base;
 using namespace Tizen::Base::Collection;
 using namespace Tizen::Base::Runtime;
@@ -63,8 +66,17 @@ _FrameImpl::Dispose(void)
                __pFrameEvent = null;
        }
 
-       delete __pOrientationAgent;
-       __pOrientationAgent = null;
+       if (__pOrientationAgent)
+       {
+               delete __pOrientationAgent;
+               __pOrientationAgent = null;
+       }
+
+       if (__pImeOrientationAgent)
+       {
+               delete __pImeOrientationAgent;
+               __pImeOrientationAgent = null;
+       }
 
        delete __pFrameAnimator;
        __pFrameAnimator = null;
@@ -75,12 +87,22 @@ _FrameImpl::_FrameImpl(Frame* pPublic, _Frame* pCore)
        , __pFrameEvent(null)
        , __pFrameAnimator(null)
        , __pOrientationAgent(null)
+       , __pImeOrientationAgent(null)
 {
        __pFrameEvent = _PublicFrameEvent::CreateInstanceN(*pPublic);
        SysTryReturnVoidResult(NID_UI_CTRL, __pFrameEvent, GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
 
-       __pOrientationAgent = _OrientationAgent::CreateInstanceN(*pPublic);
-       SysTryCatch(NID_UI_CTRL, __pOrientationAgent != null, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       int appType = _AppInfo::GetAppType();
+       if (appType == _APP_TYPE_IME_APP)
+       {
+               __pImeOrientationAgent = _ImeOrientationAgent::CreateInstanceN(*pPublic);
+               SysTryCatch(NID_UI_CTRL, __pImeOrientationAgent != null, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       }
+       else
+       {
+               __pOrientationAgent = _OrientationAgent::CreateInstanceN(*pPublic);
+               SysTryCatch(NID_UI_CTRL, __pOrientationAgent != null, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
+       }
 
        return;
 
@@ -283,7 +305,10 @@ _FrameImpl::GetFrameAnimator(void) const
 void
 _FrameImpl::OnDraw(void)
 {
-       __pOrientationAgent->FireOrientationEvent();
+       if (__pOrientationAgent)
+       {
+               __pOrientationAgent->FireOrientationEvent();
+       }
 
        _WindowImpl::OnDraw();
 }
@@ -499,7 +524,10 @@ _FrameImpl::OnAttachedToMainTree(void)
        result r = _WindowImpl::OnAttachedToMainTree();
        SysTryReturn(NID_UI_CTRL, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
 
-       __pOrientationAgent->RequestOrientationEvent();
+       if (__pOrientationAgent)
+       {
+               __pOrientationAgent->RequestOrientationEvent();
+       }
 
        return r;
 }
@@ -512,7 +540,10 @@ _FrameImpl::OnNotifiedN(const _ControlImpl& source, IList* pArgs)
        {
                if (*pString == _REQUEST_ORIENTATION_EVENT)
                {
-                       __pOrientationAgent->FireOrientationEvent();
+                       if (__pOrientationAgent)
+                       {
+                               __pOrientationAgent->FireOrientationEvent();
+                       }
 
                        pArgs->RemoveAll(true);
                        delete pArgs;
@@ -527,31 +558,58 @@ _FrameImpl::OnNotifiedN(const _ControlImpl& source, IList* pArgs)
 void
 _FrameImpl::AddOrientationEventListener(Tizen::Ui::IOrientationEventListener& listener)
 {
-       __pOrientationAgent->AddListener(listener);
+       if (__pOrientationAgent)
+       {
+               __pOrientationAgent->AddListener(listener);
+       }
+       else if (__pImeOrientationAgent)
+       {
+               __pImeOrientationAgent->AddListener(listener);
+       }
 }
 
 void
 _FrameImpl::RemoveOrientationEventListener(Tizen::Ui::IOrientationEventListener& listener)
 {
-       __pOrientationAgent->RemoveListener(listener);
+       if (__pOrientationAgent)
+       {
+               __pOrientationAgent->RemoveListener(listener);
+       }
+       else if (__pImeOrientationAgent)
+       {
+               __pImeOrientationAgent->RemoveListener(listener);
+       }
 }
 
 void
 _FrameImpl::SetOrientation(Orientation orientation)
 {
-       __pOrientationAgent->SetMode(orientation);
+       if (__pOrientationAgent)
+       {
+               __pOrientationAgent->SetMode(orientation);
+       }
 }
 
 Orientation
 _FrameImpl::GetOrientation(void) const
 {
-       return __pOrientationAgent->GetMode();
+       if (__pOrientationAgent)
+       {
+               return __pOrientationAgent->GetMode();
+       }
+
+       return ORIENTATION_NONE;
 }
 
 OrientationStatus
 _FrameImpl::GetOrientationStatus(void) const
 {
-       return __pOrientationAgent->GetStatus();
+       if (__pOrientationAgent)
+       {
+               return __pOrientationAgent->GetStatus();
+       }
+
+       return ORIENTATION_STATUS_NONE;
 }
 
 bool
@@ -563,17 +621,34 @@ _FrameImpl::IsChildAttachable(_ControlImpl& child) const
 void
 _FrameImpl::UpdateOrientationStatus(void)
 {
-       __pOrientationAgent->Update();
+       if (__pOrientationAgent)
+       {
+               __pOrientationAgent->Update();
+       }
 }
 
 #if defined(WINDOW_BASE_ROTATE)
 void
 _FrameImpl::UpdateOrientation(void)
 {
-       __pOrientationAgent->UpdateOrientation();
+       if (__pOrientationAgent)
+       {
+               __pOrientationAgent->UpdateOrientation();
+       }
 }
 #endif
 
+void
+_FrameImpl::UpdateOrientation(int angle)
+{
+       SysLog(NID_UI_CTRL, "[Ime Rotation]");
+
+       if (__pImeOrientationAgent)
+       {
+               __pImeOrientationAgent->UpdateOrientation(angle);
+       }
+}
+
 bool
 _FrameImpl::IsOpaque(void) const
 {
index e8ff97c..8626ce1 100644 (file)
@@ -25,6 +25,7 @@
 namespace Tizen { namespace Ui {
 class DataBindingContext;
 class _OrientationAgent;
+class _ImeOrientationAgent;
 }} // Tizen::Ui
 
 namespace Tizen { namespace Ui { namespace Controls {
@@ -123,6 +124,7 @@ public:
 #if defined(WINDOW_BASE_ROTATE)
        void UpdateOrientation(void);
 #endif
+       void UpdateOrientation(int angle);
 
        // Invoked by operations
        virtual void OnChangeLayout(Tizen::Ui::_ControlOrientation orientation);
@@ -174,6 +176,7 @@ private:
        IFormBackEventListener* __pFormBackEventListener;
 
        Tizen::Ui::_OrientationAgent* __pOriAgent;
+       Tizen::Ui::_ImeOrientationAgent* __pImeOriAgent;
        Tizen::Ui::Controls::_PublicActionEvent* __pLeftSoftkeyActionEvent;
        Tizen::Ui::Controls::_PublicActionEvent* __pRightSoftkeyActionEvent;
        Tizen::Ui::Controls::_PublicActionEvent* __pOptionMenuActionEvent;
index b484034..d6f8c55 100644 (file)
@@ -24,6 +24,7 @@
 
 namespace Tizen { namespace Ui {
 class _OrientationAgent;
+class _ImeOrientationAgent;
 } } // Tizen::Ui
 
 namespace Tizen { namespace Ui { namespace Animations {
@@ -71,6 +72,7 @@ public:
 #if defined(WINDOW_BASE_ROTATE)
        void UpdateOrientation(void);
 #endif
+       void UpdateOrientation(int angle);
 
 // Callback
        virtual void OnDraw(void);
@@ -112,6 +114,7 @@ private:
        _PublicFrameEvent* __pFrameEvent;
        Tizen::Ui::Animations::FrameAnimator* __pFrameAnimator;
        Tizen::Ui::_OrientationAgent* __pOrientationAgent;
+       Tizen::Ui::_ImeOrientationAgent* __pImeOrientationAgent;
 }; // _FrameImpl
 
 }}}    // Tizen::Ui::Controls
index 77e2182..b9dbd22 100644 (file)
@@ -66,6 +66,7 @@ private:
        _WindowImpl* __pFrameImpl;
        static _ControlImplManager* __pInstance;
        friend class _OrientationAgent;
+       friend class _ImeOrientationAgent;
 }; // _ControlImplManager
 
 }} // Tizen::Ui