SoSelection(3IV)
SoSelection (SoSel) - manages a list of selected objects
As shipped in IRIX 6.5.22. Added in IRIX 6.5.22.
NAME SoSelection (SoSel) - manages a list of selected objects INHERITS FROM SoBase > SoFieldContainer > SoNode > SoGroup > SoSeparator > SoSelection SYNOPSIS #include <Inventor_c/nodes/SoSelection.h> typedef void SoSelectionPathCB(void *userData, SoPath *path) typedef void SoSelectionClassCB(void *userData, SoSelection *sel) typedef SoPath * SoSelectionPickCB(void *userData, const SoPickedPoint *pick) typedef SoSelection SoSel enum SoSelectionPolicy { SO_SEL_SINGLE Left mouse pick on object clears selection, then selects object. Left mouse pick on nothing clears selection. Only one object may be selected at a time. SO_SEL_TOGGLE Left mouse pick on object toggles its selection status. Left mouse pick on nothing does nothing. Multiple objects may be selected. SO_SEL_SHIFT When shift key is down, selection policy is TOGGLE. When shift key is up, selection policy is SINGLE. Multiple objects may be selected. } Fields from class SoSelection: SoSFEnum policy Fields from class SoSeparator: SoSFEnum renderCaching SoSFEnum boundingBoxCaching SoSFEnum renderCulling SoSFEnum pickCulling Functions from class SoSelection: SoSelection * SoSelCreate() SoSelection * SoSelCreate(int nChildren) SoType SoSelGetClassTypeId() void SoSelSel(SoSel *this, const SoPath *path) void SoSelSelNode(SoSel *this, SoNode *node) void SoSelDesel(SoSel *this, const SoPath *path) void SoSelDeselByInd(SoSel *this, int which) void SoSelDeselNode(SoSel *this, SoNode *node) void SoSelToggle(SoSel *this, const SoPath *path) void SoSelToggleNode(SoSel *this, SoNode *node) SbBool SoSelIsSel(const SoSel *this, const SoPath *path) SbBool SoSelIsSelNode(const SoSel *this, SoNode *node) void SoSelDeselAll(SoSel *this) int SoSelGetNumSel(const SoSel *this) const SoPathList * SoSelGetList(const SoSel *this) SoPath * SoSelGetPath(const SoSel *this, int index) SoPath * SoSelUnknownOperator(const SoSel *this, int i) void SoSelAddSelCB(SoSel *this, SoSelectionPathCB *f, void *userData = NULL) void SoSelRemoveSelCB(SoSel *this, SoSelectionPathCB *f, void *userData = NULL) void SoSelAddDeselCB(SoSel *this, SoSelectionPathCB *f, void *userData = NULL) void SoSelRemoveDeselCB(SoSel *this, SoSelectionPathCB *f, void *userData = NULL) void SoSelAddStartCB(SoSel *this, SoSelectionClassCB *f, void *userData = NULL) void SoSelRemoveStartCB(SoSel *this, SoSelectionClassCB *f, void *userData = NULL) void SoSelAddFinishCB(SoSel *this, SoSelectionClassCB *f, void *userData = NULL) void SoSelRemoveFinishCB(SoSel *this, SoSelectionClassCB *f, void *userData = NULL) void SoSelSetPickFilterCB(SoSel *this, SoSelectionPickCB *f, void *userData = NULL, SbBool callOnlyIfSelectable = TRUE) void SoSelSetPickMatching(SoSel *this, SbBool pickTwice) SbBool SoSelGetPickMatching(const SoSel *this) Functions from class SoSeparator: void SoSelSetNumRenderCaches(int howMany) int SoSelGetNumRenderCaches() Functions from class SoGroup: void SoSelAddChild(SoSel *this, SoNode *child) void SoSelInsertChild(SoSel *this, SoNode *child, int newChildIndex) SoNode * SoSelGetChild(const SoSel *this, int index) int SoSelFindChild(const SoSel *this, const SoNode *child) int SoSelGetNumChildren(const SoSel *this) void SoSelRemoveChild(SoSel *this, int index) void SoSelRemoveChildNode(SoSel *this, SoNode *child) void SoSelRemoveAllChildren(SoSel *this) void SoSelReplaceChild(SoSel *this, int index, SoNode *newChild) void SoSelReplaceChildNode(SoSel *this, SoNode *oldChild, SoNode *newChild) Functions from class SoNode: void SoSelSetOverride(SoSel *this, SbBool state) SbBool SoSelIsOverride(const SoSel *this) SoNode * SoSelCopy(const SoSel *this, SbBool copyConnections = FALSE) SbBool SoSelAffectsState(const SoSel *this) SoNode * SoSelGetByName(const char *name) int SoSelGetByNameList(const char *name, SoNodeList *list) Functions from class SoFieldContainer: void SoSelSetToDflts(SoSel *this) SbBool SoSelHasDfltVals(const SoSel *this) SbBool SoSelFldsAreEq(const SoSel *this, const SoFieldContainer *fc) void SoSelCopyFieldVals(SoSel *this, const SoFieldContainer *fc, SbBool copyConnections = FALSE) SbBool SoSelSet(SoSel *this, const char *fieldDataString) void SoSelGet(SoSel *this, SbString *fieldDataString) int SoSelGetFields(const SoSel *this, SoFieldList *resultList) SoField * SoSelGetField(const SoSel *this, const char *fieldName) SbBool SoSelGetFieldName(const SoSel *this, const SoField *field, SbName *fieldName) SbBool SoSelIsNotifyEnabled(const SoSel *this) SbBool SoSelEnableNotify(SoSel *this, SbBool flag) Functions from class SoBase: void SoSelRef(SoSel *this) void SoSelUnref(const SoSel *this) void SoSelUnrefNoDelete(const SoSel *this) void SoSelTouch(SoSel *this) SoType SoSelGetTypeId(const SoSel *this) SbBool SoSelIsOfType(const SoSel *this, SoType type) void SoSelSetName(SoSel *this, const char *name) SbName SoSelGetName(const SoSel *this) DESCRIPTION SoSelection defines a node which can be inserted into a scene graph and will generate and manage a selection list from picks on any node in the subgraph below it. Nodes are selected based on a current selection policy. Callback functions report back to the application when a path has been selected or deselected. The selection list can also be managed programmatically. When handling events, SoSelection makes sure that the mouse release event was over the same object as the mouse press event before changing the list of selected objects. This allows users to mouse down on an object, change their mind and move the cursor off the object, then release the mouse button without altering the selection. The selection can be highlighted automatically through the SoXtRenderArea, or the application can provide custom highlights. Please see the chapter "Creating a Selection Highlight Style" in the Inventor Toolmaker. FIELDS SoSFEnum policy Selection policy that is followed in response to user interaction. This can be set to SO_SEL_SINGLE, SO_SEL_TOGGLE, or SO_SEL_SHIFT. FUNCTIONS SoSelection * SoSelCreate() Creates a selection node with the default settings. SoSelection * SoSelCreate(int nChildren) Constructor that specifies the approximate number of children. SoType SoSelGetClassTypeId() Return the type id for the SoSelection class. void SoSelSel(SoSel *this, const SoPath *path) Select the passed path by adding it to the selection list. The selection node must lie in the path. The path is copied and truncated such that the selection node is the head of the path. If the selection node does not lie in the path, the selection list remains unchanged. This function ignores the current selection policy. void SoSelSelNode(SoSel *this, SoNode *node) Select the passed node by creating a path to it, and adding the path to the selection list by calling SoSelSel(). If there is more than one instance of node beneath the selection node, the created path will be the first instance found. void SoSelDesel(SoSel *this, const SoPath *path) Deselect the passed path by removing it from the selection list. void SoSelDeselByInd(SoSel *this, int which) Deselect a path by removing it from the selection list. The argument which specifies which path in the list to be removed. void SoSelDeselNode(SoSel *this, SoNode *node) Deselect the passed node by creating a path to it, and removing the node from the selection list by calling SoSelDesel(). If there is more than one instance of node beneath the selection node, the created path will be the first instance found. void SoSelToggle(SoSel *this, const SoPath *path) Toggle the selection status of the passed path - if the path is in the selection list, it is removed; if not in the list, it is added. void SoSelToggleNode(SoSel *this, SoNode *node) Toggle the selection status of the passed node by creating a path to it, then calling SoSelToggle(). If there is more than one instance of node beneath the selection node, the created path will be the first instance found. SbBool SoSelIsSel(const SoSel *this, const SoPath *path) Returns TRUE if the passed path is selected, that is, if it is in the selection list. SbBool SoSelIsSelNode(const SoSel *this, SoNode *node) Returns TRUE if the passed node is selected by creating a path to it, then calling SoSelIsSel(). If there is more than one instance of node beneath the selection node, the created path will be the first instance found. void SoSelDeselAll(SoSel *this) Deselect all paths in the selection list, that is, clear the list. int SoSelGetNumSel(const SoSel *this) Return the number of paths in the selection list. const SoPathList * SoSelGetList(const SoSel *this) Return the list of selected paths. SoPath * SoSelGetPath(const SoSel *this, int index) SoPath * SoSelUnknownOperator(const SoSel *this, int i) Return the ith path in the selection list. void SoSelAddSelCB(SoSel *this, SoSelectionPathCB *f, void *userData = NULL) void SoSelRemoveSelCB(SoSel *this, SoSelectionPathCB *f, void *userData = NULL) The selection callbacks are invoked every time an object is selected, whether it be from user interaction or from function call. The callbacks are invoked after the object has been added to the selection list. void SoSelAddDeselCB(SoSel *this, SoSelectionPathCB *f, void *userData = NULL) void SoSelRemoveDeselCB(SoSel *this, SoSelectionPathCB *f, void *userData = NULL) The deselection callbacks are invoked every time an object is deselected, whether it be from user interaction or from function call. This is invoked after the object has been removed from the selection list. void SoSelAddStartCB(SoSel *this, SoSelectionClassCB *f, void *userData = NULL) void SoSelRemoveStartCB(SoSel *this, SoSelectionClassCB *f, void *userData = NULL) The start callbacks are invoked when the user has initiated an interactive change to the selection list (by picking objects). This will be followed by invocations of the select and/or deselect callbacks, finally followed by each finish callback. A start callback can be used, for instance, to save the current selection for later restoration (e.g. undo/redo). The start callbacks are not called when the selection list is changed programmatically. void SoSelAddFinishCB(SoSel *this, SoSelectionClassCB *f, void *userData = NULL) void SoSelRemoveFinishCB(SoSel *this, SoSelectionClassCB *f, void *userData = NULL) The finish callbacks are invoked when the user has finished interactively changing the selection list (by picking objects). This was preceded by an invocation of each start callback, and invocations of the select and/or deselect callbacks. The finish callbacks are not called when the selection list is changed programmatically. void SoSelSetPickFilterCB(SoSel *this, SoSelectionPickCB *f, void *userData = NULL, SbBool callOnlyIfSelectable = TRUE) The pick filter callback is invoked when a pick has occurred and the selection node is about to change the selection list. The callback function returns the path that the selection node should use when selecting and deselecting. If no pick callback is registered (the default), the selection node will use the path returned by SoPickPtGetPath() on the picked point associated with the event being processed. The returned path should not be ref'd - selection will ref() and unref() it. (See SoPathUnrefNoDelete().) Note that a picked object may or may not be a child of the selection node. A selection node will only select paths that pass through it. Possible return values from the callback: [a] NULL - selection behaves as if nothing was picked (i.e. for SINGLE and SHIFT policies, this clears the selection list). Handle event action traversal halts. [b] Path - this path will be selected/deselected according to the selection policy (it must lie under the selection node). Handle event action traversal halts. [c] Path containing only the selection node - apply the selection policy as if nothing was picked. Handle event action traversal continues. [d] Path not passing through the selection node - selection ignores this pick event and no change is made to the selection list. Handle event action traversal continues. A simple way to tell selection to ignore the pick is to return an SoPath with no nodes in it. (i.e. return new SoPath;) Selection will always ref the path returned by the callback, make a copy of the path, then unref the path. The callOnlyIfSelectable argument, when set to TRUE, means the pick callback function will only be invoked on picks which pass through the selection node. When FALSE, all picks will be passed to the callback whether they pass through the selection or not. void SoSelSetPickMatching(SoSel *this, SbBool pickTwice) SbBool SoSelGetPickMatching(const SoSel *this) SoSelection will pick once on mouse down and once on mouse up, and make sure the picks match before changing the selection list. This allows the user to pick down on an object, change their mind and drag off the object, release the mouse button and not affect the selection. Pass TRUE to enable this behavior. Pass FALSE to disable this, meaning whatever is picked on a mouse release is added to/removed from the selection list. Default is pick-matching on. FILE FORMAT/DEFAULTS Selection { renderCaching AUTO boundingBoxCaching AUTO renderCulling AUTO pickCulling AUTO policy SHIFT } SEE ALSO SoEventCallback, SoXtRenderArea, SoBoxHighlightRenderAction, SoLineHighlightRenderAction