author | alwin <alwin> | 2004-04-15 07:44:05 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-15 07:44:05 (UTC) |
commit | 20175bc18b278426c80ff890853cbf54839f88be (patch) (unidiff) | |
tree | abc2943f625238019fa3fe60f822af46f3f91425 | |
parent | c2431e77975471a85adf882a7d4642089e2219f4 (diff) | |
download | opie-20175bc18b278426c80ff890853cbf54839f88be.zip opie-20175bc18b278426c80ff890853cbf54839f88be.tar.gz opie-20175bc18b278426c80ff890853cbf54839f88be.tar.bz2 |
start of documentation
-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 | |||
@@ -6,54 +6,139 @@ | |||
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 | ||
12 | class QPainter; | 12 | class QPainter; |
13 | 13 | ||
14 | namespace Opie { namespace MM { | 14 | namespace 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 | */ | ||
18 | class OImageScrollView:public QScrollView | 27 | class OImageScrollView:public QScrollView |
19 | { | 28 | { |
20 | Q_OBJECT | 29 | Q_OBJECT |
21 | public: | 30 | public: |
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 | ||
45 | public slots: | 111 | public 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 | ||
50 | signals: | 126 | signals: |
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 | ||
54 | protected: | 139 | protected: |
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; |