SoFCUnifiedSelection.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (c) 2005 Jürgen Riegel <juergen.riegel@web.de>              *
00003  *                                                                         *
00004  *   This file is part of the FreeCAD CAx development system.              *
00005  *                                                                         *
00006  *   This library is free software; you can redistribute it and/or         *
00007  *   modify it under the terms of the GNU Library General Public           *
00008  *   License as published by the Free Software Foundation; either          *
00009  *   version 2 of the License, or (at your option) any later version.      *
00010  *                                                                         *
00011  *   This library  is distributed in the hope that it will be useful,      *
00012  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00013  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00014  *   GNU Library General Public License for more details.                  *
00015  *                                                                         *
00016  *   You should have received a copy of the GNU Library General Public     *
00017  *   License along with this library; see the file COPYING.LIB. If not,    *
00018  *   write to the Free Software Foundation, Inc., 59 Temple Place,         *
00019  *   Suite 330, Boston, MA  02111-1307, USA                                *
00020  *                                                                         *
00021  ***************************************************************************/
00022 
00023 #ifndef GUI_SOFCUNIFIEDSELECTION_H
00024 #define GUI_SOFCUNIFIEDSELECTION_H
00025 
00026 # ifdef FC_OS_MACOSX
00027 # include <OpenGL/gl.h>
00028 # else
00029 # ifdef FC_OS_WIN32
00030 #  include <windows.h>
00031 # endif
00032 # include <GL/gl.h>
00033 # endif
00034 
00035 #include <Inventor/nodes/SoSubNode.h>
00036 #include <Inventor/nodes/SoSeparator.h>
00037 #include <Inventor/fields/SoSFBool.h>
00038 #include <Inventor/fields/SoSFColor.h>
00039 #include <Inventor/fields/SoSFEnum.h>
00040 #include <Inventor/fields/SoSFString.h>
00041 #include <Inventor/nodes/SoLightModel.h>
00042 #include "View3DInventorViewer.h"
00043 
00044 class SoFullPath;
00045 class SoPickedPoint;
00046 
00047 
00048 namespace Gui {
00049 
00050 
00058 class GuiExport SoFCUnifiedSelection : public SoSeparator {
00059     typedef SoSeparator inherited;
00060 
00061     SO_NODE_HEADER(Gui::SoFCUnifiedSelection);
00062 
00063 public:
00064     static void initClass(void);
00065     static void finish(void);
00066     SoFCUnifiedSelection(void);
00067     void applySettings();
00068 
00069     enum HighlightModes {
00070         AUTO, ON, OFF
00071     };
00072 
00073     const char* getFileFormatName(void) const;
00074 
00075     SoSFColor colorHighlight;
00076     SoSFColor colorSelection;
00077     SoSFEnum highlightMode;
00078     SoSFEnum selectionMode;
00079     SoSFBool selectionRole;
00080 
00081     virtual void doAction(SoAction *action);
00082     //virtual void GLRender(SoGLRenderAction * action);
00083 
00084     virtual void handleEvent(SoHandleEventAction * action);
00085     //virtual void GLRenderBelowPath(SoGLRenderAction * action);
00086     //virtual void GLRenderInPath(SoGLRenderAction * action);
00087     //static  void turnOffCurrentHighlight(SoGLRenderAction * action);
00088 
00089     friend class View3DInventorViewer;
00090 protected:
00091     virtual ~SoFCUnifiedSelection();
00092     //virtual void redrawHighlighted(SoAction * act, SbBool flag);
00093     //virtual SbBool readInstance(SoInput *  in, unsigned short  flags); 
00094 
00095     View3DInventorViewer *viewer;
00096 private:
00097     //static void turnoffcurrent(SoAction * action);
00098     //void setOverride(SoGLRenderAction * action);
00099     //SbBool isHighlighted(SoAction *action);
00100     //SbBool preRender(SoGLRenderAction *act, GLint &oldDepthFunc);
00101     static int getPriority(const SoPickedPoint* p);
00102     const SoPickedPoint* getPickedPoint(SoHandleEventAction*) const;
00103 
00104     static SoFullPath * currenthighlight;
00105 
00106     SbBool highlighted;
00107     SoColorPacker colorpacker;
00108 
00109     SbBool bShift;
00110     SbBool bCtrl;
00111 };
00112 
00116 class GuiExport SoHighlightElementAction : public SoAction
00117 {
00118     SO_ACTION_HEADER(SoHighlightElementAction);
00119 
00120 public:
00121     SoHighlightElementAction ();
00122     ~SoHighlightElementAction();
00123 
00124     void setHighlighted(SbBool);
00125     SbBool isHighlighted() const;
00126     void setColor(const SbColor&);
00127     const SbColor& getColor() const;
00128     void setElement(const SoPickedPoint*);
00129     const SoPickedPoint* getElement() const;
00130 
00131     static void initClass();
00132 
00133 protected:
00134     virtual void beginTraversal(SoNode *node);
00135 
00136 private:
00137     static void callDoAction(SoAction *action,SoNode *node);
00138 
00139 private:
00140     SbBool _highlight;
00141     SbColor _color;
00142     const SoPickedPoint* _pp;
00143 };
00144 
00148 class GuiExport SoSelectionElementAction : public SoAction
00149 {
00150     SO_ACTION_HEADER(SoSelectionElementAction);
00151 
00152 public:
00153     enum Type {None, Append, Remove, All};
00154 
00155     SoSelectionElementAction (Type);
00156     ~SoSelectionElementAction();
00157 
00158     Type getType() const;
00159     void setColor(const SbColor&);
00160     const SbColor& getColor() const;
00161     void setElement(const SoPickedPoint*);
00162     const SoPickedPoint* getElement() const;
00163 
00164     static void initClass();
00165 
00166 protected:
00167     virtual void beginTraversal(SoNode *node);
00168 
00169 private:
00170     static void callDoAction(SoAction *action,SoNode *node);
00171 
00172 private:
00173     Type _type;
00174     SbBool _select;
00175     SbColor _color;
00176     const SoPickedPoint* _pp;
00177 };
00178 
00179 
00180 } // namespace Gui
00181 
00182 #endif // !GUI_SOFCSELECTION_H

Generated on Wed Nov 23 19:00:40 2011 for FreeCAD by  doxygen 1.6.1