Revert "[Tizen] Revert "Enable indicator in tizen 5.0""
[platform/core/uifw/dali-adaptor.git] / dali / internal / window-system / common / window-impl.cpp
1 /*
2  * Copyright (c) 2018 Samsung Electronics Co., Ltd.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  *
16  */
17
18 // CLASS HEADER
19 #include <dali/internal/window-system/common/window-impl.h>
20
21 // EXTERNAL HEADERS
22 #include <dali/integration-api/core.h>
23 #include <dali/integration-api/system-overlay.h>
24 #include <dali/public-api/render-tasks/render-task.h>
25 #include <dali/public-api/render-tasks/render-task-list.h>
26 #include <dali/devel-api/adaptor-framework/orientation.h>
27
28 // INTERNAL HEADERS
29 #include <dali/internal/input/common/drag-and-drop-detector-impl.h>
30 #include <dali/internal/window-system/common/window-visibility-observer.h>
31 #include <dali/internal/window-system/common/orientation-impl.h>
32 #include <dali/internal/window-system/common/render-surface-factory.h>
33 #include <dali/internal/window-system/common/window-factory.h>
34 #include <dali/internal/window-system/common/window-base.h>
35 #include <dali/internal/window-system/common/window-render-surface.h>
36
37 namespace Dali
38 {
39 namespace Internal
40 {
41 namespace Adaptor
42 {
43
44 namespace
45 {
46
47 #if defined(DEBUG_ENABLED)
48 Debug::Filter* gWindowLogFilter = Debug::Filter::New( Debug::NoLogging, false, "LOG_WINDOW" );
49 #endif
50
51 } // unnamed namespace
52
53 Window* Window::New( const PositionSize& positionSize, const std::string& name, const std::string& className, bool isTransparent )
54 {
55   Window* window = new Window();
56   window->mIsTransparent = isTransparent;
57   window->Initialize( positionSize, name, className );
58   return window;
59 }
60
61 Window::Window()
62 : mSurface( NULL ),
63   mWindowBase(),
64   mIndicatorVisible( Dali::Window::VISIBLE ),
65   mIndicatorIsShown( false ),
66   mShowRotatedIndicatorOnClose( false ),
67   mStarted( false ),
68   mIsTransparent( false ),
69   mIsFocusAcceptable( true ),
70   mVisible( true ),
71   mIconified( false ),
72   mOpaqueState( false ),
73   mResizeEnabled( false ),
74   mIndicator(),
75   mIndicatorOrientation( Dali::Window::PORTRAIT ),
76   mNextIndicatorOrientation( Dali::Window::PORTRAIT ),
77   mIndicatorOpacityMode( Dali::Window::OPAQUE ),
78   mOverlay( NULL ),
79   mAdaptor( NULL ),
80   mType( Dali::Window::NORMAL ),
81   mPreferredOrientation( Dali::Window::PORTRAIT ),
82   mIndicatorVisibilityChangedSignal(),
83   mFocusChangedSignal(),
84   mResizedSignal(),
85   mDeleteRequestSignal()
86 {
87 }
88
89 Window::~Window()
90 {
91   if( mIndicator )
92   {
93     mOverlay->Remove( mIndicator->GetActor() );
94     Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
95     Dali::RenderTask indicatorTask = taskList.GetTask(0);
96     mOverlay->GetOverlayRenderTasks().RemoveTask(indicatorTask);
97     mIndicator->Close();
98   }
99
100   if ( mAdaptor )
101   {
102     mAdaptor->RemoveObserver( *this );
103     mAdaptor->SetDragAndDropDetector( NULL );
104     mAdaptor = NULL;
105   }
106
107   delete mSurface;
108 }
109
110 void Window::Initialize(const PositionSize& positionSize, const std::string& name, const std::string& className)
111 {
112   // Create a window render surface
113   Any surface;
114   auto renderSurfaceFactory = Dali::Internal::Adaptor::GetRenderSurfaceFactory();
115   auto windowRenderSurface = renderSurfaceFactory->CreateWindowRenderSurface( positionSize, surface, mIsTransparent );
116   mSurface = windowRenderSurface.release();
117
118   // Get a window base
119   mWindowBase = mSurface->GetWindowBase();
120
121   // Connect signals
122   mWindowBase->IconifyChangedSignal().Connect( this, &Window::OnIconifyChanged );
123   mWindowBase->FocusChangedSignal().Connect( this, &Window::OnFocusChanged );
124   mWindowBase->DeleteRequestSignal().Connect( this, &Window::OnDeleteRequest );
125   mWindowBase->IndicatorFlickedSignal().Connect( this, &Window::OnIndicatorFlicked );
126
127   mSurface->OutputTransformedSignal().Connect( this, &Window::OnOutputTransformed );
128
129   if( !positionSize.IsEmpty() )
130   {
131     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
132     mResizeEnabled = true;
133   }
134
135   SetClass( name, className );
136
137   mSurface->Map();
138
139   mOrientation = Orientation::New( this );
140 }
141
142 void Window::SetAdaptor(Dali::Adaptor& adaptor)
143 {
144   DALI_ASSERT_ALWAYS( !mStarted && "Adaptor already started" );
145   mStarted = true;
146
147   // Only create one overlay per window
148   Internal::Adaptor::Adaptor& adaptorImpl = Internal::Adaptor::Adaptor::GetImplementation(adaptor);
149   Integration::Core& core = adaptorImpl.GetCore();
150   mOverlay = &core.GetSystemOverlay();
151
152   Dali::RenderTaskList taskList = mOverlay->GetOverlayRenderTasks();
153   taskList.CreateTask();
154
155   mAdaptor = &adaptorImpl;
156   mAdaptor->AddObserver( *this );
157
158   // Can only create the detector when we know the Core has been instantiated.
159   mDragAndDropDetector = DragAndDropDetector::New();
160   mAdaptor->SetDragAndDropDetector( &GetImplementation( mDragAndDropDetector ) );
161
162   if( mOrientation )
163   {
164     mOrientation->SetAdaptor(adaptor);
165   }
166
167   if( mIndicator != NULL )
168   {
169     mIndicator->SetAdaptor(mAdaptor);
170   }
171 }
172
173 WindowRenderSurface* Window::GetSurface()
174 {
175   return mSurface;
176 }
177
178 void Window::ShowIndicator( Dali::Window::IndicatorVisibleMode visibleMode )
179 {
180   mIndicatorVisible = visibleMode;
181
182   mWindowBase->ShowIndicator( mIndicatorVisible, mIndicatorOpacityMode );
183
184   DoShowIndicator( mIndicatorOrientation );
185 }
186
187 void Window::SetIndicatorBgOpacity( Dali::Window::IndicatorBgOpacity opacityMode )
188 {
189   mIndicatorOpacityMode = opacityMode;
190
191   if( mIndicator != NULL )
192   {
193     mIndicator->SetOpacityMode( opacityMode );
194   }
195 }
196
197 void Window::SetIndicatorVisibleMode( Dali::Window::IndicatorVisibleMode mode )
198 {
199   mIndicatorVisible = mode;
200 }
201
202 void Window::RotateIndicator( Dali::Window::WindowOrientation orientation )
203 {
204   DALI_LOG_TRACE_METHOD_FMT( gWindowLogFilter, "Orientation: %d\n", orientation );
205
206   DoRotateIndicator( orientation );
207 }
208
209 void Window::SetClass( std::string name, std::string className )
210 {
211   mWindowBase->SetClass( name, className );
212 }
213
214 void Window::Raise()
215 {
216   mWindowBase->Raise();
217 }
218
219 void Window::Lower()
220 {
221   mWindowBase->Lower();
222 }
223
224 void Window::Activate()
225 {
226   mWindowBase->Activate();
227 }
228
229 void Window::AddAvailableOrientation( Dali::Window::WindowOrientation orientation )
230 {
231   bool found = false;
232
233   if( orientation <= Dali::Window::LANDSCAPE_INVERSE )
234   {
235     for( std::size_t i = 0; i < mAvailableOrientations.size(); i++ )
236     {
237       if( mAvailableOrientations[i] == orientation )
238       {
239         found = true;
240         break;
241       }
242     }
243
244     if( !found )
245     {
246       mAvailableOrientations.push_back( orientation );
247       SetAvailableOrientations( mAvailableOrientations );
248     }
249   }
250 }
251
252 void Window::RemoveAvailableOrientation( Dali::Window::WindowOrientation orientation )
253 {
254   for( std::vector<Dali::Window::WindowOrientation>::iterator iter = mAvailableOrientations.begin();
255        iter != mAvailableOrientations.end(); ++iter )
256   {
257     if( *iter == orientation )
258     {
259       mAvailableOrientations.erase( iter );
260       break;
261     }
262   }
263   SetAvailableOrientations( mAvailableOrientations );
264 }
265
266 void Window::SetAvailableOrientations( const std::vector< Dali::Window::WindowOrientation >& orientations )
267 {
268   if( orientations.size() > 4 )
269   {
270     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetAvailableOrientations: Invalid vector size! [%d]\n", orientations.size() );
271     return;
272   }
273
274   mAvailableOrientations = orientations;
275
276   mWindowBase->SetAvailableOrientations( mAvailableOrientations );
277 }
278
279 const std::vector< Dali::Window::WindowOrientation >& Window::GetAvailableOrientations()
280 {
281   return mAvailableOrientations;
282 }
283
284 void Window::SetPreferredOrientation( Dali::Window::WindowOrientation orientation )
285 {
286   mPreferredOrientation = orientation;
287
288   mWindowBase->SetPreferredOrientation( mPreferredOrientation );
289 }
290
291 Dali::Window::WindowOrientation Window::GetPreferredOrientation()
292 {
293   return mPreferredOrientation;
294 }
295
296 Dali::DragAndDropDetector Window::GetDragAndDropDetector() const
297 {
298   return mDragAndDropDetector;
299 }
300
301 Dali::Any Window::GetNativeHandle() const
302 {
303   return mSurface->GetNativeWindow();
304 }
305
306 void Window::SetAcceptFocus( bool accept )
307 {
308   mIsFocusAcceptable = accept;
309
310   mWindowBase->SetAcceptFocus( accept );
311 }
312
313 bool Window::IsFocusAcceptable() const
314 {
315   return mIsFocusAcceptable;
316 }
317
318 void Window::Show()
319 {
320   mVisible = true;
321
322   mWindowBase->Show();
323
324   if( !mIconified )
325   {
326     WindowVisibilityObserver* observer( mAdaptor );
327     observer->OnWindowShown();
328     DALI_LOG_RELEASE_INFO( "Window (%p) ::Show()\n", this );
329   }
330 }
331
332 void Window::Hide()
333 {
334   mVisible = false;
335
336   mWindowBase->Hide();
337
338   if( !mIconified )
339   {
340     WindowVisibilityObserver* observer( mAdaptor );
341     observer->OnWindowHidden();
342     DALI_LOG_RELEASE_INFO( "Window (%p) ::Hide() \n", this );
343   }
344 }
345
346 bool Window::IsVisible() const
347 {
348   return mVisible;
349 }
350
351 unsigned int Window::GetSupportedAuxiliaryHintCount() const
352 {
353   return mWindowBase->GetSupportedAuxiliaryHintCount();
354 }
355
356 std::string Window::GetSupportedAuxiliaryHint( unsigned int index ) const
357 {
358   return mWindowBase->GetSupportedAuxiliaryHint( index );
359 }
360
361 unsigned int Window::AddAuxiliaryHint( const std::string& hint, const std::string& value )
362 {
363   return mWindowBase->AddAuxiliaryHint( hint, value );
364 }
365
366 bool Window::RemoveAuxiliaryHint( unsigned int id )
367 {
368   return mWindowBase->RemoveAuxiliaryHint( id );
369 }
370
371 bool Window::SetAuxiliaryHintValue( unsigned int id, const std::string& value )
372 {
373   return mWindowBase->SetAuxiliaryHintValue( id, value );
374 }
375
376 std::string Window::GetAuxiliaryHintValue( unsigned int id ) const
377 {
378   return mWindowBase->GetAuxiliaryHintValue( id );
379 }
380
381 unsigned int Window::GetAuxiliaryHintId( const std::string& hint ) const
382 {
383   return mWindowBase->GetAuxiliaryHintId( hint );
384 }
385
386 void Window::SetInputRegion( const Rect< int >& inputRegion )
387 {
388   mWindowBase->SetInputRegion( inputRegion );
389
390   DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetInputRegion: x = %d, y = %d, w = %d, h = %d\n", inputRegion.x, inputRegion.y, inputRegion.width, inputRegion.height );
391 }
392
393 void Window::SetType( Dali::Window::Type type )
394 {
395   if( type != mType )
396   {
397     mWindowBase->SetType( type );
398
399     mType = type;
400   }
401 }
402
403 Dali::Window::Type Window::GetType() const
404 {
405   return mType;
406 }
407
408 bool Window::SetNotificationLevel( Dali::Window::NotificationLevel::Type level )
409 {
410   if( mType != Dali::Window::NOTIFICATION )
411   {
412     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetNotificationLevel: Not supported window type [%d]\n", mType );
413     return false;
414   }
415
416   return mWindowBase->SetNotificationLevel( level );
417 }
418
419 Dali::Window::NotificationLevel::Type Window::GetNotificationLevel() const
420 {
421   if( mType != Dali::Window::NOTIFICATION )
422   {
423     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::GetNotificationLevel: Not supported window type [%d]\n", mType );
424     return Dali::Window::NotificationLevel::NONE;
425   }
426
427   return mWindowBase->GetNotificationLevel();
428 }
429
430 void Window::SetOpaqueState( bool opaque )
431 {
432   mOpaqueState = opaque;
433
434   mWindowBase->SetOpaqueState( opaque );
435
436   DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetOpaqueState: opaque = %d\n", opaque );
437 }
438
439 bool Window::IsOpaqueState() const
440 {
441   return mOpaqueState;
442 }
443
444 bool Window::SetScreenOffMode(Dali::Window::ScreenOffMode::Type screenOffMode)
445 {
446   return mWindowBase->SetScreenOffMode( screenOffMode );
447 }
448
449 Dali::Window::ScreenOffMode::Type Window::GetScreenOffMode() const
450 {
451   return mWindowBase->GetScreenOffMode();
452 }
453
454 bool Window::SetBrightness( int brightness )
455 {
456   if( brightness < 0 || brightness > 100 )
457   {
458     DALI_LOG_INFO( gWindowLogFilter, Debug::Verbose, "Window::SetBrightness: Invalid brightness value [%d]\n", brightness );
459     return false;
460   }
461
462   return mWindowBase->SetBrightness( brightness );
463 }
464
465 int Window::GetBrightness() const
466 {
467   return mWindowBase->GetBrightness();
468 }
469
470 void Window::SetSize( Dali::Window::WindowSize size )
471 {
472   if( !mResizeEnabled )
473   {
474     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
475     mResizeEnabled = true;
476   }
477
478   PositionSize positionSize = mSurface->GetPositionSize();
479
480   if( positionSize.width != size.GetWidth() || positionSize.height != size.GetHeight() )
481   {
482     positionSize.width = size.GetWidth();
483     positionSize.height = size.GetHeight();
484
485     mSurface->MoveResize( positionSize );
486
487     mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
488
489     // Emit signal
490     mResizedSignal.Emit( Dali::Window::WindowSize( positionSize.width, positionSize.height ) );
491
492     mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
493   }
494 }
495
496 Dali::Window::WindowSize Window::GetSize() const
497 {
498   PositionSize positionSize = mSurface->GetPositionSize();
499
500   return Dali::Window::WindowSize( positionSize.width, positionSize.height );
501 }
502
503 void Window::SetPosition( Dali::Window::WindowPosition position )
504 {
505   if( !mResizeEnabled )
506   {
507     AddAuxiliaryHint( "wm.policy.win.user.geometry", "1" );
508     mResizeEnabled = true;
509   }
510
511   PositionSize positionSize = mSurface->GetPositionSize();
512
513   if( positionSize.x != position.GetX() || positionSize.y != position.GetY() )
514   {
515     positionSize.x = position.GetX();
516     positionSize.y = position.GetY();
517
518     mSurface->MoveResize( positionSize );
519   }
520 }
521
522 Dali::Window::WindowPosition Window::GetPosition() const
523 {
524   PositionSize positionSize = mSurface->GetPositionSize();
525
526   return Dali::Window::WindowPosition( positionSize.x, positionSize.y );
527 }
528
529 void Window::SetTransparency( bool transparent )
530 {
531   mSurface->SetTransparency( transparent );
532 }
533
534 bool Window::GrabKey( Dali::KEY key, KeyGrab::KeyGrabMode grabMode )
535 {
536   return mWindowBase->GrabKey( key, grabMode );
537 }
538
539 bool Window::UngrabKey( Dali::KEY key )
540 {
541   return mWindowBase->UngrabKey( key );
542 }
543
544 bool Window::GrabKeyList( const Dali::Vector< Dali::KEY >& key, const Dali::Vector< KeyGrab::KeyGrabMode >& grabMode, Dali::Vector< bool >& result )
545 {
546   return mWindowBase->GrabKeyList( key, grabMode, result );
547 }
548
549 bool Window::UngrabKeyList( const Dali::Vector< Dali::KEY >& key, Dali::Vector< bool >& result )
550 {
551   return mWindowBase->UngrabKeyList( key, result );
552 }
553
554 void Window::RotationDone( int orientation, int width, int height )
555 {
556   mSurface->RequestRotation( orientation, width, height );
557
558   mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( width, height ) );
559
560   // Emit signal
561   mResizedSignal.Emit( Dali::Window::WindowSize( width, height ) );
562
563   mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( width, height ) );
564 }
565
566 void Window::DoShowIndicator( Dali::Window::WindowOrientation lastOrientation )
567 {
568   if( mIndicator == NULL )
569   {
570     if( mIndicatorVisible != Dali::Window::INVISIBLE )
571     {
572       auto windowFactory = Dali::Internal::Adaptor::GetWindowFactory();
573       mIndicator = windowFactory->CreateIndicator( mAdaptor, mIndicatorOrientation, this );
574       if( mIndicator )
575       {
576         mIndicator->SetOpacityMode( mIndicatorOpacityMode );
577         Dali::Actor actor = mIndicator->GetActor();
578         SetIndicatorActorRotation();
579         mOverlay->Add(actor);
580       }
581     }
582     // else don't create a hidden indicator
583   }
584   else // Already have indicator
585   {
586     if( mIndicatorVisible == Dali::Window::VISIBLE )
587     {
588       // If we are resuming, and rotation has changed,
589       if( mIndicatorIsShown == false && mIndicatorOrientation != mNextIndicatorOrientation )
590       {
591         // then close current indicator and open new one
592         mShowRotatedIndicatorOnClose = true;
593         mIndicator->Close(); // May synchronously call IndicatorClosed() callback & 1 level of recursion
594         // Don't show actor - will contain indicator for old orientation.
595       }
596     }
597   }
598
599   // set indicator visible mode
600   if( mIndicator != NULL )
601   {
602     mIndicator->SetVisible( mIndicatorVisible );
603   }
604
605   bool show = (mIndicatorVisible != Dali::Window::INVISIBLE );
606   SetIndicatorProperties( show, lastOrientation );
607   mIndicatorIsShown = show;
608 }
609
610 void Window::DoRotateIndicator( Dali::Window::WindowOrientation orientation )
611 {
612   if( mIndicatorIsShown )
613   {
614     mShowRotatedIndicatorOnClose = true;
615     mNextIndicatorOrientation = orientation;
616     if( mIndicator )
617     {
618       mIndicator->Close(); // May synchronously call IndicatorClosed() callback
619     }
620   }
621   else
622   {
623     // Save orientation for when the indicator is next shown
624     mShowRotatedIndicatorOnClose = false;
625     mNextIndicatorOrientation = orientation;
626   }
627 }
628
629 void Window::SetIndicatorActorRotation()
630 {
631   DALI_LOG_TRACE_METHOD( gWindowLogFilter );
632   if( mIndicator )
633   {
634     Dali::Actor actor = mIndicator->GetActor();
635     switch( mIndicatorOrientation )
636     {
637       case Dali::Window::PORTRAIT:
638         actor.SetParentOrigin( ParentOrigin::TOP_CENTER );
639         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
640         actor.SetOrientation( Degree(0), Vector3::ZAXIS );
641         break;
642       case Dali::Window::PORTRAIT_INVERSE:
643         actor.SetParentOrigin( ParentOrigin::BOTTOM_CENTER );
644         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
645         actor.SetOrientation( Degree(180), Vector3::ZAXIS );
646         break;
647       case Dali::Window::LANDSCAPE:
648         actor.SetParentOrigin( ParentOrigin::CENTER_LEFT );
649         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
650         actor.SetOrientation( Degree(270), Vector3::ZAXIS );
651         break;
652       case Dali::Window::LANDSCAPE_INVERSE:
653         actor.SetParentOrigin( ParentOrigin::CENTER_RIGHT );
654         actor.SetAnchorPoint(  AnchorPoint::TOP_CENTER );
655         actor.SetOrientation( Degree(90), Vector3::ZAXIS );
656         break;
657     }
658   }
659 }
660
661 void Window::SetIndicatorProperties( bool isShow, Dali::Window::WindowOrientation lastOrientation )
662 {
663   mWindowBase->SetIndicatorProperties( isShow, lastOrientation );
664 }
665
666 void Window::OnIconifyChanged( bool iconified )
667 {
668   if( iconified )
669   {
670     mIconified = true;
671
672     if( mVisible )
673     {
674       WindowVisibilityObserver* observer( mAdaptor );
675       observer->OnWindowHidden();
676       DALI_LOG_RELEASE_INFO( "Window (%p) Iconified\n", this );
677     }
678   }
679   else
680   {
681     mIconified = false;
682
683     if( mVisible )
684     {
685       WindowVisibilityObserver* observer( mAdaptor );
686       observer->OnWindowShown();
687       DALI_LOG_RELEASE_INFO( "Window (%p) Deiconified\n", this );
688     }
689   }
690 }
691
692 void Window::OnFocusChanged( bool focusIn )
693 {
694   mFocusChangedSignal.Emit( focusIn );
695 }
696
697 void Window::OnOutputTransformed()
698 {
699   PositionSize positionSize = mSurface->GetPositionSize();
700   mAdaptor->SurfaceResizePrepare( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
701   mAdaptor->SurfaceResizeComplete( Adaptor::SurfaceSize( positionSize.width, positionSize.height ) );
702 }
703
704 void Window::OnDeleteRequest()
705 {
706   mDeleteRequestSignal.Emit();
707 }
708
709 void Window::OnIndicatorFlicked()
710 {
711   if( mIndicator )
712   {
713     mIndicator->Flicked();
714   }
715 }
716
717 void Window::IndicatorTypeChanged( IndicatorInterface::Type type )
718 {
719   mWindowBase->IndicatorTypeChanged( type );
720 }
721
722 void Window::IndicatorClosed( IndicatorInterface* indicator )
723 {
724   DALI_LOG_TRACE_METHOD( gWindowLogFilter );
725
726   if( mShowRotatedIndicatorOnClose )
727   {
728     Dali::Window::WindowOrientation currentOrientation = mIndicatorOrientation;
729     if( mIndicator )
730     {
731       mIndicator->Open( mNextIndicatorOrientation );
732     }
733     mIndicatorOrientation = mNextIndicatorOrientation;
734     SetIndicatorActorRotation();
735     DoShowIndicator( currentOrientation );
736   }
737 }
738
739 void Window::IndicatorVisibilityChanged( bool isVisible )
740 {
741   mIndicatorVisibilityChangedSignal.Emit( isVisible );
742 }
743
744 void Window::OnStart()
745 {
746   DoShowIndicator( mIndicatorOrientation );
747 }
748
749 void Window::OnPause()
750 {
751 }
752
753 void Window::OnResume()
754 {
755   // resume indicator status
756   if( mIndicator != NULL )
757   {
758     // Restore own indicator opacity
759     // Send opacity mode to indicator service when app resumed
760     mIndicator->SetOpacityMode( mIndicatorOpacityMode );
761   }
762 }
763
764 void Window::OnStop()
765 {
766   if( mIndicator )
767   {
768     mIndicator->Close();
769   }
770
771   mIndicator.release();
772 }
773
774 void Window::OnDestroy()
775 {
776   mAdaptor = NULL;
777 }
778
779 } // Adaptor
780
781 } // Internal
782
783 } // Dali