Merge "Prevents an invalid texture cache being interrogated for a texture. This ...
[platform/core/uifw/dali-core.git] / dali / public-api / events / key-event.h
1 #ifndef __DALI_KEY_EVENT_H__
2 #define __DALI_KEY_EVENT_H__
3
4 /*
5  * Copyright (c) 2015 Samsung Electronics Co., Ltd.
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  *
19  */
20
21 // EXTERNAL INCLUDES
22 #include <string>
23
24 // INTERNAL INCLUDES
25 #include <dali/public-api/common/dali-common.h>
26
27 namespace Dali
28 {
29 /**
30  * @addtogroup dali-core-events
31  * @{
32  */
33
34 /**
35  * @brief The key event structure is used to store a key press.
36  *
37  * It facilitates processing of these key presses and passing to other
38  * libraries like Toolkit. The keyString is the actual character you
39  * might want to display while the key name is just a descriptive
40  * name.  There is a key modifier which relates to keys like alt,
41  * shift and control functions are supplied to check if they have been
42  * pressed.
43  *
44  * Currently KeyEvent is also being used to relay messages from the
45  * IMF keyboard to Core. In future IMF may communicate via its own
46  * module.
47  */
48 struct DALI_IMPORT_API KeyEvent
49 {
50   // Enumerations
51
52   /**
53    * @brief Specifies the state of the key event.
54    */
55   enum State
56   {
57     Down,        ///< Key down
58     Up,          ///< Key up
59     Last
60   };
61
62   /**
63    * @brief Default constructor
64    */
65   KeyEvent();
66
67   /**
68    * @brief Constructor.
69    *
70    * @param[in]  keyName       The name of the key pressed or command from the IMF, if later then the some following parameters will be needed.
71    * @param[in]  keyString     A string of input characters or key pressed
72    * @param[in]  keyCode       The unique key code for the key pressed.
73    * @param[in]  keyModifier   The key modifier for special keys like shift and alt
74    * @param[in]  timeStamp The time (in ms) that the key event occurred.
75    * @param[in]  keyState The state of the key event.
76    */
77   KeyEvent(const std::string& keyName, const std::string& keyString, int keyCode, int keyModifier, unsigned long timeStamp, const State& keyState);
78
79   /**
80    * @brief Destructor.
81    */
82   ~KeyEvent();
83
84   /**
85    * @brief Check to see if Shift key modifier has been supplied.
86    *
87    * @return bool true if shift modifier
88    */
89   bool IsShiftModifier() const;
90
91   /**
92    * @brief Check to see if Ctrl (control) key modifier has been supplied.
93    *
94    * @return bool true if ctrl modifier
95    */
96   bool IsCtrlModifier() const;
97
98   /**
99    * @brief Check to see if Alt key modifier has been supplied.
100    *
101    * @return bool true if alt modifier
102    */
103   bool IsAltModifier() const;
104
105   // Data
106
107   /**
108    * @brief name given to the key pressed.
109    */
110   std::string keyPressedName;
111
112   /**
113    * @brief The actual string returned that should be used for input editors.
114    */
115   std::string keyPressed;
116
117   /**
118    * @brief Keycode for the key pressed.
119    */
120   int  keyCode;
121
122   /**
123    * @brief special keys like shift, alt and control which modify the next key pressed.
124    */
125   int  keyModifier;
126
127   /**
128    * @brief The time (in ms) that the key event occurred.
129    */
130   unsigned long time;
131
132   /**
133    * @brief State of the key event.
134    *
135    * @see State
136    */
137   State state;
138
139 };
140
141 /**
142  * @}
143  */
144 } // namespace Dali
145
146 #endif // __DALI_KEY_EVENT_H__