SoFCUnifiedSelection.h
Go to the documentation of this file.00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
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     
00083 
00084     virtual void handleEvent(SoHandleEventAction * action);
00085     
00086     
00087     
00088 
00089     friend class View3DInventorViewer;
00090 protected:
00091     virtual ~SoFCUnifiedSelection();
00092     
00093     
00094 
00095     View3DInventorViewer *viewer;
00096 private:
00097     
00098     
00099     
00100     
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 } 
00181 
00182 #endif // !GUI_SOFCSELECTION_H