9040707fd36c6e4c47107db4c9f3b2e7eb0519b2
[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) 2017 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 #include <dali/devel-api/events/key-event-devel.h>
28
29 namespace Dali DALI_IMPORT_API
30 {
31
32 namespace Integration
33 {
34
35 /**
36  * An instance of this class should be used by the adaptor to send a key event to
37  * the Dali core.
38  *
39  */
40 struct KeyEvent : public Event
41 {
42   // Enumerations
43   // Specifies the state of the key event.
44   enum State
45   {
46     Down,        /**< Key down */
47     Up,          /**< Key up */
48
49     Last
50   };
51
52   /**
53    * Default Constructor
54    */
55   KeyEvent();
56
57   /**
58    * Constructor
59    * @param[in]  keyName       The name of the key pressed or command from the IMF, if later then the some following parameters will be needed.
60    * @param[in]  keyString     A string of input characters or key pressed
61    * @param[in]  keyCode       The unique key code for the key pressed.
62    * @param[in]  keyModifier   The key modifier for special keys like shift and alt
63    * @param[in]  timeStamp     The time (in ms) that the key event occurred.
64    * @param[in]  keyState      The state of the key event.
65    * @param[in]  deviceName    Name of device KeyEvent originated from
66    * @param[in]  deviceClass   Class of device KeyEvent originated from
67    */
68   KeyEvent(const std::string& keyName,
69            const std::string& keyString,
70            int keyCode,
71            int keyModifier,
72            unsigned long timeStamp,
73            const State& keyState,
74            const std::string& deviceName,
75            const DevelDevice::Class::Type deviceClass,
76            const DevelDevice::Subclass::Type deviceSubclass );
77
78   /*
79    * Constructor, creates a Integration::KeyEvent from a Dali::KeyEvent
80    * @param[in] event Dali::KeyEvent to convert from
81    */
82   explicit KeyEvent( const Dali::KeyEvent& event );
83
84   /**
85    * Virtual destructor
86    */
87   virtual ~KeyEvent();
88
89   // Data
90
91   /**
92    *@copydoc Dali::KeyEvent::keyPressedName
93    */
94   std::string keyName;
95
96   /**
97    *@copydoc Dali::KeyEvent::keyPressed
98    */
99   std::string keyString;
100
101   /**
102    * @copydoc Dali::KeyEvent::keyCode
103    */
104   int  keyCode;
105
106   /**
107    *@copydoc Dali::KeyEvent::keyModifier
108    */
109   int  keyModifier;
110
111   /**
112    *@copydoc Dali::KeyEvent::time
113    */
114   unsigned long time;
115
116   /**
117    * State of the key event.
118    * @see State
119    */
120   State state;
121
122   /**
123    * Name of device KeyEvent originated from
124    */
125   std::string deviceName;
126
127   /**
128    * Class of device KeyEvent originated from
129    */
130   DevelDevice::Class::Type deviceClass;
131
132   /**
133    * Subclass of device KeyEvent originated from
134    */
135   DevelDevice::Subclass::Type deviceSubclass;
136 };
137
138 } // namespace Integration
139
140 } // namespace Dali
141
142 #endif // __DALI_INTEGRATION_KEY_EVENT_H__