# SoVRMLSwitch.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_SOVRMLSWITCH_H
    00025 #define COIN_SOVRMLSWITCH_H
    00026
    00027 #include <Inventor/nodes/SoSubNode.h>
    00028 #include <Inventor/nodes/SoGroup.h>
    00029 #include <Inventor/fields/SoMFNode.h>
    00030 #include <Inventor/fields/SoSFInt32.h>
    00031
    00032 // undef in case Inventor/nodes/SoSwitch.h has been included first
    00033 #undef SO_SWITCH_NONE
    00034 #undef SO_SWITCH_INHERIT
    00035 #undef SO_SWITCH_ALL
    00036
    00037 #define SO_SWITCH_NONE     (-1)
    00038 #define SO_SWITCH_INHERIT  (-2)
    00039 #define SO_SWITCH_ALL      (-3)
    00040
    00041 class SoVRMLSwitchP;
    00042
    00043 class COIN_DLL_API SoVRMLSwitch : public SoGroup
    00044 {
    00045   typedef SoGroup inherited;
    00046   SO_NODE_HEADER(SoVRMLSwitch);
    00047
    00048 public:
    00049   static void initClass(void);
    00050   SoVRMLSwitch(void);
    00051   SoVRMLSwitch( int choices);
    00052
    00053   SoMFNode choice;
    00054   SoSFInt32 whichChoice;
    00055
    00056   virtual SbBool affectsState(void) const;
    00057
    00058   void addChoice(SoNode * choice);
    00059   void insertChoice(SoNode * choice, int idx);
    00060   SoNode * getChoice(int idx) const;
    00061   int findChoice(SoNode * choice) const;
    00062   int getNumChoices(void) const;
    00063   void removeChoice(int idx);
    00064   void removeChoice(SoNode * node);
    00065   void removeAllChoices(void);
    00066   void replaceChoice(int idx, SoNode * choice);
    00067   void replaceChoice(SoNode * old, SoNode * choice);
    00068
    00069   virtual void doAction(SoAction * action);
    00070   virtual void callback(SoCallbackAction * action);
    00071   virtual void GLRender(SoGLRenderAction * action);
    00072   virtual void pick(SoPickAction * action);
    00073   virtual void getBoundingBox(SoGetBoundingBoxAction * action);
    00074   virtual void handleEvent(SoHandleEventAction * action);
    00075   virtual void getMatrix(SoGetMatrixAction * action);
    00076   virtual void search(SoSearchAction * action);
    00077   virtual void write(SoWriteAction * action);
    00078   virtual void audioRender(SoAudioRenderAction * action);
    00079
    00080   void addChild(SoNode * child);
    00081   void insertChild(SoNode * child, int idx);
    00082   SoNode * getChild(int idx) const;
    00083   int findChild(const SoNode * child) const;
    00084   int getNumChildren(void) const;
    00085   void removeChild(int idx);
    00086   void removeChild(SoNode * child);
    00087   void removeAllChildren(void);
    00088   void replaceChild(int idx, SoNode * node);
    00089   void replaceChild(SoNode * old, SoNode * node);
    00090   virtual SoChildList * getChildren(void) const;
    00091
    00092 protected:
    00093   virtual ~SoVRMLSwitch(void);
    00094
    00095   virtual void notify(SoNotList * list);
    00096   virtual SbBool readInstance(SoInput * in, unsigned short flags);
    00097   virtual void copyContents(const SoFieldContainer * from, SbBool copyConn);
    00098
    00099 private:
    00100   void commonConstructor(void);
    00101   SoVRMLSwitchP * pimpl;
    00102   friend class SoVRMLSwitchP;
    00103 }; // class SoVRMLSwitch
    00104
    00105 #endif // ! COIN_SOVRMLSWITCH_H