From fe6808b41795d1b6000932bf84d74dbd24c4ed95 Mon Sep 17 00:00:00 2001 From: alwin Date: Wed, 14 Apr 2004 20:50:42 +0000 Subject: added the image-display widgets to lib 'cause it may used in other applications ToDo: Interface description --- (limited to 'libopie2/opiemm/oimagescrollview.h') diff --git a/libopie2/opiemm/oimagescrollview.h b/libopie2/opiemm/oimagescrollview.h new file mode 100644 index 0000000..3d2ea38 --- a/dev/null +++ b/libopie2/opiemm/oimagescrollview.h @@ -0,0 +1,95 @@ +#ifndef _IMAGE_SCROLL_VIEW_H +#define _IMAGE_SCROLL_VIEW_H + +#include +#include +#include +#include +#include +#include + + +class QPainter; + +namespace Opie { namespace MM { + + class OImageZoomer; + +class OImageScrollView:public QScrollView +{ + Q_OBJECT +public: + enum Rotation { + Rotate0, + Rotate90, + Rotate180, + Rotate270 + }; + + OImageScrollView( QWidget* parent, const char* name = 0, WFlags fl = 0 ); + OImageScrollView (const QImage&, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); + OImageScrollView (const QString&, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); + virtual ~OImageScrollView(); + + + virtual void setDestructiveClose(); + + virtual void setAutoRotate(bool); + virtual void setAutoScale(bool); + virtual void setShowZoomer(bool); + + virtual bool AutoRotate()const; + virtual bool AutoScale()const; + virtual bool ShowZoomer()const; + +public slots: + virtual void setImage(const QImage&); + virtual void setImage( const QString& path ); + + +signals: + void imageSizeChanged( const QSize& ); + void viewportSizeChanged( const QSize& ); + +protected: + virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph ); + void init(); + + Opie::MM::OImageZoomer *_zoomer; + QImage _image_data; + QImage _original_data; + QPixmap _pdata; + + int _mouseStartPosX,_mouseStartPosY; + + QBitArray m_states; + + Rotation m_last_rot; + QString m_lastName; + virtual void rescaleImage(int w, int h); + + virtual void rotate_into_data(Rotation r); + virtual void generateImage(); + virtual void loadJpeg(bool interncall = false); + bool image_fit_into(const QSize&s); + void check_zoomer(); + + /* internal bitset manipulation */ + virtual bool ImageIsJpeg()const; + virtual void setImageIsJpeg(bool how); + virtual bool ImageScaledLoaded()const; + virtual void setImageScaledLoaded(bool how); + virtual bool FirstResizeDone()const; + virtual void setFirstResizeDone(bool how); + +protected slots: + virtual void viewportMouseMoveEvent(QMouseEvent* e); + virtual void contentsMousePressEvent ( QMouseEvent * e); + virtual void resizeEvent(QResizeEvent * e); + virtual void keyPressEvent(QKeyEvent * e); +}; + +} +} + +#endif -- cgit v0.9.0.2