Logic that setting type of indicator when setting currentform.
authorKeuckdo Bang <keuckdo.bang@samsung.net>
Thu, 25 Apr 2013 23:58:21 +0000 (08:58 +0900)
committerKeuckdo Bang <keuckdo.bang@samsung.net>
Thu, 25 Apr 2013 23:58:21 +0000 (08:58 +0900)
Change-Id: Ic5402b522d01414269d7472d55ed9f2553fd403a

src/ui/controls/FUiCtrl_Form.cpp
src/ui/controls/FUiCtrl_FormImpl.cpp
src/ui/controls/FUiCtrl_Indicator.cpp
src/ui/inc/FUiCtrl_Form.h
src/ui/inc/FUiCtrl_FormImpl.h
src/ui/inc/FUi_ControlImplManager.h

index 633af5e..760f8bc 100644 (file)
@@ -82,6 +82,7 @@ _Form::_Form(void)
        , __updatedSoftkeyCount(0)
        , __keypadShowstate(false)
        , __clipboardShowstate(false)
+       , __pFormOrientationstatusEventListener(null)
 {
        Color color;
        result r = GET_COLOR_CONFIG(FORM::BG_NORMAL,color);
@@ -3293,4 +3294,19 @@ _Form::OnVisibleStateChanged(void)
        }
 }
 
+void
+_Form::SetFormOrientationStatusEventListener(_IFormOrientationStatusEventListener* pFormOrientationstatusEventListener)
+{
+       __pFormOrientationstatusEventListener = pFormOrientationstatusEventListener;
+}
+
+Tizen::Ui::OrientationStatus
+_Form::GetFormOrientationStatus(void) const
+{
+       if (__pFormOrientationstatusEventListener)
+       {
+               return __pFormOrientationstatusEventListener->OnFormOrientationStatusRequested();
+       }
+}
+
 }}} // Tizen::Ui::Controls
index 3041031..67f6cd3 100644 (file)
@@ -195,6 +195,8 @@ _FormImpl::CreateFormImplN(Form* pControl, Layout* pPublicPortraitLayout, Layout
        }
        SysAssert(r == E_SUCCESS);
 
+       pCore->SetFormOrientationStatusEventListener(pImpl);
+
        // Make surface opaque.
        pVisualElement = pCore->GetVisualElement();
        SysTryCatch(NID_UI_CTRL, pVisualElement, , GetLastResult(), "[%s] Propagating.", GetErrorMessage(GetLastResult()));
@@ -1608,6 +1610,17 @@ _FormImpl::OnFormBackRequested(Tizen::Ui::Controls::_Form& source)
        }
 }
 
+OrientationStatus
+_FormImpl::OnFormOrientationStatusRequested(void)
+{
+       _ControlImplManager* pImplManager = _ControlImplManager::GetInstance();
+       SysAssert(pImplManager);
+
+       OrientationStatus status = pImplManager->GetOrientationStatus(GetOrientation());
+       return status;
+}
+
+
 bool
 _FormImpl::IsOpaque(void) const
 {
index 87d7f04..4604e13 100644 (file)
@@ -279,21 +279,25 @@ _Indicator::AddIndicatorObject(_Form* pForm)
        ecore_evas_callback_msg_handle_set(pPortraitEe, _Indicator::OnMessageHandle);
        ecore_evas_callback_msg_handle_set(pLandscapeEe, _Indicator::OnMessageHandle);
 
-       _ControlRotation controlRotation = _ControlManager::GetInstance()->GetOrientationStatus();
-       int rotation = 0;
+       OrientationStatus status = ORIENTATION_STATUS_PORTRAIT;
+       if (pForm)
+       {
+               status = pForm->GetFormOrientationStatus();
+       }
 
-       switch(controlRotation)
+       int rotation = 0;
+       switch(status)
        {
-       case _CONTROL_ROTATION_0 :
+       case ORIENTATION_STATUS_PORTRAIT :
                rotation = 0;
                break;
-       case _CONTROL_ROTATION_90 :
+       case ORIENTATION_STATUS_LANDSCAPE :
                rotation = 90;
                break;
-       case _CONTROL_ROTATION_180 :
+       case ORIENTATION_STATUS_PORTRAIT_REVERSE :
                rotation = 180;
                break;
-       case _CONTROL_ROTATION_270 :
+       case ORIENTATION_STATUS_LANDSCAPE_REVERSE :
                rotation = 270;
                break;
        default :
index 7951c7d..b7dc35a 100644 (file)
@@ -24,6 +24,7 @@
 #define _FUI_CTRL_INTERNAL_FORM_H_
 
 #include <unique_ptr.h>
+#include <FUiIOrientationEventListener.h>
 #include <FUiCtrlControlsTypes.h>
 #include <FUiCtrlOverlayRegion.h>
 #include "FUi_Control.h"
@@ -64,6 +65,18 @@ enum _Softkey
        _SOFTKEY_COUNT   /**< This is internal. If used in an application, the application can get rejected during the certification process. Define the softkey count */
 };
 
+class _IFormOrientationStatusEventListener
+       : virtual public Tizen::Base::Runtime::IEventListener
+{
+       // Lifecycle
+       public:
+               virtual ~_IFormOrientationStatusEventListener(void) {}
+
+       // Operation
+       public:
+               virtual Tizen::Ui::OrientationStatus OnFormOrientationStatusRequested(void) = 0;
+};
+
 /**
  * @class _Form
  * @brief
@@ -194,6 +207,9 @@ public:
        result SetNotificationTrayOpenEnabled(bool enable);
        bool IsNotificationTrayOpenEnabled(void) const;
 
+       void SetFormOrientationStatusEventListener(Tizen::Ui::Controls::_IFormOrientationStatusEventListener* pFormOrientationstatusEventListener);
+       Tizen::Ui::OrientationStatus GetFormOrientationStatus(void) const;
+
 //callback
        virtual void OnDraw(void);
        virtual void OnActionPerformed(const Tizen::Ui::_Control& source, int actionId);
@@ -276,6 +292,8 @@ private:
        Tizen::Graphics::Bitmap* __pSoftkeyPressedIcon[_SOFTKEY_COUNT+1];
        Tizen::Graphics::Bitmap* __pSoftkeyHighlightedIcon[_SOFTKEY_COUNT+1];
 
+       Tizen::Ui::Controls::_IFormOrientationStatusEventListener* __pFormOrientationstatusEventListener;
+
        //Back button action ID
        static const int ID_BACK_BUTTON = -10;
 
index 4ec0497..1e4e52f 100644 (file)
@@ -40,6 +40,7 @@ class _OSP_EXPORT_ _FormImpl
        , public Tizen::Ui::Controls::_IActionEventListener
        , public Tizen::Ui::Controls::_IFormBackEventListener
        , virtual public Tizen::Base::Runtime::IEventListener
+       , public _IFormOrientationStatusEventListener
 {
 public:
        class FormSizeInfo : public _ControlImpl::SizeInfo
@@ -147,6 +148,8 @@ public:
 
        virtual void OnFormBackRequested(Tizen::Ui::Controls::_Form& source);
 
+       virtual Tizen::Ui::OrientationStatus OnFormOrientationStatusRequested(void);
+
        static const _FormImpl* GetInstance(const Form& form);
 
        static _FormImpl* GetInstance(Form& form);
index 7bdbb72..a590b38 100644 (file)
@@ -50,11 +50,11 @@ public:
 
        void OnScreenRotated(int rotation);
        OrientationStatus GetFormOrientationStatus(_ControlImpl *pControlImpl);
+       OrientationStatus GetOrientationStatus(Orientation mode) const;
 
 private:
        void SetOrientationStatus(OrientationStatus orientationStatus);
        static void RotateScreen(_ControlImpl* pControlImpl, OrientationStatus orientationStatus);
-       OrientationStatus GetOrientationStatus(Orientation mode) const;
 
 private:
        _ControlImplManager(void);