gcn::Key Class Reference

#include <key.hpp>

List of all members.


Detailed Description

Represents a key or a character.

Definition at line 67 of file key.hpp.

Public Types

 SPACE = ' '
 TAB = '\t'
 ENTER = '\n'
 LEFT_ALT = 1000
 RIGHT_ALT
 LEFT_SHIFT
 RIGHT_SHIFT
 LEFT_CONTROL
 RIGHT_CONTROL
 LEFT_META
 RIGHT_META
 LEFT_SUPER
 RIGHT_SUPER
 INSERT
 HOME
 PAGE_UP
 DELETE
 END
 PAGE_DOWN
 ESCAPE
 CAPS_LOCK
 BACKSPACE
 F1
 F2
 F3
 F4
 F5
 F6
 F7
 F8
 F9
 F10
 F11
 F12
 F13
 F14
 F15
 PRINT_SCREEN
 SCROLL_LOCK
 PAUSE
 NUM_LOCK
 ALT_GR
 LEFT
 RIGHT
 UP
 DOWN
enum  {
  SPACE = ' ', TAB = '\t', ENTER = '\n', LEFT_ALT = 1000,
  RIGHT_ALT, LEFT_SHIFT, RIGHT_SHIFT, LEFT_CONTROL,
  RIGHT_CONTROL, LEFT_META, RIGHT_META, LEFT_SUPER,
  RIGHT_SUPER, INSERT, HOME, PAGE_UP,
  DELETE, END, PAGE_DOWN, ESCAPE,
  CAPS_LOCK, BACKSPACE, F1, F2,
  F3, F4, F5, F6,
  F7, F8, F9, F10,
  F11, F12, F13, F14,
  F15, PRINT_SCREEN, SCROLL_LOCK, PAUSE,
  NUM_LOCK, ALT_GR, LEFT, RIGHT,
  UP, DOWN
}
 An enum with key values.

Public Member Functions

 Key (int value=0)
 Constructor.
bool isCharacter () const
 Checks whether a key is a character.
bool isNumber () const
 Checks whether a key is a number.
bool isLetter () const
 Checks whether a key is a letter.
bool isShiftPressed () const
 Checks whether shift is pressed.
void setShiftPressed (bool pressed)
 Sets the shift pressed flag.
bool isControlPressed () const
 Checks whether control is pressed.
void setControlPressed (bool pressed)
 Sets the control pressed flag.
bool isAltPressed () const
 Checks whether alt is pressed.
void setAltPressed (bool pressed)
 Sets the alt pressed flag.
bool isMetaPressed () const
 Checks whether meta is pressed.
void setMetaPressed (bool pressed)
 Sets the meta pressed flag.
bool isNumericPad () const
 Checks whether the key was pressed at the numeric pad.
void setNumericPad (bool numpad)
 Sets the numeric pad flag.
int getValue () const
 Gets the value of the key.
void setValue (int value)
 Sets the value of the key.

Protected Attributes

int mValue
bool mShiftPressed
bool mControlPressed
bool mAltPressed
bool mMetaPressed
bool mNumericPad


Constructor & Destructor Documentation

gcn::Key::Key ( int  value = 0  ) 

Constructor.

Parameters:
value the ascii or enum value for the key.

Definition at line 65 of file key.cpp.


Member Function Documentation

int gcn::Key::getValue (  )  const

Gets the value of the key.

If an ascii value exists it will be returned. Otherwise an enum value will be returned.

Returns:
the value of the key.

Definition at line 148 of file key.cpp.

References mValue.

Referenced by gcn::TextField::keyPress(), gcn::TextBox::keyPress(), gcn::Slider::keyPress(), gcn::RadioButton::keyPress(), gcn::ListBox::keyPress(), gcn::DropDown::keyPress(), gcn::CheckBox::keyPress(), gcn::Button::keyPress(), and gcn::Button::keyRelease().

bool gcn::Key::isAltPressed (  )  const

Checks whether alt is pressed.

Returns:
true if alt was pressed at the same time as the key.

Definition at line 113 of file key.cpp.

References mAltPressed.

bool gcn::Key::isCharacter (  )  const

Checks whether a key is a character.

Returns:
true if the key is a letter, number or whitespace.

Definition at line 73 of file key.cpp.

References mValue.

Referenced by gcn::TextField::keyPress(), and gcn::TextBox::keyPress().

bool gcn::Key::isControlPressed (  )  const

Checks whether control is pressed.

Returns:
true if control was pressed at the same time as the key.

Definition at line 103 of file key.cpp.

References mControlPressed.

bool gcn::Key::isLetter (  )  const

Checks whether a key is a letter.

Returns:
true if the key is a letter (a-z,A-Z).

Definition at line 85 of file key.cpp.

References mValue.

bool gcn::Key::isMetaPressed (  )  const

Checks whether meta is pressed.

Returns:
true if meta was pressed at the same time as the key.

Definition at line 123 of file key.cpp.

References mMetaPressed.

bool gcn::Key::isNumber (  )  const

Checks whether a key is a number.

Returns:
true if the key is a number (0-9).

Definition at line 80 of file key.cpp.

References mValue.

bool gcn::Key::isNumericPad (  )  const

Checks whether the key was pressed at the numeric pad.

Returns:
true if key pressed at the numeric pad.

Definition at line 133 of file key.cpp.

References mNumericPad.

bool gcn::Key::isShiftPressed (  )  const

Checks whether shift is pressed.

Returns:
true if shift was pressed at the same time as the key.

Definition at line 93 of file key.cpp.

References mShiftPressed.

void gcn::Key::setAltPressed ( bool  pressed  ) 

Sets the alt pressed flag.

Parameters:
pressed the alt flag value.

Definition at line 118 of file key.cpp.

References mAltPressed.

Referenced by gcn::SDLInput::convertKeyCharacter(), gcn::GLUTInput::convertKeyCharacter(), gcn::GLUTInput::convertSpecialCharacter(), and gcn::AllegroInput::convertToKey().

void gcn::Key::setControlPressed ( bool  pressed  ) 

Sets the control pressed flag.

Parameters:
pressed the control flag value.

Definition at line 108 of file key.cpp.

References mControlPressed.

Referenced by gcn::SDLInput::convertKeyCharacter(), gcn::GLUTInput::convertKeyCharacter(), gcn::GLUTInput::convertSpecialCharacter(), and gcn::AllegroInput::convertToKey().

void gcn::Key::setMetaPressed ( bool  pressed  ) 

Sets the meta pressed flag.

Parameters:
pressed the meta flag value.

Definition at line 128 of file key.cpp.

References mMetaPressed.

Referenced by gcn::SDLInput::convertKeyCharacter(), and gcn::AllegroInput::convertToKey().

void gcn::Key::setNumericPad ( bool  numpad  ) 

Sets the numeric pad flag.

Parameters:
numpad the numeric pad flag value.

Definition at line 138 of file key.cpp.

References mNumericPad.

Referenced by gcn::SDLInput::convertKeyCharacter(), and gcn::AllegroInput::convertToKey().

void gcn::Key::setShiftPressed ( bool  pressed  ) 

Sets the shift pressed flag.

Parameters:
pressed the shift flag value.

Definition at line 98 of file key.cpp.

References mShiftPressed.

Referenced by gcn::SDLInput::convertKeyCharacter(), gcn::GLUTInput::convertKeyCharacter(), gcn::GLUTInput::convertSpecialCharacter(), and gcn::AllegroInput::convertToKey().

void gcn::Key::setValue ( int  value  ) 

Sets the value of the key.

An ascii value or an enum value.

Parameters:
value the key value.

Definition at line 143 of file key.cpp.

References mValue.

Referenced by gcn::SDLInput::convertKeyCharacter(), gcn::GLUTInput::convertKeyCharacter(), and gcn::GLUTInput::convertSpecialCharacter().


The documentation for this class was generated from the following files:
Generated on Sat Jul 29 19:38:48 2006 for Guichan by  doxygen 1.4.7