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_Indicator.cpp
19 * @brief This is the implementation file for the _Form class.
22 #include <FGrpRectangle.h>
23 #include <FUiAnimAnimationTransaction.h>
24 #include <FUiAnimVisualElementPropertyAnimation.h>
25 #include <FGrp_CoordinateSystem.h>
26 #include <FUiAnim_VisualElementSurfaceImpl.h>
27 #include "FUiAnim_VisualElement.h"
28 #include "FUiAnim_VisualElementImpl.h"
29 #include "FUiAnim_EflNode.h"
30 #include "FUi_EcoreEvasMgr.h"
31 #include "FUi_EcoreEvas.h"
32 #include "FUi_ResourceManager.h"
33 #include "FUi_CoordinateSystemUtils.h"
34 #include "FUi_UiEventManager.h"
35 #include "FUi_Window.h"
36 #include "FUi_TouchManager.h"
37 #include "FUiCtrl_Form.h"
38 #include "FUiCtrl_Indicator.h"
39 #include "FUiCtrl_IndicatorManager.h"
40 #include "FUiAnim_EflVisualElementSurfaceImpl.h"
42 using namespace Tizen::Base::Runtime;
43 using namespace Tizen::Graphics;
44 using namespace Tizen::Ui;
45 using namespace Tizen::Ui::Animations;
49 const char* pPortraitSvcName = "elm_indicator_portrait";
50 const char* pLandScapeSvcName = "elm_indicator_landscape";
51 const char* pPortPublicKey = "__Plug_Ecore_Evas_Port";
52 const char* pLandPublicKey = "__Plug_Ecore_Evas_Land";
53 const char* pIndicatorKey = "Inidcator_Manager_Object";
54 const int CONNECTION_INTERVAL = 1000;
55 const int ANIMATION_INTERVAL = 3000;
56 const int ANIMATION_DURATION = 200;
58 const int MSG_DOMAIN_CONTROL_INDICATOR = 0x10001;
59 const int MSG_ID_INDICATOR_REPEAT_EVENT = 0x10002;
60 const int MSG_ID_INDICATOR_ROTATION = 0x10003;
61 const int MSG_ID_INDICATOR_OPACITY = 0X1004;
62 const int MSG_ID_INDICATOR_TYPE = 0X1005;
63 const int MSG_ID_INDICATOR_START_ANIMATION = 0X10006;
66 namespace Tizen { namespace Ui { namespace Controls
69 struct _IndicatorDataAnimation
77 _INDICATOR_TYPE_UNKNOWN, /**< Unknown indicator type mode */
78 _INDICATOR_TYPE_1, /**< Type 0 the the indicator */
79 _INDICATOR_TYPE_2, /**< Type 1 the indicator */
83 _Indicator::CreateIndicator(void)
86 Color bgColor(0xff343432);
88 _Indicator* pIndicator = new (std::nothrow) _Indicator;
89 SysTryReturn(NID_UI_CTRL, pIndicator, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
90 SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
92 r = pIndicator->ConstructControlVisualElement();
93 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
95 pIndicator->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
104 _Indicator::_Indicator(void)
105 : __pPortraitIndicatorEvasObject(null)
106 , __pLandscapeIndicatorEvasObject(null)
107 , __pConnectionTimer(null)
108 , __pAnimationTimer(null)
109 , __pPortraitVisualElement(null)
110 , __pLandscapeVisualElement(null)
111 , __pCurrentVisualElement(null)
114 , __portraitautohide(false)
115 , __landscapeautohide(false)
116 , __opacity(_INDICATOR_OPACITY_OPAQUE)
117 , __orientation(_CONTROL_ORIENTATION_PORTRAIT)
118 , __startTouchPoint(0.0f, 0.0f)
119 , __animationing(false)
120 , __touchPressed(false)
121 , __quickpanelOpened(false)
125 _Indicator::~_Indicator(void)
127 if (__pConnectionTimer != null)
129 __pConnectionTimer->Cancel();
130 delete __pConnectionTimer;
131 __pConnectionTimer = null;
134 if (__pAnimationTimer != null)
136 __pAnimationTimer->Cancel();
137 delete __pAnimationTimer;
138 __pAnimationTimer = null;
141 _UiEventManager::GetInstance()->RemoveTouchEventListener(*this);
145 _Indicator::SetIndicatorShowState(bool state)
147 result r = E_SUCCESS;
149 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
150 SysTryReturnResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas");
152 Ecore_X_Window win = 0;
156 r = pEcoreEvas->SetIndicatorShowState(*__pWindow, state);
157 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
158 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
167 SetIndicatorOpacity(__opacity);
174 _Indicator::SetIndicatorAutoHide(bool portrait, bool landscape)
176 Ecore_X_Window win = 0;
179 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
182 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
186 Color bgColor(0x00000000);
187 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
188 if (__pPortraitVisualElement)
190 __pPortraitVisualElement->SetShowState(false);
192 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
193 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
197 SetIndicatorOpacity(__opacity);
198 if (__pPortraitVisualElement)
200 __pPortraitVisualElement->SetShowState(true);
202 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
203 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
210 Color bgColor(0x00000000);
211 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
212 if (__pLandscapeVisualElement)
214 __pLandscapeVisualElement->SetShowState(false);
216 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
217 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
221 SetIndicatorOpacity(__opacity);
222 if (__pLandscapeVisualElement)
224 __pLandscapeVisualElement->SetShowState(true);
226 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
227 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
230 __portraitautohide = portrait;
231 __landscapeautohide = landscape;
236 _Indicator::SetIndicatorOpacity(_IndicatorOpacity opacity)
238 result r = E_SUCCESS;
240 if (opacity == _INDICATOR_OPACITY_OPAQUE)
242 Color bgColor(0xff1e1e1e);
243 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
245 else if (opacity == _INDICATOR_OPACITY_TRANSLUCENT)
247 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
249 Color bgColor(0x7f000000);
250 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
254 Color bgColor(0x00000000);
255 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
265 _Indicator::GetIndicatorShowState(void) const
271 _Indicator::GetIndicatorOpacity(void) const
273 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
275 if (__portraitautohide)
277 return _INDICATOR_OPACITY_TRANSPARENT;
282 if (__landscapeautohide)
284 return _INDICATOR_OPACITY_TRANSPARENT;
292 _Indicator::GetIndicatorAutoHide(void) const
294 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
296 return __portraitautohide;
300 return __landscapeautohide;
306 _Indicator::GetIndicatorBounds(void) const
308 const Dimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSize();
309 const Dimension landscapeSize = Dimension(portraitSize.height, portraitSize.width);
311 Rectangle indicatorbounds(0, 0, 0, 0);
313 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
315 indicatorbounds.width = portraitSize.width;
319 indicatorbounds.width = landscapeSize.width;
321 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
323 _CoordinateSystem* pCoordSystem = _CoordinateSystem::GetInstance();
324 SysTryReturn(NID_UI_CTRL, pCoordSystem, Rectangle(-1, -1, -1, -1), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
326 _ICoordinateSystemTransformer* pXformer = pCoordSystem->GetTransformer();
327 SysTryReturn(NID_UI_CTRL, pXformer, Rectangle(-1, -1, -1, -1), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
329 indicatorbounds = pXformer->Transform(indicatorbounds);
331 return indicatorbounds;
335 _Indicator::GetIndicatorBoundsF(void) const
337 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
338 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
340 FloatRectangle indicatorbounds(0.0f, 0.0f, 0.0f, 0.0f);
342 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
344 indicatorbounds.width = portraitSize.width;
348 indicatorbounds.width = landscapeSize.width;
351 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
353 _CoordinateSystem* pCoordSystem = _CoordinateSystem::GetInstance();
354 SysTryReturn(NID_UI_CTRL, pCoordSystem, FloatRectangle(-1.0, -1.0, -1.0, -1.0), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
356 _ICoordinateSystemTransformer* pXformer = pCoordSystem->GetTransformer();
357 SysTryReturn(NID_UI_CTRL, pXformer, FloatRectangle(-1.0, -1.0, -1.0, -1.0), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
359 indicatorbounds = pXformer->Transform(indicatorbounds);
361 return indicatorbounds;
365 _Indicator::AddIndicatorObject(_Control* pControl, _Window* pWindow)
367 result r = E_SUCCESS;
371 __pPortraitVisualElement = _IndicatorManager::GetInstance()->GetIndicatorVisualElement(pWindow, _INDICATOR_ORIENTATION_PORTRAIT, pControl);
372 SysTryReturn(NID_UI_CTRL, __pPortraitVisualElement, null, E_SYSTEM, "[E_SYSTEM] Indicator can not create the surface.");
373 __pLandscapeVisualElement = _IndicatorManager::GetInstance()->GetIndicatorVisualElement(pWindow, _INDICATOR_ORIENTATION_LANDSCAPE, pControl);
374 SysTryReturn(NID_UI_CTRL, __pLandscapeVisualElement, null, E_SYSTEM, "[E_SYSTEM] Indicator can not create the surface.");
375 __pPortraitIndicatorEvasObject = _IndicatorManager::GetInstance()->GetEvasObject(pWindow, pControl, _INDICATOR_ORIENTATION_PORTRAIT);
376 SysTryReturn(NID_UI_CTRL, __pPortraitIndicatorEvasObject, null, E_SYSTEM, "[E_SYSTEM] Indicator can not get the Evas_Object.");
377 __pLandscapeIndicatorEvasObject = _IndicatorManager::GetInstance()->GetEvasObject(pWindow, pControl, _INDICATOR_ORIENTATION_LANDSCAPE);
378 SysTryReturn(NID_UI_CTRL, __pLandscapeIndicatorEvasObject, null, E_SYSTEM, "[E_SYSTEM] Indicator can not get the Evas_Object.");
380 _ControlOrientation orientation = pControl->GetOrientation();
381 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
383 r = ChangeCurrentVisualElement(__pPortraitVisualElement);
387 r = ChangeCurrentVisualElement(__pLandscapeVisualElement);
390 Ecore_Evas *pPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
391 SysTryReturn(NID_UI_CTRL, pPortraitEe, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
392 Ecore_Evas *pLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
393 SysTryReturn(NID_UI_CTRL, pLandscapeEe, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
395 ecore_evas_data_set(pPortraitEe, pPortPublicKey, __pPortraitIndicatorEvasObject);
396 ecore_evas_data_set(pLandscapeEe, pLandPublicKey, __pLandscapeIndicatorEvasObject);
397 ecore_evas_data_set(pPortraitEe, pIndicatorKey, this);
398 ecore_evas_data_set(pLandscapeEe, pIndicatorKey, this);
399 ecore_evas_callback_delete_request_set(pPortraitEe, _Indicator::OnDisconnected);
400 ecore_evas_callback_delete_request_set(pLandscapeEe, _Indicator::OnDisconnected);
402 ecore_evas_callback_msg_handle_set(pPortraitEe, _Indicator::OnMessageHandle);
403 ecore_evas_callback_msg_handle_set(pLandscapeEe, _Indicator::OnMessageHandle);
411 _Indicator::DeleteIndicatorObject(void)
413 result r = E_SUCCESS;
415 r = _IndicatorManager::GetInstance()->ReleaseIndicatorVisualElement(__pWindow, _INDICATOR_ORIENTATION_PORTRAIT, __pPortraitVisualElement);
416 r = _IndicatorManager::GetInstance()->ReleaseIndicatorVisualElement(__pWindow, _INDICATOR_ORIENTATION_LANDSCAPE, __pLandscapeVisualElement);
418 if (__pPortraitVisualElement)
420 if (__pPortraitVisualElement == __pCurrentVisualElement)
422 r = DetachChild(*__pPortraitVisualElement);
425 if (__pLandscapeVisualElement)
427 if (__pLandscapeVisualElement == __pCurrentVisualElement)
429 r = DetachChild(*__pLandscapeVisualElement);
433 Ecore_Evas *pPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
434 Ecore_Evas *pLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
438 ecore_evas_callback_delete_request_set(pPortraitEe, null);
439 ecore_evas_callback_msg_handle_set(pPortraitEe, null);
444 ecore_evas_callback_delete_request_set(pLandscapeEe, null);
445 ecore_evas_callback_msg_handle_set(pLandscapeEe, null);
448 __pPortraitIndicatorEvasObject = null;
449 __pLandscapeIndicatorEvasObject = null;
450 __pPortraitVisualElement = null;
451 __pLandscapeVisualElement = null;
452 __pCurrentVisualElement = null;
458 _Indicator::ChangeCurrentVisualElement(Tizen::Ui::Animations::_VisualElement* pVisualElement)
460 result r = E_SUCCESS;
462 if (!(__pCurrentVisualElement == pVisualElement))
464 r = AttachChild(*pVisualElement);
465 if (__pCurrentVisualElement)
467 r = DetachChild(*__pCurrentVisualElement);
469 __pCurrentVisualElement = pVisualElement;
476 _Indicator::OnChangeLayout(_ControlOrientation orientation)
478 RemoveIndicatorAnimations();
479 if (__pAnimationTimer != null)
481 __pAnimationTimer->Cancel();
482 __animationing = false;
485 Ecore_X_Window win = 0;
488 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
491 __orientation = orientation;
493 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
495 ChangeCurrentVisualElement(__pPortraitVisualElement);
496 SetClipChildrenEnabled(true);
498 if (__portraitautohide)
500 Color bgColor(0x00000000);
501 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
502 if (__pPortraitVisualElement)
504 __pPortraitVisualElement->SetShowState(false);
506 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
507 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
511 SetIndicatorOpacity(__opacity);
512 if (__pPortraitVisualElement)
514 __pPortraitVisualElement->SetShowState(true);
516 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
517 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
523 ChangeCurrentVisualElement(__pLandscapeVisualElement);
524 SetClipChildrenEnabled(false);
526 if (__landscapeautohide)
528 Color bgColor(0x00000000);
529 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
530 if (__pLandscapeVisualElement)
532 __pLandscapeVisualElement->SetShowState(false);
534 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
535 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
539 SetIndicatorOpacity(__opacity);
540 if (__pLandscapeVisualElement)
542 __pLandscapeVisualElement->SetShowState(true);
544 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
545 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
551 _Indicator::OnAttachedToMainTree(void)
553 result r = E_SUCCESS;
555 if (__pCurrentVisualElement)
557 r = ChangeCurrentVisualElement(__pCurrentVisualElement);
564 _Indicator::OnTimerExpired(Timer& timer)
566 if (__pConnectionTimer == &timer)
568 Eina_Bool result = EINA_TRUE;
570 _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
571 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
573 result = ecore_evas_extn_plug_connect(__pPortraitIndicatorEvasObject, pPortraitSvcName, 0, EINA_FALSE);
577 result = ecore_evas_extn_plug_connect(__pLandscapeIndicatorEvasObject, pLandScapeSvcName, 0, EINA_FALSE);
580 if (result == EINA_TRUE)
586 timer.Start(CONNECTION_INTERVAL);
589 else if(__pAnimationTimer == &timer)
591 ShowIndicatorEffect(false, ANIMATION_DURATION);
594 __animationing = false;
599 _Indicator::OnDisconnected(Ecore_Evas *pEe)
601 _Indicator* pIndicator = (_Indicator*)ecore_evas_data_get(pEe, pIndicatorKey);
602 SysTryReturnVoidResult(NID_UI_CTRL, pIndicator, E_SYSTEM, "[E_SYSTEM] Unable to get Indicator Object");
604 if (pIndicator->__pConnectionTimer == null)
606 pIndicator->__pConnectionTimer = new (std::nothrow) Timer;
607 if (pIndicator->__pConnectionTimer == null)
612 result r = pIndicator->__pConnectionTimer->Construct(*pIndicator);
615 delete pIndicator->__pConnectionTimer;
616 pIndicator->__pConnectionTimer = null;
622 pIndicator->__pConnectionTimer->Start(CONNECTION_INTERVAL);
626 _Indicator::SetNotificationTrayOpenEnabled(bool enable)
628 Ecore_X_Window win = (Ecore_X_Window)__pWindow->GetNativeHandle();
630 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
633 int returnResult = ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
646 ecore_x_window_prop_card32_set(win, atomPanelScrollable, val, 3);
653 _Indicator::IsNotificationTrayOpenEnabled(void) const
655 Ecore_X_Window win = (Ecore_X_Window)__pWindow->GetNativeHandle();
657 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
660 int returnResult = ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
677 _Indicator::OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *data, int size)
684 _Indicator* pIndicator = (_Indicator*)ecore_evas_data_get(pEe, pIndicatorKey);
685 SysTryReturnVoidResult(NID_UI_CTRL, pIndicator, E_SYSTEM, "[E_SYSTEM] Unable to get Indicator Object");
687 Evas_Object* pPortraitIndicatorEvasObject = (Evas_Object*)ecore_evas_data_get(pEe, pPortPublicKey);
688 Evas_Object* pLandscapeIndicatorEvasObject = (Evas_Object*)ecore_evas_data_get(pEe, pLandPublicKey);
690 if (msgDomain == MSG_DOMAIN_CONTROL_INDICATOR)
692 if (msgId == MSG_ID_INDICATOR_REPEAT_EVENT)
694 int *repeat = (int*)data;
697 if (pPortraitIndicatorEvasObject)
699 evas_object_repeat_events_set(pPortraitIndicatorEvasObject, EINA_TRUE);
701 if (pLandscapeIndicatorEvasObject)
703 evas_object_repeat_events_set(pLandscapeIndicatorEvasObject, EINA_TRUE);
708 if (pPortraitIndicatorEvasObject)
710 evas_object_repeat_events_set(pPortraitIndicatorEvasObject, EINA_FALSE);
712 if (pLandscapeIndicatorEvasObject)
714 evas_object_repeat_events_set(pLandscapeIndicatorEvasObject, EINA_FALSE);
718 else if (msgId == MSG_ID_INDICATOR_START_ANIMATION)
720 _IndicatorDataAnimation* pData = (_IndicatorDataAnimation*)data;
721 Ecore_X_Window win = 0;
722 _Window* pWindow = pIndicator->__pWindow;
725 win = (Ecore_X_Window)pWindow->GetNativeHandle();
728 if (pData->xwin == win)
730 pIndicator->ShowIndicatorEffect(true, pData->duration);
738 _Indicator::OnHitTest(const Tizen::Graphics::FloatPoint& point)
742 return HIT_TEST_NOWHERE;
745 if (!GetBounds().Contains(point))
747 return HIT_TEST_NOWHERE;
750 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
752 if (__portraitautohide)
754 return HIT_TEST_NOWHERE;
758 return HIT_TEST_MATCH;
763 if (__landscapeautohide)
765 return HIT_TEST_NOWHERE;
769 return HIT_TEST_MATCH;
776 _Indicator::SetIndicatorOrientation(Tizen::Ui::_ControlOrientation orientation)
778 __orientation = orientation;
782 _Indicator::SetWindow(_Window* pWindow)
788 _Indicator::ShowIndicatorEffect(bool down, int duration)
790 Ecore_X_Window win = 0;
793 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
796 VisualElementPropertyAnimation* pSlideAnimation = new (std::nothrow) VisualElementPropertyAnimation();
797 SysTryReturnResult(NID_UI_CTRL, pSlideAnimation, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
799 pSlideAnimation->SetDuration(duration);
800 pSlideAnimation->SetPropertyName( L"bounds.position");
801 pSlideAnimation->SetVisualElementAnimationStatusEventListener(this);
803 float indicatorHeight = 0.0f;
804 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __orientation, indicatorHeight);
806 String* pUserData = null;
809 Color bgColor(0xff1e1e1e);
810 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
812 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
814 if (__pPortraitVisualElement)
816 __pPortraitVisualElement->SetShowState(true);
821 if (__pLandscapeVisualElement)
823 __pLandscapeVisualElement->SetShowState(true);
827 pSlideAnimation->SetStartValue(Variant(FloatPoint(0.0f, -indicatorHeight)));
828 pSlideAnimation->SetEndValue(Variant(FloatPoint(0.0f, 0.0f)));
829 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
830 pUserData = new (std::nothrow) String(L"DownAnimation");
831 SysTryReturnResult(NID_UI_CTRL, pUserData, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
835 pSlideAnimation->SetStartValue(Variant(FloatPoint(0.0f, 0.0f)));
836 pSlideAnimation->SetEndValue(Variant(FloatPoint(0.0f, -indicatorHeight)));
837 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
838 pUserData = new (std::nothrow) String(L"UpAnimation");
839 SysTryReturnResult(NID_UI_CTRL, pUserData, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
841 pSlideAnimation->SetUserData((void*)(pUserData));
842 AddAnimation( L"bounds.position", *pSlideAnimation);
844 delete pSlideAnimation;
850 _Indicator::RemoveIndicatorAnimations(void)
852 if (__pAnimationTimer)
854 __pAnimationTimer->Cancel();
856 RemoveAllAnimations();
860 _Indicator::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
863 if (IsVisible() ==false)
868 int pointId = touchinfo.GetPointId();
869 _TouchManager* pTouchManager = _TouchManager::GetInstance();
871 FloatPoint touchPosition = source.ConvertToScreenPosition(touchinfo.GetCurrentPosition());
872 int indicatorHeight = 0;
875 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorHeight);
881 if (touchPosition.y < indicatorHeight)
889 __startTouchPoint = touchinfo.GetCurrentPosition();
890 __touchPressed = true;
894 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
896 if (__portraitautohide)
907 if (__landscapeautohide)
918 if (pTouchManager->IsListenerOnly(pointId) == true )
929 _Indicator::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
931 if (IsVisible() ==false)
936 _TouchManager* pTouchManager = _TouchManager::GetInstance();
940 if (touchinfo.GetPointId() == __pointId)
942 __touchPressed = false;
945 FloatPoint touchPosition = source.ConvertToScreenPosition(touchinfo.GetCurrentPosition());
946 int indicatorHeight = 0;
949 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorHeight);
955 if (touchPosition.y < indicatorHeight)
963 if (pTouchManager->IsListenerOnly(touchinfo.GetPointId()) == true)
972 else if (__quickpanelOpened == true)
974 OnChangeLayout(__orientation);
975 __quickpanelOpened = false;
981 _Indicator::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
985 if (IsVisible() ==false)
990 int pointId = touchinfo.GetPointId();
991 _TouchManager* pTouchManager = _TouchManager::GetInstance();
995 FloatPoint touchPoint = touchinfo.GetCurrentPosition();
996 float gap = touchPoint.y - __startTouchPoint.y;
1001 GET_SHAPE_CONFIG(FORM::INDICATOR_TOUCH_GAP, __pWindow->GetOrientation(), touchGap);
1008 if (gap < touchGap || __animationing)
1013 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
1015 if (__portraitautohide)
1017 ShowIndicatorEffect(true, ANIMATION_DURATION);
1022 if (__landscapeautohide)
1024 ShowIndicatorEffect(true, ANIMATION_DURATION);
1029 if (pTouchManager->IsListenerOnly(pointId) == true)
1040 if (__pAnimationTimer)
1042 __pAnimationTimer->Cancel();
1044 __quickpanelOpened = true;
1045 __animationing = false;
1052 _Indicator::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1058 _Indicator::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
1060 String* pUserData = (String*) animation.GetUserData();
1062 if ((pUserData != null) && (*pUserData == String(L"DownAnimation")))
1064 if (__pAnimationTimer == null)
1066 __pAnimationTimer = new (std::nothrow) Timer;
1067 if (__pAnimationTimer == null)
1072 result r = __pAnimationTimer->Construct(*this);
1075 delete __pAnimationTimer;
1076 __pAnimationTimer = null;
1082 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
1084 if (__portraitautohide)
1086 __pAnimationTimer->Start(ANIMATION_INTERVAL);
1087 __animationing = true;
1092 if (__landscapeautohide)
1094 __pAnimationTimer->Start(ANIMATION_INTERVAL);
1095 __animationing = true;
1102 _Indicator::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
1108 _Indicator::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
1110 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
1111 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
1113 String* pUserData = (String*) animation.GetUserData();
1115 if ((pUserData != null) && (*pUserData == String(L"UpAnimation")))
1117 Color bgColor(0x00000000);
1119 int indicatorHeight = 0;
1120 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorHeight);
1122 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
1124 if (__portraitautohide)
1126 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
1127 if (__pPortraitVisualElement && __portraitautohide)
1129 __pPortraitVisualElement->SetShowState(false);
1132 SetBounds(FloatRectangle(0.0f, 0.0f, portraitSize.width, indicatorHeight));
1136 if (__landscapeautohide)
1138 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
1139 if (__pLandscapeVisualElement && __landscapeautohide)
1141 __pLandscapeVisualElement->SetShowState(false);
1144 SetBounds(FloatRectangle(0.0f, 0.0f, landscapeSize.width, indicatorHeight));
1151 _Indicator::Activate(void)
1153 _UiEventManager::GetInstance()->AddTouchEventListener(*this);
1159 _Indicator::Deactivate(void)
1161 _UiEventManager::GetInstance()->RemoveTouchEventListener(*this);
1163 if (__pAnimationTimer)
1165 __pAnimationTimer->Cancel();
1167 RemoveAllAnimations();
1169 Ecore_X_Window win = 0;
1172 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
1175 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
1177 if (__portraitautohide)
1179 Color bgColor(0x00000000);
1180 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
1182 if (__pPortraitVisualElement)
1184 __pPortraitVisualElement->SetShowState(false);
1185 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
1187 __animationing = false;
1192 if (__landscapeautohide)
1194 Color bgColor(0x00000000);
1195 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
1197 if (__pLandscapeVisualElement)
1199 __pLandscapeVisualElement->SetShowState(false);
1200 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
1202 __animationing = false;
1209 }}} // Tizen::Ui::Controls