SoHandleEventAction(3)
β¨ NAME β¨
SoHandleEventAction β ok so this is the class that distributes user events to the scene. That's the whole job. It's the middleman between your mouse/keyboard going feral and your scene graph actually caring. π
(also hi, you're reading SoHandleEventAction(3) from the Library Functions Manual β section 3, library functions, we love her π)
π SYNOPSIS π
#include <Inventor/actions/SoHandleEventAction.h>
Inherits SoAction. Yeah bestie it's nepo-baby-coded, but that's how you get all the traversal machinery for free. π
π«Ά Public Member Functions
virtual SoType getTypeId (void) const
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)
π§ Public Member Functions inherited from SoAction
virtual ~SoAction ()
virtual SbBool isOfType (SoType type) const
virtual void apply (SoNode *root)
virtual void apply (SoPath *path)
virtual void apply (const SoPathList &pathlist, SbBool obeysrules=0)
void apply (SoAction *beingApplied)
virtual void invalidateState (void)
AppliedCode getWhatAppliedTo (void) const
SoNode * getNodeAppliedTo (void) const
SoPath * getPathAppliedTo (void) const
const SoPathList * getPathListAppliedTo (void) const
const SoPathList * getOriginalPathListAppliedTo (void) const
SbBool isLastPathListAppliedTo (void) const
PathCode getPathCode (int &numindices, const int *&indices)
void traverse (SoNode *const node)
SbBool hasTerminated (void) const
const SoPath * getCurPath (void)
SoState * getState (void) const
PathCode getCurPathCode (void) const
virtual SoNode * getCurPathTail (void)
void usePathCode (int &numindices, const int *&indices)
void pushCurPath (const int childindex, SoNode *node=NULL)
void popCurPath (const PathCode prevpathcode)
void pushCurPath (void)
void popPushCurPath (const int childindex, SoNode *node=NULL)
void popCurPath (void)
void switchToPathTraversal (SoPath *path)
void switchToNodeTraversal (SoNode *node)
π Static Public Member Functions
static SoType getClassTypeId (void)
static void addMethod (const SoType type, SoActionMethod method)
static void enableElement (const SoType type, const int stackindex)
static void initClass (void)
π Static Public Member Functions inherited from SoAction
static void initClass (void)
static void initClasses (void)
static SoType getClassTypeId (void)
static void nullAction (SoAction *action, SoNode *node)
π Protected Member Functions
virtual const SoEnabledElementsList & getEnabledElements (void) const
virtual void beginTraversal (SoNode *node)
π¦ 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 SoEnabledElementsList * getClassEnabledElements (void)
static SoActionMethodList * getClassActionMethods (void)
π« Static Protected Member Functions inherited from SoAction
static SoEnabledElementsList * getClassEnabledElements (void)
static SoActionMethodList * getClassActionMethods (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
SoState * state
SoActionMethodList * traversalMethods
π¦ Detailed Description π¦
The SoHandleEventAction class distributes user events to the scene. Yes, again. It's the same sentence. It's the sentence. Periodt. π
This is the action the GUI viewer classes use to pass interaction events from the window system over to the nodes in the scene graph. So like β your window manager says "bestie, the mouse moved" and this action carries that news straight to the nodes. πΈ
On top of all that, SoHandleEventAction also handles tracking whatever object is currently chilling under the cursor, plus it gives you the functionality for "grabbing" the event focus. So if one node wants to be the main character and keep every event for itself? That's the grabber. π
See also SoEvent
π Constructor & Destructor Documentation π
π SoHandleEventAction::SoHandleEventAction (const SbViewportRegion & viewportregion)
Constructor. It exists. She's born. π£
SoHandleEventAction needs a viewportregion to pass on to the raypick action instance it uses, so it can actually track the objects under the mouse cursor. No viewport, no cursor tracking, no vibes. π
References SoHandleEventAction().
Referenced by addMethod(), and SoHandleEventAction().
π¦ SoHandleEventAction::~SoHandleEventAction () [virtual]
Destructor. She's leaving, but make it graceful. π
β¨ Member Function Documentation β¨
okay bestie, this is the part where we actually meet the functions π like the whole page has been leading up to this. every single one is here, no skipping, no cap.
SoType SoHandleEventAction::getTypeId (void ) const [virtual] π¦
Returns the type identification of an action derived from a class inheriting SoAction. This is used for run-time type checking and "downward" casting.
Usage example:
void bar(SoAction * action)
{
if (action->getTypeId() == SoGLRenderAction::getClassTypeId()) {
// safe downward cast, know the type
SoGLRenderAction * glrender = (SoGLRenderAction *)action;
}
return; // ignore if not renderaction
}
For application programmers wanting to extend the library with new actions: this method needs to be overridden in all subclasses. This is typically done as part of setting up the full type system for extension classes, which is usually accomplished by using the pre-defined macros available through Inventor/nodes/SoSubAction.h: SO_ACTION_SOURCE, SO_ACTION_INIT_CLASS and SO_ACTION_CONSTRUCTOR.
For more information on writing Coin extensions, see the SoAction class documentation.
Returns the actual type id of an object derived from a class inheriting SoAction. Needs to be overridden in all subclasses.
Implements SoAction.
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.
References SoAction::SoAction(), and SoHandleEventAction().
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.
const SoEnabledElementsList & SoHandleEventAction::getEnabledElements (void ) const [protected], [virtual] π
Returns a list of the elements used by action instances of this class upon traversal operations.
Reimplemented from SoAction.
void SoHandleEventAction::setViewportRegion (const SbViewportRegion & newregion) πΈ
Set a new viewport region, replacing the one passed in the constructor.
Referenced by SoSceneManager::setHandleEventAction().
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();
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 ) const π
Returns the event this action is handling.
Referenced by SoDragger::handleEvent(), SoExtSelection::handleEvent(), SoLocateHighlight::handleEvent(), SoSelection::handleEvent(), SoVRMLAnchor::handleEvent(), SoVRMLDragSensor::handleEvent(), SoVRMLTouchSensor::handleEvent(), and SoWWWAnchor::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().
SbBool SoHandleEventAction::isHandled (void ) const π₯
Returns whether or not the event has been handled by a node during scene graph traversal.
See also setHandled()
References SoAction::hasTerminated().
Referenced by beginTraversal(), SoDragger::handleEvent(), SoExtSelection::handleEvent(), and SoSelection::handleEvent().
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 laterSoHandleEventActioninvokations are just applied directly on the grabber node, usingSoHandleEventActionmethods likegetCurPath()will return bogus data. π not the bogus data
References SoNode::grabEventsSetup(), and 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()
References SoNode::grabEventsCleanup().
Referenced by setGrabber().
SoNode * SoHandleEventAction::getGrabber (void ) const β
Returns 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.
References SoBase::ref(), and SoBase::unref().
Referenced by beginTraversal().
SoNode * SoHandleEventAction::getPickRoot (void ) const π
Returns 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 SoDragger::handleEvent(), SoEventCallback::handleEvent(), SoLocateHighlight::handleEvent(), SoSelection::handleEvent(), SoVRMLDragSensor::handleEvent(), SoVRMLTouchSensor::handleEvent(), and SoWWWAnchor::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.
and that's the whole page bestie π this was Coin Version 2.5.0, page SoHandleEventAction(3) β go forth and handle those events, you absolute icon ππ
π¦ where this page comes from
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 43: Coin2-devel 2.5.0-52.fc43 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- fedora 44: Coin2-devel 2.5.0-54.fc44 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms