1 #ifndef __DALI_INTERNAL_FRAMEWORK_H__
2 #define __DALI_INTERNAL_FRAMEWORK_H__
5 * Copyright (c) 2014 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.
23 #include <dali/public-api/signals/callback.h>
26 #include "abort-handler.h"
38 * The Framework class is used to register callbacks with the TIZEN platform so that
39 * we know when any of the application lifecycle events occur. This includes events
40 * like when our application is to be initialised, terminated, paused, resumed etc.
47 * Observer class for the framework.
54 * Invoked when the application is to be initialised.
56 virtual void OnInit() {}
59 * Invoked when the application is to be terminated.
61 virtual void OnTerminate() {}
64 * Invoked when the application is to be paused.
66 virtual void OnPause() {}
69 * Invoked when the application is to be resumed.
71 virtual void OnResume() {}
74 * Invoked when the application is to be reset.
76 virtual void OnReset() {}
79 * Invoked when the AppControl message is received.
80 * @param[in] The bundle data of AppControl message.
82 virtual void OnAppControl(void *) {}
85 * Invoked when the language of the device is changed.
87 virtual void OnLanguageChanged() {}
90 * Invoked when the region is changed.
92 virtual void OnRegionChanged() {}
95 * Invoked when the battery level of the device is low.
97 virtual void OnBatteryLow() {}
100 * Invoked when the memory level of the device is low.
102 virtual void OnMemoryLow() {}
109 * @param[in] observer The observer of the Framework.
110 * @param[in] argc A pointer to the number of arguments.
111 * @param[in] argv A pointer the the argument list.
113 Framework(Observer& observer, int* argc, char ***argv, const std::string& name);
123 * Runs the main loop of framework
128 * Quits the main loop
133 * Checks whether the main loop of the framework is running.
134 * @return true, if the main loop is running, false otherwise.
136 bool IsMainLoopRunning();
139 * If the main loop aborts unexpectedly, then the connected callback function is called.
140 * @param[in] callBack The function to call.
141 * @note Only one callback can be registered. The last callback to be set will be called on abort.
142 * @note The ownership of callback is passed onto this class.
144 void AddAbortCallback( CallbackBase* callback );
147 * Gets bundle name which was passed in app_reset callback.
149 std::string GetBundleName() const;
152 * Gets bundle id which was passed in app_reset callback.
154 std::string GetBundleId() const;
159 Framework(const Framework&);
160 Framework& operator=(Framework&);
164 * Called by the App framework when an application lifecycle event occurs.
165 * @param[in] type The type of event occurred.
166 * @param[in] bundleData The bundle data of event occurred.
168 bool AppStatusHandler(int type, void *bundleData);
171 * Called app_reset callback was called with bundle.
173 void SetBundleName(const std::string& name);
176 * Called app_reset callback was called with bundle.
178 void SetBundleId(const std::string& id);
181 * Called if the application is aborted.
183 void AbortCallback();
186 * Called for initializing on specified backend. (X11 or Wayland)
197 std::string mBundleName;
198 std::string mBundleId;
199 AbortHandler mAbortHandler;
201 private: // impl members
208 } // namespace Adaptor
210 } // namespace Internal
214 #endif // __DALI_INTERNAL_FRAMEWORK_H__