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_START_ANIMATION = 0X10006;
63 namespace Tizen { namespace Ui { namespace Controls
66 struct _IndicatorDataAnimation
73 _Indicator::CreateIndicator(void)
76 Color bgColor(0xff343432);
78 _Indicator* pIndicator = new (std::nothrow) _Indicator;
79 SysTryReturn(NID_UI_CTRL, pIndicator, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
80 SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
82 r = pIndicator->ConstructControlVisualElement();
83 SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
85 pIndicator->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
94 _Indicator::_Indicator(void)
95 : __pPortraitIndicatorEvasObject(null)
96 , __pLandscapeIndicatorEvasObject(null)
97 , __pConnectionTimer(null)
98 , __pAnimationTimer(null)
99 , __pPortraitVisualElement(null)
100 , __pLandscapeVisualElement(null)
101 , __pCurrentVisualElement(null)
104 , __portraitautohide(false)
105 , __landscapeautohide(false)
106 , __opacity(_INDICATOR_OPACITY_OPAQUE)
107 , __orientation(_CONTROL_ORIENTATION_PORTRAIT)
108 , __startTouchPoint(0.0f, 0.0f)
109 , __animationing(false)
110 , __touchPressed(false)
111 , __quickpanelOpened(false)
115 _Indicator::~_Indicator(void)
117 if (__pConnectionTimer != null)
119 __pConnectionTimer->Cancel();
120 delete __pConnectionTimer;
121 __pConnectionTimer = null;
124 if (__pAnimationTimer != null)
126 __pAnimationTimer->Cancel();
127 delete __pAnimationTimer;
128 __pAnimationTimer = null;
131 _UiEventManager::GetInstance()->RemoveTouchEventListener(*this);
135 _Indicator::SetIndicatorShowState(bool state)
137 result r = E_SUCCESS;
139 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
140 SysTryReturnResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas");
142 Ecore_X_Window win = 0;
146 r = pEcoreEvas->SetIndicatorShowState(*__pWindow, state);
147 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
148 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
157 SetIndicatorOpacity(__opacity);
164 _Indicator::SetIndicatorAutoHide(bool portrait, bool landscape)
166 Ecore_X_Window win = 0;
169 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
172 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
176 Color bgColor(0x00000000);
177 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
178 if (__pPortraitVisualElement)
180 __pPortraitVisualElement->SetShowState(false);
182 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
183 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
187 SetIndicatorOpacity(__opacity);
188 if (__pPortraitVisualElement)
190 __pPortraitVisualElement->SetShowState(true);
192 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
193 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
200 Color bgColor(0x00000000);
201 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
202 if (__pLandscapeVisualElement)
204 __pLandscapeVisualElement->SetShowState(false);
206 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
207 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
211 SetIndicatorOpacity(__opacity);
212 if (__pLandscapeVisualElement)
214 __pLandscapeVisualElement->SetShowState(true);
216 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
217 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
220 __portraitautohide = portrait;
221 __landscapeautohide = landscape;
226 _Indicator::SetIndicatorOpacity(_IndicatorOpacity opacity)
228 result r = E_SUCCESS;
230 if (opacity == _INDICATOR_OPACITY_OPAQUE)
232 Color bgColor(0xff1e1e1e);
233 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
235 else if (opacity == _INDICATOR_OPACITY_TRANSLUCENT)
237 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
239 Color bgColor(0x7f000000);
240 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
244 Color bgColor(0x00000000);
245 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
255 _Indicator::GetIndicatorShowState(void) const
261 _Indicator::GetIndicatorOpacity(void) const
263 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
265 if (__portraitautohide)
267 return _INDICATOR_OPACITY_TRANSPARENT;
272 if (__landscapeautohide)
274 return _INDICATOR_OPACITY_TRANSPARENT;
282 _Indicator::GetIndicatorAutoHide(void) const
284 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
286 return __portraitautohide;
290 return __landscapeautohide;
296 _Indicator::GetIndicatorBounds(void) const
298 const Dimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSize();
299 const Dimension landscapeSize = Dimension(portraitSize.height, portraitSize.width);
301 Rectangle indicatorbounds(0, 0, 0, 0);
303 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
305 indicatorbounds.width = portraitSize.width;
309 indicatorbounds.width = landscapeSize.width;
311 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
313 _CoordinateSystem* pCoordSystem = _CoordinateSystem::GetInstance();
314 SysTryReturn(NID_UI_CTRL, pCoordSystem, Rectangle(-1, -1, -1, -1), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
316 _ICoordinateSystemTransformer* pXformer = pCoordSystem->GetTransformer();
317 SysTryReturn(NID_UI_CTRL, pXformer, Rectangle(-1, -1, -1, -1), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
319 indicatorbounds = pXformer->Transform(indicatorbounds);
321 return indicatorbounds;
325 _Indicator::GetIndicatorBoundsF(void) const
327 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
328 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
330 FloatRectangle indicatorbounds(0.0f, 0.0f, 0.0f, 0.0f);
332 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
334 indicatorbounds.width = portraitSize.width;
338 indicatorbounds.width = landscapeSize.width;
341 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
343 _CoordinateSystem* pCoordSystem = _CoordinateSystem::GetInstance();
344 SysTryReturn(NID_UI_CTRL, pCoordSystem, FloatRectangle(-1.0, -1.0, -1.0, -1.0), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
346 _ICoordinateSystemTransformer* pXformer = pCoordSystem->GetTransformer();
347 SysTryReturn(NID_UI_CTRL, pXformer, FloatRectangle(-1.0, -1.0, -1.0, -1.0), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
349 indicatorbounds = pXformer->Transform(indicatorbounds);
351 return indicatorbounds;
355 _Indicator::AddIndicatorObject(_Control* pControl, _Window* pWindow)
357 result r = E_SUCCESS;
361 __pPortraitVisualElement = _IndicatorManager::GetInstance()->GetIndicatorVisualElement(pWindow, _INDICATOR_ORIENTATION_PORTRAIT, pControl);
362 SysTryReturn(NID_UI_CTRL, __pPortraitVisualElement, null, E_SYSTEM, "[E_SYSTEM] Indicator can not create the surface.");
363 __pLandscapeVisualElement = _IndicatorManager::GetInstance()->GetIndicatorVisualElement(pWindow, _INDICATOR_ORIENTATION_LANDSCAPE, pControl);
364 SysTryReturn(NID_UI_CTRL, __pLandscapeVisualElement, null, E_SYSTEM, "[E_SYSTEM] Indicator can not create the surface.");
365 __pPortraitIndicatorEvasObject = _IndicatorManager::GetInstance()->GetEvasObject(pWindow, pControl, _INDICATOR_ORIENTATION_PORTRAIT);
366 SysTryReturn(NID_UI_CTRL, __pPortraitIndicatorEvasObject, null, E_SYSTEM, "[E_SYSTEM] Indicator can not get the Evas_Object.");
367 __pLandscapeIndicatorEvasObject = _IndicatorManager::GetInstance()->GetEvasObject(pWindow, pControl, _INDICATOR_ORIENTATION_LANDSCAPE);
368 SysTryReturn(NID_UI_CTRL, __pLandscapeIndicatorEvasObject, null, E_SYSTEM, "[E_SYSTEM] Indicator can not get the Evas_Object.");
370 _ControlOrientation orientation = pControl->GetOrientation();
371 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
373 r = ChangeCurrentVisualElement(__pPortraitVisualElement);
377 r = ChangeCurrentVisualElement(__pLandscapeVisualElement);
380 Ecore_Evas* pPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
381 SysTryReturn(NID_UI_CTRL, pPortraitEe, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
382 Ecore_Evas* pLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
383 SysTryReturn(NID_UI_CTRL, pLandscapeEe, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
385 ecore_evas_data_set(pPortraitEe, pPortPublicKey, __pPortraitIndicatorEvasObject);
386 ecore_evas_data_set(pLandscapeEe, pLandPublicKey, __pLandscapeIndicatorEvasObject);
387 ecore_evas_data_set(pPortraitEe, pIndicatorKey, this);
388 ecore_evas_data_set(pLandscapeEe, pIndicatorKey, this);
389 ecore_evas_callback_delete_request_set(pPortraitEe, _Indicator::OnDisconnected);
390 ecore_evas_callback_delete_request_set(pLandscapeEe, _Indicator::OnDisconnected);
392 ecore_evas_callback_msg_handle_set(pPortraitEe, _Indicator::OnMessageHandle);
393 ecore_evas_callback_msg_handle_set(pLandscapeEe, _Indicator::OnMessageHandle);
401 _Indicator::DeleteIndicatorObject(void)
403 result r = E_SUCCESS;
405 r = _IndicatorManager::GetInstance()->ReleaseIndicatorVisualElement(__pWindow, _INDICATOR_ORIENTATION_PORTRAIT, __pPortraitVisualElement);
406 r = _IndicatorManager::GetInstance()->ReleaseIndicatorVisualElement(__pWindow, _INDICATOR_ORIENTATION_LANDSCAPE, __pLandscapeVisualElement);
408 if (__pPortraitVisualElement)
410 if (__pPortraitVisualElement == __pCurrentVisualElement)
412 r = DetachChild(*__pPortraitVisualElement);
415 if (__pLandscapeVisualElement)
417 if (__pLandscapeVisualElement == __pCurrentVisualElement)
419 r = DetachChild(*__pLandscapeVisualElement);
423 Ecore_Evas* pPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
424 Ecore_Evas* pLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
428 ecore_evas_callback_delete_request_set(pPortraitEe, null);
429 ecore_evas_callback_msg_handle_set(pPortraitEe, null);
434 ecore_evas_callback_delete_request_set(pLandscapeEe, null);
435 ecore_evas_callback_msg_handle_set(pLandscapeEe, null);
438 __pPortraitIndicatorEvasObject = null;
439 __pLandscapeIndicatorEvasObject = null;
440 __pPortraitVisualElement = null;
441 __pLandscapeVisualElement = null;
442 __pCurrentVisualElement = null;
448 _Indicator::ChangeCurrentVisualElement(Tizen::Ui::Animations::_VisualElement* pVisualElement)
450 result r = E_SUCCESS;
452 if (!(__pCurrentVisualElement == pVisualElement))
454 r = AttachChild(*pVisualElement);
455 if (__pCurrentVisualElement)
457 r = DetachChild(*__pCurrentVisualElement);
459 __pCurrentVisualElement = pVisualElement;
466 _Indicator::OnChangeLayout(_ControlOrientation orientation)
468 RemoveIndicatorAnimations();
469 if (__pAnimationTimer != null)
471 __pAnimationTimer->Cancel();
472 __animationing = false;
475 Ecore_X_Window win = 0;
478 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
481 __orientation = orientation;
483 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
485 ChangeCurrentVisualElement(__pPortraitVisualElement);
486 SetClipChildrenEnabled(true);
488 if (__portraitautohide)
490 Color bgColor(0x00000000);
491 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
492 if (__pPortraitVisualElement)
494 __pPortraitVisualElement->SetShowState(false);
496 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
497 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
501 SetIndicatorOpacity(__opacity);
502 if (__pPortraitVisualElement)
504 __pPortraitVisualElement->SetShowState(true);
506 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
507 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
513 ChangeCurrentVisualElement(__pLandscapeVisualElement);
514 SetClipChildrenEnabled(false);
516 if (__landscapeautohide)
518 Color bgColor(0x00000000);
519 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
520 if (__pLandscapeVisualElement)
522 __pLandscapeVisualElement->SetShowState(false);
524 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
525 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
529 SetIndicatorOpacity(__opacity);
530 if (__pLandscapeVisualElement)
532 __pLandscapeVisualElement->SetShowState(true);
534 ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
535 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
541 _Indicator::OnAttachedToMainTree(void)
543 result r = E_SUCCESS;
545 if (__pCurrentVisualElement)
547 r = ChangeCurrentVisualElement(__pCurrentVisualElement);
554 _Indicator::OnTimerExpired(Timer& timer)
556 if (__pConnectionTimer == &timer)
558 Eina_Bool result = EINA_TRUE;
560 _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
561 if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
563 result = ecore_evas_extn_plug_connect(__pPortraitIndicatorEvasObject, pPortraitSvcName, 0, EINA_FALSE);
567 result = ecore_evas_extn_plug_connect(__pLandscapeIndicatorEvasObject, pLandScapeSvcName, 0, EINA_FALSE);
570 if (result == EINA_TRUE)
576 timer.Start(CONNECTION_INTERVAL);
579 else if(__pAnimationTimer == &timer)
581 ShowIndicatorEffect(false, ANIMATION_DURATION);
584 __animationing = false;
589 _Indicator::OnDisconnected(Ecore_Evas* pEe)
591 _Indicator* pIndicator = (_Indicator*)ecore_evas_data_get(pEe, pIndicatorKey);
592 SysTryReturnVoidResult(NID_UI_CTRL, pIndicator, E_SYSTEM, "[E_SYSTEM] Unable to get Indicator Object");
594 if (pIndicator->__pConnectionTimer == null)
596 pIndicator->__pConnectionTimer = new (std::nothrow) Timer;
597 if (pIndicator->__pConnectionTimer == null)
602 result r = pIndicator->__pConnectionTimer->Construct(*pIndicator);
605 delete pIndicator->__pConnectionTimer;
606 pIndicator->__pConnectionTimer = null;
612 pIndicator->__pConnectionTimer->Start(CONNECTION_INTERVAL);
616 _Indicator::SetNotificationTrayOpenEnabled(bool enable)
618 Ecore_X_Window win = (Ecore_X_Window)__pWindow->GetNativeHandle();
620 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
623 int returnResult = ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
636 ecore_x_window_prop_card32_set(win, atomPanelScrollable, val, 3);
643 _Indicator::IsNotificationTrayOpenEnabled(void) const
645 Ecore_X_Window win = (Ecore_X_Window)__pWindow->GetNativeHandle();
647 Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
650 int returnResult = ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
667 _Indicator::OnMessageHandle(Ecore_Evas* pEe, int msgDomain, int msgId, void *data, int size)
674 _Indicator* pIndicator = (_Indicator*)ecore_evas_data_get(pEe, pIndicatorKey);
675 SysTryReturnVoidResult(NID_UI_CTRL, pIndicator, E_SYSTEM, "[E_SYSTEM] Unable to get Indicator Object");
677 Evas_Object* pPortraitIndicatorEvasObject = (Evas_Object*)ecore_evas_data_get(pEe, pPortPublicKey);
678 Evas_Object* pLandscapeIndicatorEvasObject = (Evas_Object*)ecore_evas_data_get(pEe, pLandPublicKey);
680 if (msgDomain == MSG_DOMAIN_CONTROL_INDICATOR)
682 if (msgId == MSG_ID_INDICATOR_REPEAT_EVENT)
684 int* repeat = (int*)data;
687 if (pPortraitIndicatorEvasObject)
689 evas_object_repeat_events_set(pPortraitIndicatorEvasObject, EINA_TRUE);
691 if (pLandscapeIndicatorEvasObject)
693 evas_object_repeat_events_set(pLandscapeIndicatorEvasObject, EINA_TRUE);
698 if (pPortraitIndicatorEvasObject)
700 evas_object_repeat_events_set(pPortraitIndicatorEvasObject, EINA_FALSE);
702 if (pLandscapeIndicatorEvasObject)
704 evas_object_repeat_events_set(pLandscapeIndicatorEvasObject, EINA_FALSE);
708 else if (msgId == MSG_ID_INDICATOR_START_ANIMATION)
710 _IndicatorDataAnimation* pData = (_IndicatorDataAnimation*)data;
711 Ecore_X_Window win = 0;
712 _Window* pWindow = pIndicator->__pWindow;
715 win = (Ecore_X_Window)pWindow->GetNativeHandle();
718 if (pData->xwin == win)
720 if (pIndicator->__orientation == _CONTROL_ORIENTATION_PORTRAIT)
722 if (pIndicator->__portraitautohide)
724 pIndicator->ShowIndicatorEffect(true, pData->duration);
729 if (pIndicator->__landscapeautohide)
731 pIndicator->ShowIndicatorEffect(true, pData->duration);
741 _Indicator::OnHitTest(const Tizen::Graphics::FloatPoint& point)
745 return HIT_TEST_NOWHERE;
748 if (!GetBounds().Contains(point))
750 return HIT_TEST_NOWHERE;
753 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
755 if (__portraitautohide)
757 return HIT_TEST_NOWHERE;
761 return HIT_TEST_MATCH;
766 if (__landscapeautohide)
768 return HIT_TEST_NOWHERE;
772 return HIT_TEST_MATCH;
779 _Indicator::SetIndicatorOrientation(Tizen::Ui::_ControlOrientation orientation)
781 __orientation = orientation;
785 _Indicator::SetWindow(_Window* pWindow)
791 _Indicator::ShowIndicatorEffect(bool down, int duration)
793 Ecore_X_Window win = 0;
796 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
799 VisualElementPropertyAnimation* pSlideAnimation = new (std::nothrow) VisualElementPropertyAnimation();
800 SysTryReturnResult(NID_UI_CTRL, pSlideAnimation, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
802 pSlideAnimation->SetDuration(duration);
803 pSlideAnimation->SetPropertyName(L"bounds.position");
804 pSlideAnimation->SetVisualElementAnimationStatusEventListener(this);
806 float indicatorHeight = 0.0f;
807 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __orientation, indicatorHeight);
809 String* pUserData = null;
812 Color bgColor(0xff1e1e1e);
813 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
815 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
817 if (__pPortraitVisualElement)
819 __pPortraitVisualElement->SetShowState(true);
824 if (__pLandscapeVisualElement)
826 __pLandscapeVisualElement->SetShowState(true);
830 pSlideAnimation->SetStartValue(Variant(FloatPoint(0.0f, -indicatorHeight)));
831 pSlideAnimation->SetEndValue(Variant(FloatPoint(0.0f, 0.0f)));
832 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
833 pUserData = new (std::nothrow) String(L"DownAnimation");
834 SysTryReturnResult(NID_UI_CTRL, pUserData, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
838 pSlideAnimation->SetStartValue(Variant(FloatPoint(0.0f, 0.0f)));
839 pSlideAnimation->SetEndValue(Variant(FloatPoint(0.0f, -indicatorHeight)));
840 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
841 pUserData = new (std::nothrow) String(L"UpAnimation");
842 SysTryReturnResult(NID_UI_CTRL, pUserData, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory allocation failed.");
844 pSlideAnimation->SetUserData((void*)(pUserData));
845 AddAnimation(L"bounds.position", *pSlideAnimation);
847 delete pSlideAnimation;
853 _Indicator::RemoveIndicatorAnimations(void)
855 if (__pAnimationTimer)
857 __pAnimationTimer->Cancel();
859 RemoveAllAnimations();
863 _Indicator::OnTouchPressed(const _Control& source, const _TouchInfo& touchinfo)
866 if (IsVisible() ==false)
871 int pointId = touchinfo.GetPointId();
872 _TouchManager* pTouchManager = _TouchManager::GetInstance();
874 FloatPoint touchPosition = source.ConvertToScreenPosition(touchinfo.GetCurrentPosition());
875 int indicatorHeight = 0;
878 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorHeight);
884 if (touchPosition.y < indicatorHeight)
892 __startTouchPoint = touchPosition;
893 __touchPressed = true;
897 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
899 if (__portraitautohide)
910 if (__landscapeautohide)
921 if (pTouchManager->IsListenerOnly(pointId) == true)
932 _Indicator::OnTouchReleased(const _Control& source, const _TouchInfo& touchinfo)
934 if (IsVisible() ==false)
939 _TouchManager* pTouchManager = _TouchManager::GetInstance();
943 if (touchinfo.GetPointId() == __pointId)
945 __touchPressed = false;
948 FloatPoint touchPosition = source.ConvertToScreenPosition(touchinfo.GetCurrentPosition());
949 int indicatorHeight = 0;
952 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorHeight);
958 if (touchPosition.y < indicatorHeight)
962 _TouchManager* pTouchManager = _TouchManager::GetInstance();
965 if(pTouchManager->GetTouchControlSource() == &source)
967 SysLog(NID_UI, "VisibleState changed false, Call SetTouchCanceled");
968 pTouchManager->SetTouchCanceled(null);
975 if (pTouchManager->IsListenerOnly(touchinfo.GetPointId()) == true)
977 _TouchManager* pTouchManager = _TouchManager::GetInstance();
980 if(pTouchManager->GetTouchControlSource() == &source)
982 SysLog(NID_UI, "VisibleState changed false, Call SetTouchCanceled");
983 pTouchManager->SetTouchCanceled(null);
993 else if (__quickpanelOpened == true)
995 OnChangeLayout(__orientation);
996 __quickpanelOpened = false;
1002 _Indicator::OnTouchMoved(const _Control& source, const _TouchInfo& touchinfo)
1006 if (IsVisible() ==false)
1011 int pointId = touchinfo.GetPointId();
1012 _TouchManager* pTouchManager = _TouchManager::GetInstance();
1016 FloatPoint touchPoint = source.ConvertToScreenPosition(touchinfo.GetCurrentPosition());
1017 float gap = touchPoint.y - __startTouchPoint.y;
1022 GET_SHAPE_CONFIG(FORM::INDICATOR_TOUCH_GAP, __pWindow->GetOrientation(), touchGap);
1029 if (gap < touchGap || __animationing)
1034 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
1036 if (__portraitautohide)
1038 ShowIndicatorEffect(true, ANIMATION_DURATION);
1043 if (__landscapeautohide)
1045 ShowIndicatorEffect(true, ANIMATION_DURATION);
1050 if (pTouchManager->IsListenerOnly(pointId) == true)
1061 if (__pAnimationTimer)
1063 __pAnimationTimer->Cancel();
1065 __quickpanelOpened = true;
1066 __animationing = false;
1073 _Indicator::OnTouchCanceled(const _Control& source, const _TouchInfo& touchinfo)
1079 _Indicator::OnVisualElementAnimationStarted(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target)
1081 String* pUserData = (String*) animation.GetUserData();
1083 if ((pUserData != null) && (*pUserData == String(L"DownAnimation")))
1085 if (__pAnimationTimer == null)
1087 __pAnimationTimer = new (std::nothrow) Timer;
1088 if (__pAnimationTimer == null)
1093 result r = __pAnimationTimer->Construct(*this);
1096 delete __pAnimationTimer;
1097 __pAnimationTimer = null;
1103 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
1105 if (__portraitautohide)
1107 __pAnimationTimer->Start(ANIMATION_INTERVAL);
1108 __animationing = true;
1113 if (__landscapeautohide)
1115 __pAnimationTimer->Start(ANIMATION_INTERVAL);
1116 __animationing = true;
1123 _Indicator::OnVisualElementAnimationRepeated(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, long currentRepeatCount)
1129 _Indicator::OnVisualElementAnimationFinished(const Tizen::Ui::Animations::VisualElementAnimation& animation, const Tizen::Base::String& keyName, Tizen::Ui::Animations::VisualElement& target, bool completedNormally)
1131 const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
1132 const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
1134 String* pUserData = (String*) animation.GetUserData();
1136 if ((pUserData != null) && (*pUserData == String(L"UpAnimation")))
1138 Color bgColor(0x00000000);
1140 int indicatorHeight = 0;
1141 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorHeight);
1143 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
1145 if (__portraitautohide)
1147 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
1148 if (__pPortraitVisualElement && __portraitautohide)
1150 __pPortraitVisualElement->SetShowState(false);
1153 SetBounds(FloatRectangle(0.0f, 0.0f, portraitSize.width, indicatorHeight));
1157 if (__landscapeautohide)
1159 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
1160 if (__pLandscapeVisualElement && __landscapeautohide)
1162 __pLandscapeVisualElement->SetShowState(false);
1165 SetBounds(FloatRectangle(0.0f, 0.0f, landscapeSize.width, indicatorHeight));
1172 _Indicator::Activate(void)
1174 _UiEventManager::GetInstance()->AddTouchEventListener(*this);
1180 _Indicator::Deactivate(void)
1182 _UiEventManager::GetInstance()->RemoveTouchEventListener(*this);
1184 if (__pAnimationTimer)
1186 __pAnimationTimer->Cancel();
1188 RemoveAllAnimations();
1190 Ecore_X_Window win = 0;
1193 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
1196 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
1198 if (__portraitautohide)
1200 Color bgColor(0x00000000);
1201 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
1203 if (__pPortraitVisualElement)
1205 __pPortraitVisualElement->SetShowState(false);
1206 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
1208 __animationing = false;
1213 if (__landscapeautohide)
1215 Color bgColor(0x00000000);
1216 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
1218 if (__pLandscapeVisualElement)
1220 __pLandscapeVisualElement->SetShowState(false);
1221 ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
1223 __animationing = false;
1230 }}} // Tizen::Ui::Controls