1 #ifndef DALI_INTERNAL_LIFECYCLE_CONTROLLER_H
2 #define DALI_INTERNAL_LIFECYCLE_CONTROLLER_H
5 * Copyright (c) 2019 Samsung Electronics Co., Ltd.
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
22 #include <dali/public-api/object/ref-object.h>
23 #include <dali/public-api/object/base-object.h>
26 #include <dali/devel-api/adaptor-framework/lifecycle-controller.h>
27 #include <dali/public-api/adaptor-framework/application.h>
41 * This provides signals that are emitted according the lifecylce of the program.
43 class LifecycleController : public BaseObject, public ConnectionTracker
47 // Creation & Destruction
52 LifecycleController();
55 * Retrieve the initialized instance of the LifecycleController.
56 * @return Handle to LifecycleController.
58 static Dali::LifecycleController Get();
63 * @copydoc Dali::StyleMonitor::InitSignal()
65 Dali::LifecycleController::LifecycleSignalType& InitSignal();
68 * @copydoc Dali::StyleMonitor::TerminateSignal()
70 Dali::LifecycleController::LifecycleSignalType& TerminateSignal();
73 * @copydoc Dali::StyleMonitor::PauseSignal()
75 Dali::LifecycleController::LifecycleSignalType& PauseSignal();
78 * @copydoc Dali::StyleMonitor::ResumeSignal()
80 Dali::LifecycleController::LifecycleSignalType& ResumeSignal();
83 * @copydoc Dali::StyleMonitor::ResetSignal()
85 Dali::LifecycleController::LifecycleSignalType& ResetSignal();
88 * @copydoc Dali::StyleMonitor::ResizeSignal()
90 Dali::LifecycleController::LifecycleSignalType& ResizeSignal();
93 * @copydoc Dali::StyleMonitor::LanguageChangedSignal()
95 Dali::LifecycleController::LifecycleSignalType& LanguageChangedSignal();
100 * Called when the framework is initialised.
102 * @param[in] app The application instance
104 void OnInit( Dali::Application& app );
107 * Called when the framework is terminated.
109 * @param[in] app The application instance
111 void OnTerminate( Dali::Application& app );
114 * Called when the framework is paused.
116 * @param[in] app The application instance
118 void OnPause( Dali::Application& app );
121 * Called when the framework resumes from a paused state.
123 * @param[in] app The application instance
125 void OnResume( Dali::Application& app );
128 * Called when the framework informs the application that it should reset itself.
130 * @param[in] app The application instance
132 void OnReset( Dali::Application& app );
135 * Called when the framework informs the application that the language of the device has changed.
137 * @param[in] app The application instance
139 void OnLanguageChanged( Dali::Application& app );
142 * Signal handler when the adaptor's window resizes itself.
144 * @param[in] app The application instance
146 void OnResize( Dali::Application& app );
151 * Virtual Destructor.
153 virtual ~LifecycleController();
158 * Emit the init signal.
160 void EmitInitSignal();
163 * Emit the init signal.
165 void EmitTerminateSignal();
168 * Emit the init signal.
170 void EmitPauseSignal();
173 * Emit the init signal.
175 void EmitResumeSignal();
178 * Emit the init signal.
180 void EmitResetSignal();
183 * Emit the init signal.
185 void EmitResizeSignal();
188 * Emit the init signal.
190 void EmitLanguageChangedSignal();
195 Dali::LifecycleController::LifecycleSignalType mInitSignal;
196 Dali::LifecycleController::LifecycleSignalType mTerminateSignal;
197 Dali::LifecycleController::LifecycleSignalType mPauseSignal;
198 Dali::LifecycleController::LifecycleSignalType mResumeSignal;
199 Dali::LifecycleController::LifecycleSignalType mResetSignal;
200 Dali::LifecycleController::LifecycleSignalType mResizeSignal;
201 Dali::LifecycleController::LifecycleSignalType mLanguageChangedSignal;
205 } // namespace Adaptor
207 } // namespace Internal
209 // Additional Helpers for public-api forwarding methods
211 inline Internal::Adaptor::LifecycleController& GetImplementation(Dali::LifecycleController& controller)
213 DALI_ASSERT_ALWAYS(controller && "Controller handle is empty");
214 BaseObject& handle = controller.GetBaseObject();
215 return static_cast<Internal::Adaptor::LifecycleController&>(handle);
218 inline const Internal::Adaptor::LifecycleController& GetImplementation(const Dali::LifecycleController& controller)
220 DALI_ASSERT_ALWAYS(controller && "Controller handle is empty");
221 const BaseObject& handle = controller.GetBaseObject();
222 return static_cast<const Internal::Adaptor::LifecycleController&>(handle);
227 #endif // DALI_INTERNAL_LIFECYCLE_CONTROLLER_H