Apply new indicator UI.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_Indicator.cpp
index 0386b6b..662c321 100644 (file)
@@ -49,6 +49,19 @@ static const char* pLandPublicKey = "__Plug_Ecore_Evas_Land";
 static const char* pIndicatorKey = "Inidcator_Manager_Object";
 static const int CONNECTION_INTERVAL = 1000;
 
+#define MSG_DOMAIN_CONTROL_INDICATOR 0x10001
+#define MSG_ID_INDICATOR_REPEAT_EVENT 0x10002
+#define MSG_ID_INDICATOR_ROTATION 0x10003
+#define MSG_ID_INDICATOR_OPACITY 0X1004
+#define MSG_ID_INDICATOR_TYPE 0X1005
+
+typedef enum
+{
+   INDICATOR_TYPE_UNKNOWN, /**< Unknown indicator type mode */
+   INDICATOR_TYPE_1, /**< Type 0 the the indicator */
+   INDICATOR_TYPE_2, /**< Type 1 the indicator */
+} IndicatorTypeMode;
+
 _Indicator*
 _Indicator::CreateIndicator(void)
 {
@@ -133,7 +146,16 @@ _Indicator::SetIndicatorOpacity(_IndicatorOpacity opacity)
        }
        else if (opacity == _INDICATOR_OPACITY_TRANSLUCENT)
        {
-               SetBackgroundColor(0x7f000000);
+               _ControlOrientation orientation = GetOrientation();
+
+               if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
+               {
+                       SetBackgroundColor(0x7f000000);
+               }
+               else
+               {
+                       SetBackgroundColor(0x00000000);
+               }
        }
 
        __opacity = opacity;
@@ -250,6 +272,30 @@ _Indicator::AddIndicatorObject(_Form* pForm)
        ecore_evas_data_set(pEe, pIndicatorKey, this);
        ecore_evas_callback_delete_request_set(pEe, _Indicator::OnDisconnected);
 
+       ecore_evas_callback_msg_handle_set(pEe, _Indicator::OnMessageHandle);
+
+       _ControlRotation controlRotation = _ControlManager::GetInstance()->GetOrientationStatus();
+       int rotation = 0;
+
+       switch(controlRotation)
+       {
+       case _CONTROL_ROTATION_0 :
+               rotation = 0;
+               break;
+       case _CONTROL_ROTATION_90 :
+               rotation = 90;
+               break;
+       case _CONTROL_ROTATION_180 :
+               rotation = 180;
+               break;
+       case _CONTROL_ROTATION_270 :
+               rotation = 270;
+               break;
+       default :
+               break;
+       }
+       ecore_evas_msg_parent_send(pEe, MSG_DOMAIN_CONTROL_INDICATOR, MSG_ID_INDICATOR_ROTATION, &rotation, sizeof(int));
+
        return r;
 }
 
@@ -308,11 +354,38 @@ _Indicator::OnChangeLayout(_ControlOrientation orientation)
        if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
        {
                ChangeCurrentVisualElement(__pPortraitVisualElement);
+               SetClipChildrenEnabled(true);
        }
        else
        {
                ChangeCurrentVisualElement(__pLandscapeVisualElement);
+               SetClipChildrenEnabled(false);
+       }
+       SetIndicatorOpacity(__opacity);
+
+       _ControlRotation controlRotation = _ControlManager::GetInstance()->GetOrientationStatus();
+       int rotation = 0;
+       Ecore_Evas *pEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
+       SysTryReturnVoidResult(NID_UI_CTRL, pEe, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
+
+       switch(controlRotation)
+       {
+       case _CONTROL_ROTATION_0 :
+               rotation = 0;
+               break;
+       case _CONTROL_ROTATION_90 :
+               rotation = 90;
+               break;
+       case _CONTROL_ROTATION_180 :
+               rotation = 180;
+               break;
+       case _CONTROL_ROTATION_270 :
+               rotation = 270;
+               break;
+       default :
+               break;
        }
+       ecore_evas_msg_parent_send(pEe, MSG_DOMAIN_CONTROL_INDICATOR, MSG_ID_INDICATOR_ROTATION, &rotation, sizeof(int));
 }
 
 result
@@ -431,4 +504,39 @@ _Indicator::IsNotificationTrayOpenEnabled(void) const
     }
 }
 
+void
+_Indicator::OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *data, int size)
+{
+       if (!data)
+       {
+               return;
+       }
+
+       if (msgDomain == MSG_DOMAIN_CONTROL_INDICATOR)
+       {
+               /*if (msg_id == MSG_ID_INDICATOR_REPEAT_EVENT)
+               {
+                       int *repeat = static_cast<int*>(data);
+               }*/
+               if (msgId == MSG_ID_INDICATOR_TYPE)
+               {
+                       IndicatorTypeMode *pIndicatorTypeMode = (IndicatorTypeMode*)(data);
+
+                       _Window* pWindow =      _ControlManager::GetInstance()->_ControlManager::GetCurrentFrame();
+                       SysTryReturnVoidResult(NID_UI_CTRL, pWindow, E_INVALID_STATE, "[E_INVALID_STATE] Indicator is not attached main tree.");
+
+                       Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
+
+                       if (*pIndicatorTypeMode == INDICATOR_TYPE_1)
+                       {
+                         ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
+                       }
+                       else if (*pIndicatorTypeMode == INDICATOR_TYPE_2)
+                       {
+                         ecore_x_e_illume_indicator_type_set   (win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
+                       }
+               }
+       }
+}
+
 }}} // Tizen::Ui::Controls