Back to index

salome-gui  6.5.0
SUPERVGraph_ViewFrame.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  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 
00027 #ifndef SUPERVGraph_ViewFrame_H
00028 #define SUPERVGraph_ViewFrame_H
00029 
00030 #include "SUPERVGraph.h"
00031 
00032 #include "SALOME_InteractiveObject.hxx"
00033 #include "SUIT_PopupClient.h"
00034 #include "SUIT_ViewWindow.h"
00035 
00036 #include <QtxAction.h>
00037 
00038 #ifdef WIN32
00039 #pragma warning ( disable:4251 )
00040 #endif
00041 
00042 class SUPERVGRAPH_EXPORT SUPERVGraph_View: public QWidget, public SUIT_PopupClient {
00043   Q_OBJECT;
00044  public:
00045   static QString Type() { return "SUPERVGraphViewer"; }
00046 
00047   SUPERVGraph_View(QWidget* theParent);
00048   SUPERVGraph_View(SUPERVGraph_View* theParent);
00049 
00050   virtual void ActivatePanning() = 0;
00051   virtual void ResetView() = 0;
00052 
00053   /* redefine functions from SUIT_PopupClient */
00054   virtual QString popupClientType() const { return Type(); }
00055   virtual void    contextMenuPopup( QMenu* );
00056   
00057   virtual void resizeView( QResizeEvent* theEvent ) {};
00058   
00059  protected:
00060   void init(QWidget* theParent);
00061   
00062 };
00063 
00064 class SUPERVGRAPH_EXPORT SUPERVGraph_ViewFrame : public SUIT_ViewWindow {
00065   Q_OBJECT
00066 
00067     public:
00068   SUPERVGraph_ViewFrame(SUIT_Desktop* theDesktop );
00069   ~SUPERVGraph_ViewFrame();
00070 
00071   SUPERVGraph_View*              getViewWidget();
00072   void                           setViewWidget(SUPERVGraph_View* theView);
00073 
00074   void                           setBackgroundColor( const QColor& );
00075   QColor                         backgroundColor() const;
00076   
00077   void                           onAdjustTrihedron( );
00078   
00079   /*  interactive object management */
00080   void                           highlight( const Handle(SALOME_InteractiveObject)& IObject, 
00081                                             bool highlight, bool immediatly = true );
00082   void                           unHighlightAll();
00083   void                           rename( const Handle(SALOME_InteractiveObject)& IObject,
00084                                          QString newName );
00085   bool                           isInViewer( const Handle(SALOME_InteractiveObject)& IObject );
00086   bool                           isVisible( const Handle(SALOME_InteractiveObject)& IObject );
00087   
00088   /* selection */
00089   Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; };
00090 
00091   /* display */         
00092   void           Display(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
00093   void           DisplayOnly(const Handle(SALOME_InteractiveObject)& IObject){};
00094   void           Erase(const Handle(SALOME_InteractiveObject)& IObject, bool immediatly = true){};
00095   void           DisplayAll(){};
00096   void           EraseAll(){};
00097   void           Repaint() {};
00098 
00099   QToolBar*      getToolBar() { return myToolBar; }
00100 
00101  public slots:
00102   void           onViewPan(); 
00103   void           onViewZoom();
00104   void           onViewFitAll();
00105   void           onViewFitArea();
00106   void           onViewGlobalPan(); 
00107   void           onViewRotate();
00108   void           onViewReset();     
00109   void           onViewFront(); 
00110   void           onViewBack(); 
00111   void           onViewRight(); 
00112   void           onViewLeft();     
00113   void           onViewBottom();
00114   void           onViewTop();
00115   void           onViewTrihedron(); 
00116 
00117  protected:
00118   void           resizeEvent( QResizeEvent* theEvent );
00119   
00120  private:
00121   void           createActions();
00122   void           createToolBar();
00123 
00125   enum { PanId, ResetId };
00126   typedef QMap<int, QtxAction*> ActionsMap;
00127 
00128   ActionsMap       myActionsMap;
00129   QToolBar*        myToolBar;
00130 
00131   SUPERVGraph_View* myView;
00132 };
00133 
00134 #ifdef WIN32
00135 #pragma warning ( default:4251 )
00136 #endif
00137 
00138 #endif