00001 #ifndef _IMAGE_SCROLL_VIEW_H
00002 #define _IMAGE_SCROLL_VIEW_H
00003
00004 #include <qscrollview.h>
00005 #include <qimage.h>
00006 #include <qpixmap.h>
00007 #include <qstring.h>
00008 #include <qdialog.h>
00009 #include <qbitarray.h>
00010
00011
00012 class QPainter;
00013
00014 namespace Opie { namespace MM {
00015
00016 class OImageZoomer;
00027 class OImageScrollView:public QScrollView
00028 {
00029 Q_OBJECT
00030 public:
00031 enum Rotation {
00032 Rotate0,
00033 Rotate90,
00034 Rotate180,
00035 Rotate270
00036 };
00037
00044 OImageScrollView( QWidget* parent, const char* name = 0, WFlags fl = 0 );
00054 OImageScrollView (const QImage&aImage, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false );
00064 OImageScrollView (const QString&aFile, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false );
00065 virtual ~OImageScrollView();
00066
00070 virtual void setDestructiveClose();
00071
00079 virtual void setAutoRotate(bool how);
00089 virtual void setAutoScale(bool how);
00102 virtual void setAutoScaleRotate(bool scale, bool rotate);
00109 virtual void setShowZoomer(bool how);
00110
00114 virtual bool AutoRotate()const;
00118 virtual bool AutoScale()const;
00122 virtual bool ShowZoomer()const;
00123
00130 virtual int setIntensity(int value,bool reload=false);
00134 virtual const int Intensity()const;
00135
00136
00137 public slots:
00143 virtual void setImage(const QImage&aImage);
00149 virtual void setImage( const QString& path );
00150
00151
00152 signals:
00156 void imageSizeChanged( const QSize& );
00163 void viewportSizeChanged( const QSize& );
00164
00165 protected:
00166 virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph );
00167 void init();
00168
00169 Opie::MM::OImageZoomer *_zoomer;
00170 QImage _image_data;
00171 QImage _original_data;
00172 QPixmap _pdata;
00173 int _intensity;
00174 bool _newImage;
00175
00176 int _mouseStartPosX,_mouseStartPosY;
00177
00178 QBitArray m_states;
00179
00180 Rotation m_last_rot;
00181 QString m_lastName;
00182 virtual void rescaleImage(int w, int h);
00183
00184 virtual void rotate_into_data(Rotation r);
00185 virtual void generateImage();
00186 virtual void loadJpeg(bool interncall = false);
00187 bool image_fit_into(const QSize&s);
00188 void check_zoomer();
00189
00190
00191 virtual bool ImageIsJpeg()const;
00192 virtual void setImageIsJpeg(bool how);
00193 virtual bool ImageScaledLoaded()const;
00194 virtual void setImageScaledLoaded(bool how);
00195 virtual bool FirstResizeDone()const;
00196 virtual void setFirstResizeDone(bool how);
00197 virtual void apply_gamma(int aValue);
00198
00199 protected slots:
00200 virtual void viewportMouseMoveEvent(QMouseEvent* e);
00201 virtual void contentsMousePressEvent ( QMouseEvent * e);
00202 virtual void resizeEvent(QResizeEvent * e);
00203 virtual void keyPressEvent(QKeyEvent * e);
00204 };
00205
00206 }
00207 }
00208
00209 #endif