Merge "Fix Ime Rotation" into tizen_2.1
[platform/framework/native/uifw.git] / inc / FUiSystemUtil.h
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
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
8 //
9 //     http://floralicense.org/license/
10 //
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.
16 //
17
18 /**
19 * @file     FUiSystemUtil.h
20 * @brief    This is the header file for the %SystemUtil class.
21 *
22 * This header file contains the declarations of the %SystemUtil class.
23 *
24 */
25
26 #ifndef _FUI_SYSTEM_UTIL_H_
27 #define _FUI_SYSTEM_UTIL_H_
28
29 #include <FUiIKeyEventListener.h>
30
31 namespace Tizen { namespace Graphics
32 {
33 class Bitmap;
34 class Point;
35 class FloatPoint;
36 }}
37
38 namespace Tizen { namespace Ui
39 {
40
41 /**
42 * @enum         KeyEventType
43 *
44 * Defines key event types.
45 *
46 * @since 2.0
47 */
48 enum KeyEventType
49 {
50            KEY_EVENT_TYPE_PRESSED,           /**< Key pressed event type */
51            KEY_EVENT_TYPE_RELEASED,          /**< Key released event type */
52 };
53
54 /**
55 * @enum         TouchEventType
56 *
57 * Defines touch event types.
58 *
59 * @since 2.0
60 */
61 enum TouchEventType
62 {
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 */
66 };
67
68 /**
69 * @class SystemUtil
70 * @brief This class is for system utililty such as touch, key, and capturing screen. It provides
71 *        functionalities to simulate user inputs.
72 * @since 2.0
73 * @final           This class is not intended for extension.
74 *
75 * The %SystemUtil 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.
77 */
78 class _OSP_EXPORT_ SystemUtil
79 {
80 public:
81            /**
82            * Generates a key event.
83            *
84            * @since 2.0
85            *
86            * @privlevel          platform
87            * @privilege %http://tizen.org/privilege/inputmanager
88            *
89            * @return                   An error code
90            * @param[in]     keyEvent             The event type of the key to generate
91            * @param[in]     keyCode     The code of the key
92            * @exception                   E_SUCCESS        The method is successful.
93            * @exception      E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
94            * @exception                   E_OPERATION_FAILED         An error has occurred in the underlying system.
95            * @exception               E_INVALID_ARG  The specified @c keyEvent or @c keyCode is not supported.
96            */
97            static result GenerateKeyEvent(KeyEventType keyEvent, KeyCode keyCode);
98
99            /**
100            * Generates a touch event.
101            *
102            * @since 2.0
103            *
104            * @privlevel          platform
105            * @privilege %http://tizen.org/privilege/inputmanager
106            *
107            * @return                   An error code
108            * @param[in]     touchEvent          The event type of the touch to generate
109            * @param[in]     point                 The point on which the touch occurs
110            * @exception                   E_SUCCESS        The method is successful.
111            * @exception      E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
112            * @exception                   E_OPERATION_FAILED         An error has occurred in the underlying system.
113            * @exception     E_INVALID_ARG  The specified @c touchEvent is not supported.
114            */
115            static result GenerateTouchEvent(TouchEventType touchEvent, const Tizen::Graphics::Point& point);
116
117            /**
118            * Generates a touch event.
119            *
120            * @since 2.0
121            *
122            * @privlevel          platform
123            * @privilege %http://tizen.org/privilege/inputmanager
124            *
125            * @return                   An error code
126            * @param[in]     touchEvent          The event type of the touch to generate
127            * @param[in]     point                 The point on which the touch occurs
128            * @exception                   E_SUCCESS        The method is successful.
129            * @exception      E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
130            * @exception                   E_OPERATION_FAILED         An error has occurred in the underlying system.
131            * @exception     E_INVALID_ARG  The specified @c touchEvent is not supported.
132            */
133            static result GenerateTouchEvent(TouchEventType touchEvent, const Tizen::Graphics::FloatPoint& point);
134
135            /**
136            * Captures a screen.
137            *
138            * @since 2.0
139            *
140            * @privlevel          platform
141            * @privilege %http://tizen.org/privilege/inputmanager
142            *
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 is successful.
146            * @exception      E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
147            * @exception                   E_OPERATION_FAILED         An error has 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 must be deleted by the application after use.
151            */
152           static Tizen::Graphics::Bitmap* CaptureScreenN(void);
153
154 private:
155            //
156            // This default constructor is intentionally declared as private because this class cannot be constructed.
157            //
158            SystemUtil(void);
159
160            //
161            // The implementation of this copy constructor is intentionally blank and declared as private to prohibit copying of objects.
162            //
163            SystemUtil(const SystemUtil& rhs);
164
165            //
166            // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
167            //
168            SystemUtil& operator =(const SystemUtil& rhs);
169
170            //
171            // This is a destructor for this class.
172            // This destructor is intentionally declared as private because this class cannot be constructed.
173            //
174            ~SystemUtil(void);
175
176 }; //SystemUtil
177
178 }} //Tizen::Ui
179 #endif
180