2 * Copyright (c) 2014 Samsung Electronics Co., Ltd.
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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/adaptor/common/lifecycle-controller-impl.h>
22 #include <dali/public-api/object/type-registry.h>
25 #include <dali/internal/adaptor/common/adaptor-impl.h>
26 #include <dali/internal/system/common/singleton-service-impl.h>
37 Dali::LifecycleController LifecycleController::Get()
39 Dali::LifecycleController lifecycleController;
41 Dali::SingletonService service( SingletonService::Get() );
44 // Check whether the singleton is already created
45 Dali::BaseHandle handle = service.GetSingleton( typeid( Dali::LifecycleController ) );
48 // If so, downcast the handle
49 lifecycleController = Dali::LifecycleController( dynamic_cast< LifecycleController* >( handle.GetObjectPtr() ) );
53 lifecycleController = Dali::LifecycleController( new LifecycleController() );
54 service.Register( typeid( lifecycleController ), lifecycleController );
58 return lifecycleController;
61 LifecycleController::LifecycleController()
65 LifecycleController::~LifecycleController()
69 Dali::LifecycleController::LifecycleSignalType& LifecycleController::InitSignal()
74 void LifecycleController::EmitInitSignal()
76 if( !mInitSignal.Empty() )
82 Dali::LifecycleController::LifecycleSignalType& LifecycleController::TerminateSignal()
84 return mTerminateSignal;
87 void LifecycleController::EmitTerminateSignal()
89 if( !mTerminateSignal.Empty() )
91 mTerminateSignal.Emit();
95 Dali::LifecycleController::LifecycleSignalType& LifecycleController::PauseSignal()
100 void LifecycleController::EmitPauseSignal()
102 if( !mPauseSignal.Empty() )
108 Dali::LifecycleController::LifecycleSignalType& LifecycleController::ResumeSignal()
110 return mResumeSignal;
113 void LifecycleController::EmitResumeSignal()
115 if( !mResumeSignal.Empty() )
117 mResumeSignal.Emit();
121 Dali::LifecycleController::LifecycleSignalType& LifecycleController::ResetSignal()
126 void LifecycleController::EmitResetSignal()
128 if( !mResetSignal.Empty() )
134 Dali::LifecycleController::LifecycleSignalType& LifecycleController::ResizeSignal()
136 return mResizeSignal;
139 void LifecycleController::EmitResizeSignal()
141 if( !mResizeSignal.Empty() )
143 mResizeSignal.Emit();
147 Dali::LifecycleController::LifecycleSignalType& LifecycleController::LanguageChangedSignal()
149 return mLanguageChangedSignal;
152 void LifecycleController::EmitLanguageChangedSignal()
154 if( !mLanguageChangedSignal.Empty() )
156 mLanguageChangedSignal.Emit();
160 void LifecycleController::OnInit( Dali::Application& app )
165 void LifecycleController::OnTerminate( Dali::Application& app )
167 EmitTerminateSignal();
170 void LifecycleController::OnPause( Dali::Application& app )
175 void LifecycleController::OnResume( Dali::Application& app )
180 void LifecycleController::OnReset( Dali::Application& app )
185 void LifecycleController::OnLanguageChanged( Dali::Application& app )
187 EmitLanguageChangedSignal();
190 void LifecycleController::OnResize( Dali::Application& app )
195 } // namespace Adaptor
197 } // namespace Internal