1 #ifndef DALI_INTERNAL_LIFECYCLE_CONTROLLER_H
2 #define DALI_INTERNAL_LIFECYCLE_CONTROLLER_H
5 * Copyright (c) 2021 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/base-object.h>
23 #include <dali/public-api/object/ref-object.h>
26 #include <dali/devel-api/adaptor-framework/lifecycle-controller.h>
27 #include <dali/public-api/adaptor-framework/application.h>
38 * This provides signals that are emitted according the lifecylce of the program.
40 class LifecycleController : public BaseObject, public ConnectionTracker
43 // Creation & Destruction
48 LifecycleController();
51 * Retrieve the initialized instance of the LifecycleController.
52 * @return Handle to LifecycleController.
54 static Dali::LifecycleController Get();
59 * @copydoc Dali::StyleMonitor::InitSignal()
61 Dali::LifecycleController::LifecycleSignalType& InitSignal();
64 * @copydoc Dali::StyleMonitor::TerminateSignal()
66 Dali::LifecycleController::LifecycleSignalType& TerminateSignal();
69 * @copydoc Dali::StyleMonitor::PauseSignal()
71 Dali::LifecycleController::LifecycleSignalType& PauseSignal();
74 * @copydoc Dali::StyleMonitor::ResumeSignal()
76 Dali::LifecycleController::LifecycleSignalType& ResumeSignal();
79 * @copydoc Dali::StyleMonitor::ResetSignal()
81 Dali::LifecycleController::LifecycleSignalType& ResetSignal();
84 * @copydoc Dali::StyleMonitor::LanguageChangedSignal()
86 Dali::LifecycleController::LifecycleSignalType& LanguageChangedSignal();
90 * Called when the framework is initialised.
92 * @param[in] app The application instance
94 void OnInit(Dali::Application& app);
97 * Called when the framework is terminated.
99 * @param[in] app The application instance
101 void OnTerminate(Dali::Application& app);
104 * Called when the framework is paused.
106 * @param[in] app The application instance
108 void OnPause(Dali::Application& app);
111 * Called when the framework resumes from a paused state.
113 * @param[in] app The application instance
115 void OnResume(Dali::Application& app);
118 * Called when the framework informs the application that it should reset itself.
120 * @param[in] app The application instance
122 void OnReset(Dali::Application& app);
125 * Called when the framework informs the application that the language of the device has changed.
127 * @param[in] app The application instance
129 void OnLanguageChanged(Dali::Application& app);
133 * Virtual Destructor.
135 ~LifecycleController() override;
139 * Emit the init signal.
141 void EmitInitSignal();
144 * Emit the init signal.
146 void EmitTerminateSignal();
149 * Emit the init signal.
151 void EmitPauseSignal();
154 * Emit the init signal.
156 void EmitResumeSignal();
159 * Emit the init signal.
161 void EmitResetSignal();
164 * Emit the init signal.
166 void EmitLanguageChangedSignal();
170 Dali::LifecycleController::LifecycleSignalType mInitSignal;
171 Dali::LifecycleController::LifecycleSignalType mTerminateSignal;
172 Dali::LifecycleController::LifecycleSignalType mPauseSignal;
173 Dali::LifecycleController::LifecycleSignalType mResumeSignal;
174 Dali::LifecycleController::LifecycleSignalType mResetSignal;
175 Dali::LifecycleController::LifecycleSignalType mLanguageChangedSignal;
178 } // namespace Adaptor
180 } // namespace Internal
182 // Additional Helpers for public-api forwarding methods
184 inline Internal::Adaptor::LifecycleController& GetImplementation(Dali::LifecycleController& controller)
186 DALI_ASSERT_ALWAYS(controller && "Controller handle is empty");
187 BaseObject& handle = controller.GetBaseObject();
188 return static_cast<Internal::Adaptor::LifecycleController&>(handle);
191 inline const Internal::Adaptor::LifecycleController& GetImplementation(const Dali::LifecycleController& controller)
193 DALI_ASSERT_ALWAYS(controller && "Controller handle is empty");
194 const BaseObject& handle = controller.GetBaseObject();
195 return static_cast<const Internal::Adaptor::LifecycleController&>(handle);
200 #endif // DALI_INTERNAL_LIFECYCLE_CONTROLLER_H