From f8e633dea182beabbb665a25136b43a9dd7d0558 Mon Sep 17 00:00:00 2001 From: zecke Date: Wed, 07 Apr 2004 19:13:22 +0000 Subject: Add the ImageZoomer now alwin connect some signals and slots --- (limited to 'noncore/graphics/opie-eye/lib/oimagezoomer.h') 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 +#include + +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 -- cgit v0.9.0.2