Commit c8dbc4eb authored by JP Dinger's avatar JP Dinger

Skins2: Refactor string manipulation event handling a bit and replace some...

Skins2: Refactor string manipulation event handling a bit and replace some static const members with an enum.
parent 68ce8550
...@@ -24,16 +24,9 @@ ...@@ -24,16 +24,9 @@
#include "evt_input.hpp" #include "evt_input.hpp"
const int EvtInput::kModNone = 0;
const int EvtInput::kModAlt = 1;
const int EvtInput::kModCtrl = 2;
const int EvtInput::kModShift = 4;
EvtInput::EvtInput( intf_thread_t *pIntf, int mod )
EvtInput::EvtInput( intf_thread_t *pIntf, int mod ): : EvtGeneric( pIntf), m_mod( mod ) { }
EvtGeneric( pIntf), m_mod( mod )
{
}
void EvtInput::addModifier( string &rEvtString ) const void EvtInput::addModifier( string &rEvtString ) const
...@@ -44,21 +37,14 @@ void EvtInput::addModifier( string &rEvtString ) const ...@@ -44,21 +37,14 @@ void EvtInput::addModifier( string &rEvtString ) const
} }
else else
{ {
string modList = ":"; string m = ":";
if( m_mod & kModAlt ) if( m_mod & kModAlt )
{ m += "alt,";
modList += "alt,";
}
if( m_mod & kModCtrl ) if( m_mod & kModCtrl )
{ m += "ctrl,";
modList += "ctrl,";
}
if( m_mod & kModShift ) if( m_mod & kModShift )
{ m += "shift,";
modList += "shift,"; // Append the result except the last ','
} rEvtString.insert( rEvtString.end(), m.begin(), m.end()-1 );
// Remove the last ','
modList = modList.substr( 0, modList.size() - 1 );
rEvtString += modList;
} }
} }
...@@ -35,10 +35,7 @@ public: ...@@ -35,10 +35,7 @@ public:
virtual ~EvtInput() { } virtual ~EvtInput() { }
/// Masks for modifier keys /// Masks for modifier keys
static const int kModNone; enum { kModNone=0, kModAlt=1, kModCtrl=2, kModShift=4 };
static const int kModAlt;
static const int kModCtrl;
static const int kModShift;
/// Get the modifiers /// Get the modifiers
virtual int getMod() const { return m_mod; } virtual int getMod() const { return m_mod; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment