Open Inventor Reference
SoInteractionKit.h
Go to the documentation of this file.
1/*
2 *
3 * Copyright (C) 2000 Silicon Graphics, Inc. All Rights Reserved.
4 *
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2.1 of the License, or (at your option) any later version.
9 *
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
14 *
15 * Further, this software is distributed without any warranty that it is
16 * free of the rightful claim of any third person regarding infringement
17 * or the like. Any license provided herein, whether implied or
18 * otherwise, applies only to this software file. Patent licenses, if
19 * any, provided herein do not apply to combinations of this program with
20 * other software, or any other product whatsoever.
21 *
22 * You should have received a copy of the GNU Lesser General Public
23 * License along with this library; if not, write to the Free Software
24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 *
26 * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
27 * Mountain View, CA 94043, or:
28 *
29 * http://www.sgi.com
30 *
31 * For further information regarding this notice, see:
32 *
33 * http://oss.sgi.com/projects/GenInfo/NoticeExplan/
34 *
35 */
36
37
38/*
39 * Copyright (C) 1990,91 Silicon Graphics, Inc.
40 *
41 _______________________________________________________________________
42 ______________ S I L I C O N G R A P H I C S I N C . ____________
43 |
44 | $Revision: 1.1.1.1 $
45 |
46 | Description:
47 | This file defines the base class for all interaction nodekits.
48 |
49 | Author(s): Paul Isaacs
50 |
51 ______________ S I L I C O N G R A P H I C S I N C . ____________
52 _______________________________________________________________________
53 */
54
55#ifndef _SO_INTERACTION_KIT_
56#define _SO_INTERACTION_KIT_
57
63
64class SoPath;
65class SoPathList;
66
67
70
95
97
99
100 SO_KIT_CATALOG_ENTRY_HEADER(topSeparator);
101 SO_KIT_CATALOG_ENTRY_HEADER(geomSeparator);
102
103 public:
104
134 virtual bool setPartAsPath( const SbName &partName,
135 SoPath *surrogatePath );
136
138 virtual bool affectsState() const;
139
144 AUTO
145 };
146
148
149
152
157
162
165
167
168 SoEXTENDER public:
169
184 virtual bool setPartAsDefault(const SbName &partName,
185 SoNode *newNode, bool onlyIfAlready = TRUE );
186 virtual bool setPartAsDefault(const SbName &partName,
187 const SbName &newNodeName, bool onlyIfAlready = TRUE);
188
196 bool isPathSurrogateInMySubgraph(const SoPath *pathToCheck);
197 bool isPathSurrogateInMySubgraph(const SoPath *pathToCheck,
198 SoPath *&pathToOwner,
199 SbName &surrogateNameInOwner,
200 SoPath *&surrogatePathInOwner,
201 bool fillArgs = TRUE );
202
203 static void setSwitchValue( SoNode *n, int newVal );
204
205 SoINTERNAL public:
206 static void initClass();
207
208 protected:
211
214 virtual void copyContents(const SoFieldContainer *fromFC,
215 bool copyConnections);
216
219 virtual SoNode *getAnyPart( const SbName &partName, bool makeIfNeeded,
220 bool leafCheck = FALSE, bool publicCheck = FALSE );
221 virtual SoNodeKitPath *createPathToAnyPart(const SbName &partName,
222 bool makeIfNeeded,
223 bool leafCheck = FALSE, bool publicCheck = FALSE,
224 const SoPath *pathToExtend = NULL );
225 virtual bool setAnyPart( const SbName &partName, SoNode *from,
226 bool anyPart = TRUE );
227
231 virtual bool setAnyPartAsPath( const SbName &partName,
232 SoPath *surrogatePath,
233 bool leafCheck = FALSE,
234 bool publicCheck = FALSE );
235
238 virtual bool readInstance(SoInput *in, unsigned short flags);
239
240 static void readDefaultParts( const char *fileName,
241 const char defaultBuffer[],
242 int defBufSize );
243
246 virtual bool setAnyPartAsDefault(const SbName &partName,
247 SoNode *newNode, bool anyPart = TRUE,
248 bool onlyIfAlready = TRUE );
249 virtual bool setAnyPartAsDefault(const SbName &partName,
250 const SbName &newNodeName, bool anyPart = TRUE,
251 bool onlyIfAlready = TRUE );
252
253 bool setAnySurrogatePath( const SbName &inName, SoPath *inPath,
254 bool leafCheck = FALSE, bool publicCheck = FALSE );
255
262 virtual bool setUpConnections( bool onOff, bool doItAlways = FALSE );
263
284
295 static void fieldSensorCB( void *, SoSensor *);
297
298 void connectSeparatorFields( SoSeparator *dest, bool onOff );
299
300 private:
301
306 SoPathList *surrogatePartPathList;
307 SbPList *surrogatePartNameList;
308
309 void setMySurrogatePath( const SbName &name, SoPath *newPath );
310 int indexOfSurrogateInMyList(const SoPath *pathToCheck);
311
313 static SoGroup *readFromFile(const char *fileName);
314 static SoGroup *readFromBuffer( const char defaultBuffer[], int defBufSize);
315};
316
317#endif /* _SO_INTERACTION_KIT_ */
318
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
Definition SbBasic.h:154
#define TRUE
Definition SbBasic.h:76
#define FALSE
Definition SbBasic.h:79
#define SoINTERNAL
Definition SbBasic.h:155
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition SbSystem.h:77
#define SO_KIT_CATALOG_ENTRY_HEADER(partName)
This defines an SoSFNode field for the catalog part given.
Definition SoSubKit.h:155
#define SO_KIT_HEADER(className)
Definition SoSubKit.h:143
Character string stored in a hash table.
Definition SbString.h:264
List of generic (void *) pointers.
Definition SbPList.h:78
Base class for all node kits.
Definition SoBaseKit.h:262
Abstract base class for objects that contain fields.
Sensor class that can be attached to Inventor fields.
Base class for all group nodes.
Definition SoGroup.h:104
Used to read Inventor data files.
Definition SoInput.h:128
Base class for all interaction nodekit classes.
virtual bool setAnyPart(const SbName &partName, SoNode *from, bool anyPart=TRUE)
SoSFEnum renderCaching
Set render caching mode. Default is AUTO.
static void initClass()
initialize the class
virtual SoNode * getAnyPart(const SbName &partName, bool makeIfNeeded, bool leafCheck=FALSE, bool publicCheck=FALSE)
These are overloaded to set the surrogate path to NULL after completing their work.
static void setSwitchValue(SoNode *n, int newVal)
virtual bool setPartAsDefault(const SbName &partName, SoNode *newNode, bool onlyIfAlready=TRUE)
Sets the part, then sets the field for that part to default using partField.setDefault(TRUE).
virtual bool readInstance(SoInput *in, unsigned short flags)
Reads in from file.
virtual SoNodeKitPath * createPathToAnyPart(const SbName &partName, bool makeIfNeeded, bool leafCheck=FALSE, bool publicCheck=FALSE, const SoPath *pathToExtend=NULL)
virtual bool setAnyPartAsPath(const SbName &partName, SoPath *surrogatePath, bool leafCheck=FALSE, bool publicCheck=FALSE)
This allows you to set any part in the nodekit as a surrogate path.
virtual bool setPartAsDefault(const SbName &partName, const SbName &newNodeName, bool onlyIfAlready=TRUE)
SoFieldSensor * fieldSensor
This sensor will watch the topSeparator part.
virtual void setDefaultOnNonWritingFields()
Called by the SoBaseKit::write() method.
bool isPathSurrogateInMySubgraph(const SoPath *pathToCheck)
Is the 'inPath' valid as a surrogate path anywhere in this node's subgraph? Examines the surrogate pa...
CacheEnabled
Possible values for caching.
@ OFF
Never build or use a cache.
@ ON
Always try to build a cache.
static void readDefaultParts(const char *fileName, const char defaultBuffer[], int defBufSize)
read from buffer
bool isPathSurrogateInMySubgraph(const SoPath *pathToCheck, SoPath *&pathToOwner, SbName &surrogateNameInOwner, SoPath *&surrogatePathInOwner, bool fillArgs=TRUE)
static void fieldSensorCB(void *, SoSensor *)
void connectSeparatorFields(SoSeparator *dest, bool onOff)
SoSFEnum boundingBoxCaching
Set bounding box caching mode.
SoSFEnum renderCulling
Set render culling mode.
virtual bool affectsState() const
Override the default behavior of SoNode.
virtual void copyContents(const SoFieldContainer *fromFC, bool copyConnections)
Copies the contents of the given instance into this instance This copies the surrogatePartPathList an...
bool setAnySurrogatePath(const SbName &inName, SoPath *inPath, bool leafCheck=FALSE, bool publicCheck=FALSE)
SoSFEnum pickCulling
Set pick caching mode. Default is AUTO.
SoSeparator * oldTopSep
virtual bool setAnyPartAsDefault(const SbName &partName, const SbName &newNodeName, bool anyPart=TRUE, bool onlyIfAlready=TRUE)
virtual bool setAnyPartAsDefault(const SbName &partName, SoNode *newNode, bool anyPart=TRUE, bool onlyIfAlready=TRUE)
Protected versions of these methods that allow you to set non-leaf and/or private parts.
virtual bool setPartAsPath(const SbName &partName, SoPath *surrogatePath)
Sets any public part in the interaction kit as a "surrogate" path instead.
virtual bool setUpConnections(bool onOff, bool doItAlways=FALSE)
detach/attach any sensors, callbacks, and/or field connections.
Path that points to a list of hierarchical nodekits.
Abstract base class for all database nodes.
Definition SoNode.h:103
Maintains a list of pointers to paths.
Definition SoLists.h:212
Path that points to a list of hierarchical nodes.
Definition SoPath.h:109
Field containing an enumerated value.
Definition SoSFEnum.h:93
Abstract base class for Inventor sensors.
Definition SoSensor.h:108
Group node that saves and restores traversal state.