A handler of user interface events (i.e. More...
#include <EventHandler.h>
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. |
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.
Special keys.
ork::EventHandler::EventHandler | ( | const char * | type | ) |
Creates a new event handler.
virtual ork::EventHandler::~EventHandler | ( | ) | [virtual] |
Deletes this event handler.
virtual void ork::EventHandler::idle | ( | bool | damaged | ) | [virtual] |
This method is called periodically when no event occur.
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.
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. |
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.
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. |
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.
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. |
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.
x | the mouse x coordinate in pixels. | |
y | the mouse y coordinate in pixels. |
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.
x | the mouse x coordinate in pixels. | |
y | the mouse y coordinate in pixels. |
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.
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. |
virtual void ork::EventHandler::redisplay | ( | double | t, | |
double | dt | |||
) | [virtual] |
This method is called when a window must be redrawn.
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.
x | the new window width. | |
y | the new window height. |
Reimplemented in ork::GlutWindow.
This method is called when a special key is typed.
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. |
This method is called when a special key is released.
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. |