2 // Open Service Platform
3 // Copyright (c) 2012 Samsung Electronics Co., Ltd.
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
20 * @brief This is the header file for the %UiApp class.
22 * This header file contains the declarations of the %UiApp class.
25 #ifndef _FAPP_UI_APP_H_
26 #define _FAPP_UI_APP_H_
30 namespace Tizen { namespace Base { namespace Collection { class IList; } } }
31 namespace Tizen { namespace Ui { namespace Controls { class Frame; } } }
33 namespace Tizen { namespace App
39 typedef UiApp* (*UiAppInstanceFactory)(void);
43 * @brief This class is the base class of a %Tizen native UI application.
47 * The %UiApp class is the base class of a %Tizen native UI application.
48 * A %Tizen native UI application must inherit from the %UiApp class. This class provides the basic features necessary to define the
49 * %Tizen native UI application.
51 * For more information on the class features, see <a href="../org.tizen.native.appprogramming/html/guide/app/app_namespace.htm">App Guide</a> and <a href="../org.tizen.native.appprogramming/html/basics_tizen_programming/tizen_app_model/application_model.htm">Native Application Model</a>.
54 class _OSP_EXPORT_ UiApp
55 : public Tizen::App::App
59 * This destructor overrides Tizen::Base::Object::~Object().
66 * Gets the first frame in the frame list of the UI application.
70 * @return A pointer to the IAppFrame interface of the frame, @n
71 * else @c null if it fails
72 * @exception E_SUCCESS The method is successful.
73 * @exception E_INVALID_STATE The frame has not been properly initialized.
74 * @exception E_OBJ_NOT_FOUND The frame is not found.
76 IAppFrame* GetAppFrame(void) const;
79 * Adds the frame to the end of the list that is maintained by the UI application.
83 * @return An error code
84 * @param[in] frame The frame that is added to the UI application
85 * @exception E_SUCCESS The method is successful.
86 * @exception E_INVALID_ARG The specified input parameter is invalid.
87 * @exception E_INVALID_STATE The application is in an invalid state.
88 * @exception E_OBJ_ALREADY_EXIST The frame to be added is already registered with the UI application.
89 * @exception E_OUT_OF_MEMORY The memory is insufficient.
90 * @exception E_MAX_EXCEEDED The number of frames has exceeded the maximum limit.
91 * @exception E_SYSTEM A system error has occurred.
93 result AddFrame(const Tizen::Ui::Controls::Frame& frame);
96 * Removes the specified @c frame from the UI application.
100 * @return An error code
101 * @param[in] frame The frame to remove
102 * @exception E_SUCCESS The method is successful.
103 * @exception E_OBJ_NOT_FOUND The specified @c frame cannot be found.
104 * @exception E_SYSTEM A system error has occurred.
105 * @remarks The removed frame is deleted from the memory.
107 result RemoveFrame(const Tizen::Ui::Controls::Frame& frame);
110 * Gets the list of the frames of the UI application.
114 * @return A pointer to Tizen::Base::Collection::IList that contains Tizen::Ui::Frame instances, @n
115 * else @c null if it fails
116 * @exception E_SUCCESS The method is successful.
117 * @exception E_INVALID_STATE The application is in an invalid state.
118 * @remarks The specific error code can be accessed using the GetLastResult() method.
120 Tizen::Base::Collection::IList* GetFrameList(void) const;
123 * Gets the frame with the specified @c name.
127 * @return A pointer to the frame having the specified @c name, @n
128 * else @c null if it fails
129 * @param[in] name The name of the frame
130 * @exception E_SUCCESS The method is successful.
131 * @exception E_OBJ_NOT_FOUND The specified @c frame cannot be found.
132 * @remarks The specific error code can be accessed using the GetLastResult() method.
134 Tizen::Ui::Controls::Frame* GetFrame(const Tizen::Base::String& name) const;
137 * Gets the frame at the specified @c index of the list.
141 * @return A pointer to the frame at the specified @c index, @n
142 * else @c null if it fails
143 * @param[in] index The index of the frame
144 * @exception E_SUCCESS The method is successful.
145 * @exception E_OUT_OF_RANGE The specified @c index is outside the bounds of the frame list.
146 * @remarks The specific error code can be accessed using the GetLastResult() method.
148 Tizen::Ui::Controls::Frame* GetFrameAt(int index) const;
151 * Gets the UI state of the UI application.
155 * @return The UI state of the UI application
156 * @remarks Note that UiApp::OnBackground() is invoked when the UI state of a UI application changes
157 * from App::APP_UI_STATE_FOREGROUND to App::APP_UI_STATE_PARTIAL_BACKGROUND or App::APP_UI_STATE_BACKGROUND.
160 AppUiState GetAppUiState(void) const;
163 * Called when a UI application moves to the foreground. @n
164 * User interaction is enabled when the UI application moves to the foreground. @n
165 * A UI application moves to the foreground when:
167 * - A UI application is selected from the Task Manager.
168 * - A UI application icon in the Launcher application is pressed when it is running in the background.
169 * - A UI application is to be launched while it is running in the background.
170 * - A system pop-up, such as an incoming call, notification (for example, SMS), or a low battery warning
173 * %OnForeground() is called when the UI application is moved to the foreground. @n
174 * When this method is invoked, the following actions are recommended:
176 * - Resume the graphic processing, such as 3D or animation, as the UI application now has the focus.
177 * - Resume the operations that stopped when the UI application is last moved to the background.
181 * @remarks When the system needs to refresh a screen component, it can call this method even if the UI application is present in the foreground.
183 virtual void OnForeground(void);
186 * Called when another UI application moves to the top or a system pop-up is displayed. @n
187 * User interaction is disabled when the UI application is in the background. @n
188 * A UI application moves to the background when:
190 * - A system pop-up, such as an incoming call or a low battery warning pop-up is displayed.
191 * - A device is locked.
192 * - The Home key is pressed.
194 * %OnBackground() is called when the UI application is moved to the background. @n
195 * Whenever this method is invoked, the following actions are recommended:
197 * - Stop the graphic processing, such as 3D or animation, as they will not be displayed.
198 * - Release unnecessary resources.
199 * - Stop media processing, sensor manipulations, and location updates.
203 * @remarks When notification (for example, SMS) pops up, this method is not called.
204 * When a system pop-up is displayed, a UI application becomes partially hidden
205 * (App::APP_UI_STATE_PARTIAL_BACKGROUND).
206 * If a UI application is partially hidden, it is recommended to hold the activated
207 * tasks or resources instead of stopping or releasing them.
208 * @see GetAppUiState()
210 virtual void OnBackground(void);
213 * Gets the %UiApp instance's pointer.
217 * @return A pointer to the %UiApp instance, @n
218 * else @c null if it fails
220 static UiApp* GetInstance(void);
223 * Executes an application implemented by inheriting this class.
224 * The %Execute() method must be called from the entry method - OspMain(), which is generated by IDE.
228 * @return An error code
229 * @param[in] pUiAppFactory The factory method that creates this UiApp's instance
230 * @param[in] pArguments The launch arguments for %App
231 * @exception E_SUCCESS The method is successful.
232 * @exception E_INVALID_ARG A specified input parameter is invalid.
233 * @exception E_OUT_OF_MEMORY The memory is insufficient.
234 * @exception E_INIT_FAILED The initialization failure during OnAppInitializing().
235 * @exception E_SYSTEM A system error has occurred.
237 static result Execute(UiAppInstanceFactory pUiAppFactory, const Tizen::Base::Collection::IList* pArguments);
241 * This is the default constructor for this class.
248 // This method is for internal use only.
249 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
251 // The following methods are reserved and the name of the methods can be changed at any time without prior notice.
255 virtual void UiApp_Reserved1(void) {}
258 // This method is for internal use only.
259 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
261 // The following methods are reserved and the name of the methods can be changed at any time without prior notice.
265 virtual void UiApp_Reserved2(void) {}
268 // This method is for internal use only.
269 // Using this method can cause behavioral, security-related, and consistency-related issues in the application.
271 // The following methods are reserved and the name of the methods can be changed at any time without prior notice.
275 virtual void UiApp_Reserved3(void) {}
279 * The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
283 UiApp(const UiApp& rhs);
286 * The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
290 UiApp& operator =(const UiApp& rhs);
293 class _UiAppImpl* __pUiAppImpl;
296 typedef UiApp Application;
300 #endif // _FAPP_UI_APP_H_