b017843c732bb49d568ebe9b1b73ee820c2e2345
[platform/framework/native/uifw.git] / src / ui / FUi_Window.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 /**
19  * @file                FUi_Window.cpp
20  * @brief               This is the implementation file for the _Window class.
21  */
22
23 #include <FBaseSysLog.h>
24 #include <FUiAnimDisplayContext.h>
25 #include <FUiWindow.h>
26 #include <FBase_Log.h>
27 #include <FBaseColArrayListT.h>
28 #include "FUi_Window.h"
29 #include "FUi_ControlManager.h"
30 #include "FUi_TouchManager.h"
31 #include "FUiAnim_DisplayContextImpl.h"
32 #include "FUiAnim_RootVisualElement.h"
33 #include "FUiAnim_VisualElement.h"
34 #include "FUi_EcoreEvasMgr.h"
35 #include "FUi_EcoreEvas.h"
36 #include "FUiAnim_DisplayManager.h"
37 #include "FUiAnim_EflLayer.h"
38 #include "FUiCtrl_Form.h"
39 #include "FUiCtrl_FormImpl.h"
40 #include "FUiCtrl_FrameImpl.h"
41
42 using namespace Tizen::Base;
43 using namespace Tizen::Base::Collection;
44 using namespace Tizen::Graphics;
45 using namespace Tizen::Ui::Animations;
46 using namespace Tizen::Ui::Controls;
47
48 namespace Tizen { namespace Ui
49 {
50
51 _Window*
52 _Window::CreateWindowN(void)
53 {
54         _Window* pWindow = new (std::nothrow) _Window;
55         SysTryReturn(NID_UI, pWindow, null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory shortage.");
56
57         result r = E_SUCCESS;
58
59         if (IsFailed(GetLastResult()))
60         {
61                 goto CATCH;
62         }
63
64         r = pWindow->CreateRootVisualElement();
65         SysTryCatch(NID_UI, r == E_SUCCESS, , r, "[%s] Propagating.", GetErrorMessage(r));
66
67         pWindow->AcquireHandle();
68
69         return pWindow;
70
71 CATCH:
72         delete pWindow;
73         return null;
74 }
75
76 _Window::~_Window(void)
77 {
78         __destroying = true;
79         Close();
80         SetOwner(null);
81
82         if (__pDisplayContext)
83         {
84                 _DisplayContextImpl::DestroyPublicInstance(*__pDisplayContext);
85                 __pDisplayContext = null;
86         }
87
88         if(__pLayer)
89         {
90                 //_EflLayer* pLayer = static_cast<_EflLayer*>(__pLayer);
91                 //Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pLayer->GetEcoreEvas());
92                 //SysLog(NID_UI, "[Multi_Window] destroy x window(0x%x)", win);
93
94                 if(__pRootVisualElement)
95                 {
96                         __pRootVisualElement->DetachChild(*GetVisualElement());
97                 }
98                 delete __pLayer;
99                 __pLayer = NULL;
100         }
101
102         delete __pDimmingLayer;
103         __pDimmingLayer = null;
104
105         __pRootVisualElement =NULL;
106 }
107
108 _IWindowDelegate&
109 _Window::GetWindowDelegate(void) const
110 {
111         if (__destroying)
112         {
113                 return const_cast<_Window&>(*this);
114         }
115
116         SysAssert(__pWindowDelegate);
117         return *__pWindowDelegate;
118 }
119
120 String
121 _Window::GetDescription(void) const
122 {
123         String description = _Control::GetDescription();
124         String descriptionTemp(L"");
125
126         descriptionTemp.Format(LOG_LEN_MAX, L"_Window: xid(0x%x) owner(0x%x) delegate(0x%x) activated(%d) destroying(%d) displayContext(0x%x)",
127                 GetNativeHandle(), __pOwner, __pWindowDelegate, __activated, __destroying, __pDisplayContext);
128
129         description.Append(descriptionTemp);
130
131         return description;
132 }
133
134 void
135 _Window::SetRootVisualElement(const Tizen::Ui::Animations::_RootVisualElement& rootVisualElement)
136 {
137         _RootVisualElement* pRootVE = const_cast<_RootVisualElement*>(&rootVisualElement);
138
139         __pRootVisualElement = pRootVE;
140 }
141
142 void
143 _Window::SetLayer(const Tizen::Ui::Animations::_NativeLayer& layer)
144 {
145         _NativeLayer* pLayer = const_cast<_NativeLayer*>(&layer);
146
147         __pLayer = pLayer;
148 }
149
150 bool
151 _Window::IsActivatedOnOpen(void) const
152 {
153         return true;
154 }
155
156 bool
157 _Window::IsActivated(void) const
158 {
159         return __activated;
160 }
161
162 void
163 _Window::SetWindowDelegate(_IWindowDelegate& delegate)
164 {
165         ClearLastResult();
166         __pWindowDelegate = &delegate;
167 }
168
169 void
170 _Window::ResetWindowDelegate(void)
171 {
172         ClearLastResult();
173         __pWindowDelegate = this;
174 }
175
176 bool
177 _Window::IsAttached(void) const
178 {
179         return _ControlManager::GetInstance()->IsWindowAttached(*this);
180 }
181
182 result
183 _Window::Open(bool drawAndShow)
184 {
185         bool visibleState = GetVisibleState();
186         if (!__isOpened && visibleState)
187         {
188                 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
189                 SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
190                 pEcoreEvas->SetWindowVisibleState(*GetRootWindow(), visibleState);
191                 __isOpened = true;
192                 __isInitialized = true;
193                 return _ControlManager::GetInstance()->OpenWindow(*this, drawAndShow);
194         }
195
196         return E_SUCCESS;
197 }
198
199 void
200 _Window::Close(void)
201 {
202         if (__isOpened)
203         {
204                 bool visibleState = GetVisibleState();
205                 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
206                 SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
207                 pEcoreEvas->SetWindowVisibleState(*GetRootWindow(), visibleState);
208
209                 _ControlManager::GetInstance()->CloseWindow(*this);
210                 __isOpened = false;
211         }
212 }
213
214 _Control*
215 _Window::GetOwner(void) const
216 {
217         ClearLastResult();
218         return __pOwner;
219 }
220
221 void
222 _Window::SetOwner(_Control* pOwner)
223 {
224         ClearLastResult();
225
226         if (pOwner)
227         {
228                 _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
229                 if (pEcoreEvas)
230                 {
231                         if (__transient == true)
232                         {
233                                 pEcoreEvas->SetOwner(*this, *pOwner);
234                         }
235
236                         __transient = true;
237                 }
238         }
239
240         if (pOwner == __pOwner)
241         {
242                 return;
243         }
244
245         if (__pOwner)
246         {
247                 __pOwner->DetachOwnee(*this);
248         }
249
250         if (pOwner)
251         {
252                 pOwner->AttachOwnee(*this);
253         }
254
255         _Control* pOldOwner = __pOwner;
256         __pOwner = pOwner;
257         GetWindowDelegate().OnOwnerChanged(pOldOwner);
258 }
259
260 result
261 _Window::CreateRootVisualElement(_WindowType windowType)
262 {
263         __type = windowType;
264
265         result r = CreateLayer();
266         SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
267
268         _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
269         SysAssert(pEcoreEvas);
270         __rotation = pEcoreEvas->GetWindowRotation(*this);
271         pEcoreEvas->RegisterWindowStateCallback(*this);
272
273         // Get visual element.
274         _VisualElement* pVisualElement = GetVisualElement();
275         SysAssert(pVisualElement);
276
277         pVisualElement->SetName(L"Window");
278         pVisualElement->SetClipChildrenEnabled(false);
279         pVisualElement->SetRenderOperation(_VisualElement::RENDER_OPERATION_COPY);
280
281         // Attach visual element to root visual element.
282         __pRootVisualElement->AttachChild(*GetVisualElement());
283
284         if (__type == _WINDOW_TYPE_MAIN)
285         {
286                 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, BASIC] Create.", GetNativeHandle());
287         }
288         else
289         {
290                 pEcoreEvas->SetWindowType(*this, _WINDOW_TYPE_SUB);
291                 SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, UTILITY] Create.", GetNativeHandle());
292         }
293
294         return E_SUCCESS;
295 }
296
297 result
298 _Window::CreateLayer(void)
299 {
300         _DisplayManager* pDisplayManager = _DisplayManager::GetInstance();
301         SysAssert(pDisplayManager);
302
303         if (__type == _WINDOW_TYPE_MAIN)
304         {
305                 __pLayer = _NativeLayer::CreateInstanceN();
306         }
307         else
308         {
309                 __pLayer = _NativeLayer::CreateInstanceN(false);
310         }
311
312         SysAssert(__pLayer);
313         __pRootVisualElement = __pLayer->GetRootVisualElement();
314
315         _EflLayer* pLayer = static_cast<_EflLayer*>(__pLayer);
316         SysAssert(pLayer);
317
318         int rootWindowW = 0;
319         int rootWindowH = 0;
320         ecore_x_window_size_get(ecore_x_window_root_get((Ecore_X_Window)ecore_evas_window_get(pLayer->GetEcoreEvas())), &rootWindowW, &rootWindowH);
321
322         pLayer->SetBounds(FloatRectangle(0.0f, 0.0f, (float)rootWindowW, (float)rootWindowH));
323         pLayer->SetOpacity(0);
324
325         __pRootVisualElement->SetName(L"Root");
326
327         return E_SUCCESS;
328 }
329
330 bool
331 _Window::IsFocusableDescendant(const _Control* pFocus) const
332 {
333         return true;
334 }
335
336 void
337 _Window::SetActivationEnabled(bool enable)
338 {
339         _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
340         SysTryReturnVoidResult(NID_UI, pEcoreEvas, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
341
342         pEcoreEvas->SetWindowActivationEnabled(*GetRootWindow(), enable);
343
344         SetLastResult(E_SUCCESS);
345 }
346
347 bool
348 _Window::IsActivationEnabled(void)
349 {
350         _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
351         SysTryReturn(NID_UI, pEcoreEvas, true, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
352
353         bool enable = pEcoreEvas->IsWindowActivationEnabled(*GetRootWindow());
354
355         SetLastResult(E_SUCCESS);
356
357         return enable;
358 }
359
360 _RootVisualElement*
361 _Window::GetRootVisualElement(void) const
362 {
363         return __pRootVisualElement;
364 }
365
366 NativeWindowHandle
367 _Window::GetNativeHandle(void) const
368 {
369         _RootVisualElement* pRootVE = GetRootVisualElement();
370         SysAssert(pRootVE);
371
372         _EflLayer* pLayer = static_cast<_EflLayer*>(pRootVE->GetNativeLayer());
373         SysAssert(pLayer);
374
375         Ecore_Evas* pEcoreEvas = pLayer->GetEcoreEvas();
376         Ecore_X_Window win = (Ecore_X_Window) ecore_evas_window_get(pEcoreEvas);
377
378         return win;
379 }
380
381 void
382 _Window::OnActivated(void)
383 {
384         bool isFrameActivated = _ControlManager::GetInstance()->IsFrameActivated();
385         SysLog(NID_UI, "frameActivated(%d)", isFrameActivated);
386
387         _Control* focusedControl = GetFocusedControl();
388
389         if (focusedControl)
390         {
391                 focusedControl->SetFocused();
392         }
393
394         if (!isFrameActivated)
395         {
396                 return;
397         }
398
399         _Control* pFocus = GetFocused();
400         if (pFocus)
401         {
402                 pFocus->SetFocused();
403         }
404         else
405         {
406                 SetFocused();
407         }
408
409         _TouchManager* pTouchMgr = _TouchManager::GetInstance();
410         if (pTouchMgr)
411         {
412                 pTouchMgr->SetTouchCanceled(null);
413         }
414 }
415
416 void
417 _Window::OnNativeWindowActivated(void)
418 {
419
420 }
421
422 void
423 _Window::OnFocusableStateChanged(bool focusalbeState)
424 {
425         SetActivationEnabled(focusalbeState);
426 }
427
428
429 bool
430 _Window::OnNotifiedN(const _Control& source, IList* pArgs)
431 {
432         SysTryReturn(NID_UI_CTRL, pArgs, false, E_SYSTEM, "[E_SYSTEM] pArgs is null.")
433
434         String* pType = dynamic_cast <String*>(pArgs->GetAt(0));
435         SysTryReturn(NID_UI_CTRL, pType, false, E_SYSTEM, "[E_SYSTEM] pType is null.")
436
437         if (*pType == L"VisibilityEvent")
438         {
439                 int obscured = 0;
440
441                 Integer* pObscured = dynamic_cast<Integer*>(pArgs->GetAt(1));
442                 if (pObscured == null)
443                 {
444                         pArgs->RemoveAll(true);
445                         delete pArgs;
446
447                         return true;
448                 }
449
450                 obscured = pObscured->ToInt();
451                 if (obscured == 0)
452                 {
453                         GetWindowDelegate().OnNativeWindowActivated();
454                 }
455
456                 pArgs->RemoveAll(true);
457                 delete pArgs;
458
459                 return true;
460         }
461
462         return false;
463 }
464
465 void
466 _Window::OnDeactivated(void)
467 {
468         bool isFrameActivated = _ControlManager::GetInstance()->IsFrameActivated();
469         SysLog(NID_UI, "frameActivated(%d)", isFrameActivated);
470 }
471
472 void
473 _Window::OnOwnerChanged(_Control* pOldOwner)
474 {
475
476 }
477
478 result
479 _Window::OnBoundsChanging(const FloatRectangle& bounds)
480 {
481         _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
482         SysTryReturn(NID_UI, pEcoreEvas, E_SYSTEM, E_SYSTEM, "[E_SYSTEM] A system error occurred.");
483
484         pEcoreEvas->SetWindowBounds(*GetRootWindow(), bounds);
485         result r = GetLastResult();
486         SysTryReturn(NID_UI, r == E_SUCCESS, r, r, "[%s] Propagating.", GetErrorMessage(r));
487
488         return r;
489 }
490
491 void
492 _Window::OnVisibleStateChanged(void)
493 {
494         ClearLastResult();
495
496         bool visibleState = GetVisibleState();
497         if (visibleState == false)
498         {
499                 Close();
500         }
501
502         result r = GetLastResult();
503         SysTryReturnVoidResult(NID_UI, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
504
505         SetLastResult(E_SUCCESS);
506 }
507
508 result
509 _Window::OnAttachingToMainTree(const _Control* pParent)
510 {
511         _EflLayer* pLayer = static_cast<_EflLayer*>(__pRootVisualElement->GetNativeLayer());
512         SysAssert(pLayer);
513         SetVisibleState(true);
514         pLayer->SetShowState(true);
515
516         return E_SUCCESS;
517 }
518
519 result
520 _Window::OnDetachingFromMainTree(void)
521 {
522         _EflLayer* pLayer = static_cast<_EflLayer*>(__pRootVisualElement->GetNativeLayer());
523         SysAssert(pLayer);
524         pLayer->SetShowState(false);
525
526         return E_SUCCESS;
527 }
528
529 void
530 _Window::OnWindowStateChanged(void)
531 {
532         // <0>
533         // Update rotation
534         // <1>
535         // Find current form
536         // Call UpdateOrientation
537         // <2>
538         // Find current frame
539         // Call UpdateOrientation
540         // <3>
541         // Find window
542         // Change layout
543         // Rotate window
544
545         _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
546         if (!pEcoreEvas)
547         {
548                 return;
549         }
550
551         int rotation = pEcoreEvas->GetWindowRotation(*this);
552
553         Rectangle winBounds = GetBounds();
554         SysLog(NID_UI, "[Window Manager Rotation][Window : 0x%x, %d, %d, %d, %d] OnWindowStateChanged : prev rot = %d, cur rot = %d", GetNativeHandle(), winBounds.x, winBounds.y, winBounds.width, winBounds.height, __rotation, rotation);
555
556         if (rotation == __rotation)
557         {
558                 return;
559         }
560
561         __rotation = rotation;
562
563         // <1>
564         int childCount = GetChildCount();
565         for (int i = childCount; i > 0; i--)
566         {
567                 _Control* pChild = GetChild(i - 1);
568
569                 _Form* pForm = dynamic_cast<_Form*>(pChild);
570                 if (pForm)
571                 {
572                         if (pForm->IsVisible())
573                         {
574                                 // Current Form
575                                 _FormImpl* pFormImpl = static_cast<_FormImpl*>(pForm->GetUserData());
576                                 if (pFormImpl)
577                                 {
578                                         pFormImpl->UpdateOrientation();
579                                 }
580
581                                 return;
582                         }
583                 }
584         }
585
586         // <2>
587         if (IsOrientationRoot())
588         {
589                 _FrameImpl* pFrameImpl = static_cast<_FrameImpl*>(GetUserData());
590                 if (pFrameImpl)
591                 {
592                         pFrameImpl->UpdateOrientation();
593                 }
594
595                 return;
596         }
597
598         // <3>
599         SysLog(NID_UI, "[Window Manager Rotation] ---------- Update Ownee Window : START ----------");
600
601         _ControlOrientation controlOrientation = (rotation == 0 || rotation == 180) ? _CONTROL_ORIENTATION_PORTRAIT : _CONTROL_ORIENTATION_LANDSCAPE;
602         ChangeLayout(controlOrientation);
603
604         pEcoreEvas->RotateWindow(*this, __rotation, false);
605
606         Invalidate(true);
607
608         SysLog(NID_UI, "[Window Manager Rotation] ---------- Update Ownee Window : END ----------");
609 }
610
611 void
612 _Window::SetPreferredRotation(bool enable)
613 {
614         __preferredRotation = enable;
615 }
616
617 bool
618 _Window::GetPreferredRotation(void) const
619 {
620         return __preferredRotation;
621 }
622
623 bool
624 _Window::IsRotationSynchronized(void) const
625 {
626         return false;
627 }
628
629 bool
630 _Window::IsLayoutChangable(void) const
631 {
632         return false;
633 }
634
635 void
636 _Window::SetRotation(int rotation)
637 {
638         __rotation = rotation;
639 }
640
641 void
642 _Window::OnChangeLayout(_ControlOrientation orientation)
643 {
644         _DimmingLayer *pLayer = GetDimmingLayer();
645         if (pLayer)
646         {
647                 result r = GetDimmingLayer()->Rearrange();
648                 SysTryReturnVoidResult(NID_UI_CTRL, r == E_SUCCESS, r, "[%s] Propagating.", GetErrorMessage(r));
649         }
650
651         // if window, change its size specially for full-screen(Form, Frame, etc.).
652         _Control::OnChangeLayout(orientation); // if called, layout will be changed.
653 }
654
655 WindowState
656 _Window::GetWindowState(void) const
657 {
658         ClearLastResult();
659         return __windowState;
660 }
661
662 void
663 _Window::SetWindowState(WindowState windowState)
664 {
665         __windowState = windowState;
666 }
667
668 DisplayContext*
669 _Window::GetDisplayContext(void) const
670 {
671         if (!__pDisplayContext)
672         {
673                 SysTryReturn(NID_UI, __pLayer, null, E_SYSTEM, "[E_SYSTEM] Cannot gain the DisplayContext. This window is not completed.");
674
675                 __pDisplayContext = _DisplayContextImpl::CreatePublicInstance(*__pLayer);
676         }
677
678         result r = GetLastResult();
679         SysTryReturn(NID_UI, __pDisplayContext, null, r, "[%s] Propagating.", GetErrorMessage(r));
680
681         return __pDisplayContext;
682 }
683
684 result
685 _Window::SetZOrderGroup(int windowZOrderGroup)
686 {
687         _EcoreEvas* pEcoreEvas = GetEcoreEvasMgr()->GetEcoreEvas();
688
689         if (windowZOrderGroup == WINDOW_Z_ORDER_GROUP_HIGHEST)
690         {
691                 pEcoreEvas->SetWindowLevel(*this, _WINDOW_LEVEL_NOTIFICATION_HIGH);
692         }
693         else if (windowZOrderGroup == WINDOW_Z_ORDER_GROUP_HIGH)
694         {
695                 pEcoreEvas->SetWindowLevel(*this, _WINDOW_LEVEL_NOTIFICATION_MIDDLE);
696         }
697         else if (windowZOrderGroup == WINDOW_Z_ORDER_GROUP_NORMAL)
698         {
699                 pEcoreEvas->SetWindowLevel(*this, _WINDOW_LEVEL_NORMAL);
700         }
701
702         __transient = false;
703
704         bool visible = pEcoreEvas->IsWindowVisible(*this);
705         bool activationEnabled = pEcoreEvas->IsWindowActivationEnabled(*this);
706
707         if ((visible == true) && (activationEnabled == true))
708         {
709                 pEcoreEvas->ActivateWindow(*this);
710         }
711
712         return E_SUCCESS;
713 }
714
715 _Window::_Window()
716         : __type(_WINDOW_TYPE_MAIN)
717         , __windowState(WINDOW_STATE_INITIALIZED)
718         , __pOwner(null)
719         , __pWindowDelegate(null)
720         , __activated(false)
721         , __destroying(false)
722         , __pRootVisualElement(null)
723         , __pLayer(null)
724         , __pDimmingLayer(null)
725         , __pDisplayContext(null)
726         , __systemWindow(false)
727         , __isOpened(false)
728         , __isInitialized(false)
729         , __pFocusedControl(null)
730         , __transient(true)
731         , __dimmingEnabled(false)
732         , __rotation(-1)
733         , __preferredRotation(false)
734         , __orientationCallbackMode(false)
735 {
736         SetControlDelegate(*this);
737         SetWindowDelegate(*this);
738         SetClipToParent(false); // [ToDo] exception check.
739 }
740
741 void
742 _Window::Activate(void)
743 {
744         if (__activated)
745         {
746                 return;
747         }
748
749         __activated = true;
750         GetWindowDelegate().OnActivated();
751 }
752
753 void
754 _Window::Deactivate(void)
755 {
756         __activated = false;
757
758         if (__destroying == false)
759         {
760                 GetWindowDelegate().OnDeactivated();
761         }
762 }
763
764 void
765 _Window::SetSystemWindow(bool systemWindow)
766 {
767         __systemWindow = systemWindow;
768 }
769
770 bool
771 _Window::IsSystemWindow(void) const
772 {
773         return __systemWindow;
774 }
775
776 void
777 _Window::SetFocusedControl(const _Control* pControl)
778 {
779         __pFocusedControl = const_cast<_Control*>(pControl);
780 }
781
782 _Control*
783 _Window::GetFocusedControl(void) const
784 {
785         return __pFocusedControl;
786 }
787
788 IListT<_Control*>*
789 _Window::GetFocusList(void) const
790 {
791         if(!__pFocusControlList)
792         {
793                 __pFocusControlList.reset(GetFocusListN());
794                 __pFocusControlList->InsertAt(const_cast<_Window*>(this), 0);
795         }
796         return __pFocusControlList.get();
797 }
798
799 void
800 _Window::ResetFocusList(void)
801 {
802         if(__pFocusControlList)
803         {
804                 __pFocusControlList.reset();
805         }
806 }
807
808 result
809 _Window::SetDimmingEnabled(bool enabled)
810 {
811         __dimmingEnabled = enabled;
812
813         return E_SUCCESS;
814 }
815
816 bool
817 _Window::IsDimmingEnabled(void) const
818 {
819         return __dimmingEnabled;
820 }
821
822 void
823 _Window::SetDimmingLayer(_DimmingLayer* pLayer)
824 {
825         __pDimmingLayer = pLayer;
826 }
827
828 _DimmingLayer*
829 _Window::GetDimmingLayer(void)
830 {
831         return __pDimmingLayer;
832 }
833
834 void
835 _Window::SetOrientationCallbackModeEnabled(bool enable)
836 {
837         __orientationCallbackMode = enable;
838 }
839
840 bool
841 _Window::IsOrientationCallbackModeEnabled(void) const
842 {
843         return __orientationCallbackMode;
844 }
845
846 }} // Tizen::Ui