1 #ifndef __DALI_KEY_EVENT_H__
2 #define __DALI_KEY_EVENT_H__
5 * Copyright (c) 2015 Samsung Electronics Co., Ltd.
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
11 * http://www.apache.org/licenses/LICENSE-2.0
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.
25 #include <dali/public-api/common/dali-common.h>
30 * @addtogroup dali_core_events
35 * @brief The key event structure is used to store a key press.
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
44 * Currently KeyEvent is also being used to relay messages from the
45 * IMF(Input Method Framework) keyboard to the internal core. In future IMF may communicate via its own
49 struct DALI_IMPORT_API KeyEvent
54 * @brief Enumeration for specifying the state of the key event.
59 Down, ///< Key down @SINCE_1_0.0
60 Up, ///< Key up @SINCE_1_0.0
65 * @brief Default constructor.
74 * @param[in] keyName The name of the key pressed or command from the IMF, if later then the some following parameters will be needed
75 * @param[in] keyString A string of input characters or key pressed
76 * @param[in] keyCode The unique key code for the key pressed
77 * @param[in] keyModifier The key modifier for special keys like shift and alt
78 * @param[in] timeStamp The time (in ms) that the key event occurred
79 * @param[in] keyState The state of the key event
81 KeyEvent(const std::string& keyName, const std::string& keyString, int keyCode, int keyModifier, unsigned long timeStamp, const State& keyState);
90 * @brief Checks to see if Shift key modifier has been supplied.
93 * @return True if shift modifier
95 bool IsShiftModifier() const;
98 * @brief Checks to see if Ctrl (control) key modifier has been supplied.
101 * @return True if ctrl modifier
103 bool IsCtrlModifier() const;
106 * @brief Checks to see if Alt key modifier has been supplied.
109 * @return True if alt modifier
111 bool IsAltModifier() const;
116 * @brief Name given to the key pressed.
118 std::string keyPressedName;
121 * @brief The actual string returned that should be used for input editors.
123 std::string keyPressed;
126 * @brief Keycode for the key pressed.
128 * @remarks We recommend not to use this key code value
129 * directly because its meaning might be changed in the future. Currently, it means a
130 * platform-specific key code. You need to use IsKey() to know what a key event means
131 * instead of direct comparison of key code value.
136 * @brief special keys like shift, alt and control which modify the next key pressed.
141 * @brief The time (in ms) that the key event occurred.
146 * @brief State of the key event.
159 #endif // __DALI_KEY_EVENT_H__