Version: 6.3.1

src/SUPERVGraph/SUPERVGraph_ViewFrame.h

Go to the documentation of this file.
00001 // Copyright (C) 2007-2011  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
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 GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 //  SALOME SUPERVGraph : build Supervisor viewer into desktop
00024 //  File   : SUPERVGraph_ViewFrame.h
00025 //  Author : Nicolas REJNERI
00026 //  Module : SALOME
00027 //  $Header: /home/server/cvs/GUI/GUI_SRC/src/SUPERVGraph/SUPERVGraph_ViewFrame.h,v 1.10.2.1.8.1.12.1 2011-06-01 13:53:39 vsr Exp $
00028 //
00029 #ifndef SUPERVGraph_ViewFrame_H
00030 #define SUPERVGraph_ViewFrame_H
00031 
00032 #include "SUPERVGraph.h"
00033 
00034 #include "SALOME_InteractiveObject.hxx"
00035 #include "SUIT_PopupClient.h"
00036 #include "SUIT_ViewWindow.h"
00037 
00038 #include <QtxAction.h>
00039 
00040 #ifdef WIN32
00041 #pragma warning ( disable:4251 )
00042 #endif
00043 
00044 class SUPERVGRAPH_EXPORT SUPERVGraph_View: public QWidget, public SUIT_PopupClient {
00045   Q_OBJECT;
00046  public:
00047   static QString Type() { return "SUPERVGraphViewer"; }
00048 
00049   SUPERVGraph_View(QWidget* theParent);
00050   SUPERVGraph_View(SUPERVGraph_View* theParent);
00051 
00052   virtual void ActivatePanning() = 0;
00053   virtual void ResetView() = 0;
00054 
00055   /* redefine functions from SUIT_PopupClient */
00056   virtual QString popupClientType() const { return Type(); }
00057   virtual void    contextMenuPopup( QMenu* );
00058   
00059   virtual void resizeView( QResizeEvent* theEvent ) {};
00060   
00061  protected:
00062   void init(QWidget* theParent);
00063   
00064 };
00065 
00066 class SUPERVGRAPH_EXPORT SUPERVGraph_ViewFrame : public SUIT_ViewWindow {
00067   Q_OBJECT
00068 
00069     public:
00070   SUPERVGraph_ViewFrame(SUIT_Desktop* theDesktop );
00071   ~SUPERVGraph_ViewFrame();
00072 
00073   SUPERVGraph_View*              getViewWidget();
00074   void                           setViewWidget(SUPERVGraph_View* theView);
00075 
00076   void                           setBackgroundColor( const QColor& );
00077   QColor                         backgroundColor() const;
00078   
00079   void                           onAdjustTrihedron( );
00080   
00081   /*  interactive object management */
00082   void                           highlight( const Handle(SALOME_InteractiveObject)& IObject, 
00083                                             bool highlight, bool immediatly = true );
00084   void                           unHighlightAll();
00085   void                           rename( const Handle(SALOME_InteractiveObject)& IObject,
00086                                          QString newName );
00087   bool                           isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
00088   bool                           isVisible( const Handle(SALOME_InteractiveObject)& IObject );
00089   
00090   /* selection */
00091   Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; };
00092 
00093   /* display */         
00094   void           Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
00095   void           DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject){};
00096   void           Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
00097   void           DisplayAll(){};
00098   void           EraseAll(){};
00099   void           Repaint() {};
00100 
00101   QToolBar*      getToolBar() { return myToolBar; }
00102 
00103  public slots:
00104   void           onViewPan(); 
00105   void           onViewZoom();
00106   void           onViewFitAll();
00107   void           onViewFitArea();
00108   void           onViewGlobalPan(); 
00109   void           onViewRotate();
00110   void           onViewReset();     
00111   void           onViewFront(); 
00112   void           onViewBack(); 
00113   void           onViewRight(); 
00114   void           onViewLeft();     
00115   void           onViewBottom();
00116   void           onViewTop();
00117   void           onViewTrihedron(); 
00118 
00119  protected:
00120   void           resizeEvent( QResizeEvent* theEvent );
00121   
00122  private:
00123   void           createActions();
00124   void           createToolBar();
00125 
00127   enum { PanId, ResetId };
00128   typedef QMap<int, QtxAction*> ActionsMap;
00129 
00130   ActionsMap       myActionsMap;
00131   QToolBar*        myToolBar;
00132 
00133   SUPERVGraph_View* myView;
00134 };
00135 
00136 #ifdef WIN32
00137 #pragma warning ( default:4251 )
00138 #endif
00139 
00140 #endif
Copyright © 2007-2011 CEA/DEN, EDF R&D, OPEN CASCADE
Copyright © 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS