2 // Open Service Platform
3 // Copyright (c) 2012-2013 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.
19 * @file FApp_UiAppImpl.h
20 * @brief This is the header file for the %_UiAppImpl class.
23 #ifndef _FAPP_INTERNAL_UI_APP_IMPL_H_
24 #define _FAPP_INTERNAL_UI_APP_IMPL_H_
28 #include <FAppUiApp.h>
29 #include <FBaseRtIEventListener.h>
31 #include <FUi_IKeyEventListener.h>
32 #include <FUi_IUiEventListener.h>
34 #include "FApp_IAppImpl.h"
36 namespace Tizen { namespace Base { namespace Collection { class IList; } } }
37 namespace Tizen { namespace Ui {namespace Controls { class Frame; } } }
39 namespace Tizen { namespace App
47 * @brief This class is the Impl class of a UiApp class.
50 * This class is the Impl class of a UiApp class.
52 class _OSP_EXPORT_ _UiAppImpl
53 : public Tizen::Base::Object
54 , public Tizen::App::_IAppImpl
55 , public Tizen::Ui::_IKeyEventListener
56 , virtual public Tizen::Ui::_IUiEventListener
57 , virtual public Tizen::Base::Runtime::IEventListener
61 * Returns the _UiAppImpl's instance pointer.
64 * @return A pointer to the %_UiAppImpl instance, @n
65 * else @c null if it fails
67 static _UiAppImpl* GetInstance(void);
70 * Returns the UiApp's instance pointer.
73 * @return A pointer to the %UiApp instance, @n
74 * else @c null if it fails
76 UiApp* GetUiAppInstance(void);
79 * Called when the application is started
82 * @return @c true if the method is successful, @n
84 * @param[in] user_data The user data passed from the callback registration function
85 * @remarks This is a system dependent callback function
87 virtual bool OnCreate(void);
90 * Called when other application send the launch request to the application
93 * @param[in] service The handle to the service
94 * @param[in] user_data The user data passed from the callback registration function
95 * @remarks This is a system dependent callback function
97 virtual void OnService(service_s* service, bool initial);
100 * Called when the application is completely obscured by another application and becomes invisible
103 * @param[in] user_data The user data passed from the callback registration function
104 * @remarks This is a system dependent callback function
106 virtual void OnPause(void);
109 * Called when the application becomes visible
112 * @param[in] user_data The user data passed from the callback registration function
113 * @remarks This is a system dependent callback function
115 virtual void OnResume(void);
118 * Called once after the main loop of application exits
121 * @param[in] user_data The user data passed from the callback registration function
122 * @remarks This is a system dependent callback function
124 virtual void OnTerminate(void);
127 * Called when an orintation event occurs.
130 * @param[in] orientation The information about the orientation event
132 virtual void OnDeviceOrientationChanged(app_device_orientation_e orientation);
135 * Called when the application's state changes to Tizen::App::AppState::INITIALIZING. @n
138 * @return @c true if the method is successful, @n
141 virtual bool OnAppInitializing(void);
144 * Called when the application's INITIALIZING state is finished
147 * @return @c true if the method is successful, @n
150 virtual bool OnAppInitialized(void);
154 * Called when the internal window handle is required.
158 virtual long OnWindowHandleRequest(void);
161 * Called when the application's state change to Tizen::App::AppState::TERMINATING. @n
164 * @param[in] forcedTermination @c true if the application terminate by system or other application, else @c false.
165 * @return @c true if the method is successful, @n
168 bool OnUiAppImplTerminating(void);
171 * Gets the first frame in the frame list of the UI application. @n
175 * @return A pointer to the IAppFrame interface of the frame, @n
176 * else @c null if it fails
178 IAppFrame* GetAppFrame(void);
181 * Notifies when a key is pressed.
184 * @param[in] source The source of the event
185 * @param[in] keyCode The key code
187 virtual bool OnKeyPressed(const Tizen::Ui::_Control& source, const Tizen::Ui::_KeyInfo& keyInfo);
190 * Notifies when a key is released.
193 * @param[in] source The source of the event
194 * @param[in] keyCode The key code
196 virtual bool OnKeyReleased(const Tizen::Ui::_Control& source, const Tizen::Ui::_KeyInfo& keyInfo);
200 * This is the default constructor for this class.
207 * This is the constructor for this class.
211 _UiAppImpl(UiApp* pUiApp);
214 * This is the copy constructor for the this class.
216 _UiAppImpl(const _UiAppImpl& source);
219 * This is the assignment operator for this class.
221 _UiAppImpl& operator =(const _UiAppImpl& source);
224 * This is the destructor for this class.
228 virtual ~_UiAppImpl(void);
231 * Delete all frames of Ui application. @n
235 * @return An error code
237 result RemoveAllFrames(void);
240 * Adds the frame at the end of the list maintained by the UI application. @n
244 * @return An error code
245 * @param[in] frame The frame to be added to the UI application
246 * @exception E_SUCCESS The method was successful.
247 * @exception E_INVALID_ARG The specified input parameter is invalid.
248 * @exception E_INVALID_STATE The application state is invalid.
249 * @exception E_OBJ_ALREADY_EXIST The frame to be added is already registered to the UI application.
250 * @exception E_OUT_OF_MEMORY Insufficient memory.
251 * @exception E_MAX_EXCEEDED The number of frame has exceeded the maximum limit.
252 * @exception E_SYSTEM A system error occurred.
254 result AddFrame(const Tizen::Ui::Controls::Frame& frame);
257 * Removes the specified frame from the UI application. @n
261 * @return An error code
262 * @param[in] frame The frame to be removed
263 * @exception E_SUCCESS The method was successful.
264 * @exception E_OBJ_NOT_FOUND The specified frame is not found.
265 * @exception E_SYSTEM A system error occurred.
266 * @remarks The removed frame is deleted from the memory.
268 result RemoveFrame(const Tizen::Ui::Controls::Frame& frame);
271 * Gets the list of the frames of the UI application. @n
275 * @return A pointer to IList that contains the registered frames @n
276 * else @c null if it fails
277 * @exception E_SUCCESS The method is successful.
278 * @exception E_INVALID_STATE The application state is invalid.
279 * @remarks The specific error code can be accessed using the GetLastResult() method.
281 Tizen::Base::Collection::IList* GetFrameList(void);
284 * Gets the frame with the specified name. @n
288 * @return A pointer to the frame having the specified name@n
289 * else @c null if it fails
290 * @param[in] name The name of the frame
291 * @exception E_SUCCESS The method is successful.
292 * @exception E_OBJ_NOT_FOUND The frame which has specified name is not fount.
293 * @remarks The specific error code can be accessed using the GetLastResult() method.
295 Tizen::Ui::Controls::Frame* GetFrame(const Tizen::Base::String& name);
297 Tizen::Ui::Controls::Frame* GetFrameAt(int index);
300 * Gets the UI state of the UI application.
303 * @return The UI state of the UI application
305 AppUiState GetAppUiState(void) const;
307 void OnForeground(void);
309 void OnBackground(void);
312 static _UiAppImpl* __pUiAppImpl;
314 _AppFrame* __pAppFrame;
316 _AppImpl* __pAppImpl;
318 AppUiState __appUiState;
320 Tizen::Base::Collection::ArrayList* __pFrameList;
326 friend class _ImeAppImpl;
331 #endif // _FAPP_INTERNAL_UI_APP_IMPL_H_