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 QxGraph : build Supervisor viewer into desktop 00024 // 00025 #ifndef QXGRAPH_VIEWWINDOW_H 00026 #define QXGRAPH_VIEWWINDOW_H 00027 00028 #include "QxGraph.h" 00029 #include "QxGraph_ViewModel.h" 00030 00031 #include "SUIT_ViewWindow.h" 00032 00033 #include "QtxAction.h" 00034 00035 #include <qaction.h> 00036 00037 #ifdef WIN32 00038 #pragma warning ( disable:4251 ) 00039 #endif 00040 00041 class SUIT_ResourceMgr; 00042 00043 class QXGRAPH_EXPORT QxGraph_ViewWindow : public SUIT_ViewWindow { 00044 Q_OBJECT 00045 00046 public: 00047 QxGraph_ViewWindow(SUIT_Desktop* theDesktop, QxGraph_Viewer* theModel); 00048 virtual ~QxGraph_ViewWindow(); 00049 00050 void setBackgroundColor( const QColor& ); 00051 QColor backgroundColor() const; 00052 00053 QToolBar* getToolBar() { return myToolBar; } 00054 00055 SUIT_ResourceMgr* resMgr() const; 00056 00057 QxGraph_Viewer* getViewModel() const { return myViewModel; } 00058 void setViewModel(QxGraph_Viewer* theViewModel) { myViewModel = theViewModel; } 00059 00060 virtual void initLayout(); 00061 00062 void contextPopupEvent(QContextMenuEvent* theEvent) { emit contextMenuRequested( theEvent); } 00063 00064 public slots: 00065 void onViewFitAll(); 00066 void onViewFitArea(); 00067 void onViewZoom(); 00068 void onViewPan(); 00069 void onViewGlobalPan(); 00070 void onViewReset(); 00071 00072 protected: 00073 void resizeEvent( QResizeEvent* theEvent ); 00074 00075 virtual void initCanvas(); 00076 virtual void initCanvasViews(); 00077 00078 private: 00079 void createActions(); 00080 void createToolBar(); 00081 00083 enum { FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, ResetId }; 00084 typedef QMap<int, QtxAction*> ActionsMap; 00085 00086 ActionsMap myActionsMap; 00087 QToolBar* myToolBar; 00088 00089 QxGraph_Viewer* myViewModel; 00090 00091 }; 00092 00093 #ifdef WIN32 00094 #pragma warning ( default:4251 ) 00095 #endif 00096 00097 #endif