# SoNodeKitListPart.h

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