31a8dfdc11291c6848216d9b0485352afbdf9115
[platform/core/uifw/dali-core.git] / dali / integration-api / events / key-event-integ.h
1 #ifndef DALI_INTEGRATION_KEY_EVENT_H
2 #define DALI_INTEGRATION_KEY_EVENT_H
3
4 /*
5  * Copyright (c) 2020 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/integration-api/events/event.h>
26 #include <dali/public-api/events/key-event.h>
27
28 namespace Dali
29 {
30
31 namespace Integration
32 {
33
34 /**
35  * An instance of this class should be used by the adaptor to send a key event to
36  * the Dali core.
37  *
38  */
39 struct DALI_CORE_API KeyEvent : public Event
40 {
41   // Enumerations
42   // Specifies the state of the key event.
43   enum State
44   {
45     DOWN,        /**< Key down */
46     UP,          /**< Key up */
47   };
48
49   /**
50    * Default Constructor
51    */
52   KeyEvent();
53
54   /**
55    * Constructor
56    * @param[in]  keyName         The name of the key pressed or command from the IMF, if later then the some following parameters will be needed.
57    * @param[in]  logicalKey      The logical key symbol (eg. shift + 1 == "exclamation")
58    * @param[in]  keyString       The string of input characters or key pressed
59    * @param[in]  keyCode         The unique key code for the key pressed.
60    * @param[in]  keyModifier     The key modifier for special keys like shift and alt
61    * @param[in]  timeStamp       The time (in ms) that the key event occurred.
62    * @param[in]  keyState        The state of the key event.
63    * @param[in]  compose         The key compose
64    * @param[in]  deviceName      The name of device KeyEvent originated from
65    * @param[in]  deviceClass     The class of device KeyEvent originated from
66    * @param[in]  deviceSubclass  The subclass of device KeyEvent originated from
67    */
68   KeyEvent(const std::string& keyName,
69            const std::string& logicalKey,
70            const std::string& keyString,
71            int keyCode,
72            int keyModifier,
73            unsigned long timeStamp,
74            const State& keyState,
75            const std::string& compose,
76            const std::string& deviceName,
77            const Device::Class::Type deviceClass,
78            const Device::Subclass::Type deviceSubclass );
79
80   /**
81    * Virtual destructor
82    */
83   ~KeyEvent() override;
84
85   // Data
86
87   /**
88    * The name of the key pressed or command from the IMF
89    */
90   std::string keyName;
91
92   /**
93    * The logical key symbol
94    */
95   std::string logicalKey;
96
97   /**
98    * The string of input characters or key pressed
99    */
100   std::string keyString;
101
102   /**
103    * The unique key code for the key pressed.
104    */
105   int  keyCode;
106
107   /**
108    * The key modifier for special keys like shift and alt
109    */
110   int  keyModifier;
111
112   /**
113    * The time (in ms) that the key event occurred.
114    */
115   unsigned long time;
116
117   /**
118    * State of the key event.
119    * @see State
120    */
121   State state;
122
123   /**
124    * If this keystroke has modified a string in the middle of being composed - this string replaces the previous one.
125    */
126   std::string compose;
127
128   /**
129    * The name of device KeyEvent originated from
130    */
131   std::string deviceName;
132
133   /**
134    * The class of device KeyEvent originated from
135    */
136   Device::Class::Type deviceClass;
137
138   /**
139    * The subclass of device KeyEvent originated from
140    */
141   Device::Subclass::Type deviceSubclass;
142 };
143
144 } // namespace Integration
145
146 } // namespace Dali
147
148 #endif // DALI_INTEGRATION_KEY_EVENT_H