MGL_wmPushWindowEventHandler

Adds event handler to the window.

Declaration

void MGLAPI MGL_wmPushWindowEventHandler(
window_t *wnd,
windoweventhandler_t hndFunc,
ulong mask,
int id)
typedef ibool (MGLAPIP windoweventhandler_t)(struct window_t *wnd,event_t *event)

Prototype In

mgraph.h

Parameters

wnd | window
hndFunc | handler callback function
mask | mask of events the handler will handle (for event_t.what)
id | arbitrary user-choosen ID of this handler, used only when removing the event handler from the middle of handlers stack

Description

This function adds event handler to the stack of window's event handlers. These handlers are callback functions that are called by MGL_wmProcessEvent when it is determined that the event belongs to this window and event handler.

The algorithm used to determine target window for an event is described in MGL_wmProcessEvent documentation. The event is passed to the first event handler on the stack whose mask produces non-zero result of bitwise and with event_t.what member of the event.

An event handler returns true if it processed the event (that is, the event is processed no longer) or false if it didn't (in which case the event goes to the next handler on the stack).

Note: Handlers that were added later take precedence over earlier pushed ones.

See Also

MGL_wmProcessEvent, MGL_wmPopWindowEventHandler, MGL_wmRemoveWindowEventHandler, MGL_wmPushGlobalEventHandler, MGL_wmPopGlobalEventHandler, MGL_wmRemoveGlobalEventHander, MGL_wmCaptureEvents, MGL_wmUncaptureEvents

Copyright © 2002 SciTech Software, Inc. Visit our web site at http://www.scitechsoft.com