00001 /*======================================================================= 00002 * Copyright 1991-1996, Silicon Graphics, Inc. 00003 * ALL RIGHTS RESERVED 00004 * 00005 * UNPUBLISHED -- Rights reserved under the copyright laws of the United 00006 * States. Use of a copyright notice is precautionary only and does not 00007 * imply publication or disclosure. 00008 * 00009 * U.S. GOVERNMENT RESTRICTED RIGHTS LEGEND: 00010 * Use, duplication or disclosure by the Government is subject to restrictions 00011 * as set forth in FAR 52.227.19(c)(2) or subparagraph (c)(1)(ii) of the Rights 00012 * in Technical Data and Computer Software clause at DFARS 252.227-7013 and/or 00013 * in similar or successor clauses in the FAR, or the DOD or NASA FAR 00014 * Supplement. Contractor/manufacturer is Silicon Graphics, Inc., 00015 * 2011 N. Shoreline Blvd. Mountain View, CA 94039-7311. 00016 * 00017 * THE CONTENT OF THIS WORK CONTAINS CONFIDENTIAL AND PROPRIETARY 00018 * INFORMATION OF SILICON GRAPHICS, INC. ANY DUPLICATION, MODIFICATION, 00019 * DISTRIBUTION, OR DISCLOSURE IN ANY FORM, IN WHOLE, OR IN PART, IS STRICTLY 00020 * PROHIBITED WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF SILICON 00021 * GRAPHICS, INC. 00022 **=======================================================================*/ 00023 /*======================================================================= 00024 ** Author : Paul Isaacs (MMM yyyy) 00025 **=======================================================================*/ 00026 /*======================================================================= 00027 *** THE CONTENT OF THIS WORK IS PROPRIETARY TO FEI S.A.S, (FEI S.A.S.), *** 00028 *** AND IS DISTRIBUTED UNDER A LICENSE AGREEMENT. *** 00029 *** *** 00030 *** REPRODUCTION, DISCLOSURE, OR USE, IN WHOLE OR IN PART, OTHER THAN AS *** 00031 *** SPECIFIED IN THE LICENSE ARE NOT TO BE UNDERTAKEN EXCEPT WITH PRIOR *** 00032 *** WRITTEN AUTHORIZATION OF FEI S.A.S. *** 00033 *** *** 00034 *** RESTRICTED RIGHTS LEGEND *** 00035 *** USE, DUPLICATION, OR DISCLOSURE BY THE GOVERNMENT OF THE CONTENT OF THIS *** 00036 *** WORK OR RELATED DOCUMENTATION IS SUBJECT TO RESTRICTIONS AS SET FORTH IN *** 00037 *** SUBPARAGRAPH (C)(1) OF THE COMMERCIAL COMPUTER SOFTWARE RESTRICTED RIGHT *** 00038 *** CLAUSE AT FAR 52.227-19 OR SUBPARAGRAPH (C)(1)(II) OF THE RIGHTS IN *** 00039 *** TECHNICAL DATA AND COMPUTER SOFTWARE CLAUSE AT DFARS 52.227-7013. *** 00040 *** *** 00041 *** COPYRIGHT (C) 1996-2014 BY FEI S.A.S, *** 00042 *** BORDEAUX, FRANCE *** 00043 *** ALL RIGHTS RESERVED *** 00044 **=======================================================================*/ 00045 /*======================================================================= 00046 ** Modified by : VSG (MMM YYYY) 00047 **=======================================================================*/ 00048 00049 00050 #ifndef _SO_NODE_KIT_LIST_PART_ 00051 #define _SO_NODE_KIT_LIST_PART_ 00052 00053 #include <Inventor/misc/SoChildList.h> 00054 #include <Inventor/fields/SoSFName.h> 00055 #include <Inventor/fields/SoMFName.h> 00056 #include <Inventor/fields/SoSFNode.h> 00057 #include <Inventor/nodes/SoNode.h> 00058 #include <Inventor/nodes/SoNode.h> 00059 #include <Inventor/nodekits/SoNodekitParts.h> 00060 #include <Inventor/nodekits/SoBaseKit.h> 00061 00062 class SoGroup; 00063 00064 class SoGetMatrixAction; 00065 class SoGLRenderAction; 00066 class SoGetBoundingBoxAction; 00067 class SoHandleEventAction; 00068 class SoSearchAction; 00069 class SoSearchAction; 00070 class SoCallbackAction; 00071 00073 // Class: SoNodeKitListPart 00074 // 00076 00121 class SoNodeKitListPart : public SoNode { 00122 00123 SO_NODE_HEADER(SoNodeKitListPart); 00124 00125 public: 00126 00130 SoNodeKitListPart(); 00131 00135 SoType getContainerType() const; 00139 void setContainerType( SoType newContainerType ); 00140 00145 const SoTypeList &getChildTypes() const; 00152 void addChildType( SoType typeToAdd ); 00153 00157 SbBool isTypePermitted( SoType typeToCheck ) const; 00162 SbBool isChildPermitted( const SoNode *child ) const; 00163 00169 void containerSet( const SbString& fieldDataString ); 00170 00171 00177 void lockTypes(); 00182 SbBool isTypeLocked() const { return areTypesLocked; } 00183 00190 void addChild(SoNode *child); 00197 void insertChild(SoNode *child, int childIndex); 00198 00205 SoNode *getChild(int index) const; 00212 int findChild(const SoNode *child) const; 00219 int getNumChildren() const; 00226 void removeChild(int index); 00233 void removeChild(SoNode *child) 00234 { removeChild( findChild(child)); } 00241 void replaceChild(int index, SoNode *newChild); 00248 void replaceChild( SoNode *oldChild, SoNode *newChild) 00249 { replaceChild(findChild(oldChild), newChild); } 00250 00251 // Depending on the type of the container, this may 00252 // or may not affect the state. 00253 virtual SbBool affectsState() const; 00254 00255 00256 private: 00257 00258 // These functions implement all actions for nodekits. 00259 virtual void doAction( SoAction *action ); 00260 virtual void callback( SoCallbackAction *action ); 00261 virtual void GLRender( SoGLRenderAction *action ); 00262 virtual void getBoundingBox( SoGetBoundingBoxAction *action ); 00263 virtual void getMatrix(SoGetMatrixAction *action ); 00264 virtual void handleEvent( SoHandleEventAction *action ); 00265 virtual void pick( SoPickAction *action ); 00266 virtual void search( SoSearchAction *action ); 00267 virtual void getPrimitiveCount (SoGetPrimitiveCountAction *action); 00268 00269 private: 00270 static void initClass(); 00271 static void exitClass(); 00272 00273 // Returns pointer to children 00274 virtual SoChildList *getChildren() const; 00275 00281 virtual bool affectsPath() const; 00282 00283 // Copies the contents of the given nodekit into this instance 00284 virtual void copyContents(const SoFieldContainer *fromFC, 00285 SbBool copyConnections); 00286 00287 private: 00288 00289 SoGroup *getContainerNode(); 00290 00291 // Reads in from file. Takes care of setting parts and stuff. 00292 virtual SbBool readInstance(SoInput *in, unsigned short flags); 00293 00294 SoChildList *children; 00295 00296 private: 00297 virtual ~SoNodeKitListPart(); 00298 00299 private: 00300 SoSFName containerTypeName; 00301 SoMFName childTypeNames; 00302 SoSFNode containerNode; 00303 00304 SoTypeList childTypes; 00305 00306 SbBool areTypesLocked; 00307 00308 friend class SoBaseKit; 00309 00310 }; 00311 00312 #endif /* _SO_NODE_KIT_LIST_PART_ */ 00313 00314