author | alwin <alwin> | 2004-04-15 07:44:05 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-15 07:44:05 (UTC) |
commit | 20175bc18b278426c80ff890853cbf54839f88be (patch) (side-by-side diff) | |
tree | abc2943f625238019fa3fe60f822af46f3f91425 /libopie2/opiemm/oimagescrollview.h | |
parent | c2431e77975471a85adf882a7d4642089e2219f4 (diff) | |
download | opie-20175bc18b278426c80ff890853cbf54839f88be.zip opie-20175bc18b278426c80ff890853cbf54839f88be.tar.gz opie-20175bc18b278426c80ff890853cbf54839f88be.tar.bz2 |
start of documentation
Diffstat (limited to 'libopie2/opiemm/oimagescrollview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiemm/oimagescrollview.h | 109 |
1 files changed, 97 insertions, 12 deletions
diff --git a/libopie2/opiemm/oimagescrollview.h b/libopie2/opiemm/oimagescrollview.h index 3d2ea38..94fddb6 100644 --- a/libopie2/opiemm/oimagescrollview.h +++ b/libopie2/opiemm/oimagescrollview.h @@ -2,62 +2,147 @@ #define _IMAGE_SCROLL_VIEW_H #include <qscrollview.h> #include <qimage.h> #include <qpixmap.h> #include <qstring.h> #include <qdialog.h> #include <qbitarray.h> class QPainter; -namespace Opie { namespace MM { - - class OImageZoomer; - +namespace Opie { namespace MM { + + class OImageZoomer; +/** + * \brief Class displaying an image with scrollbars + * + * This class displays various image formats supported by QT an + * gives a small interface for basics display modifications. + * + * @see QScrollView + * + * @since 1.2 + */ class OImageScrollView:public QScrollView { Q_OBJECT public: enum Rotation { Rotate0, Rotate90, Rotate180, Rotate270 }; + /** + * Standard constructor + * @param parent the parent widget + * @param name the name of the widget + * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set. + */ 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 ); + /** + * constructor + * @param aImage QImage object to display + * @param parent the parent widget + * @param name the name of the widget + * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set. + * @param always_scale if the image should be scaled into the display + * @param rfit the image will be rotated to fit + */ + OImageScrollView (const QImage&aImage, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); + /** + * constructor + * @param aFile image file to display + * @param parent the parent widget + * @param name the name of the widget + * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set. + * @param always_scale if the image should be scaled into the display + * @param rfit the image will be rotated to fit + */ + OImageScrollView (const QString&aFile, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); virtual ~OImageScrollView(); - + /** + * sets the WDestructiveClose flag to the view + */ virtual void setDestructiveClose(); - virtual void setAutoRotate(bool); - virtual void setAutoScale(bool); - virtual void setShowZoomer(bool); - + /** + * set if the image should be rotate to best fit + * and repaint it if set to a new value. + * + * Be carefull - autorating real large images cost time! + * @param how if true then autorotate otherwise not + */ + virtual void setAutoRotate(bool how); + /** + * set if the image should be scaled to the size of the viewport if larger(!) + * + * if autoscaling is set when loading a jpeg image, it will use a feature of + * jpeg lib to load the image scaled to display size. If switch of later the + * image will reloaded. + * + * @param how true - display image scaled down otherwise not + */ + virtual void setAutoScale(bool how); + /** + * set if there should be displayed a small zoomer widget at the right bottom of + * the view when the image is larger than the viewport. + * + * @param how true - display zoomer + */ + virtual void setShowZoomer(bool how); + + /** + * return the current value of the autorotate flag. + */ virtual bool AutoRotate()const; + /** + * return the current value of the autoscale flag. + */ virtual bool AutoScale()const; + /** + * return the current value of the show zoomer flag. + */ virtual bool ShowZoomer()const; public slots: - virtual void setImage(const QImage&); + /** + * Displays a new image, calculations will made immediately. + * + * @param aImage the image to display + */ + virtual void setImage(const QImage&aImage); + /** + * Displays a new image, calculations will made immediately. + * + * @param path the image to display + */ virtual void setImage( const QString& path ); signals: + /** + * emitted when the display image size has changed. + */ void imageSizeChanged( const QSize& ); + /** + * emitted when the size of the viewport has changed, eg. in resizeEvent of + * the view. + * + * @see QWidget::resizeEvent + */ 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; |