# Ogre::KeyEvent Class Reference

`#include <OgreKeyEvent.h>`

Inheritance diagram for Ogre::KeyEvent:

List of all members.

## Public Types

enum | { KE_FIRST_EVENT = 2500, KE_LAST_EVENT = 2504 }
enum | { KE_KEY_CLICKED = KE_FIRST_EVENT, KE_KEY_PRESSED, KE_KEY_RELEASED, KE_KEY_FOCUSIN, KE_KEY_FOCUSOUT }
enum | { SHIFT_MASK = 1 << 0, CTRL_MASK = 1 << 1, META_MASK = 1 << 2, ALT_MASK = 1 << 3, BUTTON0_MASK = 1 << 4, BUTTON1_MASK = 1 << 5, BUTTON2_MASK = 1 << 6, BUTTON3_MASK = 1 << 7, BUTTON_ANY_MASK = 0xF << 4 }

## Public Member Functions

| KeyEvent (PositionTarget *source, int id, int key, Real when, int modifiers)
| Constructs a KeyEvent object with the specified source KeyTarget, type, modifiers, coordinates, and click count.
String | paramString () const
| Returns a parameter string identifying this event.
int | getKey ()
| return the ID of the button
char | getKeyChar ()
| return the char of the button
void | consume ()
| Consumes this event so that it will not be processed in the default manner by the source which originated it.
int | getModifiers () const
| Returns the modifiers flag for this event.
Real | getWhen () const
| Returns the timestamp of when this event occurred.
bool | isAltDown () const
| Returns whether or not the Alt modifier is down on this event.
bool | isConsumed () const
| Returns whether or not this event has been consumed.
bool | isControlDown () const
| Returns whether or not the Control modifier is down on this event.
bool | isMetaDown () const
| Returns whether or not the Meta modifier is down on this event.
bool | isShiftDown () const
| Returns whether or not the Shift modifier is down on this event.
bool | isEventBetween (int start, int end) const
int | getID () const
EventTarget * | getSource () const

## Protected Attributes

int | mKey
| Which key was pressed.
Real | mWhen
| Not implemented yet.
int | mModifiers
| The state of the modifier keys at the time the input event was fired.
EventTarget * | mSource
| The target to process the event.
int | mId
| The ID of the event.
bool | mConsumed
| whether the event has been consumed

## Detailed Description

Version:
  1.22 04/22/99

Author:
  Carl Quinn

Definition at line 45 of file OgreKeyEvent.h.

## Member Enumeration Documentation

anonymous enum`[inherited]`

Enumeration values:

  SHIFT_MASK | This flag indicates that the Shift key was down when the event occurred.
  CTRL_MASK | This flag indicates that the Control key was down when the event occurred.
  META_MASK | This flag indicates that the Meta key was down when the event occurred. For mouse events, this flag indicates that the right button was pressed or released.
  ALT_MASK | This flag indicates that the Alt key was down when the event occurred. For mouse events, this flag indicates that the middle mouse button was pressed or released.
  BUTTON0_MASK |
  BUTTON1_MASK |
  BUTTON2_MASK |
  BUTTON3_MASK |
  BUTTON_ANY_MASK |

Definition at line 93 of file OgreInputEvent.h.

anonymous enum

Enumeration values:

  KE_FIRST_EVENT |
  KE_LAST_EVENT |

Definition at line 57 of file OgreKeyEvent.h.

anonymous enum

Enumeration values:

  KE_KEY_CLICKED |
  KE_KEY_PRESSED |
  KE_KEY_RELEASED |
  KE_KEY_FOCUSIN |
  KE_KEY_FOCUSOUT |

Definition at line 63 of file OgreKeyEvent.h.

## Constructor & Destructor Documentation

Ogre::KeyEvent::KeyEvent | ( | PositionTarget * | source,
|  | int | id,
|  | int | key,
|  | Real | when,
|  | int | modifiers
| ) |

Constructs a KeyEvent object with the specified source KeyTarget, type, modifiers, coordinates, and click count.

Parameters:

  source | the KeyTarget that originated the event
  id | the integer that identifies the event
  when | a long int that gives the time the event occurred
  modifiers | the modifier keys down during event (shift, ctrl, alt, meta)
  x | the horizontal x coordinate for the key location
  y | the vertical y coordinate for the key location
  clickCount | the number of key clicks associated with event

## Member Function Documentation

void Ogre::InputEvent::consume | ( |  | ) | `[inherited]`

| Consumes this event so that it will not be processed in the default manner by the source which originated it.

int Ogre::InputEvent::getID | ( |  | ) | const`[inherited]`

int Ogre::KeyEvent::getKey | ( |  | ) |

| return the ID of the button

char Ogre::KeyEvent::getKeyChar | ( |  | ) |

| return the char of the button

int Ogre::InputEvent::getModifiers | ( |  | ) | const`[inherited]`

| Returns the modifiers flag for this event.

EventTarget* Ogre::InputEvent::getSource | ( |  | ) | const`[inherited]`

Real Ogre::InputEvent::getWhen | ( |  | ) | const`[inherited]`

| Returns the timestamp of when this event occurred. Not implemented yet

bool Ogre::InputEvent::isAltDown | ( |  | ) | const`[inherited]`

| Returns whether or not the Alt modifier is down on this event.

bool Ogre::InputEvent::isConsumed | ( |  | ) | const`[inherited]`

Returns whether or not this event has been consumed.

See also:
  consume

bool Ogre::InputEvent::isControlDown | ( |  | ) | const`[inherited]`

| Returns whether or not the Control modifier is down on this event.

bool Ogre::InputEvent::isEventBetween | ( | int | start,
|  | int | end
| ) | const`[inherited]`

bool Ogre::InputEvent::isMetaDown | ( |  | ) | const`[inherited]`

| Returns whether or not the Meta modifier is down on this event.

bool Ogre::InputEvent::isShiftDown | ( |  | ) | const`[inherited]`

| Returns whether or not the Shift modifier is down on this event.

String Ogre::KeyEvent::paramString | ( |  | ) | const

Returns a parameter string identifying this event.

This method is useful for event-logging and for debugging.

Returns:
  a string identifying the event and its attributes

## Member Data Documentation

bool Ogre::InputEvent::mConsumed `[protected, inherited]`

| whether the event has been consumed Definition at line 88 of file OgreInputEvent.h.

int Ogre::InputEvent::mId `[protected, inherited]`

| The ID of the event. Definition at line 83 of file OgreInputEvent.h.

int Ogre::KeyEvent::mKey `[protected]`

| Which key was pressed. Definition at line 53 of file OgreKeyEvent.h.

int Ogre::InputEvent::mModifiers `[protected, inherited]`

| The state of the modifier keys at the time the input event was fired. Definition at line 72 of file OgreInputEvent.h.

EventTarget* Ogre::InputEvent::mSource `[protected, inherited]`

| The target to process the event. This is ususally found by the dispatcher Definition at line 78 of file OgreInputEvent.h.

Real Ogre::InputEvent::mWhen `[protected, inherited]`

| Not implemented yet. Definition at line 67 of file OgreInputEvent.h.

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

- OgreKeyEvent.h

Copyright © 2000-2005 by The OGRE Team
Last modified Sun Nov 20 12:37:06 2005