QtiPlot  0.9.8.2
ImageWidget.h
Go to the documentation of this file.
1 /***************************************************************************
2  File : ImageWidget.h
3  Project : QtiPlot
4  --------------------------------------------------------------------
5  Copyright : (C) 2008 - 2010 by Ion Vasilief
6  Email (use @ for *) : ion_vasilief*yahoo.fr
7  Description : A widget displaying images in 2D plots
8 
9  ***************************************************************************/
10 
11 /***************************************************************************
12  * *
13  * This program is free software; you can redistribute it and/or modify *
14  * it under the terms of the GNU General Public License as published by *
15  * the Free Software Foundation; either version 2 of the License, or *
16  * (at your option) any later version. *
17  * *
18  * This program is distributed in the hope that it will be useful, *
19  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
20  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
21  * GNU General Public License for more details. *
22  * *
23  * You should have received a copy of the GNU General Public License *
24  * along with this program; if not, write to the Free Software *
25  * Foundation, Inc., 51 Franklin Street, Fifth Floor, *
26  * Boston, MA 02110-1301 USA *
27  * *
28  ***************************************************************************/
29 #ifndef IMAGEWIDGET_H
30 #define IMAGEWIDGET_H
31 
32 #include <QWidget>
33 #include "FrameWidget.h"
34 
35 class ApplicationWindow;
36 
37 class ImageWidget: public FrameWidget
38 {
39  Q_OBJECT
40 
41 public:
43  ImageWidget(Graph *, const QString& fn = QString::null);
45  ImageWidget(Graph *, const QImage& image);
46 
48  QPixmap pixmap() const {return d_pix;};
49  void setPixmap(const QPixmap&);
50 
52  bool load(const QString& fn, bool update = true);
54  QString fileName(){return d_file_name;};
55 
56  bool saveInternally(){return d_save_xpm;};
57  void setSaveInternally(bool save = true){d_save_xpm = save;};
58 
59  void print(QPainter *p, const QwtScaleMap map[QwtPlot::axisCnt]);
60  virtual QString saveToString();
61 
62  void clone(ImageWidget* t);
63  static void restore(Graph *g, const QStringList& lst);
64 
66  QString windowName(){return d_window_name;};
67  void setWindowName(const QString& name){d_window_name = name;};
68 
69  static QPixmap windowPixmap(ApplicationWindow *mw, const QString& name, const QSize& size);
70 
71 private:
72  void draw(QPainter *painter, const QRect& r);
73  void paintEvent(QPaintEvent *e);
74  QPixmap d_pix;
76  QString d_file_name;
78  bool d_save_xpm;
80  QString d_window_name;
81 };
82 
83 #endif