[dali_1.2.35] Merge branch 'devel/master'
[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) 2014 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 DALI_IMPORT_API
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 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     Last
49   };
50
51   /**
52    * Default Constructor
53    */
54   KeyEvent();
55
56   /**
57    * Constructor
58    * @param[in]  keyName       The name of the key pressed or command from the IMF, if later then the some following parameters will be needed.
59    * @param[in]  keyString     A string of input characters or key pressed
60    * @param[in]  keyCode       The unique key code for the key pressed.
61    * @param[in]  keyModifier   The key modifier for special keys like shift and alt
62    * @param[in]  timeStamp     The time (in ms) that the key event occurred.
63    * @param[in]  keyState      The state of the key event.
64    * @param[in]  deviceName    Name of device KeyEvent originated from
65    */
66   KeyEvent(const std::string& keyName,
67            const std::string& keyString,
68            int keyCode,
69            int keyModifier,
70            unsigned long timeStamp,
71            const State& keyState,
72            const std::string deviceName );
73
74   /*
75    * Constructor, creates a Integration::KeyEvent from a Dali::KeyEvent
76    * @param[in] event Dali::KeyEvent to convert from
77    */
78   explicit KeyEvent( const Dali::KeyEvent& event );
79
80   /**
81    * Virtual destructor
82    */
83   virtual ~KeyEvent();
84
85   // Data
86
87   /**
88    *@copydoc Dali::KeyEvent::keyPressedName
89    */
90   std::string keyName;
91
92   /**
93    *@copydoc Dali::KeyEvent::keyPressed
94    */
95   std::string keyString;
96
97   /**
98    * @copydoc Dali::KeyEvent::keyCode
99    */
100   int  keyCode;
101
102   /**
103    *@copydoc Dali::KeyEvent::keyModifier
104    */
105   int  keyModifier;
106
107   /**
108    *@copydoc Dali::KeyEvent::time
109    */
110   unsigned long time;
111
112   /**
113    * State of the key event.
114    * @see State
115    */
116   State state;
117
118   /**
119    * Name of device KeyEvent originated from
120    */
121   std::string deviceName;
122
123 };
124
125 } // namespace Integration
126
127 } // namespace Dali
128
129 #endif // __DALI_INTEGRATION_KEY_EVENT_H__