Open Inventor Release 2024.1.0
 
Loading...
Searching...
No Matches
SoKeyboardEvent Class Reference

Keyboard key press and release events. More...

#include <Inventor/events/SoKeyboardEvent.h>

+ Inheritance diagram for SoKeyboardEvent:

Public Types

enum  Key {
  ANY = 0 ,
  LEFT_SHIFT = 0xFFE1 ,
  RIGHT_SHIFT = 0xFFE2 ,
  LEFT_CONTROL = 0xFFE3 ,
  RIGHT_CONTROL = 0xFFE4 ,
  LEFT_ALT = 0xFFE9 ,
  RIGHT_ALT = 0xFFEA ,
  LEFT_META = 0xFFEB ,
  RIGHT_META = 0xFFEC ,
  NUMBER_0 = 0x030 ,
  NUMBER_1 = 0x031 ,
  NUMBER_2 = 0x032 ,
  NUMBER_3 = 0x033 ,
  NUMBER_4 = 0x034 ,
  NUMBER_5 = 0x035 ,
  NUMBER_6 = 0x036 ,
  NUMBER_7 = 0x037 ,
  NUMBER_8 = 0x038 ,
  NUMBER_9 = 0x039 ,
  A = 0x061 ,
  B = 0x062 ,
  C = 0x063 ,
  D = 0x064 ,
  E = 0x065 ,
  F = 0x066 ,
  G = 0x067 ,
  H = 0x068 ,
  I = 0x069 ,
  J = 0x06A ,
  K = 0x06B ,
  L = 0x06C ,
  M = 0x06D ,
  N = 0x06E ,
  O = 0x06F ,
  P = 0x070 ,
  Q = 0x071 ,
  R = 0x072 ,
  S = 0x073 ,
  T = 0x074 ,
  U = 0x075 ,
  V = 0x076 ,
  W = 0x077 ,
  X = 0x078 ,
  Y = 0x079 ,
  Z = 0x07A ,
  HOME = 0xFF50 ,
  LEFT_ARROW = 0xFF51 ,
  UP_ARROW = 0xFF52 ,
  RIGHT_ARROW = 0xFF53 ,
  DOWN_ARROW = 0xFF54 ,
  PAGE_UP = 0xFF55 ,
  PAGE_DOWN = 0xFF56 ,
  PRIOR = 0xFF55 ,
  NEXT = 0xFF56 ,
  END = 0xFF57 ,
  PAD_ENTER = 0xFF8D ,
  PAD_F1 = 0xFF91 ,
  PAD_F2 = 0xFF92 ,
  PAD_F3 = 0xFF93 ,
  PAD_F4 = 0xFF94 ,
  PAD_0 = 0xFF9E ,
  PAD_1 = 0xFF9C ,
  PAD_2 = 0xFF99 ,
  PAD_3 = 0xFF9B ,
  PAD_4 = 0xFF96 ,
  PAD_5 = 0xFF9D ,
  PAD_6 = 0xFF98 ,
  PAD_7 = 0xFF95 ,
  PAD_8 = 0xFF97 ,
  PAD_9 = 0xFF9A ,
  PAD_ADD = 0xFFAB ,
  PAD_SUBTRACT = 0xFFAD ,
  PAD_MULTIPLY = 0xFFAA ,
  PAD_DIVIDE = 0xFFAF ,
  PAD_SPACE = 0xFF8D ,
  PAD_TAB = 0xFF89 ,
  PAD_INSERT = 0xFF9E ,
  PAD_DELETE = 0xFF9F ,
  PAD_PERIOD = 0xFF9F ,
  F1 = 0xFFBE ,
  F2 = 0xFFBF ,
  F3 = 0xFFC0 ,
  F4 = 0xFFC1 ,
  F5 = 0xFFC2 ,
  F6 = 0xFFC3 ,
  F7 = 0xFFC4 ,
  F8 = 0xFFC5 ,
  F9 = 0xFFC6 ,
  F10 = 0xFFC7 ,
  F11 = 0xFFC8 ,
  F12 = 0xFFC9 ,
  BACKSPACE = 0xFF08 ,
  TAB = 0xFF09 ,
  RETURN = 0xFF0D ,
  ENTER = 0xFF0D ,
  PAUSE = 0xFF13 ,
  SCROLL_LOCK = 0xFF14 ,
  ESCAPE = 0xFF1B ,
  KEY_DELETE = 0xFFFF ,
  DELETE = 0xFFFF ,
  PRINT = 0xFF61 ,
  INSERT = 0xFF63 ,
  NUM_LOCK = 0xFF7F ,
  CAPS_LOCK = 0xFFE5 ,
  SHIFT_LOCK = 0xFFE6 ,
  SPACE = 0x020 ,
  APOSTROPHE = 0x027 ,
  COMMA = 0x02C ,
  MINUS = 0x02D ,
  PERIOD = 0x02E ,
  SLASH = 0x02F ,
  SEMICOLON = 0x03B ,
  EQUAL = 0x03D ,
  BRACKETLEFT = 0x05B ,
  BACKSLASH = 0x05C ,
  BRACKETRIGHT = 0x05D ,
  GRAVE = 0x060 ,
  TWO_SUPERIOR = 0xB2 ,
  TILDE = 0x7E
}
 The keyboard keys. More...
 
- Public Types inherited from SoButtonEvent
enum  State {
  UP ,
  DOWN ,
  DBCLK ,
  UNKNOWN
}
 State. More...
 

Public Member Functions

virtual SoType getTypeId () const
 Returns the type identifier for this specific instance.
 
 SoKeyboardEvent ()
 Constructor.
 
void setKey (SoKeyboardEvent::Key whichKey)
 Sets which key generated the event.
 
SoKeyboardEvent::Key getKey () const
 Gets which key generated the event.
 
char getPrintableCharacter () const
 Convenience routine that returns the character representing the key, if it's printable.
 
void setUnicode (wchar_t unicode)
 Call this function to set the unicode value of the pressed key.
 
wchar_t getUnicode () const
 Return the unicode value of the pressed key, or 0 if setUnicode() wasn't call before.
 
- Public Member Functions inherited from SoButtonEvent
 SoButtonEvent ()
 Constructor.
 
void setState (SoButtonEvent::State s)
 Sets the state of the button.
 
SoButtonEvent::State getState () const
 Gets the state of the button.
 
- Public Member Functions inherited from SoEvent
 SoEvent ()
 Constructor.
 
virtual ~SoEvent ()
 Destructor.
 
virtual void setTime (SbTime t)
 Sets the time at which the event occurred.
 
SbTime getTime () const
 Gets the time at which the event occurred.
 
virtual void setPosition (const SbVec2s &p)
 Sets the window pixel location of the cursor when the event occurred.
 
virtual void setPosition (const SbVec2f &p)
 Float version of setPosition(const SbVec2s &p).
 
const SbVec2sgetPosition () const
 Returns the window pixel location of the cursor when the event occurred as integer values.
 
const SbVec2fgetPositionFloat () const
 Returns the window pixel location of the cursor when the event occurred as float values.
 
const SbVec2sgetPosition (const SbViewportRegion &vpRgn) const
 Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as integer values.
 
const SbVec2fgetPositionFloat (const SbViewportRegion &vpRgn) const
 Gets the viewport pixel location of the cursor when the event occurred, relative to the origin of the specified viewport region, as float values.
 
const SbVec2fgetNormalizedPosition (const SbViewportRegion &vpRgn) const
 Gets the normalized location of the cursor when the event occurred, relative to the specified viewport region.
 
void setShiftDown (SbBool isDown)
 Sets whether the shift key was down when the event occurred.
 
void setCtrlDown (SbBool isDown)
 Sets whether the CTRL key was down when the event occurred.
 
void setAltDown (SbBool isDown)
 Sets whether the ALT key was down when the event occurred.
 
void setButton1Down (SbBool isDown)
 Sets whether mouse Button 1 was down when the event occurred.
 
SbBool wasShiftDown () const
 Returns true if the shift key was down when the event occurred.
 
SbBool wasCtrlDown () const
 Returns true if the CTRL key was down when the event occurred.
 
SbBool wasAltDown () const
 Returns true if the ALT key was down when the event occurred.
 
SbBool wasButton1Down () const
 Returns true if mouse button 1 was down when the event occurred.
 
virtual const SbTrackerInfogetTrackerInfo () const
 Gets whether an event object has associated tracker information.
 
SbTrackerInfogetTrackerInfo ()
 Gets whether an event object has associated tracker information.
 
- Public Member Functions inherited from SoTypedObject
SbBool isOfType (const SoType &type) const
 Returns TRUE if this object is of the type specified in type or is derived from that type.
 
template<typename TypedObjectClass >
SbBool isOfType () const
 Returns TRUE if this object is of the type of class TypedObjectClass or is derived from that class.
 

Static Public Member Functions

static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static SbBool isKeyPressEvent (const SoEvent *e, SoKeyboardEvent::Key whichKey)
 Returns whether the passed event is a keyboard press event of the passed key.
 
static SbBool isKeyReleaseEvent (const SoEvent *e, SoKeyboardEvent::Key whichKey)
 Returns whether the passed event is a keyboard release event of the passed key.
 
- Static Public Member Functions inherited from SoButtonEvent
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
- Static Public Member Functions inherited from SoEvent
static SoType getClassTypeId ()
 Returns the type id for the SoEvent class.
 
- Static Public Member Functions inherited from SoTypedObject
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 

Detailed Description

Keyboard key press and release events.

SoKeyboardEvent represents keyboard key press and release events in the Open Inventor event model.

Some convenience macros for determining if an event matches

Add an SoEventCallback node to the scene graph to handle Open Inventor events.

SEE ALSO

SoEvent, SoButtonEvent, SoLocation2Event, SoMotion3Event, SoMouseButtonEvent, SoSpaceballButtonEvent, SoHandleEventAction, SoEventCallback, SoSelection, SoInteraction, SoWinDevice

Definition at line 97 of file SoKeyboardEvent.h.

Member Enumeration Documentation

◆ Key

The keyboard keys.

Enumerator
ANY 

Special constant for any key.

LEFT_SHIFT 

Left shift.

RIGHT_SHIFT 

Right shift.

LEFT_CONTROL 

Left control.

RIGHT_CONTROL 

Right control.

LEFT_ALT 

Left alt.

RIGHT_ALT 

Right alt.

LEFT_META 

Left Windows Logo key also known as Super_L.

On Mac OSX, it is mapped to the Left Control key. On Windows, it is mapped to the Left Windows key.

RIGHT_META 

Right Windows Logo key also known as Super_R.

On Mac OSX, it is mapped to the Right Control key. On Windows, it is mapped to the Right Windows key. Using Qt, this value cannot be obtained (because Qt produces the same code for left and right keys).

NUMBER_0 

0

NUMBER_1 

1

NUMBER_2 

2

NUMBER_3 

3

NUMBER_4 

4

NUMBER_5 

5

NUMBER_6 

6

NUMBER_7 

7

NUMBER_8 

8

NUMBER_9 

9

A.

B.

C.

D.

E.

F.

G.

H.

I.

J.

K.

L.

M.

N.

O.

P.

Q.

R.

S.

T.

U.

V.

W.

X.

Y.

Z.

HOME 

Home.

LEFT_ARROW 

Left.

UP_ARROW 

Up.

RIGHT_ARROW 

Right.

DOWN_ARROW 

Down.

PAGE_UP 

Page up.

PAGE_DOWN 

Page down.

PRIOR 

Prior.

NEXT 

Next.

END 

End.

PAD_ENTER 

Pad enter.

PAD_F1 

Pad F1.

PAD_F2 

Pad F2.

PAD_F3 

Pad F3.

PAD_F4 

Pad F4.

PAD_0 

Pad 0.

PAD_1 

Pad 1.

PAD_2 

Pad 2.

PAD_3 

Pad 3.

PAD_4 

Pad 4.

PAD_5 

Pad 5.

PAD_6 

Pad 6.

PAD_7 

Pad 7.

PAD_8 

Pad 8.

PAD_9 

Pad 9.

PAD_ADD 

Pad add.

PAD_SUBTRACT 

Pad substract.

PAD_MULTIPLY 

Pad multiply.

PAD_DIVIDE 

Pad divide.

PAD_SPACE 

Pad space.

PAD_TAB 

Pad tab.

PAD_INSERT 

Pad insert.

PAD_DELETE 

Pad delete.

PAD_PERIOD 

Pad period.

F1 

F1.

F2 

F2.

F3 

F3.

F4 

F4.

F5 

F5.

F6 

F6.

F7 

F7.

F8 

F8.

F9 

F9.

F10 

F10.

F11 

F11.

F12 

F12.

BACKSPACE 

Backspace.

TAB 

Tab.

RETURN 

Return.

ENTER 

Enter.

PAUSE 

Pause.

SCROLL_LOCK 

Scroll lock.

ESCAPE 

Escape.

KEY_DELETE 

Delete.

DELETE 

SoKeyboardEvent::DELETE is deprecated Use KEY_DELETE instead of DELETE.

PRINT 

Print.

INSERT 

Insert.

NUM_LOCK 

Num lock.

CAPS_LOCK 

Caps lock.

SHIFT_LOCK 

Shift lock.

SPACE 

Space.

APOSTROPHE 

Apostrophe.

COMMA 

Comma.

MINUS 

Minus.

PERIOD 

Period.

SLASH 

Slash.

SEMICOLON 

Semicolon.

EQUAL 

Equal.

BRACKETLEFT 

Bracket left.

BACKSLASH 

Back slash.

BRACKETRIGHT 

Bracket right.

GRAVE 

Grave.

TWO_SUPERIOR 

Power of two key.

TILDE 

Tilde key.

Definition at line 104 of file SoKeyboardEvent.h.

Constructor & Destructor Documentation

◆ SoKeyboardEvent()

SoKeyboardEvent::SoKeyboardEvent ( )

Constructor.

Member Function Documentation

◆ getClassTypeId()

static SoType SoKeyboardEvent::getClassTypeId ( )
static

Returns the type identifier for this class.


◆ getKey()

SoKeyboardEvent::Key SoKeyboardEvent::getKey ( ) const

Gets which key generated the event.

◆ getPrintableCharacter()

char SoKeyboardEvent::getPrintableCharacter ( ) const

Convenience routine that returns the character representing the key, if it's printable.

If not, this returns NULL ('\0').

◆ getTypeId()

virtual SoType SoKeyboardEvent::getTypeId ( ) const
virtual

Returns the type identifier for this specific instance.

Reimplemented from SoButtonEvent.

◆ getUnicode()

wchar_t SoKeyboardEvent::getUnicode ( ) const

Return the unicode value of the pressed key, or 0 if setUnicode() wasn't call before.

◆ isKeyPressEvent()

static SbBool SoKeyboardEvent::isKeyPressEvent ( const SoEvent e,
SoKeyboardEvent::Key  whichKey 
)
static

Returns whether the passed event is a keyboard press event of the passed key.

When SoKeyboardEvent::ANY is passed, this returns TRUE if the event represents a keyboard press of any key.

◆ isKeyReleaseEvent()

static SbBool SoKeyboardEvent::isKeyReleaseEvent ( const SoEvent e,
SoKeyboardEvent::Key  whichKey 
)
static

Returns whether the passed event is a keyboard release event of the passed key.

When SoKeyboardEvent::ANY is passed, this returns TRUE if the event represents a keyboard release of any key.

◆ setKey()

void SoKeyboardEvent::setKey ( SoKeyboardEvent::Key  whichKey)

Sets which key generated the event.

◆ setUnicode()

void SoKeyboardEvent::setUnicode ( wchar_t  unicode)

Call this function to set the unicode value of the pressed key.

This unicode value must be computed with key and modifier presssed simultaneously.


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