Tizen 2.1 base
[framework/osp/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
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 }}
36
37 namespace Tizen { namespace Ui
38 {
39
40 /**
41  * @enum         KeyEventType
42  *
43  * Defines key event types.
44  *
45  * @since 2.0
46  */
47 enum KeyEventType
48 {
49         KEY_EVENT_TYPE_PRESSED,           /**< Key pressed event type */
50         KEY_EVENT_TYPE_RELEASED,          /**< Key released event type */
51 };
52
53 /**
54  * @enum         TouchEventType
55  *
56  * Defines touch event types.
57  *
58  * @since 2.0
59  */
60 enum TouchEventType
61 {
62         TOUCH_EVENT_TYPE_PRESSED,           /**< Touch pressed event type */
63         TOUCH_EVENT_TYPE_RELEASED,          /**< Touch released event type */
64         TOUCH_EVENT_TYPE_MOVED             /**< Touch moved event type */
65 };
66
67 /**
68  * @if VISPARTNER-MANUFACTURER
69  * @class SystemUtil
70  * @brief This is a class 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  * @visibility partner-manufacturer
75  *
76  * This class provides methods to generate user's input events such as
77  *        touch and key events for helping test application and to capture current screen.
78  * @endif
79  */
80 class _OSP_EXPORT_ SystemUtil
81 {
82 public:
83         /**
84          * @if       VISPARTNER-MANUFACTURER
85          * Generates a key event
86          *
87          * @since 2.0
88          * @visibility partner-manufacturer
89          * @privilege %http://tizen.org/privilege/inputmanager
90          *
91          * @return                   An error code
92          * @param[in]     keyEvent             The event type of the key to be generated
93          * @param[in]     keyCode     The code of the key
94          * @exception                   E_SUCCESS        The method was successful.
95          * @exception      E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
96          * @exception                   E_OPERATION_FAILED         An error occurred in the underlying system.
97          * @exception               E_INVALID_ARG  The specified @c keyEvent or @c keyCode is not supported.
98          * @endif
99          */
100         static result GenerateKeyEvent(KeyEventType keyEvent, KeyCode keyCode);
101
102         /**
103          * @if       VISPARTNER-MANUFACTURER
104          * Generates a touch event
105          *
106          * @since 2.0
107          * @visibility partner-manufacturer
108          * @privilege %http://tizen.org/privilege/inputmanager
109          *
110          * @return                   An error code
111          * @param[in]     touchEvent          The event type of the touch to be generated
112          * @param[in]     point                 The point on which the touch occurs
113          * @exception                   E_SUCCESS        The method was successful.
114          * @exception      E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
115          * @exception                   E_OPERATION_FAILED         An error occurred in the underlying system.
116          * @exception     E_INVALID_ARG  The specified @c touchEvent is not supported.
117          * @endif
118          */
119         static result GenerateTouchEvent(TouchEventType touchEvent, const Tizen::Graphics::Point& point);
120
121         /**
122          * @if       VISPARTNER-MANUFACTURER
123          * Captures a screen
124          *
125          * @since 2.0
126          * @visibility partner-manufacturer
127          * @privilege %http://tizen.org/privilege/inputmanager
128          *
129          * @return                   A pointer to the captured screen bitmap, @n
130          * else @c null if it fails to capture screen
131          * @exception                   E_SUCCESS        The method was successful.
132          * @exception      E_PRIVILEGE_DENIED The application does not have the privilege to call this method.
133          * @exception                   E_OPERATION_FAILED         An error occurred in the underlying system.
134          * @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>.
135          * @remarks     The specific error code can be accessed using the GetLastResult() method. @n
136          * The returned bitmap should be deleted by the application after use.
137          * @endif
138          */
139         static Tizen::Graphics::Bitmap* CaptureScreenN(void);
140
141 private:
142         //
143         // This default constructor is intentionally declared as private because this class cannot be constructed.
144         //
145         SystemUtil(void);
146
147         //
148         // This destructor is intentionally declared as private because this class cannot be constructed.
149         //
150         SystemUtil(const SystemUtil& rhs);
151
152         //
153         // The implementation of this copy assignment operator is intentionally blank and declared as private to prohibit copying of objects.
154         //
155         SystemUtil& operator =(const SystemUtil& rhs);
156
157         //
158         // This is a destructor for this class.
159         // This destructor is intentionally declared as private because this class cannot be constructed.
160         //
161         ~SystemUtil(void);
162
163 }; //SystemUtil
164
165 }} //Tizen::Ui
166 #endif
167