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( DevelKeyEvent::DeviceClass::NONE )
44 keyEventImplMap[keyEvent] = this;
47 KeyEventImpl::~KeyEventImpl()
49 for( KeyEventMapIter iter = keyEventImplMap.begin(); iter != keyEventImplMap.end(); ++iter )
51 if( this == iter->second )
53 keyEventImplMap.erase( iter );
59 KeyEventImpl& KeyEventImpl::operator=( const KeyEventImpl& rhs )
63 mDeviceName = rhs.mDeviceName;
64 mDeviceClass = rhs.mDeviceClass;
70 std::string KeyEventImpl::GetDeviceName() const
75 void KeyEventImpl::SetDeviceName( const std::string& deviceName )
77 mDeviceName = deviceName;
80 DevelKeyEvent::DeviceClass::Type KeyEventImpl::GetDeviceClass() const
85 void KeyEventImpl::SetDeviceClass( const DevelKeyEvent::DeviceClass::Type& deviceClass )
87 mDeviceClass = deviceClass;
90 } // namsespace Internal
92 Internal::KeyEventImpl* GetImplementation( KeyEvent* keyEvent )
94 return keyEventImplMap[keyEvent];
97 const Internal::KeyEventImpl* GetImplementation( const KeyEvent* keyEvent )
99 return keyEventImplMap[keyEvent];