Back to index

salome-gui  6.5.0
VTKViewer_ViewModel.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 #ifndef VTKVIEWER_VIEWMODEL_H
00024 #define VTKVIEWER_VIEWMODEL_H
00025 
00026 #include "VTKViewer.h"
00027 #include "Qtx.h"
00028 #include "SUIT_ViewModel.h"
00029 
00030 #include <QColor>
00031 
00032 class QMouseEvent;
00033 
00034 class SUIT_ViewWindow;
00035 class SUIT_Desktop;
00036 
00037 class VTKVIEWER_EXPORT VTKViewer_Viewer: public SUIT_ViewModel
00038 {
00039   Q_OBJECT
00040 
00041 public:
00043   enum {
00044     HorizontalGradient,
00045     VerticalGradient,
00046     FirstDiagonalGradient,
00047     SecondDiagonalGradient,
00048     FirstCornerGradient,
00049     SecondCornerGradient,
00050     ThirdCornerGradient,
00051     FourthCornerGradient,
00052     LastGradient = FourthCornerGradient,
00053   };
00054 
00056   static QString           Type() { return "VTKViewer"; }
00057   static QString           backgroundData( QStringList&, QIntList&, QIntList& );
00058 
00059   VTKViewer_Viewer();
00060   virtual ~VTKViewer_Viewer();
00061 
00062   virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
00063 
00064   virtual void             setViewManager(SUIT_ViewManager* theViewManager);
00065   virtual void             contextMenuPopup( QMenu* );
00067   virtual QString          getType() const { return Type(); }
00068 
00069 public:
00070   void                     enableSelection(bool isEnabled);
00072   bool                     isSelectionEnabled() const { return mySelectionEnabled; }
00073 
00074   void                     enableMultiselection(bool isEnable);
00076   bool                     isMultiSelectionEnabled() const { return myMultiSelectionEnabled; }
00077 
00078   int                      getSelectionCount() const;
00079 
00080   QColor                   backgroundColor() const;                  // obsolete
00081   void                     setBackgroundColor( const QColor& );      // obsolete
00082   Qtx::BackgroundData      background() const;
00083   void                     setBackground( const Qtx::BackgroundData& );
00084 
00085 signals:
00086   void                     selectionChanged();
00087 
00088 protected slots:
00089   void                     onMousePress( SUIT_ViewWindow*, QMouseEvent* );
00090   void                     onMouseMove( SUIT_ViewWindow*, QMouseEvent* );
00091   void                     onMouseRelease( SUIT_ViewWindow*, QMouseEvent* );
00092 
00093   void                     onDumpView();
00094   void                     onShowToolbar();
00095   void                     onChangeBackground();
00096 
00097 private:
00098   Qtx::BackgroundData      myDefaultBackground;
00099   bool                     mySelectionEnabled;
00100   bool                     myMultiSelectionEnabled;
00101 };
00102 
00103 #endif