struct KeyEventImpl
{
+ KeyEventImpl()
+ : deviceName( "" ),
+ deviceClass( DevelKeyEvent::DeviceClass::NONE )
+ {
+ }
+
+ KeyEventImpl& operator=( const KeyEventImpl& rhs )
+ {
+ if( this != &rhs )
+ {
+ deviceName = rhs.deviceName;
+ deviceClass = rhs.deviceClass;
+ }
+
+ return *this;
+ }
+
+ KeyEventImpl( const KeyEventImpl& rhs )
+ {
+ deviceName = rhs.deviceName;
+ deviceClass = rhs.deviceClass;
+ }
+
std::string deviceName;
+ DevelKeyEvent::DeviceClass::Type deviceClass;
};
-typedef std::map< KeyEvent*, KeyEventImpl*> KeyEventMap;
+typedef std::map< const KeyEvent*, KeyEventImpl*> KeyEventMap;
typedef KeyEventMap::const_iterator KeyEventMapIter;
time(timeStamp),
state(keyState)
{
- KeyEventImpl* impl = new KeyEventImpl;
- keyEventImplMap[this] = impl;
+ keyEventImplMap[this] = new KeyEventImpl;
+}
+
+KeyEvent::KeyEvent( const KeyEvent& rhs )
+: keyPressedName( rhs.keyPressedName ),
+ keyPressed( rhs.keyPressed ),
+ keyCode( rhs.keyCode ),
+ keyModifier( rhs.keyModifier ),
+ time( rhs.time ),
+ state( rhs.state )
+{
+ keyEventImplMap[this] = new KeyEventImpl( *keyEventImplMap[ &rhs ] );
+}
+
+KeyEvent& KeyEvent::operator=( const KeyEvent& rhs )
+{
+ if( this != &rhs )
+ {
+ keyPressedName = rhs.keyPressedName;
+ keyPressed = rhs.keyPressed;
+ keyCode = rhs.keyCode;
+ keyModifier = rhs.keyModifier;
+ time = rhs.time;
+ state = rhs.state;
+
+ *keyEventImplMap[ this ] = *keyEventImplMap[ &rhs ];
+ }
+
+ return *this;
}
KeyEvent::~KeyEvent()
return false;
}
-std::string DevelKeyEvent::GetDeviceName( KeyEvent& keyEvent )
+std::string DevelKeyEvent::GetDeviceName( const KeyEvent& keyEvent )
{
- KeyEventMapIter search;
-
- search = keyEventImplMap.find( &keyEvent );
-
- std::string result = "";
+ KeyEventMapIter search = keyEventImplMap.find( &keyEvent );
if( search != keyEventImplMap.end())
{
- result = search->second->deviceName;
+ return search->second->deviceName;
}
- return result;
+ return std::string("");
}
-void DevelKeyEvent::SetDeviceName( KeyEvent& keyEvent, std::string deviceName )
+void DevelKeyEvent::SetDeviceName( KeyEvent& keyEvent, const std::string& deviceName )
{
KeyEventMapIter search = keyEventImplMap.find( &keyEvent );
}
}
+DevelKeyEvent::DeviceClass::Type DevelKeyEvent::GetDeviceClass( const KeyEvent& keyEvent )
+{
+ KeyEventMapIter search = keyEventImplMap.find( &keyEvent );
+
+ DevelKeyEvent::DeviceClass::Type result = DevelKeyEvent::DeviceClass::NONE;
+
+ if( search != keyEventImplMap.end() )
+ {
+ result = search->second->deviceClass;
+ }
+
+ return result;
+}
+
+void DevelKeyEvent::SetDeviceClass( KeyEvent& keyEvent, const DeviceClass::Type& deviceClass )
+{
+ KeyEventMapIter search = keyEventImplMap.find( &keyEvent );
+
+ if( search != keyEventImplMap.end() )
+ {
+ search->second->deviceClass = deviceClass;
+ }
+}
} // namespace Dali