SoFCSelectionAction.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 
00024 #ifndef _SoFCSelectionAction_h
00025 #define _SoFCSelectionAction_h
00026 
00027 //#include <Inventor/SoAction.h> 
00028 #include <Inventor/actions/SoSubAction.h>
00029 #include <Inventor/events/SoSubEvent.h>
00030 #include <Inventor/actions/SoGLRenderAction.h>
00031 #include <Inventor/SbColor.h>
00032 #include <vector>
00033 
00034 class SoSFString;
00035 class SoSFColor;
00036 
00037 namespace Gui {
00038 
00039 class SelectionChanges;
00040 
00046 class GuiExport SoFCSelectionAction : public SoAction
00047 {
00048     SO_ACTION_HEADER(SoFCSelectionAction);
00049 
00050 public:
00051     SoFCSelectionAction (const SelectionChanges &SelCh);
00052     ~SoFCSelectionAction();
00053 
00054     static void initClass();
00055     static void finish(void);
00056 
00057     const SelectionChanges &SelChange;
00058 
00059 protected:
00060     virtual void beginTraversal(SoNode *node);
00061 
00062 private:
00063     static void callDoAction(SoAction *action,SoNode *node);
00064 };
00065 
00071 class GuiExport SoFCEnableSelectionAction : public SoAction
00072 {
00073     SO_ACTION_HEADER(SoFCEnableSelectionAction);
00074 
00075 public:
00076     SoFCEnableSelectionAction (const SbBool& sel);
00077     ~SoFCEnableSelectionAction();
00078 
00079     const SbBool& selection;
00080 
00081     static void initClass();
00082     static void finish(void);
00083 
00084 protected:
00085     virtual void beginTraversal(SoNode *node);
00086 
00087 private:
00088     static void callDoAction(SoAction *action,SoNode *node);
00089 };
00090 
00096 class GuiExport SoFCEnableHighlightAction : public SoAction
00097 {
00098     SO_ACTION_HEADER(SoFCEnableHighlightAction);
00099 
00100 public:
00101     SoFCEnableHighlightAction (const SbBool& sel);
00102     ~SoFCEnableHighlightAction();
00103 
00104     const SbBool& highlight;
00105 
00106     static void initClass();
00107     static void finish(void);
00108 
00109 protected:
00110     virtual void beginTraversal(SoNode *node);
00111 
00112 private:
00113     static void callDoAction(SoAction *action,SoNode *node);
00114 };
00115 
00121 class GuiExport SoFCSelectionColorAction : public SoAction
00122 {
00123     SO_ACTION_HEADER(SoFCSelectionColorAction);
00124 
00125 public:
00126     SoFCSelectionColorAction (const SoSFColor& col);
00127     ~SoFCSelectionColorAction();
00128 
00129     const SoSFColor& selectionColor;
00130 
00131     static void initClass();
00132     static void finish(void);
00133 
00134 protected:
00135     virtual void beginTraversal(SoNode *node);
00136 
00137 private:
00138     static void callDoAction(SoAction *action,SoNode *node);
00139 };
00140 
00146 class GuiExport SoFCHighlightColorAction : public SoAction
00147 {
00148     SO_ACTION_HEADER(SoFCHighlightColorAction);
00149 
00150 public:
00151     SoFCHighlightColorAction (const SoSFColor& col);
00152     ~SoFCHighlightColorAction();
00153 
00154     const SoSFColor& highlightColor;
00155 
00156     static void initClass();
00157     static void finish(void);
00158 
00159 protected:
00160     virtual void beginTraversal(SoNode *node);
00161 
00162 private:
00163     static void callDoAction(SoAction *action,SoNode *node);
00164 };
00165 
00171 class GuiExport SoFCDocumentAction : public SoAction
00172 {
00173     SO_ACTION_HEADER(SoFCDocumentAction);
00174 
00175 public:
00176     SoFCDocumentAction (const SoSFString& docName);
00177     ~SoFCDocumentAction();
00178 
00179     const SoSFString& documentName;
00180 
00181     static void initClass();
00182     static void finish(void);
00183 
00184 protected:
00185     virtual void beginTraversal(SoNode *node);
00186 
00187 private:
00188     static void callDoAction(SoAction *action,SoNode *node);
00189 };
00190 
00196 class GuiExport SoFCDocumentObjectAction : public SoAction
00197 {
00198     SO_ACTION_HEADER(SoFCDocumentObjectAction);
00199 
00200 public:
00201     SoFCDocumentObjectAction ();
00202     ~SoFCDocumentObjectAction();
00203 
00204     void setHandled();
00205     SbBool isHandled() const;
00206 
00207     static void initClass();
00208     static void finish(void);
00209 
00210 protected:
00211     virtual void beginTraversal(SoNode *node);
00212 
00213 private:
00214     static void callDoAction(SoAction *action,SoNode *node);
00215 
00216 public:
00217     SbString documentName;
00218     SbString objectName;
00219     SbString componentName;
00220 
00221 private:
00222     SbBool _handled;
00223 };
00224 
00229 class GuiExport SoGLSelectAction : public SoAction
00230 {
00231     SO_ACTION_HEADER(SoGLSelectAction);
00232 
00233 public:
00234     SoGLSelectAction (const SbViewportRegion& region, const SbViewportRegion& select);
00235     ~SoGLSelectAction();
00236 
00237     void setHandled();
00238     SbBool isHandled() const;
00239     const SbViewportRegion& getViewportRegion () const;
00240 
00241     static void initClass();
00242 
00243 protected:
00244     virtual void beginTraversal(SoNode *node);
00245 
00246 private:
00247     static void callDoAction(SoAction *action,SoNode *node);
00248 
00249 public:
00250     std::vector<unsigned long> indices;
00251 
00252 private:
00253     const SbViewportRegion& vpregion;
00254     const SbViewportRegion& vpselect;
00255     SbBool _handled;
00256 };
00257 
00261 class GuiExport SoVisibleFaceAction : public SoAction
00262 {
00263     SO_ACTION_HEADER(SoVisibleFaceAction);
00264 
00265 public:
00266     SoVisibleFaceAction ();
00267     ~SoVisibleFaceAction();
00268 
00269     void setHandled();
00270     SbBool isHandled() const;
00271 
00272     static void initClass();
00273 
00274 protected:
00275     virtual void beginTraversal(SoNode *node);
00276 
00277 private:
00278     static void callDoAction(SoAction *action,SoNode *node);
00279 
00280 private:
00281     SbBool _handled;
00282 };
00283 
00284 class SoBoxSelectionRenderActionP;
00289 class GuiExport SoBoxSelectionRenderAction : public SoGLRenderAction {
00290     typedef SoGLRenderAction inherited;
00291 
00292     SO_ACTION_HEADER(SoBoxSelectionRenderAction);
00293 
00294 public:
00295     SoBoxSelectionRenderAction(void);
00296     SoBoxSelectionRenderAction(const SbViewportRegion & viewportregion);
00297     virtual ~SoBoxSelectionRenderAction();
00298 
00299     static void initClass(void);
00300 
00301     virtual void apply(SoNode * node);
00302     virtual void apply(SoPath * path);
00303     virtual void apply(const SoPathList & pathlist, SbBool obeysrules = FALSE);
00304     void setVisible(SbBool b) { hlVisible = b; }
00305     SbBool isVisible() const { return hlVisible; }
00306     void setColor(const SbColor & color);
00307     const SbColor & getColor(void);
00308     void setLinePattern(unsigned short pattern);
00309     unsigned short getLinePattern(void) const;
00310     void setLineWidth(const float width);
00311     float getLineWidth(void) const;
00312 
00313 protected:
00314     SbBool hlVisible;
00315 
00316 private:
00317     void constructorCommon(void);
00318     void drawBoxes(SoPath * pathtothis, const SoPathList * pathlist);
00319 
00320     SoBoxSelectionRenderActionP * pimpl;
00321 };
00322 
00323 } // namespace Gui
00324 
00325 
00326 #endif // _SoFCSelectionAction_h 

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