summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/lib/oimagezoomer.h
authorzecke <zecke>2004-04-07 19:13:22 (UTC)
committer zecke <zecke>2004-04-07 19:13:22 (UTC)
commitf8e633dea182beabbb665a25136b43a9dd7d0558 (patch) (side-by-side diff)
tree2bec7c5b73ec358ac44e7158cd4bc3a708521cd2 /noncore/graphics/opie-eye/lib/oimagezoomer.h
parent673b99175f7447cbae8eff237f2f9d07be8e0087 (diff)
downloadopie-f8e633dea182beabbb665a25136b43a9dd7d0558.zip
opie-f8e633dea182beabbb665a25136b43a9dd7d0558.tar.gz
opie-f8e633dea182beabbb665a25136b43a9dd7d0558.tar.bz2
Add the ImageZoomer now alwin connect some signals and slots
Diffstat (limited to 'noncore/graphics/opie-eye/lib/oimagezoomer.h') (more/less context) (ignore whitespace changes)
-rw-r--r--noncore/graphics/opie-eye/lib/oimagezoomer.h66
1 files changed, 66 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/lib/oimagezoomer.h b/noncore/graphics/opie-eye/lib/oimagezoomer.h
new file mode 100644
index 0000000..605416c
--- a/dev/null
+++ b/noncore/graphics/opie-eye/lib/oimagezoomer.h
@@ -0,0 +1,66 @@
+#ifndef OPIE_ODP_IMAGE_ZOOMER_H
+#define OPIE_ODP_IMAGE_ZOOMER_H
+
+#include <qframe.h>
+#include <qimage.h>
+
+class QPixmap;
+class QRect;
+class QPoint;
+
+
+namespace Opie {
+namespace MM {
+
+/**
+ * \brief small class to zoom over a widget
+ * This class takes a QImage or QPixmap
+ * and gets the size of the original image
+ * and provides depending of this widgets size
+ * a zoomer and emits the region which should
+ * be shown / zoomed to
+ */
+class OImageZoomer : public QFrame {
+ Q_OBJECT
+public:
+ OImageZoomer( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ OImageZoomer( const QPixmap&,QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
+ OImageZoomer( const QImage&, QWidget* parent = 0, const char* name= 0, WFlags fl = 0 );
+ OImageZoomer( const QSize&, const QSize&, QWidget* par, const char*, WFlags fl );
+ ~OImageZoomer();
+
+public slots:
+ void setImageSize( const QSize& );
+ void setViewPortSize( const QSize& );
+ void setVisiblePoint( const QPoint& );
+ void setVisiblePoint( int x, int y );
+ void setImage( const QImage& );
+ void setImage( const QPixmap& );
+
+signals:
+ void zoomAreaRel( int,int );
+ void zoomArea( int,int );
+
+public:
+ void resizeEvent( QResizeEvent* );
+
+protected:
+ void drawContents( QPainter* p );
+ void mousePressEvent( QMouseEvent* ev );
+ void mouseMoveEvent( QMouseEvent* ev );
+
+private:
+ void init();
+ QImage m_img;
+ QSize m_imgSize, m_visSize;
+ QPoint m_visPt;
+ int m_mouseX, m_mouseY;
+};
+
+inline void OImageZoomer::setVisiblePoint( int x, int y ) {
+ setVisiblePoint( QPoint( x, y ) );
+}
+
+}
+}
+#endif