SciFigs/ImageWidget.h
Go to the documentation of this file.
00001 /***************************************************************************
00002 **
00003 **  This file is part of SciFigs.
00004 **
00005 **  This library is free software; you can redistribute it and/or
00006 **  modify it under the terms of the GNU Lesser General Public
00007 **  License as published by the Free Software Foundation; either
00008 **  version 2.1 of the License, or (at your option) any later version.
00009 **
00010 **  This file is distributed in the hope that it will be useful, but WITHOUT
00011 **  ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
00012 **  FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
00013 **  License for more details.
00014 **
00015 **  You should have received a copy of the GNU Lesser General Public
00016 **  License along with this library; if not, write to the Free Software
00017 **  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
00018 **
00019 **  See http://www.geopsy.org for more information.
00020 **
00021 **  Created : 2003-08-14
00022 **  Authors :
00023 **    Marc Wathelet
00024 **    Marc Wathelet (ULg, Liège, Belgium)
00025 **    Marc Wathelet (LGIT, Grenoble, France)
00026 **
00027 ***************************************************************************/
00028 
00029 #ifndef IMAGEWIDGET_H
00030 #define IMAGEWIDGET_H
00031 
00032 #include "GraphicObject.h"
00033 
00034 namespace SciFigs {
00035 
00036 class AxisWindow;
00037 class GraphicObjectProperties;
00038 
00039 class SCIFIGS_EXPORT ImageWidget :  public GraphicObject
00040 {
00041   Q_OBJECT
00042   // Compatibility
00043   Q_PROPERTY(QString imageFormat READ dummyPropertyString WRITE setDummyProperty STORED false)
00044   Q_PROPERTY(bool fixedXYRatio READ dummyPropertyInt WRITE setConstantWidthHeightRatio STORED false)
00045 
00046   Q_PROPERTY(QString imageFile READ fileName WRITE setFileName SCRIPTABLE true)
00047 public:
00048   ImageWidget(QWidget * parent=0);
00049   ~ImageWidget();
00050 
00051   virtual const QString& xml_tagName() const {return xmlImageWidgetTag;}
00052   static const QString xmlImageWidgetTag;
00053 
00054   QString fileName() const {return _fileName;}
00055   void setFileName(QString s) {_fileName=s;}
00056 
00057   void loadImage();
00058 
00059   virtual void addProperties(PropertyProxy * pp);
00060   virtual void removeProperties(PropertyProxy * pp);
00061   virtual void properties(PropertyWidget * w) const;
00062   virtual void setProperty(uint wid, int pid, QVariant val);
00063 private:
00064   QImage _trueImage;
00065   QPixmap _pixmap;
00066   QString _fileName;
00067   static uint _category, _tabLink;
00068 
00069   virtual void xml_polish(XML_POLISH_ARGS);
00070   virtual void resizeEvent(QResizeEvent *);
00071   virtual void paintEvent(QPaintEvent * e);
00072   virtual void updateMask();
00073   virtual void paint(QPainter& p, double dotpercm,int w, int h, bool mask);
00074   virtual void update();
00075 };
00076 
00077 } // namespace SciFigs
00078 
00079 #endif // IMAGEWIDGET_H
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Defines