Coin  4.0.3
Coin3D core library
Loading...
Searching...
No Matches
SoHandleEventAction Class Reference

The SoHandleEventAction class distributes user events to the scene. More...

#include <Inventor/actions/SoHandleEventAction.h>

Inheritance diagram for SoHandleEventAction:
SoAction

Public Member Functions

 SoHandleEventAction (const SbViewportRegion &viewportregion)
 
virtual ~SoHandleEventAction (void)
 
const SoEventgetEvent (void) const
 
SoNodegetGrabber (void) const
 
const SoPickedPointgetPickedPoint (void)
 
const SoPickedPointListgetPickedPointList (void)
 
float getPickRadius (void) const
 
SoNodegetPickRoot (void) const
 
virtual SoType getTypeId (void) const
 
const SbViewportRegiongetViewportRegion (void) const
 
SbBool isHandled (void) const
 
void releaseGrabber (void)
 
void setEvent (const SoEvent *ev)
 
void setGrabber (SoNode *node)
 
void setHandled (void)
 
void setPickRadius (const float radiusinpixels)
 
void setPickRoot (SoNode *node)
 
void setViewportRegion (const SbViewportRegion &newregion)
 
- Public Member Functions inherited from SoAction
virtual ~SoAction (void)
 
virtual void apply (const SoPathList &pathlist, SbBool obeysrules=FALSE)
 
void apply (SoAction *beingApplied)
 
virtual void apply (SoNode *root)
 
virtual void apply (SoPath *path)
 
const SoPathgetCurPath (void)
 
PathCode getCurPathCode (void) const
 
virtual SoNodegetCurPathTail (void)
 
SoNodegetNodeAppliedTo (void) const
 
const SoPathListgetOriginalPathListAppliedTo (void) const
 
SoPathgetPathAppliedTo (void) const
 
PathCode getPathCode (int &numindices, const int *&indices)
 
const SoPathListgetPathListAppliedTo (void) const
 
SoStategetState (void) const
 
AppliedCode getWhatAppliedTo (void) const
 
SbBool hasTerminated (void) const
 
virtual void invalidateState (void)
 
SbBool isLastPathListAppliedTo (void) const
 
virtual SbBool isOfType (SoType type) const
 
void popCurPath (const PathCode prevpathcode)
 
void popCurPath (void)
 
void popPushCurPath (const int childindex, SoNode *node=NULL)
 
void pushCurPath (const int childindex, SoNode *node=NULL)
 
void pushCurPath (void)
 
void switchToNodeTraversal (SoNode *node)
 
void switchToPathTraversal (SoPath *path)
 
void traverse (SoNode *const node)
 
void usePathCode (int &numindices, const int *&indices)
 

Static Public Member Functions

static void addMethod (const SoType type, SoActionMethod method)
 
static void enableElement (const SoType type, const int stackindex)
 
static SoType getClassTypeId (void)
 
static void initClass (void)
 
- Static Public Member Functions inherited from SoAction
static SoType getClassTypeId (void)
 
static void initClass (void)
 
static void initClasses (void)
 
static void nullAction (SoAction *action, SoNode *node)
 

Protected Member Functions

virtual void beginTraversal (SoNode *node)
 
virtual const SoEnabledElementsListgetEnabledElements (void) const
 
- Protected Member Functions inherited from SoAction
 SoAction (void)
 
virtual void endTraversal (SoNode *node)
 
void setTerminated (const SbBool flag)
 
virtual SbBool shouldCompactPathList (void) const
 

Static Protected Member Functions

static SoActionMethodListgetClassActionMethods (void)
 
static SoEnabledElementsListgetClassEnabledElements (void)
 
- Static Protected Member Functions inherited from SoAction
static SoActionMethodListgetClassActionMethods (void)
 
static SoEnabledElementsListgetClassEnabledElements (void)
 

Additional Inherited Members

- Public Types inherited from SoAction
enum  AppliedCode { NODE = 0 , PATH = 1 , PATH_LIST = 2 }
 
enum  PathCode { NO_PATH = 0 , IN_PATH = 1 , BELOW_PATH = 2 , OFF_PATH = 3 }
 
- Protected Attributes inherited from SoAction
SoStatestate
 
SoActionMethodListtraversalMethods
 

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::SoHandleEventAction ( const SbViewportRegion & viewportregion)

Constructor.

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

◆ ~SoHandleEventAction()

SoHandleEventAction::~SoHandleEventAction ( void )
virtual

Destructor.

Member Function Documentation

◆ addMethod()

void SoHandleEventAction::addMethod ( const SoType type,
SoActionMethod method )
static

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.

◆ beginTraversal()

void SoHandleEventAction::beginTraversal ( SoNode * node)
protectedvirtual

This virtual method is called from SoAction::apply(), and is the entry point for the actual scene graph 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 scene graph traversal.

Reimplemented from SoAction.

◆ enableElement()

void SoHandleEventAction::enableElement ( const SoType type,
const int stackindex )
static

This API member is considered internal to the library, as it is not likely to be of interest to the application programmer.

◆ getClassActionMethods()

SoActionMethodList * SoHandleEventAction::getClassActionMethods ( void )
staticprotected

Returns list of action methods for this class. The enabledElements and methods variables are protected in the original OIV API. This is not such a good idea, since exposed static class member variables is a major grievance with regard to Win32 DLLs. This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

◆ getClassEnabledElements()

SoEnabledElementsList * SoHandleEventAction::getClassEnabledElements ( void )
staticprotected

Returns list of enabled elements for this class. The enabledElements and methods variables are protected in the original OIV API. This is not such a good idea, since exposed static class member variables is a major grievance with regard to Win32 DLLs. This function is an extension for Coin, and it is not available in the original SGI Open Inventor v2.1 API.

◆ getClassTypeId()

SoType SoHandleEventAction::getClassTypeId ( void )
static

This static method returns the SoType object associated with objects of this class.

◆ getEnabledElements()

const SoEnabledElementsList & SoHandleEventAction::getEnabledElements ( void ) const
protectedvirtual

Returns list of enabled elements.

Reimplemented from SoAction.

◆ getEvent()

const SoEvent * SoHandleEventAction::getEvent ( void ) const

Returns the event this action is handling.

◆ getGrabber()

SoNode * SoHandleEventAction::getGrabber ( void ) const

Returns the grabber node, or NULL if no grabber is active.

◆ getPickedPoint()

const SoPickedPoint * SoHandleEventAction::getPickedPoint ( void )

Returns the SoPickedPoint information for the intersection point below the cursor.

◆ getPickedPointList()

const SoPickedPointList & SoHandleEventAction::getPickedPointList ( void )

Returns a list of all intersection points below the mouse cursor.

◆ getPickRadius()

float SoHandleEventAction::getPickRadius ( void ) const

Gets the pick radius for cursor tracking.

◆ getPickRoot()

SoNode * SoHandleEventAction::getPickRoot ( void ) const

Returns the root node that is used by nodes that is tracking the cursor.

◆ getTypeId()

SoType SoHandleEventAction::getTypeId ( void ) const
virtual

Returns the type identification of an object derived from a class inheriting SoAction. This is used for runtime type checking and "downward" casting.

Implements SoAction.

◆ getViewportRegion()

const SbViewportRegion & SoHandleEventAction::getViewportRegion ( void ) const

Returns 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();
The SbList class is a template container class for lists.
Definition SbList.h:70
The SbViewportRegion class is a viewport within a full window.
Definition SbViewportRegion.h:40
SoState * state
Definition SoAction.h:140
The SoState class manages the Coin scene graph traversal state data.
Definition SoState.h:44
static const SbViewportRegion & get(SoState *const state)
FIXME: write doc.
Definition SoViewportRegionElement.cpp:121

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();
The SbViewVolume class is a viewing volume in 3D space.
Definition SbViewVolume.h:50
static const SbViewVolume & get(SoState *const state)
FIXME: write doc.
Definition SoViewVolumeElement.cpp:93

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().

◆ initClass()

void SoHandleEventAction::initClass ( void )
static

Initializes the runtime type system for this class, and sets up the enabled elements and action method list.

◆ isHandled()

SbBool SoHandleEventAction::isHandled ( void ) const

Returns whether or not the event has been handled by a node during scene graph traversal.

See also
setHandled()

◆ releaseGrabber()

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()

◆ setEvent()

void SoHandleEventAction::setEvent ( const SoEvent * ev)

Set the event to distribute to the nodes of the scene.

◆ setGrabber()

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 invocations are just applied directly on the grabber node, using SoHandleEventAction methods like getCurPath() will return bogus data.

◆ setHandled()

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()

◆ setPickRadius()

void SoHandleEventAction::setPickRadius ( const float radiusinpixels)

Sets the pick radius for cursor tracking.

◆ setPickRoot()

void SoHandleEventAction::setPickRoot ( SoNode * node)

Sets the root node that is used for the pick action tracking the cursor.

◆ setViewportRegion()

void SoHandleEventAction::setViewportRegion ( const SbViewportRegion & newregion)

Set a new viewport region, replacing the one passed in the constructor.


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