2 // Open Service Platform
3 // Copyright (c) 2012-2013 Samsung Electronics Co., Ltd.
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
9 // http://www.apache.org/licenses/LICENSE-2.0/
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.
18 * @file FUiKeyEventInfo.cpp
19 * @brief This is the implementation file for the KeyEventInfo class.
22 #include <FBaseResult.h>
23 #include <FBaseSysLog.h>
24 #include <FUiKeyEventInfo.h>
25 #include <FUi_KeyEventInfoImpl.h>
27 namespace Tizen { namespace Ui
30 KeyEventInfo::KeyEventInfo(KeyCode keyCode, int keyModifiers)
32 _KeyEventInfoImpl* pImpl = _KeyEventInfoImpl::CreateInstanceN(this);
34 result r = GetLastResult();
35 SysAssertf(__pKeyEventInfoImpl != null, "[%s] Propagating.", GetErrorMessage(r));
37 __pKeyEventInfoImpl = pImpl;
38 __pKeyEventInfoImpl->SetKeyEventInfo(keyCode, keyModifiers);
41 KeyEventInfo::~KeyEventInfo(void)
43 delete __pKeyEventInfoImpl;
44 __pKeyEventInfoImpl = null;
48 KeyEventInfo::SetKeyCode(KeyCode keyCode)
50 SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
52 __pKeyEventInfoImpl->SetKeyCode(keyCode);
56 KeyEventInfo::GetKeyCode(void) const
58 SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
60 return __pKeyEventInfoImpl->GetKeyCode();
64 KeyEventInfo::SetKeyModifier(int keyModifiers)
66 SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
68 __pKeyEventInfoImpl->SetKeyModifier(keyModifiers);
72 KeyEventInfo::GetKeyModifier(void) const
74 SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
76 return __pKeyEventInfoImpl->GetKeyModifier();