# SoInteractionKit.h

    00001 #ifndef COIN_SOINTERACTIONKIT_H
    00002 #define COIN_SOINTERACTIONKIT_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/nodekits/SoSubKit.h>
    00028 #include <Inventor/nodekits/SoBaseKit.h>
    00029 #include <Inventor/fields/SoSFEnum.h>
    00030
    00031 #ifdef COIN_INTERNAL
    00032 class SoFieldSensor;
    00033 #else // !COIN_INTERNAL
    00034 // Include this header file for better Open Inventor compatibility.
    00035 #include <Inventor/sensors/SoFieldSensor.h>
    00036 #endif // !COIN_INTERNAL
    00037
    00038 class SoSensor;
    00039 class SoSeparator;
    00040
    00041 class COIN_DLL_API SoInteractionKit : public SoBaseKit {
    00042   typedef SoBaseKit inherited;
    00043
    00044   SO_KIT_HEADER(SoInteractionKit);
    00045
    00046   SO_KIT_CATALOG_ENTRY_HEADER(geomSeparator);
    00047   SO_KIT_CATALOG_ENTRY_HEADER(topSeparator);
    00048
    00049 public:
    00050   SoSFEnum renderCaching;
    00051   SoSFEnum boundingBoxCaching;
    00052   SoSFEnum renderCulling;
    00053   SoSFEnum pickCulling;
    00054
    00055 public:
    00056   SoInteractionKit(void);
    00057   static void initClass(void);
    00058
    00059   enum CacheEnabled { OFF, ON, AUTO };
    00060
    00061   virtual SbBool setPartAsPath(const SbName &partname,
    00062                                SoPath *path);
    00063   virtual SbBool setPartAsDefault(const SbName &partname,
    00064                                   SoNode *node,
    00065                                   SbBool onlyifdefault = TRUE);
    00066   virtual SbBool setPartAsDefault(const SbName &partname,
    00067                                   const SbName &nodename,
    00068                                   SbBool onlyifdefault = TRUE);
    00069   SbBool isPathSurrogateInMySubgraph(const SoPath *path,
    00070                                      SoPath *&pathToOwner,
    00071                                      SbName  &surrogatename,
    00072                                      SoPath *&surrogatepath,
    00073                                      SbBool fillargs = TRUE);
    00074   SbBool isPathSurrogateInMySubgraph(const SoPath *path);
    00075   static void setSwitchValue(SoNode *node, const int newVal);
    00076   virtual SbBool setPart(const SbName & partname, SoNode * from);
    00077
    00078 protected:
    00079   virtual ~SoInteractionKit();
    00080   virtual void copyContents(const SoFieldContainer *fromFC,
    00081                             SbBool copyConnections);
    00082
    00083   virtual SbBool setPart(const int partNum, SoNode *node);
    00084   virtual SbBool readInstance(SoInput *in, unsigned short flags);
    00085   static void readDefaultParts(const char *fileName,
    00086                                const char defaultBuffer[],
    00087                                int defBufSize);
    00088   virtual SbBool setAnyPartAsDefault(const SbName &partname,
    00089                                      SoNode *node,
    00090                                      SbBool anypart = TRUE,
    00091                                      SbBool onlyifdefault = TRUE);
    00092   virtual SbBool setAnyPartAsDefault(const SbName &partname,
    00093                                      const SbName &nodename,
    00094                                      SbBool anypart = TRUE,
    00095                                      SbBool onlyifdefault = TRUE);
    00096   SbBool setAnySurrogatePath(const SbName &name,
    00097                              SoPath *path,
    00098                              SbBool leafcheck = FALSE,
    00099                              SbBool publiccheck = FALSE);
    00100   virtual SbBool setUpConnections(SbBool onoff, SbBool doitalways = FALSE);
    00101   virtual void setDefaultOnNonWritingFields();
    00102
    00103   SoFieldSensor *fieldSensor;
    00104   static void fieldSensorCB(void *, SoSensor *);
    00105   SoSeparator *oldTopSep;
    00106
    00107   void connectSeparatorFields( SoSeparator *dest, SbBool onOff );
    00108
    00109 private:
    00110   class SoInteractionKitP * pimpl;
    00111   friend class SoInteractionKitP;
    00112 };
    00113
    00114 #endif // !COIN_SOINTERACTIONKIT_H