Open Inventor Reference
SoHandleEventAction Class Reference

Allows nodes in a graph to receive input events. More...

#include <Inventor/actions/SoHandleEventAction.h>

Inheritance diagram for SoHandleEventAction:
SoAction

Public Member Functions

 SoHandleEventAction (const SbViewportRegion &viewportRegion)
 Constructor takes viewport region to use; this is needed to perform a pick operation when requested.
 
virtual ~SoHandleEventAction ()
 Destructor.
 
void setViewportRegion (const SbViewportRegion &newRegion)
 Sets/returns current viewport region to use for action.
 
const SbViewportRegiongetViewportRegion () const
 Sets/returns current viewport region to use for action.
 
void setEvent (const SoEvent *ev)
 Sets/returns the event being handled.
 
const SoEventgetEvent () const
 Sets/returns the event being handled.
 
void setHandled ()
 Sets/returns whether any node has yet handled the event.
 
bool isHandled () const
 Sets/returns whether any node has yet handled the event.
 
void setGrabber (SoNode *node)
 Initiates grabbing of future events.
 
void releaseGrabber ()
 Releases the grab.
 
SoNodegetGrabber () const
 Returns the node that is currently grabbing events, or NULL if there is none.
 
void setPickRoot (SoNode *node)
 Sets/returns the root node used for initiating a pick action for those nodes that want to know what is under the cursor.
 
SoNodegetPickRoot () const
 Sets/returns the root node used for initiating a pick action for those nodes that want to know what is under the cursor.
 
void setPickRadius (float radiusInPixels)
 Set the radius (in pixels) around the viewport-space point through which the ray passes when doing ray picking.
 
const SoPickedPointgetPickedPoint ()
 Returns the frontmost object hit (as an SoPickedPoint) by performing a pick based on the mouse location specified in the event for which the action is being applied.
 
const SoPickedPointListgetPickedPointList ()
 Returns a list of objects intersected by a picking operation, sorted from nearest to farthest.
 
- Public Member Functions inherited from SoAction
virtual ~SoAction ()
 Destructor.
 
virtual SoType getTypeId () const =0
 Returns the type identifier for a specific instance.
 
bool isOfType (SoType type) const
 Returns TRUE if this instance is of the type specified in type or is derived from that type.
 
virtual void apply (SoNode *node)
 
virtual void apply (SoPath *path)
 
virtual void apply (const SoPathList &pathList, bool obeysRules=FALSE)
 Initiates an action on the graph defined either by a node, path, or list of paths.
 
virtual void invalidateState ()
 Invalidates the current traversal state in the action, forcing it to be recreated when the action is next applied.
 
AppliedCode getWhatAppliedTo () const
 Returns code indicating what action is being applied to.
 
SoNodegetNodeAppliedTo () const
 These returns a pointer to the node, path, or path list the action is being applied to.
 
SoPathgetPathAppliedTo () const
 
const SoPathListgetPathListAppliedTo () const
 A single path list may be split into several, one for each different head node.
 
const SoPathListgetOriginalPathListAppliedTo () const
 
bool isLastPathListAppliedTo () const
 
PathCode getPathCode (int &numIndices, const int *&indices)
 Returns path code based on where current node (the node at the end of the current path) lies with respect to the path(s) the action is being applied to.
 
void traverse (SoNode *node)
 Does traversal of a graph rooted by a node.
 
bool hasTerminated () const
 Returns TRUE if the traversal has reached a termination condition.
 
const SoPathgetCurPath ()
 Returns a pointer to the path accumulated during traversal, i.e., the chain of nodes from the root of the traversed graph to the current node being traversed.
 
SoStategetState () const
 Get the state from the action.
 
PathCode getCurPathCode () const
 These methods maintain the current path accumulated so far during traversal.
 
void pushCurPath (int childIndex)
 
void popCurPath (PathCode prevPathCode)
 
virtual SoNodegetCurPathTail ()
 This is virtual, so that SoCallbackAction can use current node.
 
void usePathCode (int &numIndices, const int *&indices)
 called by inline getPathCode:
 
void pushCurPath ()
 Optimized versions of push/pop when we know path codes won't change:
 
void popPushCurPath (int childIndex)
 
void popCurPath ()
 
const SoLightweightPathgetCurrentLightweightPath () const
 Returns the current "light" path.
 
void setCurrentLightweightPath (const SoLightweightPath &path)
 Sets the current "light" path.
 

Static Public Member Functions

static void initClass ()
 
- Static Public Member Functions inherited from SoAction
static SoType getClassTypeId ()
 Returns the type identifier for this class.
 
static void nullAction (SoAction *, SoNode *)
 Null action method that can be stored in lookup table when desired.
 
static void initClass ()
 
static void initClasses ()
 Initialize ALL Inventor action classes.
 

Protected Member Functions

virtual void beginTraversal (SoNode *node)
 Initiates action on graph.
 
- Protected Member Functions inherited from SoAction
 SoAction ()
 Constructor.
 
virtual const SoEnabledElementsListgetEnabledElements () const
 Returns the list of enabled elements for a given action subclass.
 
virtual void beginTraversal (SoNode *node)
 Begins traversal of an action at the given node.
 
void setTerminated (bool flag)
 Allows subclass instance to indicate that traversal has reached a termination condition.
 
virtual bool shouldCompactPathLists () const
 This method is used when applying an action to an SoPathList.
 

Additional Inherited Members

- Public Types inherited from SoAction
enum  AppliedCode { NODE , PATH , PATH_LIST }
 This enum is used to determine what the action is being applied to. More...
 
enum  PathCode { NO_PATH , IN_PATH , BELOW_PATH , OFF_PATH }
 This enum may be used during traversal of nodes to indicate where the node is with respect to the path being traversed. More...
 
- Protected Attributes inherited from SoAction
SoStatestate
 Traversal state.
 
SoActionMethodListtraversalMethods
 The list of what to do when.
 
- Static Protected Attributes inherited from SoAction
static SoEnabledElementsListenabledElements
 Holds list of enabled elements for the SoAction class.
 
static SoActionMethodListmethods
 ... and the methods
 

Detailed Description

This class is used to allow nodes in a scene graph to handle input events. It is usually invoked from a component derived from SoQtRenderArea when the component receives a window system event.

Manipulator, dragger and selection nodes respond to and process events. Most other group nodes just pass the event to their children, while most other nodes simply ignore the action entirely. Once a node has indicated to the action that it has handled the event, traversal stops.

A node that handles an event can also grab future events. Once it has done so, all events will be sent directly to that node, with no traversal taking place, until the node releases the grab.

See Also
SoEvent, SoPickedPoint, SoRayPickAction

Definition at line 94 of file SoHandleEventAction.h.

Constructor & Destructor Documentation

◆ SoHandleEventAction()

SoHandleEventAction::SoHandleEventAction ( const SbViewportRegion viewportRegion)

◆ ~SoHandleEventAction()

virtual SoHandleEventAction::~SoHandleEventAction ( )
virtual

Member Function Documentation

◆ beginTraversal()

virtual void SoHandleEventAction::beginTraversal ( SoNode node)
protectedvirtual

Reimplemented from SoAction.

◆ getEvent()

const SoEvent * SoHandleEventAction::getEvent ( ) const
inline

Definition at line 116 of file SoHandleEventAction.h.

◆ getGrabber()

SoNode * SoHandleEventAction::getGrabber ( ) const
inline

Definition at line 129 of file SoHandleEventAction.h.

◆ getPickedPoint()

const SoPickedPoint * SoHandleEventAction::getPickedPoint ( )

The first time this is called for a particular event, a SoRayPickAction is applied to find this object; subsequent calls for the same event return the same information. The storage for the picked point remains valid as long as the action is not re-applied or deleted.

◆ getPickedPointList()

const SoPickedPointList & SoHandleEventAction::getPickedPointList ( )

◆ getPickRoot()

SoNode * SoHandleEventAction::getPickRoot ( ) const
inline

Definition at line 136 of file SoHandleEventAction.h.

◆ getViewportRegion()

const SbViewportRegion & SoHandleEventAction::getViewportRegion ( ) const
inline

Definition at line 111 of file SoHandleEventAction.h.

◆ initClass()

static void SoHandleEventAction::initClass ( )
static

◆ isHandled()

bool SoHandleEventAction::isHandled ( ) const
inline

Definition at line 121 of file SoHandleEventAction.h.

References SoAction::hasTerminated().

◆ releaseGrabber()

void SoHandleEventAction::releaseGrabber ( )
inline

Definition at line 127 of file SoHandleEventAction.h.

◆ setEvent()

void SoHandleEventAction::setEvent ( const SoEvent ev)
inline

Definition at line 114 of file SoHandleEventAction.h.

◆ setGrabber()

void SoHandleEventAction::setGrabber ( SoNode node)

All events will be sent to the given node until the grab is released.

◆ setHandled()

void SoHandleEventAction::setHandled ( )
inline

Definition at line 119 of file SoHandleEventAction.h.

References SoAction::setTerminated(), and TRUE.

◆ setPickRadius()

void SoHandleEventAction::setPickRadius ( float  radiusInPixels)
inline

Ray picking is performed when getPickedPoint() is called. The pick radius set here is used when testing the ray against lines and points.

Definition at line 144 of file SoHandleEventAction.h.

◆ setPickRoot()

void SoHandleEventAction::setPickRoot ( SoNode node)

◆ setViewportRegion()

void SoHandleEventAction::setViewportRegion ( const SbViewportRegion newRegion)

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