Open Inventor Reference
SoEventCallback Class Reference

Node which invokes callbacks for events. More...

#include <Inventor/nodes/SoEventCallback.h>

Inheritance diagram for SoEventCallback:
SoNode SoFieldContainer SoBase

List of all members.

Public Member Functions

 SoEventCallback ()
 Constructor creates an event callback node with no event interest and a NULL path.
void setPath (SoPath *path)
const SoPathgetPath ()
 Set and get the path which must be picked in order for the callbacks to be invoked.
void addEventCallback (SoType eventType, SoEventCallbackCB *f, void *userData=NULL)
 Specifies the callback functions to be invoked for different event types.
void removeEventCallback (SoType eventType, SoEventCallbackCB *f, void *userData=NULL)
 Removes the given callback function.
SoHandleEventActiongetAction () const
 Returns the SoHandleEventAction currently traversing this node, or NULL if traversal is not taking place.
const SoEventgetEvent () const
 Returns the event currently being handled, or NULL if traversal is not taking place.
const SoPickedPointgetPickedPoint () const
 Returns pick information during SoHandleEventAction traversal, or NULL if traversal is not taking place.
void setHandled ()
 Tells the node the event was handled.
SbBool isHandled () const
 Returns whether the event has been handled.
void grabEvents ()
 Tells the event callback node to grab events or release the grab.
void releaseEvents ()
 Release the grabbing of events.

Static Public Member Functions

static void initClass ()
 initialize the class

Protected Member Functions

virtual ~SoEventCallback ()
 Destructor - protected since ref/unref is what should destroy this.
virtual void handleEvent (SoHandleEventAction *ha)
 This will be called during handleEventAction traversal.

Detailed Description

SoEventCallback will invoke application supplied callback functions during SoHandleEventAction traversal. Methods allow the application to specify which Inventor events should trigger callbacks, and which path must be picked, if any, for the callback invocation to occur. The application callback is able to get information about the event and the pick detail, and may grab events, release events, and set whether the event was handled.

If you register more than one callback function in an SoEventCallback node, all the callback functions will be invoked when an event occurs, even if one of the callbacks handles the event. However, if the event is handled by any of the callback functions, no other node in the scene graph will see the event.

See Also
SoInteraction, SoSelection, SoHandleEventAction, SoDragger

Definition at line 97 of file SoEventCallback.h.


Constructor & Destructor Documentation

SoEventCallback::SoEventCallback ( )
virtual SoEventCallback::~SoEventCallback ( ) [protected, virtual]

Member Function Documentation

void SoEventCallback::addEventCallback ( SoType  eventType,
SoEventCallbackCB f,
void *  userData = NULL 
)

When invoked, the callback function will be passed the userData, along with a pointer to this SoEventCallback node. For example, passing SoMouseButtonEvent::getClassTypeId() means callbacks will be invoked only when a mouse button is pressed or released. Passing SoEvent::getClassTypeId() for the eventType will cause the callback to be invoked for every event which passes through this event callback node.

SoHandleEventAction* SoEventCallback::getAction ( ) const [inline]

This should be called only from callback functions.

Definition at line 146 of file SoEventCallback.h.

const SoEvent* SoEventCallback::getEvent ( ) const [inline]

This should be called only from callback functions.

Definition at line 151 of file SoEventCallback.h.

const SoPath* SoEventCallback::getPath ( ) [inline]

If the path is NULL, the callbacks will be invoked for every interesting event, as specified by addEventCallback(), regardless of what is picked. The setPath() method makes its own copy of the passed path.

Definition at line 116 of file SoEventCallback.h.

const SoPickedPoint* SoEventCallback::getPickedPoint ( ) const [inline]

This should be called only from callback functions.

Definition at line 157 of file SoEventCallback.h.

void SoEventCallback::grabEvents ( ) [inline]

While grabbing, the node will consume all events; however, each callback function will only be invoked for events of interest.

Definition at line 181 of file SoEventCallback.h.

virtual void SoEventCallback::handleEvent ( SoHandleEventAction ha) [protected, virtual]

Reimplemented from SoNode.

static void SoEventCallback::initClass ( ) [static]

Reimplemented from SoNode.

SbBool SoEventCallback::isHandled ( ) const [inline]

This should be called only from callback functions.

Definition at line 174 of file SoEventCallback.h.

References FALSE.

void SoEventCallback::releaseEvents ( ) [inline]
See also:
grabEvents

Definition at line 186 of file SoEventCallback.h.

void SoEventCallback::removeEventCallback ( SoType  eventType,
SoEventCallbackCB f,
void *  userData = NULL 
)
void SoEventCallback::setHandled ( ) [inline]

The callback function is responsible for setting whether the event was handled or not. If there is more than one callback function registered with an SoEventCallback node, all of them will be invoked, regardless of whether one has handled the event or not. This should be called only from callback functions.

Definition at line 169 of file SoEventCallback.h.

void SoEventCallback::setPath ( SoPath path)
See also:
getPath()

The documentation for this class was generated from the following file: