Changed indicator bg color.
[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         : __pKeyEventInfoImpl(null)
32 {
33         _KeyEventInfoImpl* pImpl = _KeyEventInfoImpl::CreateInstanceN(this);
34
35         result r = GetLastResult();
36         SysAssertf(pImpl != null, "[%s] Propagating.", GetErrorMessage(r));
37
38         __pKeyEventInfoImpl = pImpl;
39         __pKeyEventInfoImpl->SetKeyEventInfo(keyCode, keyModifiers);
40 }
41
42 KeyEventInfo::~KeyEventInfo(void)
43 {
44         delete __pKeyEventInfoImpl;
45         __pKeyEventInfoImpl = null;
46 }
47
48 void
49 KeyEventInfo::SetKeyCode(KeyCode keyCode)
50 {
51         SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
52
53         __pKeyEventInfoImpl->SetKeyCode(keyCode);
54 }
55
56 KeyCode
57 KeyEventInfo::GetKeyCode(void) const
58 {
59         SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
60
61         return __pKeyEventInfoImpl->GetKeyCode();
62 }
63
64 void
65 KeyEventInfo::SetKeyModifier(int keyModifiers)
66 {
67         SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
68
69         __pKeyEventInfoImpl->SetKeyModifier(keyModifiers);
70 }
71
72 int
73 KeyEventInfo::GetKeyModifier(void) const
74 {
75         SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
76
77         return __pKeyEventInfoImpl->GetKeyModifier();
78 }
79
80 }} // Tizen::Ui
81