summaryrefslogtreecommitdiff
authoralwin <alwin>2004-04-15 07:44:05 (UTC)
committer alwin <alwin>2004-04-15 07:44:05 (UTC)
commit20175bc18b278426c80ff890853cbf54839f88be (patch) (unidiff)
treeabc2943f625238019fa3fe60f822af46f3f91425
parentc2431e77975471a85adf882a7d4642089e2219f4 (diff)
downloadopie-20175bc18b278426c80ff890853cbf54839f88be.zip
opie-20175bc18b278426c80ff890853cbf54839f88be.tar.gz
opie-20175bc18b278426c80ff890853cbf54839f88be.tar.bz2
start of documentation
Diffstat (more/less context) (ignore whitespace changes)
-rw-r--r--libopie2/opiemm/oimagescrollview.h109
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
@@ -1,95 +1,180 @@
1#ifndef _IMAGE_SCROLL_VIEW_H 1#ifndef _IMAGE_SCROLL_VIEW_H
2#define _IMAGE_SCROLL_VIEW_H 2#define _IMAGE_SCROLL_VIEW_H
3 3
4#include <qscrollview.h> 4#include <qscrollview.h>
5#include <qimage.h> 5#include <qimage.h>
6#include <qpixmap.h> 6#include <qpixmap.h>
7#include <qstring.h> 7#include <qstring.h>
8#include <qdialog.h> 8#include <qdialog.h>
9#include <qbitarray.h> 9#include <qbitarray.h>
10 10
11 11
12class QPainter; 12class QPainter;
13 13
14namespace Opie { namespace MM { 14namespace Opie { namespace MM {
15 15
16 class OImageZoomer; 16 class OImageZoomer;
17 17/**
18 * \brief Class displaying an image with scrollbars
19 *
20 * This class displays various image formats supported by QT an
21 * gives a small interface for basics display modifications.
22 *
23 * @see QScrollView
24 *
25 * @since 1.2
26 */
18class OImageScrollView:public QScrollView 27class OImageScrollView:public QScrollView
19{ 28{
20 Q_OBJECT 29 Q_OBJECT
21public: 30public:
22 enum Rotation { 31 enum Rotation {
23 Rotate0, 32 Rotate0,
24 Rotate90, 33 Rotate90,
25 Rotate180, 34 Rotate180,
26 Rotate270 35 Rotate270
27 }; 36 };
28 37
38 /**
39 * Standard constructor
40 * @param parent the parent widget
41 * @param name the name of the widget
42 * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set.
43 */
29 OImageScrollView( QWidget* parent, const char* name = 0, WFlags fl = 0 ); 44 OImageScrollView( QWidget* parent, const char* name = 0, WFlags fl = 0 );
30 OImageScrollView (const QImage&, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); 45 /**
31 OImageScrollView (const QString&, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); 46 * constructor
47 * @param aImage QImage object to display
48 * @param parent the parent widget
49 * @param name the name of the widget
50 * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set.
51 * @param always_scale if the image should be scaled into the display
52 * @param rfit the image will be rotated to fit
53 */
54 OImageScrollView (const QImage&aImage, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false );
55 /**
56 * constructor
57 * @param aFile image file to display
58 * @param parent the parent widget
59 * @param name the name of the widget
60 * @param fl widget flags. The flag Qt::WRepaintNoErase will be always set.
61 * @param always_scale if the image should be scaled into the display
62 * @param rfit the image will be rotated to fit
63 */
64 OImageScrollView (const QString&aFile, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false );
32 virtual ~OImageScrollView(); 65 virtual ~OImageScrollView();
33 66
34 67 /**
68 * sets the WDestructiveClose flag to the view
69 */
35 virtual void setDestructiveClose(); 70 virtual void setDestructiveClose();
36 71
37 virtual void setAutoRotate(bool); 72 /**
38 virtual void setAutoScale(bool); 73 * set if the image should be rotate to best fit
39 virtual void setShowZoomer(bool); 74 * and repaint it if set to a new value.
40 75 *
76 * Be carefull - autorating real large images cost time!
77 * @param how if true then autorotate otherwise not
78 */
79 virtual void setAutoRotate(bool how);
80 /**
81 * set if the image should be scaled to the size of the viewport if larger(!)
82 *
83 * if autoscaling is set when loading a jpeg image, it will use a feature of
84 * jpeg lib to load the image scaled to display size. If switch of later the
85 * image will reloaded.
86 *
87 * @param how true - display image scaled down otherwise not
88 */
89 virtual void setAutoScale(bool how);
90 /**
91 * set if there should be displayed a small zoomer widget at the right bottom of
92 * the view when the image is larger than the viewport.
93 *
94 * @param how true - display zoomer
95 */
96 virtual void setShowZoomer(bool how);
97
98 /**
99 * return the current value of the autorotate flag.
100 */
41 virtual bool AutoRotate()const; 101 virtual bool AutoRotate()const;
102 /**
103 * return the current value of the autoscale flag.
104 */
42 virtual bool AutoScale()const; 105 virtual bool AutoScale()const;
106 /**
107 * return the current value of the show zoomer flag.
108 */
43 virtual bool ShowZoomer()const; 109 virtual bool ShowZoomer()const;
44 110
45public slots: 111public slots:
46 virtual void setImage(const QImage&); 112 /**
113 * Displays a new image, calculations will made immediately.
114 *
115 * @param aImage the image to display
116 */
117 virtual void setImage(const QImage&aImage);
118 /**
119 * Displays a new image, calculations will made immediately.
120 *
121 * @param path the image to display
122 */
47 virtual void setImage( const QString& path ); 123 virtual void setImage( const QString& path );
48 124
49 125
50signals: 126signals:
127 /**
128 * emitted when the display image size has changed.
129 */
51 void imageSizeChanged( const QSize& ); 130 void imageSizeChanged( const QSize& );
131 /**
132 * emitted when the size of the viewport has changed, eg. in resizeEvent of
133 * the view.
134 *
135 * @see QWidget::resizeEvent
136 */
52 void viewportSizeChanged( const QSize& ); 137 void viewportSizeChanged( const QSize& );
53 138
54protected: 139protected:
55 virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph ); 140 virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph );
56 void init(); 141 void init();
57 142
58 Opie::MM::OImageZoomer *_zoomer; 143 Opie::MM::OImageZoomer *_zoomer;
59 QImage _image_data; 144 QImage _image_data;
60 QImage _original_data; 145 QImage _original_data;
61 QPixmap _pdata; 146 QPixmap _pdata;
62 147
63 int _mouseStartPosX,_mouseStartPosY; 148 int _mouseStartPosX,_mouseStartPosY;
64 149
65 QBitArray m_states; 150 QBitArray m_states;
66 151
67 Rotation m_last_rot; 152 Rotation m_last_rot;
68 QString m_lastName; 153 QString m_lastName;
69 virtual void rescaleImage(int w, int h); 154 virtual void rescaleImage(int w, int h);
70 155
71 virtual void rotate_into_data(Rotation r); 156 virtual void rotate_into_data(Rotation r);
72 virtual void generateImage(); 157 virtual void generateImage();
73 virtual void loadJpeg(bool interncall = false); 158 virtual void loadJpeg(bool interncall = false);
74 bool image_fit_into(const QSize&s); 159 bool image_fit_into(const QSize&s);
75 void check_zoomer(); 160 void check_zoomer();
76 161
77 /* internal bitset manipulation */ 162 /* internal bitset manipulation */
78 virtual bool ImageIsJpeg()const; 163 virtual bool ImageIsJpeg()const;
79 virtual void setImageIsJpeg(bool how); 164 virtual void setImageIsJpeg(bool how);
80 virtual bool ImageScaledLoaded()const; 165 virtual bool ImageScaledLoaded()const;
81 virtual void setImageScaledLoaded(bool how); 166 virtual void setImageScaledLoaded(bool how);
82 virtual bool FirstResizeDone()const; 167 virtual bool FirstResizeDone()const;
83 virtual void setFirstResizeDone(bool how); 168 virtual void setFirstResizeDone(bool how);
84 169
85protected slots: 170protected slots:
86 virtual void viewportMouseMoveEvent(QMouseEvent* e); 171 virtual void viewportMouseMoveEvent(QMouseEvent* e);
87 virtual void contentsMousePressEvent ( QMouseEvent * e); 172 virtual void contentsMousePressEvent ( QMouseEvent * e);
88 virtual void resizeEvent(QResizeEvent * e); 173 virtual void resizeEvent(QResizeEvent * e);
89 virtual void keyPressEvent(QKeyEvent * e); 174 virtual void keyPressEvent(QKeyEvent * e);
90}; 175};
91 176
92} 177}
93} 178}
94 179
95#endif 180#endif