-rw-r--r-- | libopie2/opiemm/oimagescrollview.h | 103 |
1 files changed, 94 insertions, 9 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 | |||
@@ -14,7 +14,16 @@ class QPainter; | |||
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 |
@@ -26,29 +35,105 @@ public: | |||
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: |