Salome HOME
Join modifications from BR_Dev_For_4_0 tag V4_1_1.
[modules/gui.git] / src / Plot2d / Plot2d_ViewWindow.h
1 // Copyright (C) 2005  OPEN CASCADE, CEA/DEN, EDF R&D, PRINCIPIA R&D
2 // 
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either 
6 // version 2.1 of the License.
7 // 
8 // This library is distributed in the hope that it will be useful 
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of 
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU 
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public  
14 // License along with this library; if not, write to the Free Software 
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 #ifndef PLOT2D_VIEWWINDOW_H
20 #define PLOT2D_VIEWWINDOW_H
21
22 #include "Plot2d.h"
23 #include <SUIT_ViewWindow.h>
24
25 #include <qimage.h>
26
27 #ifdef WIN32
28 #pragma warning( disable:4251 )
29 #endif
30
31 class SUIT_Desktop;
32 class Plot2d_Viewer;
33 class Plot2d_ViewFrame;
34 class QtxAction;
35 class SUIT_ToolButton;
36
37 class PLOT2D_EXPORT Plot2d_ViewWindow : public SUIT_ViewWindow  
38 {
39   Q_OBJECT
40
41 public:
42   Plot2d_ViewWindow( SUIT_Desktop* theDesktop, Plot2d_Viewer* theModel );
43   virtual ~Plot2d_ViewWindow();
44
45   Plot2d_Viewer*    getModel() { return myModel; }
46   void              putInfo(QString theMsg);
47   Plot2d_ViewFrame* getViewFrame() { return myViewFrame; };
48   QToolBar*         getToolBar() { return myToolBar; };
49   void              contextMenuPopup( QPopupMenu* thePopup );
50
51   virtual QString   getVisualParameters();
52   virtual void      setVisualParameters( const QString& parameters );
53   
54   virtual void      RefreshDumpImage();
55
56 protected:
57   virtual QImage    dumpView();
58   virtual QString   filter() const;
59   virtual bool      dumpViewToFormat( const QImage&, const QString& fileName, const QString& format );
60
61 private:
62   bool eventFilter(QObject* watched, QEvent* e);
63
64   void createActions();
65   void createToolBar();
66
67 public slots:
68   void onChangeHorMode();
69   void onChangeVerMode();
70   void onChangeCurveMode();
71   void onChangeLegendMode();
72   
73   void onFitAll();
74   void onFitRect();
75   void onZoom();
76   void onPanning();
77   void onGlobalPanning();
78   void onViewHorMode();
79   void onViewVerMode();
80   void onLegend();
81   void onCurves();
82
83   void onDumpView();
84
85 signals:
86   void cloneView();
87
88 protected:
89   enum { DumpId, FitAllId, FitRectId, ZoomId, PanId, GlobalPanId, HorId,
90          VerId, LegendId, CurvPointsId, CurvLinesId, CurvSplinesId, CurvSettingsId, CloneId,
91          PModeXLinearId, PModeXLogarithmicId, PModeYLinearId, PModeYLogarithmicId };
92   typedef QMap<int, QtxAction*> ActionsMap;
93   ActionsMap        myActionsMap;
94
95 private:
96   Plot2d_Viewer*    myModel;
97   Plot2d_ViewFrame* myViewFrame;
98   QToolBar*         myToolBar;
99
100   SUIT_ToolButton*  myCurveBtn;
101
102   QImage myDumpImage;
103 };
104
105 #ifdef WIN32
106 #pragma warning( default:4251 )
107 #endif
108
109 #endif