PtAddFilterCallback()

Add a single Pt_CB_FILTER callback to a widget

Synopsis:

void PtAddFilterCallback( PtWidget_t *widget,
                          unsigned long event_mask,
                          PtCallbackF_t *callback,
                          void *data );

Library:

ph

Description:

This function adds the specified callback to the Pt_CB_FILTER callback list that belongs to widget. The widget invokes this callback whenever an event type that matches one of the bits in event_mask intersects with the widget.


Note: The widget needs to have Pt_GETS_FOCUS set in its Pt_ARG_FLAGS in order to receive key events.

The callback argument points to a function that takes this form:

int (*callback)(PtWidget_t *, void *, PtCallbackInfo_t *)

Examples:

PtWidget_t *widget;

PtRawCallback_t callbacks[] = {
    Ph_EV_PTR_MOTION_BUTTON,
    motion_button_callback,
    NULL, 
    Ph_EV_BUT_PRESS | Ph_EV_BUT_RELEASE, 
    start_end_callback,
    "some data"
}
...
//add both event handlers
PtAddFilterCallbacks( widget, callbacks, 2 );
...
//remove both event handlers
PtRemoveFilterCallbacks( widget, callbacks, 2 );
...
//add the motion button event handler
PtAddFilterCallback( widget, Ph_EV_PTR_MOTION_BUTTON, 
                     motion_button_callback, NULL );
...
//remove the motion button event handler
PtRemoveFilterCallback( widget, Ph_EV_PTR_MOTION_BUTTON, 
                        motion_button_callbacks, NULL );
...
//add both event handlers
PtAddFilterCallbacks( widget, callbacks, 2 );
...
//remove the motion button event handler
PtRemoveFilterCallback( widget, Ph_EV_PTR_MOTION_BUTTON, 
                        motion_button_callbacks, NULL );

// at this point widget still has the Ph_EV_BUT 
// Press/Release event handler 

Classification:

Photon

Safety:
Interrupt handler No
Signal handler No
Thread No

See also:

PtAddCallback(), PtAddCallbacks(), PtAddEventHandler(), PtAddEventHandlers(), PtAddFilterCallbacks(), PtAddHotkeyHandler(), PtRemoveFilterCallback(), PtRemoveFilterCallbacks()

PtRawCallback_t, Pt_CB_FILTER in the Photon Widget Reference

PtCallbackInfo_t in the Photon Widget Reference

Event handlers in the Managing Widgets in Application Code chapter of the Photon Programmer's Guide