1SoEventCallback(3IV)() SoEventCallback(3IV)()
2
3
4
6 SoEventCallback — node which invokes callbacks for events
7
9 SoBase > SoFieldContainer > SoNode > SoEventCallback
10
12 #include <Inventor/nodes/SoEventCallback.h>
13
14 typedef void SoEventCallbackCB(void *userData, SoEventCallback
15 *node)
16
17 Methods from class SoEventCallback:
18
19 static SoType getClassTypeId()
20 SoEventCallback()
21 void setPath(SoPath *path)
22 const SoPath * getPath()
23 void addEventCallback(SoType eventType, SoEventCall‐
24 backCB *f, void *userData = NULL)
25 void removeEventCallback(SoType eventType, SoEventCall‐
26 backCB *f, void *userData = NULL)
27 SoHandleEventAction * getAction() const
28 const SoEvent * getEvent() const
29 const SoPickedPoint * getPickedPoint() const
30 void setHandled()
31 SbBool isHandled() const
32 void grabEvents()
33 void releaseEvents()
34
35 Methods from class SoNode:
36
37 void setOverride(SbBool state)
38 SbBool isOverride() const
39 SoNode * copy(SbBool copyConnections = FALSE) const
40 virtual SbBool affectsState() const
41 static SoNode * getByName(const SbName &name)
42 static int getByName(const SbName &name, SoNodeList &list)
43
44 Methods from class SoFieldContainer:
45
46 void setToDefaults()
47 SbBool hasDefaultValues() const
48 SbBool fieldsAreEqual(const SoFieldContainer *fc) const
49 void copyFieldValues(const SoFieldContainer *fc, SbBool
50 copyConnections = FALSE)
51 SbBool set(const char *fieldDataString)
52 void get(SbString &fieldDataString)
53 virtual int getFields(SoFieldList &resultList) const
54 virtual SoField * getField(const SbName &fieldName) const
55 SbBool getFieldName(const SoField *field, SbName &fieldName)
56 const
57 SbBool isNotifyEnabled() const
58 SbBool enableNotify(SbBool flag)
59
60 Methods from class SoBase:
61
62 void ref()
63 void unref() const
64 void unrefNoDelete() const
65 void touch()
66 virtual SoType getTypeId() const
67 SbBool isOfType(SoType type) const
68 virtual void setName(const SbName &name)
69 virtual SbName getName() const
70
71
73 SoEventCallback will invoke application supplied callback functions
74 during SoHandleEventAction traversal. Methods allow the application to
75 specify which Inventor events should trigger callbacks, and which path
76 must be picked, if any, for the callback invocation to occur. The
77 application callback is able to get information about the event and the
78 pick detail, and may grab events, release events, and set whether the
79 event was handled.
80
81 If you register more than one callback function in an SoEventCallback
82 node, all the callback functions will be invoked when an event occurs,
83 even if one of the callbacks handles the event. However, if the event
84 is handled by any of the callback functions, no other node in the scene
85 graph will see the event.
86
88 static SoType getClassTypeId()
89 Return the type id for the SoEventCallback class.
90
91 SoEventCallback()
92 Constructor creates an event callback node with no event interest
93 and a NULL path.
94
95 void setPath(SoPath *path)
96 const SoPath * getPath()
97 Set and get the path which must be picked in order for the callbacks
98 to be invoked. If the path is NULL, the callbacks will be invoked
99 for every interesting event, as specified by addEventCallback(),
100 regardless of what is picked. The setPath() method makes its own
101 copy of the passed path.
102
103 void addEventCallback(SoType eventType, SoEventCall‐
104 backCB *f, void *userData = NULL)
105 void removeEventCallback(SoType eventType, SoEventCall‐
106 backCB *f, void *userData = NULL)
107 Specifies the callback functions to be invoked for different event
108 types. When invoked, the callback function will be passed the user‐
109 Data, along with a pointer to this SoEventCallback node. For exam‐
110 ple, passing SoMouseButtonEvent::getClassTypeId() means callbacks
111 will be invoked only when a mouse button is pressed or released.
112 Passing SoEvent::getClassTypeId() for the eventType will cause the
113 callback to be invoked for every event which passes through this
114 event callback node.
115
116 SoHandleEventAction * getAction() const
117 Returns the SoHandleEventAction currently traversing this node, or
118 NULL if traversal is not taking place. This should be called only
119 from callback functions.
120
121 const SoEvent * getEvent() const
122 Returns the event currently being handled, or NULL if traversal is
123 not taking place. This should be called only from callback func‐
124 tions.
125
126 const SoPickedPoint * getPickedPoint() const
127 Returns pick information during SoHandleEventAction traversal, or
128 NULL if traversal is not taking place. This should be called only
129 from callback functions.
130
131 void setHandled()
132 Tells the node the event was handled. The callback function is
133 responsible for setting whether the event was handled or not. If
134 there is more than one callback function registered with an SoEvent‐
135 Callback node, all of them will be invoked, regardless of whether
136 one has handled the event or not. This should be called only from
137 callback functions.
138
139 SbBool isHandled() const
140 Returns whether the event has been handled. This should be called
141 only from callback functions.
142
143 void grabEvents()
144 void releaseEvents()
145 Tells the event callback node to grab events or release the grab.
146 While grabbing, the node will consume all events; however, each
147 callback function will only be invoked for events of interest.
148
149
151 EventCallback {
152 }
153
155 SoInteraction, SoSelection, SoHandleEventAction, SoDragger
156
157
158
159
160 SoEventCallback(3IV)()