Open Inventor Reference
SoNodeKitListPart.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 | Defines the SoNodeKitListPart class.
48 | It behaves sort of like a group to the outsider, but it only allows
49 | certain types of nodes to be put beneath it.
50 |
51 | It contains hidden children, and is not derived from SoGroup.
52 | The addChild(), insertChild(), etc. methods all check that the
53 | new node is allowable beneath it.
54 |
55 | The container node sits beteen the SoNodeKitListPart and the children.
56 | It's type is taken in the constructor, and must be derived from
57 | SoGroup. By making the container an SoSeparator, SoSwitch, etc.,
58 | the SoNodeKitList can be made to encase its set of children in
59 | the appropriate behavior.
60 |
61 | Author(s) : Paul Isaacs
62 |
63 ______________ S I L I C O N G R A P H I C S I N C . ____________
64 _______________________________________________________________________
65*/
66
67#ifndef _SO_NODE_KIT_LIST_PART_
68#define _SO_NODE_KIT_LIST_PART_
69
78
79class SoGroup;
80
85class SoSearchAction;
86class SoSearchAction;
88
89
92
120
122
124
125 public:
126
129
133 void setContainerType( SoType newContainerType );
134
138 const SoTypeList &getChildTypes() const;
148 void addChildType( SoType typeToAdd );
149
152 bool isTypePermitted( SoType typeToCheck ) const;
156 bool isChildPermitted( const SoNode *child ) const;
157
162 void containerSet( const char *fieldDataString );
163
170 void lockTypes();
175 bool isTypeLocked() const { return areTypesLocked; }
176
181 void addChild(SoNode *child);
186 void insertChild(SoNode *child, int childIndex);
191 SoNode *getChild(int index) const;
196 int findChild(SoNode *child) const;
201 int getNumChildren() const;
206 void removeChild(int index);
211 void removeChild(SoNode *child)
212 { removeChild( findChild(child)); }
217 void replaceChild(int index, SoNode *newChild);
222 void replaceChild( SoNode *oldChild, SoNode *newChild)
223 { replaceChild(findChild(oldChild), newChild); }
224
227 virtual bool affectsState() const;
228
229
230 SoEXTENDER public:
231
233 virtual void doAction( SoAction *action );
234 virtual void callback( SoCallbackAction *action );
235 virtual void GLRender( SoGLRenderAction *action );
236 virtual void getBoundingBox( SoGetBoundingBoxAction *action );
237 virtual void getMatrix(SoGetMatrixAction *action );
238 virtual void handleEvent( SoHandleEventAction *action );
239 virtual void pick( SoPickAction *action );
240 virtual void search( SoSearchAction *action );
241
242 SoINTERNAL public:
243 static void initClass();
244
246 virtual SoChildList *getChildren() const;
247
248 protected:
249
251
253 virtual bool readInstance(SoInput *in, unsigned short flags);
254
256
258 virtual void copyContents(const SoFieldContainer *fromFC,
259 bool copyConnections);
260
261 protected:
263
264 private:
265 SoSFName containerTypeName;
266 SoMFName childTypeNames;
267 SoSFNode containerNode;
268
269 SoTypeList childTypes;
270
271 bool areTypesLocked;
272
273 friend class SoBaseKit;
274};
275
276#endif /* _SO_NODE_KIT_LIST_PART_ */
#define SoEXTENDER
Provide inline template functions for abs, swap, min, max, and clamp.
Definition SbBasic.h:154
#define SoINTERNAL
Definition SbBasic.h:155
#define INVENTOR_API
Disable some annoying warnings on MSVC 6.
Definition SbSystem.h:77
#define SO_NODE_HEADER(className)
Non-abstract classes have everything abstract classes have, plus a way to create an instance.
Definition SoSubNode.h:170
Abstract base class for all actions.
Definition SoAction.h:179
Base class for all node kits.
Definition SoBaseKit.h:262
Performs a generic traversal of the scene graph.
This class maintains a list of child nodes for any node.
Definition SoChildList.h:83
Abstract base class for objects that contain fields.
Renders a scene graph using OpenGL.
Computes bounding box of a scene.
Computes transformation matrix for subgraph.
Base class for all group nodes.
Definition SoGroup.h:104
Allows nodes in a graph to receive input events.
Used to read Inventor data files.
Definition SoInput.h:128
Multiple-value field containing any number of names.
Definition SoMFName.h:87
Group node with restricted children.
bool isTypeLocked() const
Returns whether the permitted child types and the container type are locked (i.e.
void removeChild(SoNode *child)
These are the functions used to edit the children.
virtual bool readInstance(SoInput *in, unsigned short flags)
Reads in from file. Takes care of setting parts and stuff.
virtual void copyContents(const SoFieldContainer *fromFC, bool copyConnections)
Copies the contents of the given nodekit into this instance.
virtual void getBoundingBox(SoGetBoundingBoxAction *action)
void lockTypes()
This function permanently locks the permitted child types and the container type permanently.
int findChild(SoNode *child) const
These are the functions used to edit the children.
void addChildType(SoType typeToAdd)
Permits the node type typeToAdd as a child.
void addChild(SoNode *child)
These are the functions used to edit the children.
virtual void callback(SoCallbackAction *action)
bool isChildPermitted(const SoNode *child) const
Returns whether the node child may be added to this list.
virtual ~SoNodeKitListPart()
virtual void handleEvent(SoHandleEventAction *action)
SoGroup * getContainerNode()
void containerSet(const char *fieldDataString)
Sends a string to the set() method on the container node.
bool isTypePermitted(SoType typeToCheck) const
Returns whether a node of type typeToCheck may be added as a child.
int getNumChildren() const
These are the functions used to edit the children.
void removeChild(int index)
These are the functions used to edit the children.
void setContainerType(SoType newContainerType)
Gets and sets the type of node used as the container.
SoType getContainerType() const
Gets and sets the type of node used as the container.
virtual bool affectsState() const
Depending on the type of the container, this may or may not affect the state.
virtual SoChildList * getChildren() const
Returns pointer to children.
void replaceChild(int index, SoNode *newChild)
These are the functions used to edit the children.
const SoTypeList & getChildTypes() const
Returns the permitted child node types.
virtual void pick(SoPickAction *action)
virtual void getMatrix(SoGetMatrixAction *action)
SoNode * getChild(int index) const
These are the functions used to edit the children.
static void initClass()
virtual void doAction(SoAction *action)
These functions implement all actions for nodekits.
virtual void GLRender(SoGLRenderAction *action)
These virtual functions implement all of the actions for nodes, Most of the default implementations d...
SoNodeKitListPart()
Constructor.
void replaceChild(SoNode *oldChild, SoNode *newChild)
These are the functions used to edit the children.
void insertChild(SoNode *child, int childIndex)
These are the functions used to edit the children.
virtual void search(SoSearchAction *action)
Abstract base class for all database nodes.
Definition SoNode.h:103
Abstract base class for picking objects in a scene.
Field containg a name.
Definition SoSFName.h:84
Field containing a pointer to a node.
Definition SoSFNode.h:92
Searches for nodes in a scene graph.
Maintains a list of SoTypes.
Definition SoLists.h:295
SoType has no virtual functions to keep it small...
Definition SoType.h:103