OSDL::Events::KeyboardHandler Class Reference

#include <OSDLKeyboardHandler.h>

Inheritance diagram for OSDL::Events::KeyboardHandler:

[legend]
Collaboration diagram for OSDL::Events::KeyboardHandler:
[legend]
List of all members.

Detailed Description

Handler for keyboard.

Keyboard input are managed according to the current keyboard mode (example : raw input, text input with unicode support, etc.)

Definition at line 98 of file OSDLKeyboardHandler.h.

Public Types

enum  KeyIdentifier {
  BackspaceKey = SDLK_BACKSPACE, TabKey = SDLK_TAB, ClearKey = SDLK_CLEAR, EnterKey = SDLK_RETURN,
  ReturnKey = SDLK_RETURN, PauseKey = SDLK_PAUSE, EscapeKey = SDLK_ESCAPE, SpaceKey = SDLK_SPACE,
  ExclaimKey = SDLK_EXCLAIM, QuotedBLKey = SDLK_QUOTEDBL, HashKey = SDLK_HASH, DollarKey = SDLK_DOLLAR,
  AmpersandKey = SDLK_AMPERSAND, QuoteKey = SDLK_QUOTE, LeftParenthesisKey = SDLK_LEFTPAREN, RightParenthesisKey = SDLK_RIGHTPAREN,
  AsteriskKey = SDLK_ASTERISK, PlusKey = SDLK_PLUS, CommaKey = SDLK_COMMA, MinusKey = SDLK_MINUS,
  PeriodKey = SDLK_PERIOD, SlashKey = SDLK_SLASH, ZeroKey = SDLK_0, OneKey = SDLK_1,
  TwoKey = SDLK_2, ThreeKey = SDLK_3, FourKey = SDLK_4, FiveKey = SDLK_5,
  SixKey = SDLK_6, SevenKey = SDLK_7, HeightKey = SDLK_8, NineKey = SDLK_9,
  ColonKey = SDLK_COLON, SemiColonKey = SDLK_SEMICOLON, LessKey = SDLK_LESS, EqualsKey = SDLK_EQUALS,
  GreaterKey = SDLK_GREATER, QuestionKey = SDLK_QUESTION, AtKey = SDLK_AT, LeftBracketKey = SDLK_LEFTBRACKET,
  RightBracket = SDLK_RIGHTBRACKET, BackslashKey = SDLK_BACKSLASH, Caret = SDLK_CARET, Underscore = SDLK_UNDERSCORE,
  BackQuote = SDLK_BACKQUOTE, aKey = SDLK_a, bKey = SDLK_b, cKey = SDLK_c,
  dKey = SDLK_d, eKey = SDLK_e, fKey = SDLK_f, gKey = SDLK_g,
  hKey = SDLK_h, iKey = SDLK_i, jKey = SDLK_j, kKey = SDLK_k,
  lKey = SDLK_l, mKey = SDLK_m, nKey = SDLK_n, oKey = SDLK_o,
  pKey = SDLK_p, qKey = SDLK_q, rKey = SDLK_r, sKey = SDLK_s,
  tKey = SDLK_t, uKey = SDLK_u, vKey = SDLK_v, wKey = SDLK_w,
  xKey = SDLK_x, yKey = SDLK_y, zKey = SDLK_z, DeleteKey = SDLK_DELETE,
  International0Key = SDLK_WORLD_0, International1Key = SDLK_WORLD_1, International2Key = SDLK_WORLD_2, International3Key = SDLK_WORLD_3,
  International4Key = SDLK_WORLD_4, International5Key = SDLK_WORLD_5, International6Key = SDLK_WORLD_6, International7Key = SDLK_WORLD_7,
  International8Key = SDLK_WORLD_8, International9Key = SDLK_WORLD_9, International10Key = SDLK_WORLD_10, International11Key = SDLK_WORLD_11,
  International12Key = SDLK_WORLD_12, International13Key = SDLK_WORLD_13, International14Key = SDLK_WORLD_14, International15Key = SDLK_WORLD_15,
  International16Key = SDLK_WORLD_16, International17Key = SDLK_WORLD_17, International18Key = SDLK_WORLD_18, International19Key = SDLK_WORLD_19,
  International20Key = SDLK_WORLD_20, International21Key = SDLK_WORLD_21, International22Key = SDLK_WORLD_22, International23Key = SDLK_WORLD_23,
  International24Key = SDLK_WORLD_24, International25Key = SDLK_WORLD_25, International26Key = SDLK_WORLD_26, International27Key = SDLK_WORLD_27,
  International28Key = SDLK_WORLD_28, International29Key = SDLK_WORLD_29, International30Key = SDLK_WORLD_30, International31Key = SDLK_WORLD_31,
  International32Key = SDLK_WORLD_32, International33Key = SDLK_WORLD_33, International34Key = SDLK_WORLD_34, International35Key = SDLK_WORLD_35,
  International36Key = SDLK_WORLD_36, International37Key = SDLK_WORLD_37, International38Key = SDLK_WORLD_38, International39Key = SDLK_WORLD_39,
  International40Key = SDLK_WORLD_40, International41Key = SDLK_WORLD_41, International42Key = SDLK_WORLD_42, International43Key = SDLK_WORLD_43,
  International44Key = SDLK_WORLD_44, International45Key = SDLK_WORLD_45, International46Key = SDLK_WORLD_46, International47Key = SDLK_WORLD_47,
  International48Key = SDLK_WORLD_48, International49Key = SDLK_WORLD_49, International50Key = SDLK_WORLD_50, International51Key = SDLK_WORLD_51,
  International52Key = SDLK_WORLD_52, International53Key = SDLK_WORLD_53, International54Key = SDLK_WORLD_54, International55Key = SDLK_WORLD_55,
  International56Key = SDLK_WORLD_56, International57Key = SDLK_WORLD_57, International58Key = SDLK_WORLD_58, International59Key = SDLK_WORLD_59,
  International60Key = SDLK_WORLD_60, International61Key = SDLK_WORLD_61, International62Key = SDLK_WORLD_62, International63Key = SDLK_WORLD_63,
  International64Key = SDLK_WORLD_64, International65Key = SDLK_WORLD_65, International66Key = SDLK_WORLD_66, International67Key = SDLK_WORLD_67,
  International68Key = SDLK_WORLD_68, International69Key = SDLK_WORLD_69, International70Key = SDLK_WORLD_70, International71Key = SDLK_WORLD_71,
  International72Key = SDLK_WORLD_72, International73Key = SDLK_WORLD_73, International74Key = SDLK_WORLD_74, International75Key = SDLK_WORLD_75,
  International76Key = SDLK_WORLD_76, International77Key = SDLK_WORLD_77, International78Key = SDLK_WORLD_78, International79Key = SDLK_WORLD_79,
  International80Key = SDLK_WORLD_80, International81Key = SDLK_WORLD_81, International82Key = SDLK_WORLD_82, International83Key = SDLK_WORLD_83,
  International84Key = SDLK_WORLD_84, International85Key = SDLK_WORLD_85, International86Key = SDLK_WORLD_86, International87Key = SDLK_WORLD_87,
  International88Key = SDLK_WORLD_88, International89Key = SDLK_WORLD_89, International90Key = SDLK_WORLD_90, International91Key = SDLK_WORLD_91,
  International92Key = SDLK_WORLD_92, International93Key = SDLK_WORLD_93, International94Key = SDLK_WORLD_94, International95Key = SDLK_WORLD_95,
  ZeroKeypadKey = SDLK_KP0, OneKeypadKey = SDLK_KP1, TwoKeypadKey = SDLK_KP2, ThreeKeypadKey = SDLK_KP3,
  FourKeypadKey = SDLK_KP4, FiveKeypadKey = SDLK_KP5, SixKeypadKey = SDLK_KP6, SevenKeypadKey = SDLK_KP7,
  HeightKeypadKey = SDLK_KP8, NineKeypadKey = SDLK_KP9, PeriodKeypadKey = SDLK_KP_PERIOD, DivideKeypadKey = SDLK_KP_DIVIDE,
  MultiplyKeypadKey = SDLK_KP_MULTIPLY, MinusKeypadKey = SDLK_KP_MINUS, PlusKeypadKey = SDLK_KP_PLUS, EnterKeypadKey = SDLK_KP_ENTER,
  EqualsKeypadKey = SDLK_KP_EQUALS, UpArrowKey = SDLK_UP, DownArrowKey = SDLK_DOWN, LeftArrowKey = SDLK_LEFT,
  RightArrowKey = SDLK_RIGHT, InsertKey = SDLK_INSERT, HomeKey = SDLK_HOME, EndKey = SDLK_END,
  PageUpKey = SDLK_PAGEUP, PageDownKey = SDLK_PAGEDOWN, F1Key = SDLK_F1, F2Key = SDLK_F2,
  F3Key = SDLK_F3, F4Key = SDLK_F4, F5Key = SDLK_F5, F6Key = SDLK_F6,
  F7Key = SDLK_F7, F8Key = SDLK_F8, F9Key = SDLK_F9, F10Key = SDLK_F10,
  F11Key = SDLK_F11, F12Key = SDLK_F12, F13Key = SDLK_F13, F14Key = SDLK_F14,
  F15Key = SDLK_F15, NumLockKey = SDLK_NUMLOCK, CapsLockKey = SDLK_CAPSLOCK, ScrolLockKey = SDLK_SCROLLOCK,
  LeftShiftKey = SDLK_LSHIFT, RightShiftKey = SDLK_RSHIFT, LeftControlKey = SDLK_LCTRL, RightControlKey = SDLK_RCTRL,
  LeftAltKey = SDLK_LALT, RightAltKey = SDLK_RALT, LeftMetaKey = SDLK_LMETA, RightMetaKey = SDLK_RMETA,
  LeftSuperKey = SDLK_LSUPER, RightSuperKey = SDLK_RSUPER, ModeKey = SDLK_MODE, ComposeKey = SDLK_COMPOSE,
  HelpKey = SDLK_HELP, PrintKey = SDLK_PRINT, SysReqKey = SDLK_SYSREQ, BreakKey = SDLK_BREAK,
  MenuKey = SDLK_MENU, PowerKey = SDLK_POWER, EuroKey = SDLK_EURO, UndoKey = SDLK_UNDO
}
 List of all currently available key identifiers : allows to identify a keyboard key being pressed or released. More...
enum  KeyModifier {
  NoneModifier = KMOD_NONE, LeftShiftModifier = KMOD_LSHIFT, RightShiftModifier = KMOD_RSHIFT, LeftControlModifier = KMOD_LCTRL,
  RightControlModifier = KMOD_RCTRL, LeftAltModifier = KMOD_LALT, RightAltModifier = KMOD_RALT, LeftMetaModifier = KMOD_LMETA,
  RightMetaModifier = KMOD_RMETA, NumModifier = KMOD_NUM, CapsModifier = KMOD_CAPS, ModeModifier = KMOD_MODE,
  ReservedModifier = KMOD_RESERVED, ShiftModifier, ControlModifier, AltModifier,
  MetaModifier
}

Public Member Functions

 KeyboardHandler (KeyboardMode initialMode=rawInput, bool useSmarterDefaultKeyHandler=false) throw ( InputDeviceHandlerException )
 Constructs a new keyboard handler.
virtual ~KeyboardHandler () throw ()
 Virtual destructor.
virtual void linkToController (KeyIdentifier rawKey, OSDL::MVC::Controller &controller) throw ()
 Links the specified raw key to specified controller, so that any further key press or release of this raw key will be sent to the controller, if the keyboard is in raw input mode.
virtual void linkToController (Ceylan::Unicode unicode, OSDL::MVC::Controller &controller) throw ()
 Links the specified Unicode to specified controller, so that any further selection of this Unicode will be sent to the controller, if the keyboard is in text input mode.
virtual void linkToFocusController (OSDL::MVC::Controller &controller) throw ()
 Links this keyboard hander to specified focus-tracking controller, so that any further change to the keyboard focus will be notified to the controller.
virtual void linkToHandler (KeyIdentifier rawKey, KeyboardEventHandler handler) throw ()
 Links the specified raw key to specified keyboard event handler, so that if no controller is linked to this raw key, the keyboard event handler is triggered.
virtual void linkToHandler (Ceylan::Unicode unicode, KeyboardEventHandler handler) throw ()
 Links the specified Unicode to specified keyboard event handler, so that if no controller is linked to this Unicode, the keyboard event handler is triggered.
virtual void setSmarterDefaultKeyHandlers () throw ()
 Sets the default key handlers to the smarter handlers.
virtual void setDefaultRawKeyHandler (KeyboardEventHandler newHandler) throw ()
 Sets a new default handler for raw key events.
virtual void setDefaultUnicodeHandler (KeyboardEventHandler newHandler) throw ()
 Sets a new default handler for Unicode events.
virtual const std::string toString (Ceylan::VerbosityLevels level=Ceylan::high) const throw ()
 Returns an user-friendly description of the state of this object.

Static Public Member Functions

static KeyboardMode GetMode () throw ()
 Returns the current keyboard mode.
static void SetMode (KeyboardMode newMode) throw ()
 Sets the current keyboard mode.
static std::string DescribeKey (KeyIdentifier key) throw ()
 Describes specified key.
static std::string DescribeModifier (KeyModifier modifier) throw ()
 Describes specified key modifier.
static std::string DescribeUnicode (Ceylan::Unicode value) throw ()
 Describes specified Unicode value.

Static Public Attributes

static const Ceylan::System::Millisecond DefaultDelayBeforeKeyRepeat
 Specifies how long by default a key must be pressed before it begins repeating, in milliseconds.
static const Ceylan::System::Millisecond DefaulKeyRepeatInterval
 Specifies how many milliseconds by default should be waited until two repeated keys : once a key is hold long enough to repeat, this will be the time between two repeats of this key.

Protected Member Functions

virtual void focusGained (const FocusEvent &keyboardFocusEvent) throw ()
 Called whenever this keyboard gained focus, so that its controller, if any, is notified.
virtual void focusLost (const FocusEvent &keyboardFocusEvent) throw ()
 Called whenever this keyboard lost focus, so that its controller, if any, is notified.
virtual void keyPressed (const KeyboardEvent &keyboardEvent) throw ()
 Called whenever a key was pressed, so that its controller, if any, is notified.
virtual void keyReleased (const KeyboardEvent &keyboardEvent) throw ()
 Called whenever a key was released, so that its controller, if any, is notified.

Protected Attributes

std::map< KeyIdentifier, OSDL::MVC::Controller * > _rawKeyControllerMap
 Allows to link a controller to a specific keyboard raw key, when in raw input mode.
std::map< KeyIdentifier, KeyboardEventHandler_rawKeyHandlerMap
 Fall-back map used whenever a raw key was pressed or released without being registered in the map making raw keys correspond to controllers : it may then be linked to a specific keyboard event handler.
std::map< Ceylan::Unicode,
OSDL::MVC::Controller * > 
_unicodeControllerMap
 Allows to link a controller to a specific Unicode, when in text input mode.
std::map< Ceylan::Unicode,
KeyboardEventHandler
_unicodeHandlerMap
 Fall-back map used whenever a Unicode was selected by the user without being registered in the map making Unicodes correspond to controllers : it may then be linked to a specific keyboard event handler.
KeyboardEventHandler _defaultRawKeyHandler
 Default raw key event handler, does nothing, but can log keyboard events.
KeyboardEventHandler _defaultUnicodeHandler
 Default Unicode event handler, does nothing, but can log keyboard events.
OSDL::MVC::Controller_focusController
 The controller that will receive focus changes.
bool _unicodeInputWasActivated
 Records the status of Unicode input before this handler was created, so that it can be restored.

Static Protected Attributes

static KeyboardMode _CurrentMode
 Stores the current keyboard interacting scheme.

Private Member Functions

 KeyboardHandler (const KeyboardHandler &source) throw ()
 Copy constructor made private to ensure that it will never be called.
KeyboardHandleroperator= (const KeyboardHandler &source) throw ()
 Assignment operator made private to ensure that it will never be called.

Friends

class OSDL::Events::EventsModule


Member Enumeration Documentation

enum OSDL::Events::KeyboardHandler::KeyIdentifier

List of all currently available key identifiers : allows to identify a keyboard key being pressed or released.

First column lists the key identifiers which are to be used in user applications, second one maps them to the keys defined by the SDL back-end, and third describes the corresponding key.

The source of the complete list is the SDL back-end (SDL_keysym.h).

Enumerator:
BackspaceKey 
TabKey 
ClearKey 
EnterKey 
ReturnKey 
PauseKey 
EscapeKey 
SpaceKey 
ExclaimKey 
QuotedBLKey 
HashKey 
DollarKey 
AmpersandKey 
QuoteKey 
LeftParenthesisKey 
RightParenthesisKey 
AsteriskKey 
PlusKey 
CommaKey 
MinusKey 
PeriodKey 
SlashKey 
ZeroKey 
OneKey 
TwoKey 
ThreeKey 
FourKey 
FiveKey 
SixKey 
SevenKey 
HeightKey 
NineKey 
ColonKey 
SemiColonKey 
LessKey 
EqualsKey 
GreaterKey 
QuestionKey 
AtKey 
LeftBracketKey 
RightBracket 
BackslashKey 
Caret 
Underscore 
BackQuote 
aKey 
bKey 
cKey 
dKey 
eKey 
fKey 
gKey 
hKey 
iKey 
jKey 
kKey 
lKey 
mKey 
nKey 
oKey 
pKey 
qKey 
rKey 
sKey 
tKey 
uKey 
vKey 
wKey 
xKey 
yKey 
zKey 
DeleteKey 
International0Key 
International1Key 
International2Key 
International3Key 
International4Key 
International5Key 
International6Key 
International7Key 
International8Key 
International9Key 
International10Key 
International11Key 
International12Key 
International13Key 
International14Key 
International15Key 
International16Key 
International17Key 
International18Key 
International19Key 
International20Key 
International21Key 
International22Key 
International23Key 
International24Key 
International25Key 
International26Key 
International27Key 
International28Key 
International29Key 
International30Key 
International31Key 
International32Key 
International33Key 
International34Key 
International35Key 
International36Key 
International37Key 
International38Key 
International39Key 
International40Key 
International41Key 
International42Key 
International43Key 
International44Key 
International45Key 
International46Key 
International47Key 
International48Key 
International49Key 
International50Key 
International51Key 
International52Key 
International53Key 
International54Key 
International55Key 
International56Key 
International57Key 
International58Key 
International59Key 
International60Key 
International61Key 
International62Key 
International63Key 
International64Key 
International65Key 
International66Key 
International67Key 
International68Key 
International69Key 
International70Key 
International71Key 
International72Key 
International73Key 
International74Key 
International75Key 
International76Key 
International77Key 
International78Key 
International79Key 
International80Key 
International81Key 
International82Key 
International83Key 
International84Key 
International85Key 
International86Key 
International87Key 
International88Key 
International89Key 
International90Key 
International91Key 
International92Key 
International93Key 
International94Key 
International95Key 
ZeroKeypadKey 
OneKeypadKey 
TwoKeypadKey 
ThreeKeypadKey 
FourKeypadKey 
FiveKeypadKey 
SixKeypadKey 
SevenKeypadKey 
HeightKeypadKey 
NineKeypadKey 
PeriodKeypadKey 
DivideKeypadKey 
MultiplyKeypadKey 
MinusKeypadKey 
PlusKeypadKey 
EnterKeypadKey 
EqualsKeypadKey 
UpArrowKey 
DownArrowKey 
LeftArrowKey 
RightArrowKey 
InsertKey 
HomeKey 
EndKey 
PageUpKey 
PageDownKey 
F1Key 
F2Key 
F3Key 
F4Key 
F5Key 
F6Key 
F7Key 
F8Key 
F9Key 
F10Key 
F11Key 
F12Key 
F13Key 
F14Key 
F15Key 
NumLockKey 
CapsLockKey 
ScrolLockKey 
LeftShiftKey 
RightShiftKey 
LeftControlKey 
RightControlKey 
LeftAltKey 
RightAltKey 
LeftMetaKey 
RightMetaKey 
LeftSuperKey 
RightSuperKey 
ModeKey 
ComposeKey 
HelpKey 
PrintKey 
SysReqKey 
BreakKey 
MenuKey 
PowerKey 
EuroKey 
UndoKey 

Definition at line 127 of file OSDLKeyboardHandler.h.

enum OSDL::Events::KeyboardHandler::KeyModifier

Enumerator:
NoneModifier 
LeftShiftModifier 
RightShiftModifier 
LeftControlModifier 
RightControlModifier 
LeftAltModifier 
RightAltModifier 
LeftMetaModifier 
RightMetaModifier 
NumModifier 
CapsModifier 
ModeModifier 
ReservedModifier 
ShiftModifier 
ControlModifier 
AltModifier 
MetaModifier 

Definition at line 451 of file OSDLKeyboardHandler.h.


Constructor & Destructor Documentation

KeyboardHandler::KeyboardHandler ( KeyboardMode  initialMode = rawInput,
bool  useSmarterDefaultKeyHandler = false 
) throw ( InputDeviceHandlerException ) [explicit]

Constructs a new keyboard handler.

Parameters:
initialMode the mode in which this keyboard will start.
useSmarterDefaultKeyHandler if true, a key handler that will exit the event loop if escape or 'q' is pressed, will be used. Otherwise, a do-nothing key handler will be used.
Note:
The keyboard mode is shared between all keyboard handlers.
Exceptions:
InputDeviceHandlerException if keyboard could not be initialized.

Definition at line 152 of file OSDLKeyboardHandler.cc.

References doNothingKeyHandler().

KeyboardHandler::~KeyboardHandler (  )  throw () [virtual]

Virtual destructor.

Definition at line 189 of file OSDLKeyboardHandler.cc.

References _unicodeInputWasActivated.

OSDL::Events::KeyboardHandler::KeyboardHandler ( const KeyboardHandler source  )  throw () [explicit, private]

Copy constructor made private to ensure that it will never be called.

The compiler should complain whenever this undefined constructor is called, implicitly or not.


Member Function Documentation

void KeyboardHandler::linkToController ( KeyIdentifier  rawKey,
OSDL::MVC::Controller controller 
) throw () [virtual]

Links the specified raw key to specified controller, so that any further key press or release of this raw key will be sent to the controller, if the keyboard is in raw input mode.

Removes automatically any link previously defined between this raw key and any other controller.

Parameters:
rawKey the identifier of the raw key that shall be linked to the controller.
controller the OSDL controller which will be notified of this raw key presses and releases.

Definition at line 207 of file OSDLKeyboardHandler.cc.

void KeyboardHandler::linkToController ( Ceylan::Unicode  unicode,
OSDL::MVC::Controller controller 
) throw () [virtual]

Links the specified Unicode to specified controller, so that any further selection of this Unicode will be sent to the controller, if the keyboard is in text input mode.

Removes automatically any link previously defined between this Unicode and any other controller.

Parameters:
unicode the Unicode that shall be linked to the controller.
controller the OSDL controller which will be notified of this Unicode being selected.

Definition at line 216 of file OSDLKeyboardHandler.cc.

void KeyboardHandler::linkToFocusController ( OSDL::MVC::Controller controller  )  throw () [virtual]

Links this keyboard hander to specified focus-tracking controller, so that any further change to the keyboard focus will be notified to the controller.

Removes automatically any link previously defined between this Unicode and any other controller.

Parameters:
controller the OSDL controller which will be notified of the focus change.

Definition at line 226 of file OSDLKeyboardHandler.cc.

void KeyboardHandler::linkToHandler ( KeyIdentifier  rawKey,
KeyboardEventHandler  handler 
) throw () [virtual]

Links the specified raw key to specified keyboard event handler, so that if no controller is linked to this raw key, the keyboard event handler is triggered.

Parameters:
rawKey the raw key to link with the keyboard event handler.
handler the handler that will received the raw key event, in the lack of linked controller.

Definition at line 236 of file OSDLKeyboardHandler.cc.

void KeyboardHandler::linkToHandler ( Ceylan::Unicode  unicode,
KeyboardEventHandler  handler 
) throw () [virtual]

Links the specified Unicode to specified keyboard event handler, so that if no controller is linked to this Unicode, the keyboard event handler is triggered.

Parameters:
unicode the Unicode to link with the keyboard event handler.
handler the handler that will received the Unicode event, in the lack of linked controller.

Definition at line 245 of file OSDLKeyboardHandler.cc.

void KeyboardHandler::setSmarterDefaultKeyHandlers (  )  throw () [virtual]

Sets the default key handlers to the smarter handlers.

These handlers allow to trigger an exit from the event loop if escape or 'q' key is pressed, both for raw and input modes.

The 'F1' key is used to toggle between raw input and text input keyboard modes.

Definition at line 254 of file OSDLKeyboardHandler.cc.

References _defaultRawKeyHandler, _defaultUnicodeHandler, and smarterKeyHandler().

void KeyboardHandler::setDefaultRawKeyHandler ( KeyboardEventHandler  newHandler  )  throw () [virtual]

Sets a new default handler for raw key events.

Parameters:
newHandler the new handler

Definition at line 263 of file OSDLKeyboardHandler.cc.

void KeyboardHandler::setDefaultUnicodeHandler ( KeyboardEventHandler  newHandler  )  throw () [virtual]

Sets a new default handler for Unicode events.

Parameters:
newHandler the new handler

Definition at line 272 of file OSDLKeyboardHandler.cc.

const string KeyboardHandler::toString ( Ceylan::VerbosityLevels  level = Ceylan::high  )  const throw () [virtual]

Returns an user-friendly description of the state of this object.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
Ceylan::TextDisplayable

Definition at line 281 of file OSDLKeyboardHandler.cc.

References OSDL::Events::rawInput, and OSDL::Events::textInput.

KeyboardMode KeyboardHandler::GetMode (  )  throw () [static]

Returns the current keyboard mode.

The keyboard at startup is in raw input mode.

Returns:
KeyboardMode the current keyboard mode.
Note:
This belongs to overall common settings, it has therefore to be static.

Definition at line 312 of file OSDLKeyboardHandler.cc.

References _CurrentMode.

Referenced by OSDL::Events::EventsModule::DescribeEvent(), and smarterKeyHandler().

void KeyboardHandler::SetMode ( KeyboardMode  newMode  )  throw () [static]

Sets the current keyboard mode.

Parameters:
newMode the new keyboard mode.
Note:
This belongs to overall common settings, it has therefore to be static.

Definition at line 320 of file OSDLKeyboardHandler.cc.

References OSDL_KEYBOARD_HANDLER_LOG, OSDL::Events::rawInput, OSDL::Events::textInput, and OSDL::Video::Pixels::toString().

Referenced by smarterKeyHandler().

string KeyboardHandler::DescribeKey ( KeyIdentifier  key  )  throw () [static]

Describes specified key.

Parameters:
key the key to describe.

Definition at line 355 of file OSDLKeyboardHandler.cc.

References OSDL::Video::Pixels::toString().

Referenced by OSDL::Events::EventsModule::DescribeEvent().

string KeyboardHandler::DescribeModifier ( KeyModifier  modifier  )  throw () [static]

Describes specified key modifier.

Parameters:
modifier the modifier to describe (alt, control, meta, etc.).

Definition at line 410 of file OSDLKeyboardHandler.cc.

Referenced by OSDL::Events::EventsModule::DescribeEvent().

string KeyboardHandler::DescribeUnicode ( Ceylan::Unicode  value  )  throw () [static]

Describes specified Unicode value.

Parameters:
value the Unicode value to describe.

Definition at line 459 of file OSDLKeyboardHandler.cc.

References OSDL::Video::Pixels::toString().

Referenced by OSDL::Events::EventsModule::DescribeEvent().

void KeyboardHandler::focusGained ( const FocusEvent keyboardFocusEvent  )  throw () [protected, virtual]

Called whenever this keyboard gained focus, so that its controller, if any, is notified.

Note:
Expected to be triggered by the EventsModule.

Definition at line 476 of file OSDLKeyboardHandler.cc.

void KeyboardHandler::focusLost ( const FocusEvent keyboardFocusEvent  )  throw () [protected, virtual]

Called whenever this keyboard lost focus, so that its controller, if any, is notified.

Note:
Expected to be triggered by the EventsModule.

Definition at line 486 of file OSDLKeyboardHandler.cc.

void KeyboardHandler::keyPressed ( const KeyboardEvent keyboardEvent  )  throw () [protected, virtual]

Called whenever a key was pressed, so that its controller, if any, is notified.

If no controller is registered for this key, then :

Note:
The actions taken depend on the current input mode.

Expected to be triggered by the EventsModule.

Definition at line 496 of file OSDLKeyboardHandler.cc.

References OSDL_KEYBOARD_HANDLER_LOG, OSDL::Events::rawInput, and OSDL::Events::textInput.

void KeyboardHandler::keyReleased ( const KeyboardEvent keyboardEvent  )  throw () [protected, virtual]

Called whenever a key was released, so that its controller, if any, is notified.

If no controller is registered for this key, then :

Note:
The actions taken depend on the current input mode.

Expected to be triggered by the EventsModule.

Definition at line 619 of file OSDLKeyboardHandler.cc.

References OSDL_KEYBOARD_HANDLER_LOG, and OSDL::Events::rawInput.

KeyboardHandler& OSDL::Events::KeyboardHandler::operator= ( const KeyboardHandler source  )  throw () [private]

Assignment operator made private to ensure that it will never be called.

The compiler should complain whenever this undefined operator is called, implicitly or not.


Friends And Related Function Documentation

friend class OSDL::Events::EventsModule [friend]

Definition at line 107 of file OSDLKeyboardHandler.h.


Member Data Documentation

const Ceylan::System::Millisecond KeyboardHandler::DefaultDelayBeforeKeyRepeat [static]

Specifies how long by default a key must be pressed before it begins repeating, in milliseconds.

Definition at line 732 of file OSDLKeyboardHandler.h.

const Ceylan::System::Millisecond KeyboardHandler::DefaulKeyRepeatInterval [static]

Specifies how many milliseconds by default should be waited until two repeated keys : once a key is hold long enough to repeat, this will be the time between two repeats of this key.

Definition at line 743 of file OSDLKeyboardHandler.h.

KeyboardMode KeyboardHandler::_CurrentMode [static, protected]

Stores the current keyboard interacting scheme.

Definition at line 815 of file OSDLKeyboardHandler.h.

Referenced by GetMode().

std::map<KeyIdentifier, OSDL::MVC::Controller *> OSDL::Events::KeyboardHandler::_rawKeyControllerMap [protected]

Allows to link a controller to a specific keyboard raw key, when in raw input mode.

The controller can be then notified than one of its tracked keys has been pressed or released.

Note:
This is used only in raw input mode.

Definition at line 840 of file OSDLKeyboardHandler.h.

std::map<KeyIdentifier, KeyboardEventHandler> OSDL::Events::KeyboardHandler::_rawKeyHandlerMap [protected]

Fall-back map used whenever a raw key was pressed or released without being registered in the map making raw keys correspond to controllers : it may then be linked to a specific keyboard event handler.

When a key has been pressed or released, but no controller was linked to it, this key is sent to this default key dictionnary which manages external settings not linked with MVC-based simulation world.

For example, an application could decide to quit when the so-defined 'q' key is pressed, which obviously should not rely on the controller MVC framework.

Note:
This is used only in raw input mode.

Definition at line 862 of file OSDLKeyboardHandler.h.

std::map<Ceylan::Unicode, OSDL::MVC::Controller *> OSDL::Events::KeyboardHandler::_unicodeControllerMap [protected]

Allows to link a controller to a specific Unicode, when in text input mode.

The controller can be then notified than one of its tracked unicodes has been selected by the user.

Note:
This is used only in text input mode. Linked controllers will only be notified in this mode of key presses and repeats (not of key releases which are not relevant in this context).

Definition at line 879 of file OSDLKeyboardHandler.h.

std::map<Ceylan::Unicode, KeyboardEventHandler> OSDL::Events::KeyboardHandler::_unicodeHandlerMap [protected]

Fall-back map used whenever a Unicode was selected by the user without being registered in the map making Unicodes correspond to controllers : it may then be linked to a specific keyboard event handler.

When a Unicode is selected, but no controller was linked to it, this Unicode is sent to this default Unicode dictionnary which manages external settings not linked with the MVC-based simulation world.

For example, an application could decide to quit when the 'q' Unicode is selected, which obviously should not rely on the controller MVC framework.

Note:
This is used only in text input mode. Linked event handlers will only be notified in this  mode of key presses and repeats (not of key releases which are not relevant in this context).

Definition at line 904 of file OSDLKeyboardHandler.h.

KeyboardEventHandler OSDL::Events::KeyboardHandler::_defaultRawKeyHandler [protected]

Default raw key event handler, does nothing, but can log keyboard events.

Note:
It is only used when in raw input mode.

Definition at line 918 of file OSDLKeyboardHandler.h.

Referenced by setSmarterDefaultKeyHandlers().

KeyboardEventHandler OSDL::Events::KeyboardHandler::_defaultUnicodeHandler [protected]

Default Unicode event handler, does nothing, but can log keyboard events.

Note:
It is only used when in text input mode.

Definition at line 928 of file OSDLKeyboardHandler.h.

Referenced by setSmarterDefaultKeyHandlers().

OSDL::MVC::Controller* OSDL::Events::KeyboardHandler::_focusController [protected]

The controller that will receive focus changes.

No controller is owned by this handler.

Definition at line 937 of file OSDLKeyboardHandler.h.

bool OSDL::Events::KeyboardHandler::_unicodeInputWasActivated [protected]

Records the status of Unicode input before this handler was created, so that it can be restored.

Definition at line 945 of file OSDLKeyboardHandler.h.

Referenced by ~KeyboardHandler().


The documentation for this class was generated from the following files:
Generated on Fri Mar 30 14:47:28 2007 for OSDL by  doxygen 1.5.1