Debian Codegraph @

doc/man/man3/ivm/interaction/SoSelection.ivm

raw
1 NAME SoSelection "SoSel" "SO_SEL_" { manages a list of selected objects }
2
3 INCLUDE nodes/SoSelection.h
4
5 DESC { \cSoSelection\. defines a node which can be inserted into a scene graph
6 and will generate and manage a selection list from picks on any node
7 in the subgraph below it. Nodes are selected based on a current
8 selection policy.
9 Callback functions report back to the application when a path has been
10 selected or deselected. The selection list can also be managed
11 programmatically.
12 \p
13 When handling events, \cSoSelection\. makes sure that the mouse release
14 event was over the same object as the mouse press event before
15 changing the list of selected objects. This allows users to mouse
16 down on an object, change their mind and move the cursor off the object,
17 then release the mouse button without altering the selection.
18 \p
19 The selection can be highlighted automatically through the \cSoXtRenderArea\.,
20 or the application can provide custom highlights. Please see the
21 chapter "Creating a Selection Highlight Style" in the
22 \eInventor Toolmaker\..
23 }
24
25 TYPEDEF void SoSelectionPathCB "(void *userData, SoPath *path)"
26 TYPEDEF void SoSelectionClassCB "(void *userData, SoSelection *sel)"
27 TYPEDEF "SoPath *" SoSelectionPickCB "(void *userData, const SoPickedPoint *pick)"
28
29 ENUM Policy {
30 SINGLE "Left mouse pick on object clears selection, then selects object.
31 Left mouse pick on nothing clears selection.
32 Only one object may be selected at a time.",
33
34
35 TOGGLE "Left mouse pick on object toggles its selection status.
36 Left mouse pick on nothing does nothing.
37 Multiple objects may be selected.",
38
39 SHIFT "When shift key is down, selection policy is TOGGLE.
40 When shift key is up, selection policy is SINGLE.
41 Multiple objects may be selected."
42 }
43
44
45 FIELD policy {
46 Selection policy that is followed in response to user interaction.
47 This can be set to \+\kSoSelection::SINGLE\., \kSoSelection::TOGGLE\., or
48 \kSoSelection::SHIFT\.\.\-\kSO_SEL_SINGLE\.,
49 \kSO_SEL_TOGGLE\., or \kSO_SEL_SHIFT\.\..
50 }
51
52 METHOD "" SoSelection() {
53 Creates a selection node with the default settings.
54 }
55
56 METHOD "" SoSelection(int nChildren) {
57 Constructor that specifies the
58 approximate number of children.
59 }
60
61 METHOD "" static SoType getClassTypeId() {
62 Return the type id for the \cSoSelection\. class.
63 }
64
65 METHOD "sel" void select(const SoPath *path) {
66 Select the passed path by adding it to the selection list.
67 The selection node must lie in the path. The path is copied and
68 truncated such that the selection node is the head of the path.
69 If the selection node does not lie in the path, the selection list
70 remains unchanged.
71 This \+method\.\-function\. ignores the current selection policy.
72 }
73
74 METHOD "selNode" void select(SoNode *node) {
75 Select the passed node by creating a path to it, and adding
76 the path to the selection list by calling
77 \+\mselect(path)\.\.\-\mSoSelSel()\.\.. If there is more than one
78 instance of \anode\. beneath the selection node, the created
79 path will be the first instance found.
80 }
81
82 METHOD "desel" void deselect(const SoPath *path) {
83 Deselect the passed path by removing it from the selection list.
84 }
85
86 METHOD "deselByInd" void deselect(int which) {
87 Deselect a path by removing it from the selection list.
88 The argument \awhich\. specifies which path in the list to be removed.
89 }
90
91 METHOD "deselNode" void deselect(SoNode *node) {
92 Deselect the passed node by creating a path to it, and removing
93 the node from the selection list by calling
94 \+\mdeselect(path)\.\.\-\mSoSelDesel()\.\.. If there is more than one
95 instance of \anode\. beneath the selection node, the created
96 path will be the first instance found.
97 }
98
99 METHOD "" void toggle(const SoPath *path) {
100 Toggle the selection status of the passed path \(em if the path is in
101 the selection list, it is removed; if not in the list, it is added.
102 }
103
104 METHOD "toggleNode" void toggle(SoNode *node) {
105 Toggle the selection status of the passed node by creating a path to it,
106 then calling \+\mtoggle(path)\.\.\-\mSoSelToggle()\.\..
107 If there is more than one
108 instance of \anode\. beneath the selection node, the created
109 path will be the first instance found.
110 }
111
112 METHOD "isSel" SbBool isSelected(const SoPath *path) const {
113 Returns \eTRUE\. if the passed path is selected, that is, if it is in
114 the selection list.
115 }
116
117 METHOD "isSelNode" SbBool isSelected(SoNode *node) const {
118 Returns \eTRUE\. if the passed node is selected by creating a path to it,
119 then calling \+\misSelected()\.\.\-\mSoSelIsSel()\.\.. If there is more than one
120 instance of \anode\. beneath the selection node, the created
121 path will be the first instance found.
122 }
123
124 METHOD "deselAll" void deselectAll() {
125 Deselect all paths in the selection list, that is, clear the list.
126 }
127
128 METHOD "getNumSel" int getNumSelected() const {
129 Return the number of paths in the selection list.
130 }
131
132 METHOD "" const SoPathList *getList() const {
133 Return the list of selected paths.
134 }
135
136 METHOD "" SoPath *getPath(int index) const {}
137 METHOD "" SoPath * operator [\|](int i) const {
138 Return the \ai\.th path in the selection list.
139 }
140
141 METHOD "addSelCB" void addSelectionCallback(SoSelectionPathCB *f, void *userData = NULL) {}
142 METHOD "removeSelCB" void removeSelectionCallback(SoSelectionPathCB *f, void *userData = NULL) {
143 The selection callbacks are invoked every time an object is selected, whether
144 it be from user interaction or from \+method\.\-function\. call.
145 The callbacks are invoked after the object has been added to the selection list.
146 }
147
148 METHOD "addDeselCB" void addDeselectionCallback(SoSelectionPathCB *f, void *userData = NULL) {}
149 METHOD "removeDeselCB" void removeDeselectionCallback(SoSelectionPathCB *f, void *userData = NULL) {
150 The deselection callbacks are invoked every time an object is deselected, whether
151 it be from user interaction or from \+method\.\-function\. call.
152 This is invoked after the object has been removed from the selection list.
153 }
154
155 METHOD "addStartCB" void addStartCallback(SoSelectionClassCB *f, void *userData = NULL) {}
156 METHOD "removeStartCB" void removeStartCallback(SoSelectionClassCB *f, void *userData = NULL) {
157 The start callbacks are invoked when the user has initiated an interactive
158 change to the selection list (by picking objects). This will be followed by
159 invocations of the
160 select and/or deselect callbacks, finally followed by each finish callback.
161 A start callback can be used, for instance, to save the current selection
162 for later restoration (e.g. undo/redo). The start callbacks are not called
163 when the selection list is changed programmatically.
164 }
165
166 METHOD "addFinishCB" void addFinishCallback(SoSelectionClassCB *f, void *userData = NULL) {}
167 METHOD "removeFinishCB" void removeFinishCallback(SoSelectionClassCB *f, void *userData = NULL) {
168 The finish callbacks are invoked when the user has finished interactively
169 changing the selection list (by picking objects).
170 This was preceded by an invocation of each start
171 callback, and invocations of the select and/or deselect callbacks.
172 The finish callbacks are not called
173 when the selection list is changed programmatically.
174 }
175
176 METHOD "setPickFilterCB" void setPickFilterCallback(
177 SoSelectionPickCB *f,
178 void *userData = NULL,
179 SbBool callOnlyIfSelectable = TRUE) {
180 The pick filter callback is invoked when a pick has occurred
181 and the selection node is about
182 to change the selection list.
183 The callback function returns the
184 path that the selection node should use when selecting and deselecting.
185 If no pick callback is registered (the default), the selection node
186 will use the path returned by
187 \+\mSoPickedPoint::getPath()\.\.\-\mSoPickPtGetPath()\.\. on the picked
188 point associated with the event being processed.
189 The returned path should not be ref'd - selection will \mref()\. and
190 \munref()\. it.
191 (See \+\mSoPath::unrefNoDelete()\.\.\-\mSoPathUnrefNoDelete()\.\..)
192 \p
193 Note that a picked object may or may not be a child of the selection
194 node. A selection node will only select paths that pass through it.
195 Possible return values from the callback:
196 \p
197 [a] NULL \(em selection behaves as if nothing was picked
198 (i.e. for SINGLE and SHIFT policies, this clears
199 the selection list). Handle event action traversal
200 halts.
201 \p
202 [b] Path \(em this path will be selected/deselected according
203 to the selection policy (it must lie under the
204 selection node). Handle event action traversal halts.
205 \p
206 [c] Path containing \eonly\. the selection node \(em apply the
207 selection policy as if nothing was picked. Handle
208 event action traversal continues.
209 \p
210 [d] Path not passing through the selection node \(em selection
211 ignores this pick event and no change is made to the
212 selection list. Handle event action traversal continues.
213 \p
214 A simple way to tell selection to ignore the pick is to return
215 an \cSoPath\. with no nodes in it. (i.e. \mreturn new SoPath;\.)
216 Selection will always ref the path returned by the callback, make a
217 copy of the path, then unref the path.
218 \p
219 The \acallOnlyIfSelectable\. argument, when set to TRUE, means the pick
220 callback function will only be invoked on picks which pass through
221 the selection node. When FALSE, all picks will be passed to the callback
222 whether they pass through the selection or not.
223 }
224
225 METHOD "" void setPickMatching(SbBool pickTwice) {}
226 METHOD "" SbBool getPickMatching() const {
227 \cSoSelection\. will pick once on mouse down
228 and once on mouse up, and make sure the picks match before changing
229 the selection list. This allows the user to pick down on an object,
230 change their mind and drag off the object, release the mouse button
231 and not affect the selection. Pass TRUE to enable this behavior.
232 Pass FALSE to disable this, meaning whatever is picked on a mouse
233 release is added to/removed from the selection list.
234 Default is pick-matching on.
235 }
236
237 ALSO { SoEventCallback, SoXtRenderArea,
238 SoBoxHighlightRenderAction, SoLineHighlightRenderAction }