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)
31 : __pKeyEventInfoImpl(null)
33 _KeyEventInfoImpl* pImpl = _KeyEventInfoImpl::CreateInstanceN(this);
35 result r = GetLastResult();
36 SysAssertf(pImpl != null, "[%s] Propagating.", GetErrorMessage(r));
38 __pKeyEventInfoImpl = pImpl;
39 __pKeyEventInfoImpl->SetKeyEventInfo(keyCode, keyModifiers);
42 KeyEventInfo::~KeyEventInfo(void)
44 delete __pKeyEventInfoImpl;
45 __pKeyEventInfoImpl = null;
49 KeyEventInfo::SetKeyCode(KeyCode keyCode)
51 SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
53 __pKeyEventInfoImpl->SetKeyCode(keyCode);
57 KeyEventInfo::GetKeyCode(void) const
59 SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
61 return __pKeyEventInfoImpl->GetKeyCode();
65 KeyEventInfo::SetKeyModifier(int keyModifiers)
67 SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
69 __pKeyEventInfoImpl->SetKeyModifier(keyModifiers);
73 KeyEventInfo::GetKeyModifier(void) const
75 SysAssertf(__pKeyEventInfoImpl != null, "Not yet constructed. KeyEventInfo() should be called before used.");
77 return __pKeyEventInfoImpl->GetKeyModifier();