From 3c3594de2199bf676677b2ecb8ec26f5746c69d7 Mon Sep 17 00:00:00 2001 From: Keuckdo Bang Date: Sun, 24 Mar 2013 17:18:04 +0900 Subject: [PATCH] Apply new indicator UI. Change-Id: I10ebebfaee0a50bd830f913c34bea7c196136850 --- src/ui/FUi_ControlManager.cpp | 6 ++ src/ui/controls/FUiCtrl_Form.cpp | 36 +++++----- src/ui/controls/FUiCtrl_FormImpl.cpp | 26 ++++++- src/ui/controls/FUiCtrl_Indicator.cpp | 110 ++++++++++++++++++++++++++++- src/ui/inc/FUiCtrl_Indicator.h | 1 + src/ui/inc/FUi_ControlManager.h | 1 + src/ui/resource/FUi_ResourceFormConfig.cpp | 10 +++ 7 files changed, 168 insertions(+), 22 deletions(-) diff --git a/src/ui/FUi_ControlManager.cpp b/src/ui/FUi_ControlManager.cpp index bf8e9b1..7dc3bc5 100644 --- a/src/ui/FUi_ControlManager.cpp +++ b/src/ui/FUi_ControlManager.cpp @@ -923,6 +923,12 @@ _ControlManager::SetOrientationStatus(_ControlRotation orientationStatus) __orientationStatus = orientationStatus; } +_ControlRotation +_ControlManager::GetOrientationStatus(void) const +{ + return __orientationStatus; +} + void _ControlManager::RotateScreen(const _Control& control, _ControlRotation screenRotation) { diff --git a/src/ui/controls/FUiCtrl_Form.cpp b/src/ui/controls/FUiCtrl_Form.cpp index c787553..7ec3058 100644 --- a/src/ui/controls/FUiCtrl_Form.cpp +++ b/src/ui/controls/FUiCtrl_Form.cpp @@ -1072,28 +1072,10 @@ _Form::SetFormStyle(unsigned long formStyle) GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight); __pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, indicatorwidth, indicatorheight)); - r = AttachSystemChild(*__pIndicator); - SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); r = GetLastResult(); SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); } - if (_FORM_STYLE_INDICATOR & formStyle) - { - r = SetIndicatorShowState(true); - SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); - } - else if(FORM_STYLE_INDICATOR_AUTO_HIDE & formStyle) - { - r = SetIndicatorShowState(false, true); - r = GetLastResult(); - SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); - } - else - { - r = SetIndicatorShowState(false); - SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); - } } result @@ -2195,7 +2177,14 @@ _Form::GetIndicatorBounds(void) const int indicatorwidth = GetClientBounds().width; int indicatorheight = 0; - GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight); + if (GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT) + { + GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight); + } + else + { + GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, GetOrientation(), indicatorheight); + } Rectangle rect (0, 0, indicatorwidth, indicatorheight); @@ -2222,7 +2211,14 @@ _Form::GetIndicatorBoundsF(void) const float indicatorwidth = GetClientBoundsF().width; float indicatorheight = 0.0f; - GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight); + if (GetOrientation() == _CONTROL_ORIENTATION_PORTRAIT) + { + GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, GetOrientation(), indicatorheight); + } + else + { + GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, GetOrientation(), indicatorheight); + } FloatRectangle rect (0.0f, 0.0f, indicatorwidth, indicatorheight); diff --git a/src/ui/controls/FUiCtrl_FormImpl.cpp b/src/ui/controls/FUiCtrl_FormImpl.cpp index 095e044..3512884 100644 --- a/src/ui/controls/FUiCtrl_FormImpl.cpp +++ b/src/ui/controls/FUiCtrl_FormImpl.cpp @@ -296,9 +296,21 @@ _FormImpl::SetFormStyle(unsigned long formStyle) if (FORM_STYLE_INDICATOR & formStyle) { + GetCore().SetIndicatorShowState(true); indicatorBounds = GetCore().GetIndicatorBoundsF(); r = GetLastResult(); SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); + + } + else if(FORM_STYLE_INDICATOR_AUTO_HIDE & formStyle) + { + r = GetCore().SetIndicatorShowState(false, true); + SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); + } + else + { + r = GetCore().SetIndicatorShowState(false); + SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); } if (formStyle & FORM_STYLE_HEADER) @@ -348,6 +360,10 @@ _FormImpl::SetFormStyle(unsigned long formStyle) } } + _Indicator* pIndicator = GetCore().GetIndicator(); + r = GetCore().AttachSystemChild(*pIndicator); + SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r)); + if (formStyle & FORM_STYLE_TEXT_TAB) { float titleHeight = 0.0f; @@ -1040,7 +1056,15 @@ _FormImpl::OnChangeLayout(_ControlOrientation orientation) _Indicator* pIndicator = GetCore().GetIndicator(); if (pIndicator) { - pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight)); + if (orientation == _CONTROL_ORIENTATION_PORTRAIT) + { + pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight)); + } + else + { + GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, GetCore().GetOrientation(), indicatorheight); + pIndicator->SetBounds(FloatRectangle(0.0f, 0.0f, GetClientBoundsF().width, indicatorheight)); + } } GetCore().AdjustClientBounds(); } diff --git a/src/ui/controls/FUiCtrl_Indicator.cpp b/src/ui/controls/FUiCtrl_Indicator.cpp index 0386b6b..662c321 100644 --- a/src/ui/controls/FUiCtrl_Indicator.cpp +++ b/src/ui/controls/FUiCtrl_Indicator.cpp @@ -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(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 diff --git a/src/ui/inc/FUiCtrl_Indicator.h b/src/ui/inc/FUiCtrl_Indicator.h index 234c2ed..e4e167c 100644 --- a/src/ui/inc/FUiCtrl_Indicator.h +++ b/src/ui/inc/FUiCtrl_Indicator.h @@ -61,6 +61,7 @@ public: virtual result OnAttachedToMainTree(void); virtual void OnTimerExpired(Tizen::Base::Runtime::Timer& timer); static void OnDisconnected(Ecore_Evas *pEe); + static void OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *data, int size); private: _Indicator(const _Indicator& value); diff --git a/src/ui/inc/FUi_ControlManager.h b/src/ui/inc/FUi_ControlManager.h index f792708..adc16b5 100644 --- a/src/ui/inc/FUi_ControlManager.h +++ b/src/ui/inc/FUi_ControlManager.h @@ -114,6 +114,7 @@ public: // Do not use. System only. void SetOrientationStatus(_ControlRotation orientationStatus); + _ControlRotation GetOrientationStatus(void) const; void RotateScreen(const _Control& control, _ControlRotation screenRotation); void OnScreenRotated(int rotation); void OnWindowRotated(int rotation); diff --git a/src/ui/resource/FUi_ResourceFormConfig.cpp b/src/ui/resource/FUi_ResourceFormConfig.cpp index 3715b82..e47321c 100644 --- a/src/ui/resource/FUi_ResourceFormConfig.cpp +++ b/src/ui/resource/FUi_ResourceFormConfig.cpp @@ -46,5 +46,15 @@ START_UI_CONFIG(FORM); ADD_SHAPE_CONFIG(INDICATOR_HEIGHT, 60); END_UI_CONFIG_MODE(1280x720); + START_UI_CONFIG_MODE(1280x720); + ADD_SHAPE_CONFIG(INDICATOR_MINIMIZE_WIDTH, _SCREEN_HEIGHT_); + ADD_SHAPE_CONFIG(INDICATOR_MINIMIZE_HEIGHT, 21); + END_UI_CONFIG_MODE(1280x720); + + START_UI_CONFIG_MODE(800x480); + ADD_SHAPE_CONFIG(INDICATOR_MINIMIZE_WIDTH, _SCREEN_HEIGHT_); + ADD_SHAPE_CONFIG(INDICATOR_MINIMIZE_HEIGHT, 14); + END_UI_CONFIG_MODE(800x480); + } END_UI_CONFIG(FORM); -- 2.7.4