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 #ifndef QXGRAPH_VIEWMODEL_H 00024 #define QXGRAPH_VIEWMODEL_H 00025 00026 #include "QxGraph.h" 00027 00028 #include "SUIT_ViewModel.h" 00029 00030 class QCanvasItem; // for addRectangleItem(...) method (can be removed in the future) 00031 00032 class QxGraph_Canvas; 00033 class QxGraph_CanvasView; 00034 class QxGraph_ViewWindow; 00035 class QxGraph_Prs; 00036 00037 class QXGRAPH_EXPORT QxGraph_Viewer: public SUIT_ViewModel 00038 { 00039 Q_OBJECT 00040 00041 public: 00042 static QString Type() { return "QxGraphViewer"; } 00043 00044 QxGraph_Viewer(); 00045 virtual ~QxGraph_Viewer(); 00046 00047 virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop); 00048 virtual QString getType() const { return Type(); } 00049 00050 virtual void contextMenuPopup(QPopupMenu*); 00051 00052 QxGraph_Canvas* getCanvas() const { return myCanvas; } 00053 void setCanvas(QxGraph_Canvas* theCanvas) { myCanvas = theCanvas; } 00054 //QPtrList<QxGraph_Canvas> getCanvases() { return myCanvases; } 00055 //void setCanvases(QPtrList<QxGraph_Canvas> theCanvases) { myCanvases = theCanvases; } 00056 00057 //void addCanvas(QxGraph_Canvas* theCanvas) { myCanvases.append(theCanvas); } 00058 //void removeCanvas(QxGraph_Canvas* theCanvas) { myCanvases.remove(theCanvas); } 00059 00060 QPtrList<QxGraph_CanvasView> getCanvasViews() { return myCanvasViews; } 00061 void setCanvasViews(QPtrList<QxGraph_CanvasView> theViews) { myCanvasViews = theViews; } 00062 00063 void addView(QxGraph_CanvasView* theView) { myCanvasViews.append(theView); } 00064 void removeView(QxGraph_CanvasView* theView) { myCanvasViews.remove(theView); } 00065 00066 QxGraph_CanvasView* getCurrentView() const { return myCurrentView; } 00067 void setCurrentView(QxGraph_CanvasView* theView) { myCurrentView = theView; } 00068 void setCurrentView(int theIndex); 00069 00070 protected: 00071 void initView(QxGraph_ViewWindow* view); 00072 00073 protected slots: 00074 void onShowToolbar(); 00075 void onChangeBgColor(); 00076 00077 private: 00078 QxGraph_Canvas* myCanvas; 00079 //QPtrList<QxGraph_Canvas> myCanvases; 00080 QPtrList<QxGraph_CanvasView> myCanvasViews; 00081 00082 QxGraph_CanvasView* myCurrentView; 00083 00084 }; 00085 00086 #endif