1 // Copyright (C) 2007-2012 CEA/DEN, EDF R&D, OPEN CASCADE
3 // Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
23 #ifndef QXGRAPH_VIEWMODEL_H
24 #define QXGRAPH_VIEWMODEL_H
28 #include "SUIT_ViewModel.h"
30 class QCanvasItem; // for addRectangleItem(...) method (can be removed in the future)
33 class QxGraph_CanvasView;
34 class QxGraph_ViewWindow;
37 class QXGRAPH_EXPORT QxGraph_Viewer: public SUIT_ViewModel
42 static QString Type() { return "QxGraphViewer"; }
45 virtual ~QxGraph_Viewer();
47 virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
48 virtual QString getType() const { return Type(); }
50 virtual void contextMenuPopup(QPopupMenu*);
52 QxGraph_Canvas* getCanvas() const { return myCanvas; }
53 void setCanvas(QxGraph_Canvas* theCanvas) { myCanvas = theCanvas; }
54 //QPtrList<QxGraph_Canvas> getCanvases() { return myCanvases; }
55 //void setCanvases(QPtrList<QxGraph_Canvas> theCanvases) { myCanvases = theCanvases; }
57 //void addCanvas(QxGraph_Canvas* theCanvas) { myCanvases.append(theCanvas); }
58 //void removeCanvas(QxGraph_Canvas* theCanvas) { myCanvases.remove(theCanvas); }
60 QPtrList<QxGraph_CanvasView> getCanvasViews() { return myCanvasViews; }
61 void setCanvasViews(QPtrList<QxGraph_CanvasView> theViews) { myCanvasViews = theViews; }
63 void addView(QxGraph_CanvasView* theView) { myCanvasViews.append(theView); }
64 void removeView(QxGraph_CanvasView* theView) { myCanvasViews.remove(theView); }
66 QxGraph_CanvasView* getCurrentView() const { return myCurrentView; }
67 void setCurrentView(QxGraph_CanvasView* theView) { myCurrentView = theView; }
68 void setCurrentView(int theIndex);
71 void initView(QxGraph_ViewWindow* view);
75 void onChangeBgColor();
78 QxGraph_Canvas* myCanvas;
79 //QPtrList<QxGraph_Canvas> myCanvases;
80 QPtrList<QxGraph_CanvasView> myCanvasViews;
82 QxGraph_CanvasView* myCurrentView;