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