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