2 * Copyright (c) 2017 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.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
8 * http://www.apache.org/licenses/LICENSE-2.0
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.
19 #include <dali/internal/event/events/key-event-impl.h>
22 #include <dali/devel-api/common/map-wrapper.h>
30 typedef std::map< const KeyEvent*, Internal::KeyEventImpl*> KeyEventMap;
31 typedef KeyEventMap::iterator KeyEventMapIter;
33 KeyEventMap keyEventImplMap;
40 KeyEventImpl::KeyEventImpl( KeyEvent* keyEvent )
42 mDeviceClass( DevelDevice::Class::NONE ),
43 mDeviceSubclass( DevelDevice::Subclass::NONE )
45 keyEventImplMap[keyEvent] = this;
48 KeyEventImpl::~KeyEventImpl()
50 for( KeyEventMapIter iter = keyEventImplMap.begin(); iter != keyEventImplMap.end(); ++iter )
52 if( this == iter->second )
54 keyEventImplMap.erase( iter );
60 KeyEventImpl& KeyEventImpl::operator=( const KeyEventImpl& rhs )
64 mDeviceName = rhs.mDeviceName;
65 mDeviceClass = rhs.mDeviceClass;
66 mDeviceSubclass = rhs.mDeviceSubclass;
72 std::string KeyEventImpl::GetDeviceName() const
77 void KeyEventImpl::SetDeviceName( const std::string& deviceName )
79 mDeviceName = deviceName;
82 DevelDevice::Class::Type KeyEventImpl::GetDeviceClass() const
87 void KeyEventImpl::SetDeviceClass( DevelDevice::Class::Type deviceClass )
89 mDeviceClass = deviceClass;
92 DevelDevice::Subclass::Type KeyEventImpl::GetDeviceSubclass() const
94 return mDeviceSubclass;
97 void KeyEventImpl::SetDeviceSubclass( DevelDevice::Subclass::Type deviceSubclass )
99 mDeviceSubclass = deviceSubclass;
102 } // namsespace Internal
104 Internal::KeyEventImpl* GetImplementation( KeyEvent* keyEvent )
106 return keyEventImplMap[keyEvent];
109 const Internal::KeyEventImpl* GetImplementation( const KeyEvent* keyEvent )
111 return keyEventImplMap[keyEvent];