Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

dtk_set_event_handler(3) [debian man page]

DTK_PROCESS_EVENTS(3)						Draw Toolkit manual					     DTK_PROCESS_EVENTS(3)

NAME
dtk_process_events, dtk_set_event_handler - Events processing SYNOPSIS
#include <dtk_event.h> typedef int (*DTKEvtProc)(dtk_hwnd, int, const union dtk_event*); void dtk_set_event_handler(dtk_hwnd wnd, DTKEvtProc handler); int dtk_process_events(dtk_hwnd wnd); DESCRIPTION
dtk_set_event_handler() set handler as the current event handler for the window wnd. handler is a function that has arguments in the fol- lowing order: * a reference of type dtk_hwnd to the window that has received the event. * the type ID of the event. * a pointer to a union dtk_event holding event-specific data (if not NULL) defined as follows: union dtk_event { struct dtk_keyevent key; struct dtk_mouseevent mouse; }; dtk_process_events() processes pending events in the event queues associated to the window referenced by wnd, i.e. for each event in the queue, it calls the event handler that has been set by dtk_set_event_handler(). dtk_process_events() returns if a event handler has returned 0 or if there is no more pending event in the queue. If dtk_set_event_handler() has never been called or called with handle as NULL, it use a minimalistic event handler that returns 0 (i.e. stop the loop) when pressing the close button on the window. The type ID of the event can be one of the following: DTK_EVT_REDRAW This event indicates that the whole window or parts of it must be redrawn. This may be caused by another window has been overlapped it or the window has been resized. If such an event is received, the event pointer passed to the handler will be NULL. DTK_EVT_QUIT This event indicates that the close button of the window has been clicked. The event pointer passed will be NULL. DTK_EVT_KEYBOARD Indicates that a key of the keyboard has been pressed or released. If such an event is received, the meaningfull member of the union dtk_event will be key which is defined as follows: struct dtk_keyevent { unsigned int state; /* pressed or released */ unsigned int sym; /* Symbolic code of the key */ unsigned int mod; /* modifiers key */ }; DTK_EVT_MOUSEBUTTON This event indicates that one of the mouse buttons has been pressed or released. If such an event is received, the meaningfull mem- ber of the union dtk_event will be mouse which is defined as follows: struct dtk_mouseevent { unsigned int button; /* button identifier */ unsigned int state; /* pressed or realeased */ unsigned int x; /* x-coordinate of the mouse position */ unsigned int y; /* y-coordinate of the mouse position */ }; DTK_EVT_MOUSEMOTION This is similar to the DTK_EVT_MOUSEBUTTON but indicates that the mouse has moved. Event data should also be accessed through mouse member but its button and state members will be meaningless. RETURN VALUE
dtk_set_event_handler() does not return value. dtk_process_events() returns 1 if there is no more pending event in the queue. It returns 0 if the processing loop has been interrupted by an event handler, i.e. the last event handler has returned 0. EPFL
2010 DTK_PROCESS_EVENTS(3)

Check Out this Related Man Page

SDL::Event(3)						User Contributed Perl Documentation					     SDL::Event(3)

NAME
SDL::Event - a SDL perl extension SYNOPSIS
use SDL::Event; my $event = new SDL::Event; # create a new event $event->pump(); # pump all events from SDL Event Queue $event->poll(); # Get the top one from the queue while ($event->wait()) { my $type = $event->type(); # get event type # ... handle event exit if $type == SDL_QUIT; } DESCRIPTION
"SDL::Event" offers an object-oriented approach to SDL events. By creating an instance of SDL::Event via new() you can wait for events, and then determine the type of the event and take an appropriate action. EXAMPLE
Here is an example of a simple event handler loop routine. See also SDL::App::loop. sub loop { my ($self,$href) = @_; my $event = new SDL::Event; while ( $event->wait() ) { # ... insert here your event handling like: if ( ref($$href{$event->type()}) eq "CODE" ) { &{$$href{$event->type()}}($event); $self->sync(); } } } METHODS
new() Create a new event object. type() Returns the type of the event, see list of exported symbols for which are available. pump() poll() wait() Waits for an event end returns then. Always returns true. set( type, state ) Set the state for all events of the given event's type set_unicode( toggle ) Toggle unicode on the event. set_key_repeat( delay, interval) Sets the delay and intervall of the key repeat rate (e.g. when a user holds down a key on the keyboard). active_gain() active_state() key_state() key_sym() key_name() key_mod() key_unicode() key_scancode() motion_state() motion_x() Returns the motion of the mouse in X direction as an absolute value. motion_y() Returns the motion of the mouse in Y direction as an absolute value. motion_xrel() Returns the motion of the mouse in X direction as a relative value. motion_yrel() Returns the motion of the mouse in Y direction as a relative value. button_state() Returns the state of the mouse buttons. button_x() button_y() button() AUTHOR
David J. Goehrig Documentation by Tels <http://bloodgate.com/> SEE ALSO
perl SDL::App perl v5.12.1 2010-07-05 SDL::Event(3)
Man Page