modify license, permission and remove ^M char
[platform/framework/native/uifw.git] / src / ui / FUiKeyEventInfo.cpp
1 //
2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
4 //
5 // Licensed under the Apache License, Version 2.0 (the License);
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 //     http://www.apache.org/licenses/LICENSE-2.0/
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an ”AS IS” BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 //
17 /**
18  * @file                FUiKeyEventInfo.cpp
19  * @brief               This is the implementation file for the KeyEventInfo class.
20  */
21
22 #include <FBaseResult.h>
23 #include <FBaseSysLog.h>
24 #include <FUiKeyEventInfo.h>
25 #include <FUi_KeyEventInfoImpl.h>
26
27 namespace Tizen { namespace Ui
28 {
29
30 KeyEventInfo::KeyEventInfo(KeyCode keyCode, int keyModifiers)
31 {
32         _KeyEventInfoImpl* pImpl = _KeyEventInfoImpl::CreateInstanceN(this);
33
34         result r = GetLastResult();
35         SysAssertf(__pKeyEventInfoImpl != null, "[%s] Propagating.", GetErrorMessage(r));
36
37         __pKeyEventInfoImpl = pImpl;
38         __pKeyEventInfoImpl->SetKeyEventInfo(keyCode, keyModifiers);
39 }
40
41 KeyEventInfo::~KeyEventInfo(void)
42 {
43         delete __pKeyEventInfoImpl;
44         __pKeyEventInfoImpl = null;
45 }
46
47 void
48 KeyEventInfo::SetKeyCode(KeyCode keyCode)
49 {
50         SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
51
52         __pKeyEventInfoImpl->SetKeyCode(keyCode);
53 }
54
55 KeyCode
56 KeyEventInfo::GetKeyCode(void) const
57 {
58         SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
59
60         return __pKeyEventInfoImpl->GetKeyCode();
61 }
62
63 void
64 KeyEventInfo::SetKeyModifier(int keyModifiers)
65 {
66         SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
67
68         __pKeyEventInfoImpl->SetKeyModifier(keyModifiers);
69 }
70
71 int
72 KeyEventInfo::GetKeyModifier(void) const
73 {
74         SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
75
76         return __pKeyEventInfoImpl->GetKeyModifier();
77 }
78
79 }} // Tizen::Ui
80