00001 #ifndef OPIE_ODP_IMAGE_ZOOMER_H
00002 #define OPIE_ODP_IMAGE_ZOOMER_H
00003
00004 #include <qframe.h>
00005 #include <qimage.h>
00006
00007 class QPixmap;
00008 class QRect;
00009 class QPoint;
00010
00011
00012 namespace Opie {
00013 namespace MM {
00014
00040 class OImageZoomer : public QFrame {
00041 Q_OBJECT
00042 public:
00043 OImageZoomer( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00044 OImageZoomer( const QPixmap&,QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
00045 OImageZoomer( const QImage&, QWidget* parent = 0, const char* name= 0, WFlags fl = 0 );
00046 OImageZoomer( const QSize&, const QSize&, QWidget* par, const char*, WFlags fl );
00047 ~OImageZoomer();
00048
00049 public slots:
00050 void setImageSize( const QSize& );
00051 void setViewPortSize( const QSize& );
00052 void setVisiblePoint( const QPoint& );
00053 void setVisiblePoint( int x, int y );
00054 void setImage( const QImage& );
00055 void setImage( const QPixmap& );
00056
00057 signals:
00070 void zoomAreaRel( int x,int y);
00071
00082 void zoomArea( int x,int y);
00083
00084 public:
00089 void resizeEvent( QResizeEvent* );
00090
00091 protected:
00096 void drawContents( QPainter* p );
00097
00102 virtual void mousePressEvent( QMouseEvent* ev );
00107 virtual void mouseMoveEvent( QMouseEvent* ev );
00112 virtual void mouseReleaseEvent( QMouseEvent* ev );
00113
00114 private:
00118 void init();
00119 QImage m_img;
00120 QSize m_imgSize, m_visSize;
00121 QPoint m_visPt;
00122 int m_mouseX, m_mouseY;
00123 bool m_mevent;
00124 };
00125
00135 inline void OImageZoomer::setVisiblePoint( int x, int y ) {
00136 setVisiblePoint( QPoint( x, y ) );
00137 }
00138
00139 }
00140 }
00141 #endif