# SoVRMLParent.h

    00001 /**************************************************************************\
    00002  *
    00003  *  This file is part of the Coin 3D visualization library.
    00004  *  Copyright (C) 1998-2003 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 General Public License
    00008  *  ("GPL") version 2 as published by the Free Software Foundation.
    00009  *  See the file LICENSE.GPL at the root directory of this source
    00010  *  distribution for additional information about the GNU GPL.
    00011  *
    00012  *  For using Coin with software that can not be combined with the GNU
    00013  *  GPL, and for taking advantage of the additional benefits of our
    00014  *  support services, please contact Systems in Motion about acquiring
    00015  *  a Coin Professional Edition License.
    00016  *
    00017  *  See <URL:http://www.coin3d.org> for  more information.
    00018  *
    00019  *  Systems in Motion, Teknobyen, Abels Gate 5, 7030 Trondheim, NORWAY.
    00020  *  <URL:http://www.sim.no>.
    00021  *
    00022 \**************************************************************************/
    00023
    00024 #ifndef COIN_SOVRMLPARENT_H
    00025 #define COIN_SOVRMLPARENT_H
    00026
    00027 #include <Inventor/nodes/SoGroup.h>
    00028 #include <Inventor/nodes/SoSubNode.h>
    00029 #include <Inventor/fields/SoMFNode.h>
    00030
    00031 class SoVRMLParentP;
    00032 class SoSensor;
    00033
    00034 class COIN_DLL_API SoVRMLParent : public SoGroup
    00035 {
    00036   typedef SoGroup inherited;
    00037   SO_NODE_ABSTRACT_HEADER(SoVRMLParent);
    00038
    00039 public:
    00040   static void initClass(void);
    00041
    00042   SoMFNode children;
    00043
    00044   virtual SbBool affectsState(void) const;
    00045   virtual void addChild(SoNode * child);
    00046   virtual void insertChild(SoNode * child, int idx);
    00047   virtual SoNode * getChild(int idx) const;
    00048   virtual int findChild(const SoNode * child) const;
    00049   virtual int getNumChildren(void) const;
    00050   virtual void removeChild(int idx);
    00051   virtual void removeChild(SoNode * child);
    00052   virtual void removeAllChildren(void);
    00053   virtual void replaceChild(int idx, SoNode * child);
    00054   virtual void replaceChild(SoNode * old, SoNode * child);
    00055   virtual SoChildList * getChildren(void) const;
    00056
    00057   virtual void doAction(SoAction * action);
    00058   virtual void search(SoSearchAction * action);
    00059   virtual void write(SoWriteAction * action);
    00060   virtual void getPrimitiveCount(SoGetPrimitiveCountAction * action);
    00061
    00062   static void updateChildList(const SoNode * const * nodes, const int numnodes,
    00063                               SoChildList & cl);
    00064   static void updateChildList(SoNode * nodewithsfnode,
    00065                               SoChildList & cl);
    00066
    00067 protected:
    00068   SoVRMLParent(void);
    00069   SoVRMLParent(int approxchildren);
    00070   virtual ~SoVRMLParent();
    00071
    00072   SoMFNode addChildren;
    00073   SoMFNode removeChildren;
    00074
    00075   virtual void notify(SoNotList * list);
    00076   virtual SbBool readInstance(SoInput * in, unsigned short flags);
    00077   virtual void copyContents(const SoFieldContainer * from, SbBool copyConn);
    00078
    00079 private:
    00080   static void field_sensor_cb(void * data, SoSensor * sensor);
    00081   void commonConstructor(void);
    00082   void processAddChildren(void);
    00083   void processRemoveChildren(void);
    00084   SoFieldData * makeWriteData(void);
    00085
    00086   SoVRMLParentP * pimpl;
    00087 }; // class SoVRMLParent
    00088
    00089 #endif // ! COIN_SOVRMLPARENT_H