Back to index

salome-gui  6.5.0
QxScene_ViewWindow.h
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // This library is free software; you can redistribute it and/or
00004 // modify it under the terms of the GNU Lesser General Public
00005 // License as published by the Free Software Foundation; either
00006 // version 2.1 of the License.
00007 //
00008 // This library is distributed in the hope that it will be useful,
00009 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00010 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00011 // Lesser General Public License for more details.
00012 //
00013 // You should have received a copy of the GNU Lesser General Public
00014 // License along with this library; if not, write to the Free Software
00015 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00016 //
00017 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00018 //
00019 
00020 //  SALOME QxScene : build Supervisor viewer into desktop
00021 //
00022 #ifndef QXSCENE_VIEWWINDOW_H
00023 #define QXSCENE_VIEWWINDOW_H
00024 
00025 #include "QxScene.h"
00026 #include "QxScene_ViewModel.h"
00027 
00028 #include "SUIT_ViewWindow.h"
00029 
00030 #include "QtxAction.h"
00031 
00032 #include <qaction.h>
00033 
00034 #include <QGraphicsScene>
00035 #include <QGraphicsView>
00036 
00037 #ifdef WIN32
00038 #pragma warning ( disable:4251 )
00039 #endif
00040 
00041 class SUIT_ResourceMgr;
00042 
00043 class QXSCENE_EXPORT QxScene_ViewWindow : public SUIT_ViewWindow {
00044   Q_OBJECT
00045 
00046  public:
00048   enum { FitAllId, FitRectId, ZoomId, ScaleOpId, PanId, GlobalPanId, MoveOpId, ResetId };
00049 
00050   QxScene_ViewWindow(SUIT_Desktop* theDesktop, QxScene_Viewer* theModel);
00051   virtual ~QxScene_ViewWindow();
00052 
00053   void              setBackgroundColor( const QColor& );
00054   QColor            backgroundColor() const;
00055 
00056   QToolBar*         getToolBar();
00057 
00058   SUIT_ResourceMgr* resMgr() const;
00059 
00060   QxScene_Viewer*   getViewModel() const { return myViewModel; }
00061   void              setViewModel(QxScene_Viewer* theViewModel) { myViewModel = theViewModel; }
00062 
00063   virtual void      initLayout();
00064 
00065   void              contextPopupEvent(QContextMenuEvent* theEvent) { emit contextMenuRequested( theEvent); }
00066   
00067   void              setScene(QGraphicsScene* scene) { _scene = scene; }
00068   QGraphicsScene*   getScene() { return _scene; }
00069   void              setSceneView(QGraphicsView* sceneView){ _sceneView = sceneView; }
00070   QGraphicsView*    getSceneView() { return _sceneView; }
00071   virtual bool      closeRequested();
00072 
00073  signals:
00074   void              tryClose(bool &isClosed, QxScene_ViewWindow* window);
00075 
00076  public slots:
00077   void              onViewFitAll();
00078   void              onViewFitArea();
00079   void              onViewZoom();
00080   void              onViewPan(); 
00081   void              onViewGlobalPan(); 
00082   void              onViewReset(); 
00083   
00084  protected:
00085   void              resizeEvent( QResizeEvent* theEvent );
00086 
00087   QGraphicsScene*   _scene;
00088   QGraphicsView*    _sceneView;
00089 
00090  private:
00091   void              createActions();
00092   void              createToolBar();
00093 
00094   int               myToolBar;
00095 
00096   QxScene_Viewer*   myViewModel;
00097 };
00098 
00099 #ifdef WIN32
00100 #pragma warning ( default:4251 )
00101 #endif
00102 
00103 #endif