summaryrefslogtreecommitdiff
path: root/noncore/graphics/opie-eye/lib/oimagezoomer.h
Unidiff
Diffstat (limited to 'noncore/graphics/opie-eye/lib/oimagezoomer.h') (more/less context) (show 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 @@
1#ifndef OPIE_ODP_IMAGE_ZOOMER_H
2#define OPIE_ODP_IMAGE_ZOOMER_H
3
4#include <qframe.h>
5#include <qimage.h>
6
7class QPixmap;
8class QRect;
9class QPoint;
10
11
12namespace Opie {
13namespace MM {
14
15/**
16 * \brief small class to zoom over a widget
17 * This class takes a QImage or QPixmap
18 * and gets the size of the original image
19 * and provides depending of this widgets size
20 * a zoomer and emits the region which should
21 * be shown / zoomed to
22 */
23class OImageZoomer : public QFrame {
24 Q_OBJECT
25public:
26 OImageZoomer( QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
27 OImageZoomer( const QPixmap&,QWidget* parent = 0, const char* name = 0, WFlags fl = 0 );
28 OImageZoomer( const QImage&, QWidget* parent = 0, const char* name= 0, WFlags fl = 0 );
29 OImageZoomer( const QSize&, const QSize&, QWidget* par, const char*, WFlags fl );
30 ~OImageZoomer();
31
32public slots:
33 void setImageSize( const QSize& );
34 void setViewPortSize( const QSize& );
35 void setVisiblePoint( const QPoint& );
36 void setVisiblePoint( int x, int y );
37 void setImage( const QImage& );
38 void setImage( const QPixmap& );
39
40signals:
41 void zoomAreaRel( int,int );
42 void zoomArea( int,int );
43
44public:
45 void resizeEvent( QResizeEvent* );
46
47protected:
48 void drawContents( QPainter* p );
49 void mousePressEvent( QMouseEvent* ev );
50 void mouseMoveEvent( QMouseEvent* ev );
51
52private:
53 void init();
54 QImage m_img;
55 QSize m_imgSize, m_visSize;
56 QPoint m_visPt;
57 int m_mouseX, m_mouseY;
58};
59
60inline void OImageZoomer::setVisiblePoint( int x, int y ) {
61 setVisiblePoint( QPoint( x, y ) );
62}
63
64}
65}
66#endif