Cinder  0.9.1
Public Types | Public Member Functions | Static Public Member Functions | Public Attributes | Protected Attributes | List of all members
cinder::app::KeyEvent Class Reference

#include <KeyEvent.h>

Inherits cinder::app::Event.

Public Types

enum  {
  SHIFT_DOWN = 0x0008, ALT_DOWN = 0x0010, CTRL_DOWN = 0x0020, META_DOWN = 0x0040,
  ACCEL_DOWN = CTRL_DOWN
}
 
enum  {
  KEY_UNKNOWN = 0, KEY_FIRST = 0, KEY_BACKSPACE = 8, KEY_TAB = 9,
  KEY_CLEAR = 12, KEY_RETURN = 13, KEY_PAUSE = 19, KEY_ESCAPE = 27,
  KEY_SPACE = 32, KEY_EXCLAIM = 33, KEY_QUOTEDBL = 34, KEY_HASH = 35,
  KEY_DOLLAR = 36, KEY_AMPERSAND = 38, KEY_QUOTE = 39, KEY_LEFTPAREN = 40,
  KEY_RIGHTPAREN = 41, KEY_ASTERISK = 42, KEY_PLUS = 43, KEY_COMMA = 44,
  KEY_MINUS = 45, KEY_PERIOD = 46, KEY_SLASH = 47, KEY_0 = 48,
  KEY_1 = 49, KEY_2 = 50, KEY_3 = 51, KEY_4 = 52,
  KEY_5 = 53, KEY_6 = 54, KEY_7 = 55, KEY_8 = 56,
  KEY_9 = 57, KEY_COLON = 58, KEY_SEMICOLON = 59, KEY_LESS = 60,
  KEY_EQUALS = 61, KEY_GREATER = 62, KEY_QUESTION = 63, KEY_AT = 64,
  KEY_LEFTBRACKET = 91, KEY_BACKSLASH = 92, KEY_RIGHTBRACKET = 93, KEY_CARET = 94,
  KEY_UNDERSCORE = 95, KEY_BACKQUOTE = 96, KEY_a = 97, KEY_b = 98,
  KEY_c = 99, KEY_d = 100, KEY_e = 101, KEY_f = 102,
  KEY_g = 103, KEY_h = 104, KEY_i = 105, KEY_j = 106,
  KEY_k = 107, KEY_l = 108, KEY_m = 109, KEY_n = 110,
  KEY_o = 111, KEY_p = 112, KEY_q = 113, KEY_r = 114,
  KEY_s = 115, KEY_t = 116, KEY_u = 117, KEY_v = 118,
  KEY_w = 119, KEY_x = 120, KEY_y = 121, KEY_z = 122,
  KEY_DELETE = 127, KEY_KP0 = 256, KEY_KP1 = 257, KEY_KP2 = 258,
  KEY_KP3 = 259, KEY_KP4 = 260, KEY_KP5 = 261, KEY_KP6 = 262,
  KEY_KP7 = 263, KEY_KP8 = 264, KEY_KP9 = 265, KEY_KP_PERIOD = 266,
  KEY_KP_DIVIDE = 267, KEY_KP_MULTIPLY = 268, KEY_KP_MINUS = 269, KEY_KP_PLUS = 270,
  KEY_KP_ENTER = 271, KEY_KP_EQUALS = 272, KEY_UP = 273, KEY_DOWN = 274,
  KEY_RIGHT = 275, KEY_LEFT = 276, KEY_INSERT = 277, KEY_HOME = 278,
  KEY_END = 279, KEY_PAGEUP = 280, KEY_PAGEDOWN = 281, KEY_F1 = 282,
  KEY_F2 = 283, KEY_F3 = 284, KEY_F4 = 285, KEY_F5 = 286,
  KEY_F6 = 287, KEY_F7 = 288, KEY_F8 = 289, KEY_F9 = 290,
  KEY_F10 = 291, KEY_F11 = 292, KEY_F12 = 293, KEY_F13 = 294,
  KEY_F14 = 295, KEY_F15 = 296, KEY_NUMLOCK = 300, KEY_CAPSLOCK = 301,
  KEY_SCROLLOCK = 302, KEY_RSHIFT = 303, KEY_LSHIFT = 304, KEY_RCTRL = 305,
  KEY_LCTRL = 306, KEY_RALT = 307, KEY_LALT = 308, KEY_RMETA = 309,
  KEY_LMETA = 310, KEY_LSUPER = 311, KEY_RSUPER = 312, KEY_MODE = 313,
  KEY_COMPOSE = 314, KEY_HELP = 315, KEY_PRINT = 316, KEY_SYSREQ = 317,
  KEY_BREAK = 318, KEY_MENU = 319, KEY_POWER = 320, KEY_EURO = 321,
  KEY_UNDO = 322, KEY_LAST
}
 

Public Member Functions

 KeyEvent ()
 
 KeyEvent (WindowRef win, int aCode, uint32_t aChar32, char aChar, unsigned int aModifiers, unsigned int aNativeKeyCode)
 
char getChar () const
 
uint32_t getCharUtf32 () const
 
int getCode () const
 
bool isShiftDown () const
 
bool isAltDown () const
 
bool isControlDown () const
 
bool isMetaDown () const
 
bool isAccelDown () const
 
int getNativeKeyCode () const
 
bool isHandled () const
 
void setHandled (bool handled=true)
 
WindowRef getWindow () const
 
void setWindow (const WindowRef &window)
 

Static Public Member Functions

static int translateNativeKeyCode (int nativeKeyCode)
 

Public Attributes

bool mHandled
 

Protected Attributes

int mCode
 
uint32_t mChar32
 
char mChar
 
unsigned int mModifiers
 
unsigned int mNativeKeyCode
 
WindowRef mWindow
 

Detailed Description

Represents a keyboard event.

Member Enumeration Documentation

anonymous enum
Enumerator
SHIFT_DOWN 
ALT_DOWN 
CTRL_DOWN 
META_DOWN 
ACCEL_DOWN 
anonymous enum
Enumerator
KEY_UNKNOWN 
KEY_FIRST 
KEY_BACKSPACE 
KEY_TAB 
KEY_CLEAR 
KEY_RETURN 
KEY_PAUSE 
KEY_ESCAPE 
KEY_SPACE 
KEY_EXCLAIM 
KEY_QUOTEDBL 
KEY_HASH 
KEY_DOLLAR 
KEY_AMPERSAND 
KEY_QUOTE 
KEY_LEFTPAREN 
KEY_RIGHTPAREN 
KEY_ASTERISK 
KEY_PLUS 
KEY_COMMA 
KEY_MINUS 
KEY_PERIOD 
KEY_SLASH 
KEY_0 
KEY_1 
KEY_2 
KEY_3 
KEY_4 
KEY_5 
KEY_6 
KEY_7 
KEY_8 
KEY_9 
KEY_COLON 
KEY_SEMICOLON 
KEY_LESS 
KEY_EQUALS 
KEY_GREATER 
KEY_QUESTION 
KEY_AT 
KEY_LEFTBRACKET 
KEY_BACKSLASH 
KEY_RIGHTBRACKET 
KEY_CARET 
KEY_UNDERSCORE 
KEY_BACKQUOTE 
KEY_a 
KEY_b 
KEY_c 
KEY_d 
KEY_e 
KEY_f 
KEY_g 
KEY_h 
KEY_i 
KEY_j 
KEY_k 
KEY_l 
KEY_m 
KEY_n 
KEY_o 
KEY_p 
KEY_q 
KEY_r 
KEY_s 
KEY_t 
KEY_u 
KEY_v 
KEY_w 
KEY_x 
KEY_y 
KEY_z 
KEY_DELETE 
KEY_KP0 
KEY_KP1 
KEY_KP2 
KEY_KP3 
KEY_KP4 
KEY_KP5 
KEY_KP6 
KEY_KP7 
KEY_KP8 
KEY_KP9 
KEY_KP_PERIOD 
KEY_KP_DIVIDE 
KEY_KP_MULTIPLY 
KEY_KP_MINUS 
KEY_KP_PLUS 
KEY_KP_ENTER 
KEY_KP_EQUALS 
KEY_UP 
KEY_DOWN 
KEY_RIGHT 
KEY_LEFT 
KEY_INSERT 
KEY_HOME 
KEY_END 
KEY_PAGEUP 
KEY_PAGEDOWN 
KEY_F1 
KEY_F2 
KEY_F3 
KEY_F4 
KEY_F5 
KEY_F6 
KEY_F7 
KEY_F8 
KEY_F9 
KEY_F10 
KEY_F11 
KEY_F12 
KEY_F13 
KEY_F14 
KEY_F15 
KEY_NUMLOCK 
KEY_CAPSLOCK 
KEY_SCROLLOCK 
KEY_RSHIFT 
KEY_LSHIFT 
KEY_RCTRL 
KEY_LCTRL 
KEY_RALT 
KEY_LALT 
KEY_RMETA 
KEY_LMETA 
KEY_LSUPER 
KEY_RSUPER 
KEY_MODE 
KEY_COMPOSE 
KEY_HELP 
KEY_PRINT 
KEY_SYSREQ 
KEY_BREAK 
KEY_MENU 
KEY_POWER 
KEY_EURO 
KEY_UNDO 
KEY_LAST 

Constructor & Destructor Documentation

cinder::app::KeyEvent::KeyEvent ( )
cinder::app::KeyEvent::KeyEvent ( WindowRef  win,
int  aCode,
uint32_t  aChar32,
char  aChar,
unsigned int  aModifiers,
unsigned int  aNativeKeyCode 
)

Member Function Documentation

char cinder::app::KeyEvent::getChar ( ) const

Returns the ASCII character associated with the event.

uint32_t cinder::app::KeyEvent::getCharUtf32 ( ) const

Returns the UTF-32 character associated with the event.

int cinder::app::KeyEvent::getCode ( ) const

Returns the key code associated with the event, which maps into the enum listed below.

bool cinder::app::KeyEvent::isShiftDown ( ) const

Returns whether the Shift key was pressed during the event.

bool cinder::app::KeyEvent::isAltDown ( ) const

Returns whether the Alt (or Option) key was pressed during the event.

bool cinder::app::KeyEvent::isControlDown ( ) const

Returns whether the Control key was pressed during the event.

bool cinder::app::KeyEvent::isMetaDown ( ) const

Returns whether the meta key was pressed during the event. Maps to the Windows key on Windows and the Command key on Mac OS X.

bool cinder::app::KeyEvent::isAccelDown ( ) const

Returns whether the accelerator key was pressed during the event. Maps to the Control key on Windows and the Command key on Mac OS X.

int cinder::app::KeyEvent::getNativeKeyCode ( ) const

Returns the platform-native key-code. Advanced users only.

int cinder::app::KeyEvent::translateNativeKeyCode ( int  nativeKeyCode)
static

Maps a platform-native key-code to the key code enum.

bool cinder::app::Event::isHandled ( ) const
inherited

Returns whether this event has been marked as handled by one of its slots, terminating the normal iteration of the event's slots.

void cinder::app::Event::setHandled ( bool  handled = true)
inherited

Marks the event as handled, terminating the normal iteration of the event's slots.

WindowRef cinder::app::Event::getWindow ( ) const
inherited

Returns the Window in which the MouseEvent occurred.

void cinder::app::Event::setWindow ( const WindowRef window)
inherited

Member Data Documentation

int cinder::app::KeyEvent::mCode
protected
uint32_t cinder::app::KeyEvent::mChar32
protected
char cinder::app::KeyEvent::mChar
protected
unsigned int cinder::app::KeyEvent::mModifiers
protected
unsigned int cinder::app::KeyEvent::mNativeKeyCode
protected
WindowRef cinder::app::KeyEvent::mWindow
protected
bool cinder::app::Event::mHandled
inherited

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