ork::EventHandler Class Reference
[ui]

A handler of user interface events (i.e. More...

#include <EventHandler.h>

Inheritance diagram for ork::EventHandler:
ork::Object ork::Window ork::GlutWindow

List of all members.

Public Types

enum  button {
  LEFT_BUTTON = 0,
  MIDDLE_BUTTON = 1,
  RIGHT_BUTTON = 2
}
 

Mouse buttons.

More...
enum  wheel {
  WHEEL_UP,
  WHEEL_DOWN
}
 

Mouse wheel event.

More...
enum  state {
  DOWN = 0,
  UP = 1
}
 

Mouse button states.

More...
enum  modifier {
  SHIFT = 1,
  CTRL = 2,
  ALT = 4
}
 

Modifier keys Shift, Ctrl and Alt.

More...
enum  key {
  KEY_F1 = 1,
  KEY_F2 = 2,
  KEY_F3 = 3,
  KEY_F4 = 4,
  KEY_F5 = 5,
  KEY_F6 = 6,
  KEY_F7 = 7,
  KEY_F8 = 8,
  KEY_F9 = 9,
  KEY_F10 = 10,
  KEY_F11 = 11,
  KEY_F12 = 12,
  KEY_LEFT = 100,
  KEY_UP = 101,
  KEY_RIGHT = 102,
  KEY_DOWN = 103,
  KEY_PAGE_UP = 104,
  KEY_PAGE_DOWN = 105,
  KEY_HOME = 106,
  KEY_END = 107,
  KEY_INSERT = 108
}
 

Special keys.

More...

Public Member Functions

 EventHandler (const char *type)
 Creates a new event handler.
virtual ~EventHandler ()
 Deletes this event handler.
virtual void redisplay (double t, double dt)
 This method is called when a window must be redrawn.
virtual void reshape (int x, int y)
 This method is called when a window is resized.
virtual void idle (bool damaged)
 This method is called periodically when no event occur.
virtual bool mouseClick (button b, state s, modifier m, int x, int y)
 This method is called when a mouse click occurs.
virtual bool mouseWheel (wheel b, modifier m, int x, int y)
 This method is called when a mouse wheel event occurs.
virtual bool mouseMotion (int x, int y)
 This method is called periodically when the mouse is moved.
virtual bool mousePassiveMotion (int x, int y)
 This method is called periodically when the mouse is moved.
virtual bool keyTyped (unsigned char c, modifier m, int x, int y)
 This method is called when a regular key is typed.
virtual bool keyReleased (unsigned char c, modifier m, int x, int y)
 This method is called when a regular key is released.
virtual bool specialKey (key k, modifier m, int x, int y)
 This method is called when a special key is typed.
virtual bool specialKeyReleased (key k, modifier m, int x, int y)
 This method is called when a special key is released.

Detailed Description

A handler of user interface events (i.e.

window, mouse and keyboard events). By default nothing is done for any event. You must override this class to provide a user interface behavior.


Member Enumeration Documentation

Mouse buttons.

Enumerator:
LEFT_BUTTON 

left button

MIDDLE_BUTTON 

middle button

RIGHT_BUTTON 

right button

Special keys.

Enumerator:
KEY_F1 

F1.

KEY_F2 

F2.

KEY_F3 

F3.

KEY_F4 

F4.

KEY_F5 

F5.

KEY_F6 

F6.

KEY_F7 

F7.

KEY_F8 

F8.

KEY_F9 

F9.

KEY_F10 

F10.

KEY_F11 

F11.

KEY_F12 

F12.

KEY_LEFT 

left arrow

KEY_UP 

up arrow

KEY_RIGHT 

right arrow

KEY_DOWN 

down arrow

KEY_PAGE_UP 

page up

KEY_PAGE_DOWN 

page down

KEY_HOME 

home

KEY_END 

end

KEY_INSERT 

insert

Modifier keys Shift, Ctrl and Alt.

Enumerator:
SHIFT 

shift

CTRL 

ctrl

ALT 

alt

Mouse button states.

Enumerator:
DOWN 

down

UP 

up

Mouse wheel event.

Enumerator:
WHEEL_UP 

wheel up event

WHEEL_DOWN 

wheel up event


Constructor & Destructor Documentation

ork::EventHandler::EventHandler ( const char *  type  ) 

Creates a new event handler.

virtual ork::EventHandler::~EventHandler (  )  [virtual]

Deletes this event handler.


Member Function Documentation

virtual void ork::EventHandler::idle ( bool  damaged  )  [virtual]

This method is called periodically when no event occur.

Parameters:
damaged true if the window (partial) visibility has changed since the last call to this method. This occurs if the window is minized, maximized or if it is partially covered by another window.

Reimplemented in ork::GlutWindow.

virtual bool ork::EventHandler::keyReleased ( unsigned char  c,
modifier  m,
int  x,
int  y 
) [virtual]

This method is called when a regular key is released.

Parameters:
c the released character.
m the modifiers that were pressed when the key was released.
x the mouse x coordinate in pixels when the key was released.
y the mouse y coordinate in pixels when the key was released.
Returns:
true if the event has been handled by this method.
virtual bool ork::EventHandler::keyTyped ( unsigned char  c,
modifier  m,
int  x,
int  y 
) [virtual]

This method is called when a regular key is typed.

Parameters:
c the typed character.
m the modifiers that were pressed when the key was typed.
x the mouse x coordinate in pixels when the key was typed.
y the mouse y coordinate in pixels when the key was typed.
Returns:
true if the event has been handled by this method.
virtual bool ork::EventHandler::mouseClick ( button  b,
state  s,
modifier  m,
int  x,
int  y 
) [virtual]

This method is called when a mouse click occurs.

The default implementation of this method does nothing. It must be overriden to provide the desired behaviour. Note that the mouse coordinates are relative to the topleft corner of the window, with positive y towards the bottom.

Parameters:
b the button that was clicked.
s the state of this button.
m the modifiers that were pressed when the click occured.
x the mouse x coordinate in pixels when the click occured.
y the mouse y coordinate in pixels when the click occured.
Returns:
true if the event has been handled by this method.
virtual bool ork::EventHandler::mouseMotion ( int  x,
int  y 
) [virtual]

This method is called periodically when the mouse is moved.

Note that the mouse coordinates are relative to the topleft corner of the window, with positive y towards the bottom.

Parameters:
x the mouse x coordinate in pixels.
y the mouse y coordinate in pixels.
Returns:
true if the event has been handled by this method.
virtual bool ork::EventHandler::mousePassiveMotion ( int  x,
int  y 
) [virtual]

This method is called periodically when the mouse is moved.

Note that the mouse coordinates are relative to the topleft corner of the window, with positive y towards the bottom.

Parameters:
x the mouse x coordinate in pixels.
y the mouse y coordinate in pixels.
Returns:
true if the event has been handled by this method.
virtual bool ork::EventHandler::mouseWheel ( wheel  b,
modifier  m,
int  x,
int  y 
) [virtual]

This method is called when a mouse wheel event occurs.

The default implementation of this method does nothing. It must be overriden to provide the desired behaviour. Note that the mouse coordinates are relative to the topleft corner of the window, with positive y towards the bottom.

Parameters:
b the wheel event that occured (WHEEL_UP or WHEEL_DOWN)
m the modifiers that were pressed when the wheel event occured.
x the mouse x coordinate in pixels when the wheel event occured.
y the mouse y coordinate in pixels when the wheel event occured.
Returns:
true if the event has been handled by this method.
virtual void ork::EventHandler::redisplay ( double  t,
double  dt 
) [virtual]

This method is called when a window must be redrawn.

Parameters:
t the current time in micro-seconds.
dt the elapsed time in micro-seconds since the last call to redisplay.

Reimplemented in ork::GlutWindow.

virtual void ork::EventHandler::reshape ( int  x,
int  y 
) [virtual]

This method is called when a window is resized.

Parameters:
x the new window width.
y the new window height.

Reimplemented in ork::GlutWindow.

virtual bool ork::EventHandler::specialKey ( key  k,
modifier  m,
int  x,
int  y 
) [virtual]

This method is called when a special key is typed.

Parameters:
k the typed key.
m the modifiers that were pressed when the key was typed.
x the mouse x coordinate in pixels when the key was typed.
y the mouse y coordinate in pixels when the key was typed.
Returns:
true if the event has been handled by this method.
virtual bool ork::EventHandler::specialKeyReleased ( key  k,
modifier  m,
int  x,
int  y 
) [virtual]

This method is called when a special key is released.

Parameters:
k the released key.
m the modifiers that were pressed when the key was released.
x the mouse x coordinate in pixels when the key was released.
y the mouse y coordinate in pixels when the key was released.
Returns:
true if the event has been handled by this method.

Generated on Mon Oct 18 09:36:12 2010 for ork by  doxygen 1.6.1