/*************************************************************************** * Copyright (c) 2005 Jürgen Riegel * * * * This file is part of the FreeCAD CAx development system. * * * * This library is free software; you can redistribute it and/or * * modify it under the terms of the GNU Library General Public * * License as published by the Free Software Foundation; either * * version 2 of the License, or (at your option) any later version. * * * * This library is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * * GNU Library General Public License for more details. * * * * You should have received a copy of the GNU Library General Public * * License along with this library; see the file COPYING.LIB. If not, * * write to the Free Software Foundation, Inc., 59 Temple Place, * * Suite 330, Boston, MA 02111-1307, USA * * * ***************************************************************************/ #ifndef GUI_SOFCUNIFIEDSELECTION_H #define GUI_SOFCUNIFIEDSELECTION_H # ifdef FC_OS_MACOSX # include # else # ifdef FC_OS_WIN32 # define NOMINMAX # include # endif # include # endif #include #include #include #include #include #include #include #include "View3DInventorViewer.h" #include class SoFullPath; class SoPickedPoint; class SoDetail; namespace Gui { class Document; /** Unified Selection node * This is the new selection node for the 3D Viewer which will * gradually remove all the low level selection nodes in the view * provider. The handling of the highlighting and the selection will * be unified here. * \author Jürgen Riegel */ class GuiExport SoFCUnifiedSelection : public SoSeparator { typedef SoSeparator inherited; SO_NODE_HEADER(Gui::SoFCUnifiedSelection); public: static void initClass(void); static void finish(void); SoFCUnifiedSelection(void); void applySettings(); enum HighlightModes { AUTO, ON, OFF }; const char* getFileFormatName(void) const; void write(SoWriteAction * action); SoSFColor colorHighlight; SoSFColor colorSelection; SoSFEnum highlightMode; SoSFEnum selectionMode; SoSFBool selectionRole; virtual void doAction(SoAction *action); //virtual void GLRender(SoGLRenderAction * action); virtual void handleEvent(SoHandleEventAction * action); virtual void GLRenderBelowPath(SoGLRenderAction * action); //virtual void GLRenderInPath(SoGLRenderAction * action); //static void turnOffCurrentHighlight(SoGLRenderAction * action); friend class View3DInventorViewer; protected: virtual ~SoFCUnifiedSelection(); //virtual void redrawHighlighted(SoAction * act, SbBool flag); //virtual SbBool readInstance(SoInput * in, unsigned short flags); private: //static void turnoffcurrent(SoAction * action); //void setOverride(SoGLRenderAction * action); //SbBool isHighlighted(SoAction *action); //SbBool preRender(SoGLRenderAction *act, GLint &oldDepthFunc); static int getPriority(const SoPickedPoint* p); const SoPickedPoint* getPickedPoint(SoHandleEventAction*) const; Gui::Document *pcDocument; static SoFullPath * currenthighlight; SbBool highlighted; // -1 = not handled, 0 = not selected, 1 = selected int32_t preSelection; SoColorPacker colorpacker; }; /** * @author Werner Mayer */ class GuiExport SoHighlightElementAction : public SoAction { SO_ACTION_HEADER(SoHighlightElementAction); public: SoHighlightElementAction (); ~SoHighlightElementAction(); void setHighlighted(SbBool); SbBool isHighlighted() const; void setColor(const SbColor&); const SbColor& getColor() const; void setElement(const SoDetail*); const SoDetail* getElement() const; static void initClass(); protected: virtual void beginTraversal(SoNode *node); private: static void callDoAction(SoAction *action,SoNode *node); private: SbBool _highlight; SbColor _color; const SoDetail* _det; }; /** * @author Werner Mayer */ class GuiExport SoSelectionElementAction : public SoAction { SO_ACTION_HEADER(SoSelectionElementAction); public: enum Type {None, Append, Remove, All}; SoSelectionElementAction (Type); ~SoSelectionElementAction(); Type getType() const; void setColor(const SbColor&); const SbColor& getColor() const; void setElement(const SoDetail*); const SoDetail* getElement() const; static void initClass(); protected: virtual void beginTraversal(SoNode *node); private: static void callDoAction(SoAction *action,SoNode *node); private: Type _type; SbColor _color; const SoDetail* _det; }; /** * @author Werner Mayer */ class GuiExport SoVRMLAction : public SoAction { SO_ACTION_HEADER(SoVRMLAction); public: SoVRMLAction(); ~SoVRMLAction(); void setOverrideMode(SbBool); SbBool isOverrideMode() const; static void initClass(); private: SbBool overrideMode; std::list bindList; static void callDoAction(SoAction *action,SoNode *node); }; } // namespace Gui #endif // !GUI_SOFCUNIFIEDSELECTION_H