Main Page | Class Hierarchy | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals

KeyStroke Class Reference


Detailed Description

KeyStroke.

Definition at line 10 of file KeyStroke.h.

Public Member Functions

 KeyStroke (const SDL_keysym &keysym)
 Create new keystroke from event.
 KeyStroke (SDLKey sym, int mod)
 Create new keystroke.
SDLKey getKey () const
Uint16 getUnicode () const
bool less (const KeyStroke &other) const
 KeyStroke comparation.
bool equals (const KeyStroke &other) const
 Test keyStroke equality.
std::string toString () const
 Return text fashion.


Constructor & Destructor Documentation

KeyStroke::KeyStroke const SDL_keysym &  keysym  ) 
 

Create new keystroke from event.

Definition at line 17 of file KeyStroke.cpp.

00018 {
00019     m_sym = keysym.sym;
00020     m_mod = modStrip(keysym.mod);
00021     m_unicode = keysym.unicode;
00022 }

KeyStroke::KeyStroke SDLKey  sym,
int  mod
 

Create new keystroke.

NOTE: KMOD_ALT mean (KMOD_LALT and KMOD_RALT), i.e. either ALTs pressed!

Parameters:
sym SDLKey
mod SDLMod ored

Definition at line 32 of file KeyStroke.cpp.

00033 {
00034     m_sym = sym;
00035     m_mod = modStrip(mod);
00036     m_unicode = 0;
00037 }


Member Function Documentation

bool KeyStroke::equals const KeyStroke other  )  const
 

Test keyStroke equality.

KMOD_NUM|KMOD_CAPS|KMOD_MODE are ignored.

Parameters:
other other keystroke
Returns:
this == other

Definition at line 73 of file KeyStroke.cpp.

00074 {
00075     return m_sym == other.m_sym &&
00076         m_mod == other.m_mod;
00077 }

SDLKey KeyStroke::getKey  )  const [inline]
 

Definition at line 22 of file KeyStroke.h.

00022 { return m_sym; }

Uint16 KeyStroke::getUnicode  )  const [inline]
 

Definition at line 23 of file KeyStroke.h.

00023 { return m_unicode; }

bool KeyStroke::less const KeyStroke other  )  const
 

KeyStroke comparation.

Parameters:
other other keystroke
Returns:
this < other

Definition at line 56 of file KeyStroke.cpp.

00057 {
00058     bool result = m_sym < other.m_sym;
00059     if (m_sym == other.m_sym) {
00060         result = m_mod < other.m_mod;
00061     }
00062     return result;
00063 }

std::string KeyStroke::toString  )  const
 

Return text fashion.

Definition at line 83 of file KeyStroke.cpp.

00084 {
00085     std::string result = SDL_GetKeyName(m_sym);
00086     result.append("+" + StringTool::toString(m_mod));
00087     return result;
00088 }


The documentation for this class was generated from the following files:
Generated on Wed Jun 1 09:55:30 2005 for Fish Fillets - Next Generation by  doxygen 1.4.2