Salome HOME
c9a8865c4e64b761eb1108ccdf10a1f5aa808756
[modules/paravis.git] / src / Plugins / View / MyView.h
1
2 #ifndef _MyView_h
3 #define _MyView_h
4
5 #include "pqView.h"
6 #include <QMap>
7 #include <QColor>
8 class QLabel;
9
10 /// a simple view that shows a QLabel with the display's name in the view
11 class MyView : public pqView
12 {
13   Q_OBJECT
14 public:
15     /// constructor takes a bunch of init stuff and must have this signature to 
16     /// satisfy pqView
17   MyView(const QString& viewtypemodule, 
18          const QString& group, 
19          const QString& name, 
20          vtkSMViewProxy* viewmodule, 
21          pqServer* server, 
22          QObject* p);
23   ~MyView();
24
25   /// don't support save images
26   bool saveImage(int, int, const QString& ) { return false; }
27   vtkImageData* captureImage(int) { return NULL; }
28   vtkImageData* captureImage(const QSize&) { return NULL; }
29
30   /// return the QWidget to give to ParaView's view manager
31   QWidget* getWidget();
32
33   /// returns whether this view can display the given source
34   bool canDisplay(pqOutputPort* opPort) const;
35
36   /// set the background color of this view
37   void setBackground(const QColor& col);
38   QColor background() const;
39
40 protected slots:
41   /// helper slots to create labels
42   void onRepresentationAdded(pqRepresentation*);
43   void onRepresentationRemoved(pqRepresentation*);
44
45 protected:
46
47   QWidget* MyWidget;
48   QMap<pqRepresentation*, QLabel*> Labels;
49
50 };
51
52 #endif // _MyView_h
53