00001 /**************************************************************************\ 00002 * 00003 * This file is part of the Coin 3D visualization library. 00004 * Copyright (C) 1998-2002 by Systems in Motion. All rights reserved. 00005 * 00006 * This library is free software; you can redistribute it and/or 00007 * modify it under the terms of the GNU Lesser General Public License 00008 * version 2.1 as published by the Free Software Foundation. See the 00009 * file LICENSE.LGPL at the root directory of the distribution for 00010 * more details. 00011 * 00012 * If you want to use Coin for applications not compatible with the 00013 * LGPL, please contact SIM to acquire a Professional Edition license. 00014 * 00015 * Systems in Motion, Prof Brochs gate 6, 7030 Trondheim, NORWAY 00016 * http://www.sim.no support@sim.no Voice: +47 22114160 Fax: +47 22207097 00017 * 00018 \**************************************************************************/ 00019 00020 #ifndef COIN_SONODEKITLISTPART_H 00021 #define COIN_SONODEKITLISTPART_H 00022 00023 #include <Inventor/nodes/SoSubNode.h> 00024 #include <Inventor/lists/SoTypeList.h> 00025 #include <Inventor/fields/SoSFNode.h> 00026 #include <Inventor/fields/SoSFName.h> 00027 #include <Inventor/fields/SoMFName.h> 00028 00029 class SoGroup; 00030 00031 00032 class COIN_DLL_API SoNodeKitListPart : public SoNode { 00033 typedef SoNode inherited; 00034 00035 SO_NODE_HEADER(SoNodeKitListPart); 00036 00037 public: 00038 static void initClass(void); 00039 SoNodeKitListPart(void); 00040 00041 SoType getContainerType(void) const; 00042 void setContainerType(SoType newContainerType); 00043 const SoTypeList & getChildTypes(void) const; 00044 void addChildType(SoType typeToAdd); 00045 SbBool isTypePermitted(SoType typeToCheck) const; 00046 SbBool isChildPermitted(const SoNode * child) const; 00047 void containerSet(const char * fieldDataString); 00048 void lockTypes(void); 00049 SbBool isTypeLocked(void) const; 00050 void addChild(SoNode * child); 00051 void insertChild(SoNode * child, int childIndex); 00052 SoNode * getChild(int index) const; 00053 int findChild(SoNode * child) const; 00054 int getNumChildren(void) const; 00055 void removeChild(int index); 00056 void removeChild(SoNode * child); 00057 void replaceChild(int index, SoNode * newChild); 00058 void replaceChild(SoNode * oldChild, SoNode * newChild); 00059 virtual SbBool affectsState(void) const; 00060 virtual void doAction(SoAction * action); 00061 virtual void callback(SoCallbackAction * action); 00062 virtual void GLRender(SoGLRenderAction * action); 00063 virtual void getBoundingBox(SoGetBoundingBoxAction * action); 00064 virtual void getMatrix(SoGetMatrixAction * action); 00065 virtual void handleEvent(SoHandleEventAction * action); 00066 virtual void pick(SoPickAction * action); 00067 virtual void search(SoSearchAction * action); 00068 virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action); 00069 virtual SoChildList * getChildren(void) const; 00070 00071 protected: 00072 virtual ~SoNodeKitListPart(); 00073 00074 SoGroup * getContainerNode(void); 00075 virtual SbBool readInstance(SoInput * in, unsigned short flags); 00076 virtual void copyContents(const SoFieldContainer * fromFC, 00077 SbBool copyConnections); 00078 SoChildList * children; 00079 00080 private: 00081 void syncInternalData(void); 00082 00083 SoSFNode containerNode; 00084 SoSFName containerTypeName; 00085 SoMFName childTypeNames; 00086 00087 SbBool typelistlocked; 00088 SoTypeList allowedtypes; 00089 00090 SbBool canCreateDefaultChild(void) const; 00091 SoNode * createAndAddDefaultChild(void); 00092 SoType getDefaultChildType(void) const; 00093 00094 friend class SoBaseKit; 00095 }; 00096 00097 #endif // !COIN_SONODEKITLISTPART_H