Unnecessary log was removed.
[platform/framework/native/uifw.git] / src / ui / controls / FUiCtrl_Indicator.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
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.
16 //
17 /**
18  * @file                FUiCtrl_Indicator.cpp
19  * @brief               This is the implementation file for the _Form class.
20  */
21
22 #include <FGrpRectangle.h>
23 #include <FGrp_CoordinateSystem.h>
24 #include <FUiAnim_VisualElementSurfaceImpl.h>
25 #include "FUiAnim_VisualElement.h"
26 #include "FUiAnim_VisualElementImpl.h"
27 #include "FUiAnim_EflNode.h"
28 #include "FUi_EcoreEvasMgr.h"
29 #include "FUi_EcoreEvas.h"
30 #include "FUi_ResourceManager.h"
31 #include "FUi_CoordinateSystemUtils.h"
32 #include "FUi_Window.h"
33 #include "FUiCtrl_Form.h"
34 #include "FUiCtrl_Indicator.h"
35 #include "FUiCtrl_IndicatorManager.h"
36 #include "FUiAnim_EflVisualElementSurfaceImpl.h"
37
38 using namespace Tizen::Base::Runtime;
39 using namespace Tizen::Graphics;
40 using namespace Tizen::Ui;
41 using namespace Tizen::Ui::Animations;
42
43 namespace Tizen { namespace Ui { namespace Controls
44 {
45
46 static const char* pPortraitSvcName = "elm_indicator_portrait";
47 static const char* pLandScapeSvcName = "elm_indicator_landscape";
48 static const char* pPortPublicKey = "__Plug_Ecore_Evas_Port";
49 static const char* pLandPublicKey = "__Plug_Ecore_Evas_Land";
50 static const char* pIndicatorKey = "Inidcator_Manager_Object";
51 static const int CONNECTION_INTERVAL = 1000;
52
53 #define MSG_DOMAIN_CONTROL_INDICATOR 0x10001
54 #define MSG_ID_INDICATOR_REPEAT_EVENT 0x10002
55 #define MSG_ID_INDICATOR_ROTATION 0x10003
56 #define MSG_ID_INDICATOR_OPACITY 0X1004
57 #define MSG_ID_INDICATOR_TYPE 0X1005
58
59 typedef enum
60 {
61    _INDICATOR_TYPE_UNKNOWN, /**< Unknown indicator type mode */
62    _INDICATOR_TYPE_1, /**< Type 0 the the indicator */
63    _INDICATOR_TYPE_2, /**< Type 1 the indicator */
64 } _IndicatorTypeMode;
65
66 _Indicator*
67 _Indicator::CreateIndicator(void)
68 {
69         result r = E_SUCCESS;
70         Color bgColor(0xff343432);
71
72         _Indicator* pIndicator = new (std::nothrow) _Indicator;
73         SysTryReturn(NID_UI_CTRL, pIndicator, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
74         SysTryCatch(NID_UI_CTRL, GetLastResult() == E_SUCCESS, , E_SYSTEM, "[E_SYSTEM] A system error occurred.");
75
76         r = pIndicator->ConstructControlVisualElement();
77         SysTryCatch(NID_UI_CTRL, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
78
79         pIndicator->SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
80
81         return pIndicator;
82
83 CATCH:
84         delete pIndicator;
85         return null;
86 }
87
88 _Indicator::_Indicator(void)
89         : __pPortraitIndicatorEvasObject(null)
90         , __pLandscapeIndicatorEvasObject(null)
91         , __pConnectionTimer(null)
92         , __pPortraitVisualElement(null)
93         , __pLandscapeVisualElement(null)
94         , __pCurrentVisualElement(null)
95         , __pWindow(null)
96         , __showstate(false)
97         , __portraitautohide(false)
98         , __landscapeautohide(false)
99         , __opacity(_INDICATOR_OPACITY_OPAQUE)
100         , __orientation(_CONTROL_ORIENTATION_PORTRAIT)
101 {
102 }
103
104 _Indicator::~_Indicator(void)
105 {
106         if (__pConnectionTimer != null)
107         {
108                 __pConnectionTimer->Cancel();
109                 delete __pConnectionTimer;
110                 __pConnectionTimer = null;
111         }
112 }
113
114 result
115 _Indicator::SetIndicatorShowState(bool state)
116 {
117         result r = E_SUCCESS;
118
119         _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
120         SysTryReturnResult(NID_UI_CTRL, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] Unable to get evas");
121
122         if (__pWindow)
123         {
124                 r = pEcoreEvas->SetIndicatorShowState(*__pWindow, state);
125                 SysTryReturnResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
126         }
127
128         __showstate = state;
129
130         SetShowState(state);
131
132         if (state)
133         {
134                 SetIndicatorOpacity(__opacity);
135         }
136
137         return r;
138 }
139
140 void
141 _Indicator::SetIndicatorAutoHide(bool portrait, bool landscape)
142 {
143         Ecore_X_Window win = 0;
144         if (__pWindow)
145         {
146                 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
147         }
148
149         if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
150         {
151                 if (portrait)
152                 {
153                         Color bgColor(0x00000000);
154                         SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
155                         ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
156                 }
157                 else
158                 {
159                         SetIndicatorOpacity(__opacity);
160                         ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
161                 }
162         }
163         else
164         {
165                 if (landscape)
166                 {
167                         Color bgColor(0x00000000);
168                         SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
169                         ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
170                 }
171                 else
172                 {
173                         SetIndicatorOpacity(__opacity);
174                         ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
175                 }
176         }
177         __portraitautohide = portrait;
178         __landscapeautohide = landscape;
179
180 }
181
182 result
183 _Indicator::SetIndicatorOpacity(_IndicatorOpacity opacity)
184 {
185         result r = E_SUCCESS;
186
187         if (opacity == _INDICATOR_OPACITY_OPAQUE)
188         {
189                 Color bgColor(0xff1e1e1e);
190                 SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
191         }
192         else if (opacity == _INDICATOR_OPACITY_TRANSLUCENT)
193         {
194                 if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
195                 {
196                         Color bgColor(0x7f000000);
197                         SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
198                 }
199                 else
200                 {
201                         Color bgColor(0x00000000);
202                         SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
203                 }
204         }
205
206         __opacity = opacity;
207
208         return r;
209 }
210
211 bool
212 _Indicator::GetIndicatorShowState(void) const
213 {
214         return __showstate;
215 }
216
217 _IndicatorOpacity
218 _Indicator::GetIndicatorOpacity(void) const
219 {
220         if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
221         {
222                 if (__portraitautohide)
223                 {
224                         return _INDICATOR_OPACITY_TRANSPARENT;
225                 }
226         }
227         else
228         {
229                 if (__landscapeautohide)
230                 {
231                         return _INDICATOR_OPACITY_TRANSPARENT;
232                 }
233         }
234
235         return __opacity;
236 }
237
238 bool
239 _Indicator::GetIndicatorAutoHide(void) const
240 {
241         if (__orientation == _CONTROL_ORIENTATION_PORTRAIT)
242         {
243                 return __portraitautohide;
244         }
245         else
246         {
247                 return __landscapeautohide;
248         }
249
250 }
251
252 Rectangle
253 _Indicator::GetIndicatorBounds(void) const
254 {
255         const Dimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSize();
256         const Dimension landscapeSize = Dimension(portraitSize.height, portraitSize.width);
257
258         _ControlOrientation orientation = __pWindow->GetOrientation();
259
260         Rectangle indicatorbounds(0, 0, 0, 0);
261
262         if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
263         {
264                 indicatorbounds.width = portraitSize.width;
265                 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
266         }
267         else
268         {
269                 indicatorbounds.width = landscapeSize.width;
270                 GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
271         }
272
273         _CoordinateSystem* pCoordSystem = _CoordinateSystem::GetInstance();
274         SysTryReturn(NID_UI_CTRL, pCoordSystem, Rectangle(-1, -1, -1, -1), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
275
276         _ICoordinateSystemTransformer* pXformer = pCoordSystem->GetTransformer();
277         SysTryReturn(NID_UI_CTRL, pXformer, Rectangle(-1, -1, -1, -1), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
278
279         indicatorbounds = pXformer->Transform(indicatorbounds);
280
281         return indicatorbounds;
282 }
283
284 FloatRectangle
285 _Indicator::GetIndicatorBoundsF(void) const
286 {
287         const FloatDimension portraitSize = _ControlManager::GetInstance()->_ControlManager::GetScreenSizeF();
288         const FloatDimension landscapeSize = FloatDimension(portraitSize.height, portraitSize.width);
289
290         _ControlOrientation orientation = __pWindow->GetOrientation();
291
292         FloatRectangle indicatorbounds(0.0f, 0.0f, 0.0f, 0.0f);
293
294         if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
295         {
296                 indicatorbounds.width = portraitSize.width;
297                 GET_SHAPE_CONFIG(FORM::INDICATOR_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
298         }
299         else
300         {
301                 indicatorbounds.width = landscapeSize.width;
302                 GET_SHAPE_CONFIG(FORM::INDICATOR_MINIMIZE_HEIGHT, __pWindow->GetOrientation(), indicatorbounds.height);
303         }
304
305         _CoordinateSystem* pCoordSystem = _CoordinateSystem::GetInstance();
306         SysTryReturn(NID_UI_CTRL, pCoordSystem, FloatRectangle(-1.0, -1.0, -1.0, -1.0), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
307
308         _ICoordinateSystemTransformer* pXformer = pCoordSystem->GetTransformer();
309         SysTryReturn(NID_UI_CTRL, pXformer, FloatRectangle(-1.0, -1.0, -1.0, -1.0), E_SYSTEM, "[E_SYSTEM] Coordinate system load failed.");
310
311         indicatorbounds = pXformer->Transform(indicatorbounds);
312
313         return indicatorbounds;
314 }
315
316 result
317 _Indicator::AddIndicatorObject(_Control* pControl, _Window* pWindow)
318 {
319         result r = E_SUCCESS;
320
321         __pWindow = pWindow;
322
323         __pPortraitVisualElement =      _IndicatorManager::GetInstance()->GetIndicatorVisualElement(pWindow, _INDICATOR_ORIENTATION_PORTRAIT, pControl);
324         SysTryReturn(NID_UI_CTRL, __pPortraitVisualElement, null,  E_SYSTEM, "[E_SYSTEM] Indicator can not create the surface.");
325         __pLandscapeVisualElement = _IndicatorManager::GetInstance()->GetIndicatorVisualElement(pWindow, _INDICATOR_ORIENTATION_LANDSCAPE, pControl);
326         SysTryReturn(NID_UI_CTRL, __pLandscapeVisualElement, null,  E_SYSTEM, "[E_SYSTEM] Indicator can not create the surface.");
327         __pPortraitIndicatorEvasObject = _IndicatorManager::GetInstance()->GetEvasObject(pWindow, pControl, _INDICATOR_ORIENTATION_PORTRAIT);
328         SysTryReturn(NID_UI_CTRL, __pPortraitIndicatorEvasObject, null,  E_SYSTEM, "[E_SYSTEM] Indicator can not get the Evas_Object.");
329         __pLandscapeIndicatorEvasObject = _IndicatorManager::GetInstance()->GetEvasObject(pWindow, pControl, _INDICATOR_ORIENTATION_LANDSCAPE);
330         SysTryReturn(NID_UI_CTRL, __pLandscapeIndicatorEvasObject, null,  E_SYSTEM, "[E_SYSTEM] Indicator can not get the Evas_Object.");
331
332         _ControlOrientation orientation = pControl->GetOrientation();
333         if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
334         {
335                 r = ChangeCurrentVisualElement(__pPortraitVisualElement);
336         }
337         else
338         {
339                 r = ChangeCurrentVisualElement(__pLandscapeVisualElement);
340         }
341
342         Ecore_Evas *pPortraitEe = ecore_evas_object_ecore_evas_get(__pPortraitIndicatorEvasObject);
343         SysTryReturn(NID_UI_CTRL, pPortraitEe, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
344         Ecore_Evas *pLandscapeEe = ecore_evas_object_ecore_evas_get(__pLandscapeIndicatorEvasObject);
345         SysTryReturn(NID_UI_CTRL, pLandscapeEe, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] Unable to get evas.");
346
347         ecore_evas_data_set(pPortraitEe, pPortPublicKey, __pPortraitIndicatorEvasObject);
348         ecore_evas_data_set(pLandscapeEe, pLandPublicKey, __pLandscapeIndicatorEvasObject);
349         ecore_evas_data_set(pPortraitEe, pIndicatorKey, this);
350         ecore_evas_data_set(pLandscapeEe, pIndicatorKey, this);
351         ecore_evas_callback_delete_request_set(pPortraitEe, _Indicator::OnDisconnected);
352         ecore_evas_callback_delete_request_set(pLandscapeEe, _Indicator::OnDisconnected);
353
354         ecore_evas_callback_msg_handle_set(pPortraitEe, _Indicator::OnMessageHandle);
355         ecore_evas_callback_msg_handle_set(pLandscapeEe, _Indicator::OnMessageHandle);
356
357         _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
358         int rotation = 0;
359         if (pEcoreEvas && __pWindow)
360         {
361                 rotation = pEcoreEvas->GetWindowRotation(*__pWindow);
362         }
363
364         if(rotation == 0 || rotation == 180)
365         {
366                 ecore_evas_msg_parent_send(pPortraitEe, MSG_DOMAIN_CONTROL_INDICATOR, MSG_ID_INDICATOR_ROTATION, &rotation, sizeof(int));
367         }
368         else
369         {
370                 ecore_evas_msg_parent_send(pLandscapeEe, MSG_DOMAIN_CONTROL_INDICATOR, MSG_ID_INDICATOR_ROTATION, &rotation, sizeof(int));
371         }
372
373         return r;
374 }
375
376 result
377 _Indicator::DeleteIndicatorObject(void)
378 {
379         result r = E_SUCCESS;
380
381         r = _IndicatorManager::GetInstance()->ReleaseIndicatorVisualElement(__pWindow, _INDICATOR_ORIENTATION_PORTRAIT, __pPortraitVisualElement);
382         r = _IndicatorManager::GetInstance()->ReleaseIndicatorVisualElement(__pWindow, _INDICATOR_ORIENTATION_LANDSCAPE, __pLandscapeVisualElement);
383
384         if (__pPortraitVisualElement)
385         {
386                 if (__pPortraitVisualElement == __pCurrentVisualElement)
387                 {
388                         r = DetachChild(*__pPortraitVisualElement);
389                 }
390         }
391         if (__pLandscapeVisualElement)
392         {
393                 if (__pLandscapeVisualElement == __pCurrentVisualElement)
394                 {
395                         r = DetachChild(*__pLandscapeVisualElement);
396                 }
397         }
398
399         __pPortraitIndicatorEvasObject = null;
400         __pLandscapeIndicatorEvasObject = null;
401         __pPortraitVisualElement = null;
402         __pLandscapeVisualElement = null;
403         __pCurrentVisualElement = null;
404
405         return r;
406 }
407
408 result
409 _Indicator::ChangeCurrentVisualElement(Tizen::Ui::Animations::_VisualElement* pVisualElement)
410 {
411         result r = E_SUCCESS;
412
413         if (!(__pCurrentVisualElement == pVisualElement))
414         {
415                 r = AttachChild(*pVisualElement);
416                 if (__pCurrentVisualElement)
417                 {
418                         r = DetachChild(*__pCurrentVisualElement);
419                 }
420                 __pCurrentVisualElement = pVisualElement;
421         }
422
423         return r;
424 }
425
426 void
427 _Indicator::OnChangeLayout(_ControlOrientation orientation)
428 {
429         Ecore_X_Window win = 0;
430         if (__pWindow)
431         {
432                 win = (Ecore_X_Window)__pWindow->GetNativeHandle();
433         }
434
435         __orientation = orientation;
436
437         if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
438         {
439                 ChangeCurrentVisualElement(__pPortraitVisualElement);
440                 SetClipChildrenEnabled(true);
441
442                 if (__portraitautohide)
443                 {
444                         Color bgColor(0x00000000);
445                         SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
446                         ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
447                 }
448                 else
449                 {
450                         SetIndicatorOpacity(__opacity);
451                         ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
452                 }
453
454         }
455         else
456         {
457                 ChangeCurrentVisualElement(__pLandscapeVisualElement);
458                 SetClipChildrenEnabled(false);
459
460                 if (__landscapeautohide)
461                 {
462                         Color bgColor(0x00000000);
463                         SetBackgroundColor(_Colorf((float)bgColor.GetRed() / 255.0f, (float)bgColor.GetGreen() / 255.0f, (float)bgColor.GetBlue() / 255.0f, (float)bgColor.GetAlpha() / 255.0f));
464                         ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_TRANSPARENT);
465                 }
466                 else
467                 {
468                         SetIndicatorOpacity(__opacity);
469                         ecore_x_e_illume_indicator_opacity_set(win, ECORE_X_ILLUME_INDICATOR_OPAQUE);
470                 }
471         }
472 }
473
474 result
475 _Indicator::OnAttachedToMainTree(void)
476 {
477         result r = E_SUCCESS;
478
479         if (__pCurrentVisualElement)
480         {
481                 r = ChangeCurrentVisualElement(__pCurrentVisualElement);
482         }
483
484         return r;
485 }
486
487 void
488 _Indicator::OnTimerExpired(Timer& timer)
489 {
490         Eina_Bool result = EINA_TRUE;
491
492         _ControlOrientation orientation = _ControlManager::GetInstance()->GetOrientation();
493         if (orientation == _CONTROL_ORIENTATION_PORTRAIT)
494         {
495                 result = ecore_evas_extn_plug_connect(__pPortraitIndicatorEvasObject, pPortraitSvcName, 0, EINA_FALSE);
496         }
497         else
498         {
499                 result = ecore_evas_extn_plug_connect(__pLandscapeIndicatorEvasObject, pLandScapeSvcName, 0, EINA_FALSE);
500         }
501
502         if (result == EINA_TRUE)
503         {
504                 timer.Cancel();
505         }
506         else
507         {
508                 timer.Start(CONNECTION_INTERVAL);
509         }
510 }
511
512 void
513 _Indicator::OnDisconnected(Ecore_Evas *pEe)
514 {
515         _Indicator* pIndicator = (_Indicator*)ecore_evas_data_get(pEe, pIndicatorKey);
516         SysTryReturnVoidResult(NID_UI_CTRL, pIndicator, E_SYSTEM, "[E_SYSTEM] Unable to get Indicator Object");
517
518         if (pIndicator->__pConnectionTimer == null)
519         {
520                 pIndicator->__pConnectionTimer = new (std::nothrow) Timer;
521                 if (pIndicator->__pConnectionTimer == null)
522                 {
523                         return;
524                 }
525
526                 result r = pIndicator->__pConnectionTimer->Construct(*pIndicator);
527                 if (r != E_SUCCESS)
528                 {
529                         delete pIndicator->__pConnectionTimer;
530                         pIndicator->__pConnectionTimer = null;
531
532                         return;
533                 }
534         }
535
536         pIndicator->__pConnectionTimer->Start(CONNECTION_INTERVAL);
537 }
538
539 result
540 _Indicator::SetNotificationTrayOpenEnabled(bool enable)
541 {
542         Ecore_X_Window win = (Ecore_X_Window)__pWindow->GetNativeHandle();
543
544         Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
545
546         unsigned int val[3];
547         int returnResult = ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
548
549         if (returnResult)
550         {
551                 if (enable)
552                 {
553                         val[1] = 1;
554                 }
555                 else
556                 {
557                         val[1] = 0;
558                 }
559
560                 ecore_x_window_prop_card32_set(win, atomPanelScrollable, val, 3);
561         }
562
563         return E_SUCCESS;
564 }
565
566 bool
567 _Indicator::IsNotificationTrayOpenEnabled(void) const
568 {
569         Ecore_X_Window win = (Ecore_X_Window)__pWindow->GetNativeHandle();
570
571         Ecore_X_Atom atomPanelScrollable = ecore_x_atom_get("_E_MOVE_PANEL_SCROLLABLE_STATE");
572
573         unsigned int val[3];
574         int returnResult = ecore_x_window_prop_card32_get(win, atomPanelScrollable, val, 3);
575
576         if (returnResult)
577         {
578                 if (val[1] == 1)
579                 {
580                         return true;
581                 }
582                 else
583                 {
584                         return false;
585                 }
586         }
587         return false;
588 }
589
590 void
591 _Indicator::OnMessageHandle(Ecore_Evas *pEe, int msgDomain, int msgId, void *data, int size)
592 {
593         if (!data)
594         {
595                 return;
596         }
597
598         Evas_Object* pPortraitIndicatorEvasObject = (Evas_Object*)ecore_evas_data_get(pEe, pPortPublicKey);
599         Evas_Object* pLandscapeIndicatorEvasObject = (Evas_Object*)ecore_evas_data_get(pEe, pLandPublicKey);
600
601         if (msgDomain == MSG_DOMAIN_CONTROL_INDICATOR)
602         {
603                 if (msgId == MSG_ID_INDICATOR_REPEAT_EVENT)
604                 {
605                         int *repeat = (int*)data;
606                         if (1 == *repeat)
607                         {
608                                 if (pPortraitIndicatorEvasObject)
609                            {
610                                         evas_object_repeat_events_set(pPortraitIndicatorEvasObject, EINA_TRUE);
611                            }
612                                 if (pLandscapeIndicatorEvasObject)
613                                 {
614                            evas_object_repeat_events_set(pLandscapeIndicatorEvasObject, EINA_TRUE);
615                                 }
616                         }
617                         else
618                         {
619                                 if (pPortraitIndicatorEvasObject)
620                            {
621                            evas_object_repeat_events_set(pPortraitIndicatorEvasObject, EINA_FALSE);
622                            }
623                                 if (pLandscapeIndicatorEvasObject)
624                                 {
625                            evas_object_repeat_events_set(pLandscapeIndicatorEvasObject, EINA_FALSE);
626                                 }
627                         }
628                 }
629
630                 if (msgId == MSG_ID_INDICATOR_TYPE)
631                 {
632                         _IndicatorTypeMode *pIndicatorTypeMode = (_IndicatorTypeMode*)(data);
633
634                         _Window* pWindow =      _ControlManager::GetInstance()->_ControlManager::GetTopVisibleWindow();
635                         SysTryReturnVoidResult(NID_UI_CTRL, pWindow, E_INVALID_STATE, "[E_INVALID_STATE] Indicator is not attached main tree.");
636
637                         Ecore_X_Window win = (Ecore_X_Window)pWindow->GetNativeHandle();
638
639                         if (*pIndicatorTypeMode == _INDICATOR_TYPE_1)
640                         {
641                           ecore_x_e_illume_indicator_type_set(win, ECORE_X_ILLUME_INDICATOR_TYPE_1);
642                         }
643                         else if (*pIndicatorTypeMode == _INDICATOR_TYPE_2)
644                         {
645                           ecore_x_e_illume_indicator_type_set   (win, ECORE_X_ILLUME_INDICATOR_TYPE_2);
646                         }
647                 }
648         }
649 }
650
651 HitTestResult
652 _Indicator::OnHitTest(const Tizen::Graphics::FloatPoint& point)
653 {
654         if (!IsVisible())
655         {
656                 return HIT_TEST_NOWHERE;
657         }
658
659         if (!GetBounds().Contains(point))
660         {
661                 return HIT_TEST_NOWHERE;
662         }
663
664         Evas_Object* pImageObject = null;
665         if (this->__pCurrentVisualElement)
666         {
667                 _VisualElementImpl* pImpl = _VisualElementImpl::GetInstance(*this->__pCurrentVisualElement);
668                 if (pImpl)
669                 {
670                         _EflNode* pNativeNode = dynamic_cast< _EflNode* >(pImpl->GetNativeNode());
671                         if (pNativeNode)
672                         {
673                                 VisualElementSurface* pPortraitSurface = pNativeNode->GetSurface();
674                                 if (pPortraitSurface)
675                                 {
676                                         _EflVisualElementSurfaceImpl* pSurface = dynamic_cast<_EflVisualElementSurfaceImpl*>(_VisualElementSurfaceImpl::GetInstance(*pPortraitSurface));
677                                         if (pSurface)
678                                         {
679                                                 pImageObject = (Evas_Object*)pSurface->GetNativeHandle();
680                                         }
681                                 }
682                         }
683                 }
684         }
685
686         if (pImageObject)
687         {
688                 if (!evas_object_repeat_events_get(pImageObject))
689                 {
690                         return HIT_TEST_MATCH;
691                 }
692                 else
693                 {
694                         return HIT_TEST_NOWHERE;
695                 }
696         }
697         else
698         {
699                 return HIT_TEST_NOWHERE;
700         }
701 }
702
703 void
704 _Indicator::SetIndicatorOrientation(Tizen::Ui::_ControlOrientation orientation)
705 {
706         __orientation = orientation;
707 }
708
709 void
710 _Indicator::SetWindow(_Window* pWindow)
711 {
712         __pWindow = pWindow;
713 }
714
715 }}} // Tizen::Ui::Controls