1 #ifndef __DALI_LIFECYCLE_CONTROLLER_H__
2 #define __DALI_LIFECYCLE_CONTROLLER_H__
5 * Copyright (c) 2015 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>
28 namespace Internal DALI_INTERNAL
32 class LifecycleController;
37 * @brief Provides application lifecycle events.
39 * Connect to the signals of this class to receive notification of events in the lifecycle
40 * of the application. The following example shows how to connect to the Init signal. This
41 * could be done for example in the constructor of a singleton that is known to be created
45 * void MyClass::MyClass()
47 * LifecycleController::Get().InitSignal().Connect( this, &MyClass::OnApplicationInit );
50 * void MyClass::OnApplicationInit()
52 * // ... Do something on init
56 class DALI_IMPORT_API LifecycleController : public BaseHandle
60 typedef Signal< void (void) > LifecycleSignalType; ///< Lifecycle Signal type
62 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();
95 * The user should connect to this signal to determine when they should initialise
98 LifecycleSignalType& InitSignal();
101 * The user should connect to this signal to determine when they should terminate
104 LifecycleSignalType& TerminateSignal();
107 * The user should connect to this signal if they need to perform any special
108 * activities when the application is about to be paused.
110 LifecycleSignalType& PauseSignal();
113 * The user should connect to this signal if they need to perform any special
114 * activities when the application has resumed.
116 LifecycleSignalType& ResumeSignal();
119 * This signal is sent when the system requires the user to reinitialise itself.
121 LifecycleSignalType& ResetSignal();
124 * This signal is emitted when the window the application is rendering on is resized.
126 LifecycleSignalType& ResizeSignal();
129 * This signal is emitted when the language is changed on the device.
131 LifecycleSignalType& LanguageChangedSignal();
136 * @brief Assignment operator.
138 * The handle points to the same implementation as the one being copied from.
139 * @param[in] controller The LifecycleController to copy from.
140 * @return reference to this object
142 LifecycleController& operator=(const LifecycleController& controller);
144 public: // Not intended for application developers
146 * @brief This constructor is used internally to create a handle from an object pointer.
147 * @param [in] lifecycleController A pointer to the internal LifecycleController.
149 explicit DALI_INTERNAL LifecycleController(Internal::Adaptor::LifecycleController* lifecycleController);
154 #endif // __DALI_LIFECYCLE_CONTROLLER_H__