Orxonox: OIS::MacKeyboard Class Reference

# OIS::MacKeyboard Class Reference

`#include <src/ois/mac/MacKeyboard.h>`

Inheritance diagram for OIS::MacKeyboard:

List of all members.

## Public Member Functions

virtual void | _initialize ()
void | _keyDownCallback (EventRef theEvent)
void | _keyUpCallback (EventRef theEvent)
void | _modChangeCallback (EventRef theEvent)
virtual void | capture ()
virtual void | copyKeyStates (char keys[256]) const
virtual std::string & | getAsString (KeyCode key)
virtual bool | isKeyDown (KeyCode key) const
| MacKeyboard (InputManager *creator, bool buffered, bool repeat)
virtual Interface * | queryInterface (Interface::IType type)
virtual void | setBuffered (bool buffered)
virtual | ~MacKeyboard ()

## Protected Types

typedef std::list < MacKeyStackEvent > | eventStack
typedef std::map< UInt32, KeyCode > | VirtualtoOIS_KeyMap

## Protected Member Functions

void | injectEvent (KeyCode kc, unsigned int time, MacEventType type, unsigned int txt=0)
void | populateKeyConversion ()

## Protected Attributes

std::string | getString
char | KeyBuffer [256]
VirtualtoOIS_KeyMap | keyConversion
EventHandlerRef | keyDownEventRef
EventHandlerUPP | keyDownUPP
EventHandlerRef | keyModEventRef
EventHandlerUPP | keyModUPP
EventHandlerRef | keyUpEventRef
EventHandlerUPP | keyUpUPP
eventStack | pendingEvents
UInt32 | prevModMask
bool | useRepeat

## Member Typedef Documentation

typedef std::list<MacKeyStackEvent> OIS::MacKeyboard::eventStack`[protected]`

typedef std::map<UInt32, KeyCode> OIS::MacKeyboard::VirtualtoOIS_KeyMap`[protected]`

## Constructor & Destructor Documentation

MacKeyboard::MacKeyboard | ( | InputManager * | creator,
|  | bool | buffered,
|  | bool | repeat |
| ) |  |  |

References keyDownEventRef, keyDownUPP, KeyDownWrapper(), keyModEventRef, keyModUPP, KeyModWrapper(), keyUpEventRef, keyUpUPP, KeyUpWrapper(), OIS::Object::mCreator, populateKeyConversion(), and useRepeat.

MacKeyboard::~MacKeyboard | ( |  | ) | `[virtual]`

References keyDownEventRef, keyDownUPP, keyModEventRef, keyModUPP, keyUpEventRef, keyUpUPP, and OIS::Object::mCreator.

## Member Function Documentation

void MacKeyboard::_initialize | ( |  | ) | `[virtual]`

Remarks:
  Internal... Do not call this directly.

Implements OIS::Object.

References DownSpec, OIS::E_General, KeyBuffer, keyDownEventRef, keyDownUPP, keyModEventRef, keyModUPP, keyUpEventRef, keyUpUPP, OIS::Object::mCreator, OIS::Keyboard::mModifiers, ModSpec, OIS_EXCEPT, prevModMask, UpSpec, and useRepeat.

void MacKeyboard::_keyDownCallback | ( | EventRef | theEvent | ) |

References OIS::Keyboard::Ascii, injectEvent(), keyConversion, OIS::MAC_KEYDOWN, OIS::Keyboard::mTextMode, and OIS::Keyboard::Unicode.

void MacKeyboard::_keyUpCallback | ( | EventRef | theEvent | ) |

References injectEvent(), keyConversion, and OIS::MAC_KEYUP.

void MacKeyboard::_modChangeCallback | ( | EventRef | theEvent | ) |

References OIS::Keyboard::Alt, OIS::Keyboard::Ctrl, injectEvent(), OIS::KC_APPS, OIS::KC_CAPITAL, OIS::KC_LCONTROL, OIS::KC_LMENU, OIS::KC_LSHIFT, OIS::KC_LWIN, OIS::KC_NUMLOCK, OIS::MAC_KEYDOWN, OIS::MAC_KEYUP, OIS::Keyboard::mModifiers, prevModMask, and OIS::Keyboard::Shift.

void MacKeyboard::capture | ( |  | ) | `[virtual]`

Remarks:
  Used for updating call once per frame before checking state or to update events

Implements OIS::Object.

References OIS::KeyListener::keyPressed(), OIS::KeyListener::keyReleased(), OIS::MAC_KEYDOWN, OIS::MAC_KEYREPEAT, OIS::MAC_KEYUP, OIS::Object::mBuffered, OIS::Keyboard::mListener, and pendingEvents.

void MacKeyboard::copyKeyStates | ( | char | keys[256] | ) | const`[virtual]`

Remarks:
  Copies the state of the keys into the sent buffer (in the form of 1 is down and 0 is up)

Implements OIS::Keyboard.

References KeyBuffer.

std::string & MacKeyboard::getAsString | ( | KeyCode | kc | ) | `[virtual]`

Remarks:
  Translates KeyCode to string representation. For example, KC_ENTER will be "Enter" - Locale specific of course.

Parameters:

  | kc | KeyCode to convert

Returns:
  The string as determined from the current locale

Implements OIS::Keyboard.

References getString.

void MacKeyboard::injectEvent | ( | KeyCode | kc,
|  | unsigned int | time,
|  | MacEventType | type,
|  | unsigned int | txt = `0` |
| ) |  |  | `[protected]`

References KeyBuffer, OIS::MAC_KEYUP, OIS::Object::mBuffered, OIS::Keyboard::mListener, and pendingEvents.

Referenced by _keyDownCallback(), _keyUpCallback(), and _modChangeCallback().

bool MacKeyboard::isKeyDown | ( | KeyCode | key | ) | const`[virtual]`

Remarks:
  Returns true if key is donwn

Parameters:

  | key | A KeyCode to check

Implements OIS::Keyboard.

References KeyBuffer.

void MacKeyboard::populateKeyConversion | ( |  | ) | `[protected]`

References OIS::KC_0, OIS::KC_1, OIS::KC_2, OIS::KC_3, OIS::KC_4, OIS::KC_5, OIS::KC_6, OIS::KC_7, OIS::KC_8, OIS::KC_9, OIS::KC_A, OIS::KC_ADD, OIS::KC_APOSTROPHE, OIS::KC_B, OIS::KC_BACK, OIS::KC_BACKSLASH, OIS::KC_C, OIS::KC_CAPITAL, OIS::KC_COMMA, OIS::KC_D, OIS::KC_DECIMAL, OIS::KC_DELETE, OIS::KC_DIVIDE, OIS::KC_DOWN, OIS::KC_E, OIS::KC_END, OIS::KC_EQUALS, OIS::KC_ESCAPE, OIS::KC_F, OIS::KC_F1, OIS::KC_F10, OIS::KC_F11, OIS::KC_F12, OIS::KC_F13, OIS::KC_F14, OIS::KC_F15, OIS::KC_F2, OIS::KC_F3, OIS::KC_F4, OIS::KC_F5, OIS::KC_F6, OIS::KC_F7, OIS::KC_F8, OIS::KC_F9, OIS::KC_G, OIS::KC_GRAVE, OIS::KC_H, OIS::KC_HOME, OIS::KC_I, OIS::KC_J, OIS::KC_K, OIS::KC_L, OIS::KC_LBRACKET, OIS::KC_LEFT, OIS::KC_M, OIS::KC_MINUS, OIS::KC_MULTIPLY, OIS::KC_N, OIS::KC_NUMPAD0, OIS::KC_NUMPAD1, OIS::KC_NUMPAD2, OIS::KC_NUMPAD3, OIS::KC_NUMPAD4, OIS::KC_NUMPAD5, OIS::KC_NUMPAD6, OIS::KC_NUMPAD7, OIS::KC_NUMPAD8, OIS::KC_NUMPAD9, OIS::KC_NUMPADENTER, OIS::KC_NUMPADEQUALS, OIS::KC_O, OIS::KC_P, OIS::KC_PERIOD, OIS::KC_PGDOWN, OIS::KC_PGUP, OIS::KC_Q, OIS::KC_R, OIS::KC_RBRACKET, OIS::KC_RETURN, OIS::KC_RIGHT, OIS::KC_S, OIS::KC_SEMICOLON, OIS::KC_SLASH, OIS::KC_SPACE, OIS::KC_SUBTRACT, OIS::KC_T, OIS::KC_TAB, OIS::KC_U, OIS::KC_UP, OIS::KC_V, OIS::KC_W, OIS::KC_X, OIS::KC_Y, OIS::KC_Z, and keyConversion.

Referenced by MacKeyboard().

virtual Interface* OIS::MacKeyboard::queryInterface | ( | Interface::IType | type | ) | `[inline, virtual]`

Remarks:
  If available, get an interface to write to some devices. Examples include, turning on and off LEDs, ForceFeedback, etc

Parameters:

  | type | The type of interface you are looking for

Implements OIS::Object.

void MacKeyboard::setBuffered | ( | bool | buffered | ) | `[virtual]`

Remarks:
  Sets buffered mode

Implements OIS::Object.

References OIS::Object::mBuffered.

## Member Data Documentation

std::string OIS::MacKeyboard::getString`[protected]`

Referenced by getAsString().

char OIS::MacKeyboard::KeyBuffer[256]`[protected]`

Referenced by _initialize(), copyKeyStates(), injectEvent(), and isKeyDown().

VirtualtoOIS_KeyMap OIS::MacKeyboard::keyConversion`[protected]`

Referenced by _keyDownCallback(), _keyUpCallback(), and populateKeyConversion().

EventHandlerRef OIS::MacKeyboard::keyDownEventRef`[protected]`

Referenced by _initialize(), MacKeyboard(), and ~MacKeyboard().

EventHandlerUPP OIS::MacKeyboard::keyDownUPP`[protected]`

Referenced by _initialize(), MacKeyboard(), and ~MacKeyboard().

EventHandlerRef OIS::MacKeyboard::keyModEventRef`[protected]`

Referenced by _initialize(), MacKeyboard(), and ~MacKeyboard().

EventHandlerUPP OIS::MacKeyboard::keyModUPP`[protected]`

Referenced by _initialize(), MacKeyboard(), and ~MacKeyboard().

EventHandlerRef OIS::MacKeyboard::keyUpEventRef`[protected]`

Referenced by _initialize(), MacKeyboard(), and ~MacKeyboard().

EventHandlerUPP OIS::MacKeyboard::keyUpUPP`[protected]`

Referenced by _initialize(), MacKeyboard(), and ~MacKeyboard().

eventStack OIS::MacKeyboard::pendingEvents`[protected]`

Referenced by capture(), and injectEvent().

UInt32 OIS::MacKeyboard::prevModMask`[protected]`

Referenced by _initialize(), and _modChangeCallback().

bool OIS::MacKeyboard::useRepeat`[protected]`

Referenced by _initialize(), and MacKeyboard().

The documentation for this class was generated from the following files:

- src/ois/mac/MacKeyboard.h
- src/ois/mac/MacKeyboard.cpp