SoHandleEventAction.3coin2

Langue: en

Version: 375463 (fedora - 01/12/10)

Section: 3 (Bibliothèques de fonctions)

Sommaire

NAME

SoHandleEventAction -

The SoHandleEventAction class distributes user events to the scene.

This is the action used by the GUI viewer classes to pass interaction events from the window system to the nodes in the scene graph.

SYNOPSIS


#include <Inventor/actions/SoHandleEventAction.h>

Inherits SoAction.

Public Member Functions


SoHandleEventAction (const SbViewportRegion &viewportregion)

virtual ~SoHandleEventAction ()

void setViewportRegion (const SbViewportRegion &newregion)

const SbViewportRegion & getViewportRegion (void) const

void setEvent (const SoEvent *ev)

const SoEvent * getEvent (void) const

void setHandled (void)

SbBool isHandled (void) const

void setGrabber (SoNode *node)

void releaseGrabber (void)

SoNode * getGrabber (void) const

void setPickRoot (SoNode *node)

SoNode * getPickRoot (void) const

void setPickRadius (const float radiusinpixels)

const SoPickedPoint * getPickedPoint (void)

const SoPickedPointList & getPickedPointList (void)

Static Public Member Functions


static void initClass (void)

Protected Member Functions


virtual void beginTraversal (SoNode *node)

Detailed Description

The SoHandleEventAction class distributes user events to the scene.

This is the action used by the GUI viewer classes to pass interaction events from the window system to the nodes in the scene graph.

SoHandleEventAction also provides the functionality for tracking the object currently under the cursor, and functionality for 'grabbing' the event focus.

See also:

SoEvent

Constructor & Destructor Documentation

SoHandleEventAction::SoHandleEventAction (const SbViewportRegion & viewportregion)Constructor.

SoHandleEventAction needs a viewportregion to pass on to the raypick action instance it uses for being able to track objects under the mouse cursor.

SoHandleEventAction::~SoHandleEventAction () [virtual]Destructor.

Member Function Documentation

void SoHandleEventAction::initClass (void) [static]Initializes the run-time type system for this class, and sets up the enabled elements and action method list.

Reimplemented from SoAction.

void SoHandleEventAction::setViewportRegion (const SbViewportRegion & newregion)Set a new viewport region, replacing the one passed in the constructor.

const SbViewportRegion & SoHandleEventAction::getViewportRegion (void) constReturns the viewport region this action instance is using.

Advanced Usage:

You can also get the viewport region by accessing it through its element on the traversal state. You do that the following way:

   #include <Inventor/elements/SoViewportRegionElement.h>
 
     SoState * state = action->getState();
     SbViewportRegion vp = SoViewportRegionElement::get(state);
 

The reason for explaining this is that you can use this generic technique when you need access to state information when you can't seem to find the accessor function you need in the action implementation. You can use it to for instance retrieve the view volume information, for which there are no accessor methods:

   #include <Inventor/elements/SoViewVolumeElement.h>
 
     SoState * state = action->getState();
     SbViewVolume vv = SoViewVolumeElement::get(state);
 

When you do this on arbitrary action instances, you need to make sure that the given element is enabled for the action before you try to use it. The relevant functions for this are SoState::isElementEnabled() and SoElement::getClassStackIndex().

void SoHandleEventAction::setEvent (const SoEvent * ev)Set the event to distribute to the nodes of the scene.

const SoEvent * SoHandleEventAction::getEvent (void) constReturns the event this action is handling.

Referenced by SoEventCallback::getEvent(), SoWWWAnchor::handleEvent(), SoSelection::handleEvent(), SoLocateHighlight::handleEvent(), SoExtSelection::handleEvent(), SoEventCallback::handleEvent(), and SoDragger::handleEvent().

void SoHandleEventAction::setHandled (void)Marks the action instance as handled, hence terminates the action.

The action is only marked as handled when a node in the graph 'grabs' the event this action is carrying, so the handled flag will be FALSE after traversal if no nodes wanted the event.

See also:

isHandled()

References SoAction::setTerminated().

Referenced by SoSelection::handleEvent(), and SoEventCallback::setHandled().

SbBool SoHandleEventAction::isHandled (void) constReturns whether or not the event has been handled by a node during scene graph traversal.

See also:

setHandled()

References SoAction::hasTerminated().

Referenced by beginTraversal(), SoSelection::handleEvent(), SoExtSelection::handleEvent(), SoDragger::handleEvent(), and SoEventCallback::isHandled().

void SoHandleEventAction::setGrabber (SoNode * node)Set a node pointer which will get all future events handled by this action until releaseGrabber() is called.

Note that since later SoHandleEventAction invokations are just applied directly on the grabber node, using SoHandleEventAction methods like getCurPath() will return bogus data.

References SoNode::grabEventsSetup(), and releaseGrabber().

Referenced by SoEventCallback::grabEvents().

void SoHandleEventAction::releaseGrabber (void)Don't send the events to a 'grabber' node anymore, use the default behavior of the action and pass them along to the scene graph again.

See also:

setGrabber()

References SoNode::grabEventsCleanup().

Referenced by SoEventCallback::releaseEvents(), and setGrabber().

SoNode * SoHandleEventAction::getGrabber (void) constReturns the grabber node, or NULL if no grabber is active.

Referenced by SoDragger::handleEvent().

void SoHandleEventAction::setPickRoot (SoNode * node)Sets the root node that is used for the pick action tracking the cursor.

Referenced by beginTraversal().

SoNode * SoHandleEventAction::getPickRoot (void) constReturns the root node that is used by nodes that is tracking the cursor.

void SoHandleEventAction::setPickRadius (const float radiusinpixels)Sets the pick radius for cursor tracking.

const SoPickedPoint * SoHandleEventAction::getPickedPoint (void)Returns the SoPickedPoint information for the intersection point below the cursor.

References SoRayPickAction::getPickedPoint(), and SoRayPickAction::setPickAll().

Referenced by SoEventCallback::getPickedPoint(), SoWWWAnchor::handleEvent(), SoSelection::handleEvent(), SoLocateHighlight::handleEvent(), SoEventCallback::handleEvent(), and SoDragger::handleEvent().

const SoPickedPointList & SoHandleEventAction::getPickedPointList (void)Returns a list of all intersection points below the mouse cursor.

References SoRayPickAction::getPickedPointList(), and SoRayPickAction::setPickAll().

void SoHandleEventAction::beginTraversal (SoNode * node) [protected, virtual]This virtual method is called from SoAction::apply(), and is the entry point for the actual scenegraph traversal.

It can be overridden to initialize the action at traversal start, for specific initializations in the action subclasses inheriting SoAction.

Default method just calls traverse(), which any overridden implementation of the method must do too (or call SoAction::beginTraversal()) to trigger the scenegraph traversal.

Reimplemented from SoAction.

References SoAction::getState(), isHandled(), SoState::pop(), SoState::push(), setPickRoot(), and SoAction::traverse().

Author

Generated automatically by Doxygen for Coin from the source code.