1 #ifndef DALI_INTERNAL_LIFECYCLE_CONTROLLER_H
2 #define DALI_INTERNAL_LIFECYCLE_CONTROLLER_H
5 * Copyright (c) 2020 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::LanguageChangedSignal()
90 Dali::LifecycleController::LifecycleSignalType& LanguageChangedSignal();
95 * Called when the framework is initialised.
97 * @param[in] app The application instance
99 void OnInit( Dali::Application& app );
102 * Called when the framework is terminated.
104 * @param[in] app The application instance
106 void OnTerminate( Dali::Application& app );
109 * Called when the framework is paused.
111 * @param[in] app The application instance
113 void OnPause( Dali::Application& app );
116 * Called when the framework resumes from a paused state.
118 * @param[in] app The application instance
120 void OnResume( Dali::Application& app );
123 * Called when the framework informs the application that it should reset itself.
125 * @param[in] app The application instance
127 void OnReset( Dali::Application& app );
130 * Called when the framework informs the application that the language of the device has changed.
132 * @param[in] app The application instance
134 void OnLanguageChanged( Dali::Application& app );
139 * Virtual Destructor.
141 virtual ~LifecycleController();
146 * Emit the init signal.
148 void EmitInitSignal();
151 * Emit the init signal.
153 void EmitTerminateSignal();
156 * Emit the init signal.
158 void EmitPauseSignal();
161 * Emit the init signal.
163 void EmitResumeSignal();
166 * Emit the init signal.
168 void EmitResetSignal();
171 * Emit the init signal.
173 void EmitLanguageChangedSignal();
178 Dali::LifecycleController::LifecycleSignalType mInitSignal;
179 Dali::LifecycleController::LifecycleSignalType mTerminateSignal;
180 Dali::LifecycleController::LifecycleSignalType mPauseSignal;
181 Dali::LifecycleController::LifecycleSignalType mResumeSignal;
182 Dali::LifecycleController::LifecycleSignalType mResetSignal;
183 Dali::LifecycleController::LifecycleSignalType mLanguageChangedSignal;
187 } // namespace Adaptor
189 } // namespace Internal
191 // Additional Helpers for public-api forwarding methods
193 inline Internal::Adaptor::LifecycleController& GetImplementation(Dali::LifecycleController& controller)
195 DALI_ASSERT_ALWAYS(controller && "Controller handle is empty");
196 BaseObject& handle = controller.GetBaseObject();
197 return static_cast<Internal::Adaptor::LifecycleController&>(handle);
200 inline const Internal::Adaptor::LifecycleController& GetImplementation(const Dali::LifecycleController& controller)
202 DALI_ASSERT_ALWAYS(controller && "Controller handle is empty");
203 const BaseObject& handle = controller.GetBaseObject();
204 return static_cast<const Internal::Adaptor::LifecycleController&>(handle);
209 #endif // DALI_INTERNAL_LIFECYCLE_CONTROLLER_H