2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
5 // Licensed under the Flora License, Version 1.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://floralicense.org/license/
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 FUiSystemUtil.h
20 * @brief This is the header file for the SystemUtil
22 * This header file contains the declarations of the SystemUtil class.
26 #ifndef _FUI_SYSTEM_UTIL_H_
27 #define _FUI_SYSTEM_UTIL_H_
29 #include <FUiIKeyEventListener.h>
31 namespace Tizen { namespace Graphics
38 namespace Tizen { namespace Ui
44 * Defines key event types.
50 KEY_EVENT_TYPE_PRESSED, /**< Key pressed event type */
51 KEY_EVENT_TYPE_RELEASED, /**< Key released event type */
55 * @enum TouchEventType
57 * Defines touch event types.
63 TOUCH_EVENT_TYPE_PRESSED, /**< Touch pressed event type */
64 TOUCH_EVENT_TYPE_RELEASED, /**< Touch released event type */
65 TOUCH_EVENT_TYPE_MOVED /**< Touch moved event type */
70 * @brief This is a class for system utililty such as touch, key, and capturing screen. It provides
71 * functionalities to simulate user inputs.
73 * @final This class is not intended for extension.
75 * This class provides methods to generate user's input events such as
76 * touch and key events for helping test application and to capture current screen.
78 class _OSP_EXPORT_ SystemUtil
82 * Generates a key event
87 * @privilege %%http://tizen.org/privilege/inputmanager
89 * @return An error code
90 * @param[in] keyEvent The event type of the key to be generated
91 * @param[in] keyCode The code of the key
92 * @exception E_SUCCESS The method was successful.
93 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
94 * @exception E_OPERATION_FAILED An error occurred in the underlying system.
95 * @exception E_INVALID_ARG The specified @c keyEvent or @c keyCode is not supported.
97 static result GenerateKeyEvent(KeyEventType keyEvent, KeyCode keyCode);
100 * Generates a touch event
104 * @privlevel platform
105 * @privilege %%http://tizen.org/privilege/inputmanager
107 * @return An error code
108 * @param[in] touchEvent The event type of the touch to be generated
109 * @param[in] point The point on which the touch occurs
110 * @exception E_SUCCESS The method was successful.
111 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
112 * @exception E_OPERATION_FAILED An error occurred in the underlying system.
113 * @exception E_INVALID_ARG The specified @c touchEvent is not supported.
115 static result GenerateTouchEvent(TouchEventType touchEvent, const Tizen::Graphics::Point& point);
118 * Generates a touch event
122 * @privlevel platform
123 * @privilege %%http://tizen.org/privilege/inputmanager
125 * @return An error code
126 * @param[in] touchEvent The event type of the touch to be generated
127 * @param[in] point The point on which the touch occurs
128 * @exception E_SUCCESS The method was successful.
129 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
130 * @exception E_OPERATION_FAILED An error occurred in the underlying system.
131 * @exception E_INVALID_ARG The specified @c touchEvent is not supported.
133 static result GenerateTouchEvent(TouchEventType touchEvent, const Tizen::Graphics::FloatPoint& point);
140 * @privlevel platform
141 * @privilege %%http://tizen.org/privilege/inputmanager
143 * @return A pointer to the captured screen bitmap, @n
144 * else @c null if it fails to capture screen
145 * @exception E_SUCCESS The method was successful.
146 * @exception E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
147 * @exception E_OPERATION_FAILED An error occurred in the underlying system.
148 * @remarks There is a high probability for an occurrence of an out-of-memory exception. If possible, check whether the exception is E_OUT_OF_MEMORY or not. For more information on how to handle the out-of-memory exception, refer <a href="../org.tizen.native.appprogramming/html/basics_tizen_programming/exception_check.htm">here</a>.
149 * @remarks The specific error code can be accessed using the GetLastResult() method. @n
150 * The returned bitmap should be deleted by the application after use.
152 static Tizen::Graphics::Bitmap* CaptureScreenN(void);
156 // This default constructor is intentionally declared as private because this class cannot be constructed.
161 // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
163 SystemUtil(const SystemUtil& rhs);
166 // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
168 SystemUtil& operator =(const SystemUtil& rhs);
171 // This is a destructor for this class.
172 // This destructor is intentionally declared as private because this class cannot be constructed.