SoFCSelection.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_SOFCSELECTION_H
00024 #define GUI_SOFCSELECTION_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/SoGroup.h>
00037 #include <Inventor/fields/SoSFColor.h>
00038 #include <Inventor/fields/SoSFEnum.h>
00039 #include <Inventor/fields/SoSFString.h>
00040 #include <Inventor/nodes/SoLightModel.h>
00041 
00042 class SoFullPath;
00043 class SoPickedPoint;
00044 
00045 
00046 namespace Gui {
00047 
00048 
00053 class GuiExport SoFCSelection : public SoGroup {
00054     typedef SoGroup inherited;
00055 
00056     SO_NODE_HEADER(Gui::SoFCSelection);
00057 
00058 public:
00059     static void initClass(void);
00060     static void finish(void);
00061     SoFCSelection(void);
00062 
00063     enum HighlightModes {
00064         AUTO, ON, OFF
00065     };
00066 
00067     enum SelectionModes {
00068         SEL_ON, SEL_OFF
00069     };
00070 
00071     enum Selected {
00072         NOTSELECTED, SELECTED
00073     };
00074 
00075     enum Styles {
00076         EMISSIVE, EMISSIVE_DIFFUSE, BOX
00077     };
00078 
00079     SbBool isHighlighted(void) const {return highlighted;}
00080 
00081     SoSFColor colorHighlight;
00082     SoSFColor colorSelection;
00083     SoSFEnum style;
00084     SoSFEnum selected;
00085     SoSFEnum highlightMode;
00086     SoSFEnum selectionMode;
00087 
00088     SoSFString documentName;
00089     SoSFString objectName;
00090     SoSFString subElementName;
00091 
00092     virtual void doAction(SoAction *action);
00093     virtual void GLRender(SoGLRenderAction * action);
00094 
00095     virtual void handleEvent(SoHandleEventAction * action);
00096     virtual void GLRenderBelowPath(SoGLRenderAction * action);
00097     virtual void GLRenderInPath(SoGLRenderAction * action);
00098     static  void turnOffCurrentHighlight(SoGLRenderAction * action);
00099 
00100 protected:
00101     virtual ~SoFCSelection();
00102     virtual void redrawHighlighted(SoAction * act, SbBool flag);
00103     virtual SbBool readInstance(SoInput *  in, unsigned short  flags); 
00104 
00105 private:
00106     static int getPriority(const SoPickedPoint*);
00107     static void turnoffcurrent(SoAction * action);
00108     void setOverride(SoGLRenderAction * action);
00109     SbBool isHighlighted(SoAction *action);
00110     SbBool preRender(SoGLRenderAction *act, GLint &oldDepthFunc);
00111     const SoPickedPoint* getPickedPoint(SoHandleEventAction*) const;
00112 
00113     static SoFullPath * currenthighlight;
00114 
00115     SbBool highlighted;
00116     SoColorPacker colorpacker;
00117 
00118     SbBool bShift;
00119     SbBool bCtrl;
00120 };
00121 
00122 
00123 } // namespace Gui
00124 
00125 #endif // !GUI_SOFCSELECTION_H

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