| 1 |
NAME SoEventCallback "SoEvCB" "" { node which invokes callbacks for events } |
| 2 |
|
| 3 |
INCLUDE nodes/SoEventCallback.h |
| 4 |
|
| 5 |
DESC { \cSoEventCallback\. will invoke application supplied |
| 6 |
callback functions during \cSoHandleEventAction\. traversal. |
| 7 |
Methods allow the application to specify which Inventor events should |
| 8 |
trigger callbacks, and which path must be picked, if any, for the callback |
| 9 |
invocation to occur. The application callback is able to get information about |
| 10 |
the event and the pick detail, and may grab events, release events, and set |
| 11 |
whether the event was handled. |
| 12 |
\p |
| 13 |
If you register more than one callback |
| 14 |
function in an \cSoEventCallback\. node, all the callback functions |
| 15 |
will be invoked when an event occurs, even if one of the callbacks handles |
| 16 |
the event. However, if the event is handled by any of the callback functions, |
| 17 |
no other node in the scene graph will see the event. |
| 18 |
} |
| 19 |
|
| 20 |
TYPEDEF void SoEventCallbackCB "(void *userData, SoEventCallback *node)" |
| 21 |
|
| 22 |
METHOD "" static SoType getClassTypeId() { |
| 23 |
Return the type id for the \cSoEventCallback\. class. |
| 24 |
} |
| 25 |
|
| 26 |
METHOD "" SoEventCallback() { |
| 27 |
Constructor creates an event callback node with no event interest |
| 28 |
and a NULL path. |
| 29 |
} |
| 30 |
|
| 31 |
METHOD "" void setPath(SoPath *path) {} |
| 32 |
METHOD "" const SoPath * getPath() { |
| 33 |
Set and get the path which must be picked in order for the callbacks |
| 34 |
to be invoked. If the path is NULL, the callbacks will be invoked |
| 35 |
for every interesting event, as specified by |
| 36 |
\+\maddEventCallback()\.,\. |
| 37 |
\-\mSoEvCBAddEvCB()\.,\. |
| 38 |
regardless of what is picked. The |
| 39 |
\+\msetPath()\. method\.\-\mSoEvCBSetPath()\. function\. |
| 40 |
makes its own copy of the passed path. |
| 41 |
} |
| 42 |
|
| 43 |
METHOD "addEvCB" void addEventCallback(SoType eventType, |
| 44 |
SoEventCallbackCB *f, |
| 45 |
void *userData = NULL) {} |
| 46 |
METHOD "removeEvCB" void removeEventCallback(SoType eventType, |
| 47 |
SoEventCallbackCB *f, |
| 48 |
void *userData = NULL) { |
| 49 |
Specifies the callback functions to be invoked for different event types. |
| 50 |
When invoked, the callback function will be passed the \auserData\., |
| 51 |
along with a pointer to this \cSoEventCallback\. node. |
| 52 |
For example, passing |
| 53 |
\+\mSoMouseButtonEvent::getClassTypeId()\.\. |
| 54 |
\-\mSoMouseEvGetClassTypeId()\.\. |
| 55 |
means callbacks will be invoked only when a mouse button is pressed |
| 56 |
or released. |
| 57 |
Passing |
| 58 |
\+\mSoEvent::getClassTypeId()\.\.\-\mSoEvGetClassTypeId()\.\. |
| 59 |
for the \aeventType\. will cause the callback to be invoked for every event |
| 60 |
which passes through this event callback node. |
| 61 |
} |
| 62 |
|
| 63 |
METHOD "getAct" SoHandleEventAction * getAction() const { |
| 64 |
Returns the \cSoHandleEventAction\. currently traversing this node, |
| 65 |
or NULL if traversal is not taking place. This should be called |
| 66 |
only from callback functions. |
| 67 |
} |
| 68 |
|
| 69 |
METHOD "getEv" const SoEvent * getEvent() const { |
| 70 |
Returns the event currently being handled, |
| 71 |
or NULL if traversal is not taking place. This should be called |
| 72 |
only from callback functions. |
| 73 |
} |
| 74 |
|
| 75 |
METHOD "getPckPt" const SoPickedPoint * getPickedPoint() const { |
| 76 |
Returns pick information during \cSoHandleEventAction\. traversal, |
| 77 |
or NULL if traversal is not taking place. This should be called |
| 78 |
only from callback functions. |
| 79 |
} |
| 80 |
|
| 81 |
METHOD "" void setHandled() { |
| 82 |
Tells the node the event was handled. The callback function is |
| 83 |
responsible for setting whether the event was handled or not. |
| 84 |
If there is more than one callback function registered |
| 85 |
with an \cSoEventCallback\. node, all of them will be |
| 86 |
invoked, regardless of whether one has handled |
| 87 |
the event or not. |
| 88 |
This should be called only from callback functions. |
| 89 |
} |
| 90 |
|
| 91 |
METHOD "" SbBool isHandled() const { |
| 92 |
Returns whether the event has been handled. |
| 93 |
This should be called only from callback functions. |
| 94 |
} |
| 95 |
|
| 96 |
METHOD "grabEv" void grabEvents() {} |
| 97 |
METHOD "releaseEv" void releaseEvents() { |
| 98 |
Tells the event callback node to grab events or release the |
| 99 |
grab. While grabbing, the node will consume all events; |
| 100 |
however, each callback function will only be invoked for |
| 101 |
events of interest. |
| 102 |
} |
| 103 |
|
| 104 |
|
| 105 |
ALSO { SoInteraction, SoSelection, SoHandleEventAction, SoDragger } |
| 106 |
|
| 107 |
|
| 108 |
|