Salome HOME
78c7a62c8c8d949b1adbbb1f0952994be142b2eb
[modules/gui.git] / src / Plot2d / Plot2d_ViewModel.h
1 // Copyright (C) 2007-2013  CEA/DEN, EDF R&D, OPEN CASCADE
2 //
3 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
5 //
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.
10 //
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.
15 //
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
19 //
20 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
21 //
22
23 #if !defined(_PLOT2D_VIEWMODEL_H)
24 #define _PLOT2D_VIEWMODEL_H
25
26 #include "Plot2d.h"
27 #include "SUIT_ViewModel.h"
28 #include <qwt_plot_item.h>
29
30 class SUIT_ViewWindow;
31 class SUIT_Desktop;
32 class Plot2d_ViewFrame;
33 class Plot2d_Prs;
34 class QString;
35 class QMenu;
36
37 class PLOT2D_EXPORT Plot2d_Viewer: public SUIT_ViewModel
38 {
39   Q_OBJECT
40
41 public:
42   static QString Type() { return "Plot2d"; }
43   
44   Plot2d_Viewer(bool theAutoDel = false);
45   ~Plot2d_Viewer();
46
47   virtual void             setViewManager( SUIT_ViewManager* );
48   virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop);
49   virtual QString getType() const { return Type(); }
50   virtual void contextMenuPopup(QMenu*);
51   Plot2d_Prs*  getPrs() const { return myPrs; };
52   void         setPrs(Plot2d_Prs* thePrs);
53   void         update();
54   void         clearPrs();
55   void         setAutoDel(bool theDel);
56   
57 signals:
58   void         viewCloned( SUIT_ViewWindow* );
59
60 protected slots:
61   void         onChangeBgColor();
62   void         onDumpView();
63   void         onShowToolbar();
64   virtual void onCloneView( Plot2d_ViewFrame*, Plot2d_ViewFrame* );
65   virtual void onLegendClicked( QwtPlotItem* );
66
67 private:
68   Plot2d_Prs* myPrs;
69   bool        myAutoDel;
70 };
71
72 #endif // !defined(_PLOT2D_VIEWMODEL_H)
73