1 #ifndef DALI_LIFECYCLE_CONTROLLER_H
2 #define DALI_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/base-handle.h>
23 #include <dali/public-api/signals/dali-signal.h>
26 #include <dali/public-api/dali-adaptor-common.h>
31 namespace Internal DALI_INTERNAL
35 class LifecycleController;
40 * @brief Provides application lifecycle events.
42 * Connect to the signals of this class to receive notification of events in the lifecycle
43 * of the application. The following example shows how to connect to the Init signal. This
44 * could be done for example in the constructor of a singleton that is known to be created
48 * void MyClass::MyClass()
50 * LifecycleController::Get().InitSignal().Connect( this, &MyClass::OnApplicationInit );
53 * void MyClass::OnApplicationInit()
55 * // ... Do something on init
59 class DALI_ADAPTOR_API LifecycleController : public BaseHandle
63 typedef Signal< void (void) > LifecycleSignalType; ///< Lifecycle Signal type
65 public: // Creation & Destruction
68 * @brief Create an uninitialized LifecycleController handle.
70 * Calling member functions when uninitialized is not allowed.
72 LifecycleController();
75 * @brief Creates a copy of the handle.
77 * The copy will point to the same implementation as the original.
78 * @param[in] monitor The LifecycleController to copy from.
80 LifecycleController(const LifecycleController& monitor);
83 * @brief Retrieve the initialized instance of the LifecycleController.
84 * @return Handle to LifecycleController.
86 static LifecycleController Get();
91 * This is non-virtual since derived Handle types must not contain data or virtual methods.
93 ~LifecycleController();
98 * The user should connect to this signal to determine when they should initialise
101 LifecycleSignalType& InitSignal();
104 * The user should connect to this signal to determine when they should terminate
107 LifecycleSignalType& TerminateSignal();
110 * The user should connect to this signal if they need to perform any special
111 * activities when the application is about to be paused.
113 LifecycleSignalType& PauseSignal();
116 * The user should connect to this signal if they need to perform any special
117 * activities when the application has resumed.
119 LifecycleSignalType& ResumeSignal();
122 * This signal is sent when the system requires the user to reinitialise itself.
124 LifecycleSignalType& ResetSignal();
127 * This signal is emitted when the window the application is rendering on is resized.
129 LifecycleSignalType& ResizeSignal();
132 * This signal is emitted when the language is changed on the device.
134 LifecycleSignalType& LanguageChangedSignal();
139 * @brief Assignment operator.
141 * The handle points to the same implementation as the one being copied from.
142 * @param[in] controller The LifecycleController to copy from.
143 * @return reference to this object
145 LifecycleController& operator=(const LifecycleController& controller);
147 public: // Not intended for application developers
149 * @brief This constructor is used internally to create a handle from an object pointer.
150 * @param [in] lifecycleController A pointer to the internal LifecycleController.
152 explicit DALI_INTERNAL LifecycleController(Internal::Adaptor::LifecycleController* lifecycleController);
157 #endif // DALI_LIFECYCLE_CONTROLLER_H