Revert "License conversion from Flora to Apache 2.0"
[platform/core/uifw/dali-core.git] / dali / public-api / events / key-event.cpp
1 //
2 // Copyright (c) 2014 Samsung Electronics Co., Ltd.
3 //
4 // Licensed under the Flora License, Version 1.0 (the License);
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 //     http://floralicense.org/license/
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an AS IS BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 //
16
17 // CLASS HEADER
18 #include <dali/public-api/events/key-event.h>
19
20 namespace Dali
21 {
22
23 namespace
24 {
25 const unsigned int MODIFIER_SHIFT = 0x1;
26 const unsigned int MODIFIER_CTRL  = 0x2;
27 const unsigned int MODIFIER_ALT   = 0x4;
28 const int KEY_INVALID_CODE = -1;
29
30 }
31
32 KeyEvent::KeyEvent()
33 : keyPressedName(""),
34   keyPressed(""),
35   keyCode(KEY_INVALID_CODE),
36   keyModifier(0),
37   state(KeyEvent::Down)
38 {
39 }
40
41 KeyEvent::KeyEvent(const std::string& keyName, const std::string& keyString, int keyCode, int keyModifier,unsigned long timeStamp, const State& keyState)
42 : keyPressedName(keyName),
43   keyPressed(keyString),
44   keyCode(keyCode),
45   keyModifier(keyModifier),
46   time(timeStamp),
47   state(keyState)
48 {
49 }
50
51 KeyEvent::~KeyEvent()
52 {
53 }
54
55 bool KeyEvent::IsShiftModifier() const
56 {
57   if ((MODIFIER_SHIFT & keyModifier) == MODIFIER_SHIFT)
58   {
59     return true;
60   }
61
62   return false;
63 }
64
65 bool KeyEvent::IsCtrlModifier() const
66 {
67   if ((MODIFIER_CTRL & keyModifier) == MODIFIER_CTRL)
68   {
69     return true;
70   }
71
72   return false;
73 }
74
75 bool KeyEvent::IsAltModifier() const
76 {
77   if ((MODIFIER_ALT & keyModifier) == MODIFIER_ALT)
78   {
79     return true;
80   }
81
82   return false;
83 }
84
85 } // namespace Dali