1 #ifndef DALI_LIFECYCLE_CONTROLLER_H
2 #define DALI_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/base-handle.h>
23 #include <dali/public-api/signals/dali-signal.h>
26 #include <dali/public-api/dali-adaptor-common.h>
30 namespace Internal DALI_INTERNAL
34 class LifecycleController;
36 } // namespace DALI_INTERNAL
39 * @brief Provides application lifecycle events.
41 * Connect to the signals of this class to receive notification of events in the lifecycle
42 * of the application. The following example shows how to connect to the Init signal. This
43 * could be done for example in the constructor of a singleton that is known to be created
47 * void MyClass::MyClass()
49 * LifecycleController::Get().InitSignal().Connect( this, &MyClass::OnApplicationInit );
52 * void MyClass::OnApplicationInit()
54 * // ... Do something on init
58 class DALI_ADAPTOR_API LifecycleController : public BaseHandle
61 typedef Signal<void(void)> LifecycleSignalType; ///< Lifecycle Signal type
63 public: // Creation & Destruction
65 * @brief Create an uninitialized LifecycleController handle.
67 * Calling member functions when uninitialized is not allowed.
69 LifecycleController();
72 * @brief Creates a copy of the handle.
74 * The copy will point to the same implementation as the original.
75 * @param[in] monitor The LifecycleController to copy from.
77 LifecycleController(const LifecycleController& monitor);
80 * @brief Retrieve the initialized instance of the LifecycleController.
81 * @return Handle to LifecycleController.
83 static LifecycleController Get();
88 * This is non-virtual since derived Handle types must not contain data or virtual methods.
90 ~LifecycleController();
94 * The user should connect to this signal to determine when they should initialise
97 LifecycleSignalType& InitSignal();
100 * The user should connect to this signal to determine when they should terminate
103 LifecycleSignalType& TerminateSignal();
106 * The user should connect to this signal if they need to perform any special
107 * activities when the application is about to be paused.
109 LifecycleSignalType& PauseSignal();
112 * The user should connect to this signal if they need to perform any special
113 * activities when the application has resumed.
115 LifecycleSignalType& ResumeSignal();
118 * This signal is sent when the system requires the user to reinitialise itself.
120 LifecycleSignalType& ResetSignal();
123 * This signal is emitted when the language is changed on the device.
125 LifecycleSignalType& LanguageChangedSignal();
129 * @brief Assignment operator.
131 * The handle points to the same implementation as the one being copied from.
132 * @param[in] controller The LifecycleController to copy from.
133 * @return reference to this object
135 LifecycleController& operator=(const LifecycleController& controller);
137 public: // Not intended for application developers
139 * @brief This constructor is used internally to create a handle from an object pointer.
140 * @param [in] lifecycleController A pointer to the internal LifecycleController.
142 explicit DALI_INTERNAL LifecycleController(Internal::Adaptor::LifecycleController* lifecycleController);
147 #endif // DALI_LIFECYCLE_CONTROLLER_H