Diffstat (limited to 'noncore/graphics/opie-eye/gui/imagescrollview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/gui/imagescrollview.h | 65 |
1 files changed, 41 insertions, 24 deletions
diff --git a/noncore/graphics/opie-eye/gui/imagescrollview.h b/noncore/graphics/opie-eye/gui/imagescrollview.h index f6e187d..3d2ea38 100644 --- a/noncore/graphics/opie-eye/gui/imagescrollview.h +++ b/noncore/graphics/opie-eye/gui/imagescrollview.h | |||
@@ -1,78 +1,95 @@ | |||
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 <lib/oimagezoomer.h> | ||
5 | |||
6 | #include <qscrollview.h> | 4 | #include <qscrollview.h> |
7 | #include <qimage.h> | 5 | #include <qimage.h> |
8 | #include <qpixmap.h> | 6 | #include <qpixmap.h> |
9 | #include <qstring.h> | 7 | #include <qstring.h> |
10 | #include <qdialog.h> | 8 | #include <qdialog.h> |
11 | 9 | #include <qbitarray.h> | |
12 | 10 | ||
13 | 11 | ||
14 | class QPainter; | 12 | class QPainter; |
15 | 13 | ||
16 | class ImageScrollView:public QScrollView | 14 | namespace Opie { namespace MM { |
15 | |||
16 | class OImageZoomer; | ||
17 | |||
18 | class OImageScrollView:public QScrollView | ||
17 | { | 19 | { |
18 | Q_OBJECT | 20 | Q_OBJECT |
19 | public: | 21 | public: |
20 | ImageScrollView( QWidget* parent, const char* name = 0, WFlags fl = 0 ); | 22 | enum Rotation { |
21 | ImageScrollView (const QImage&, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); | 23 | Rotate0, |
22 | ImageScrollView (const QString&, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); | 24 | Rotate90, |
23 | virtual ~ImageScrollView(); | 25 | Rotate180, |
26 | Rotate270 | ||
27 | }; | ||
28 | |||
29 | 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 ); | ||
31 | OImageScrollView (const QString&, QWidget * parent=0, const char * name=0, WFlags f=0,bool always_scale=false,bool rfit=false ); | ||
32 | virtual ~OImageScrollView(); | ||
33 | |||
24 | 34 | ||
25 | virtual void setImage(const QImage&); | ||
26 | virtual void setImage( const QString& path ); | ||
27 | virtual void setDestructiveClose(); | 35 | virtual void setDestructiveClose(); |
28 | 36 | ||
29 | virtual void setAutoRotate(bool); | 37 | virtual void setAutoRotate(bool); |
30 | virtual void setAutoScale(bool); | 38 | virtual void setAutoScale(bool); |
31 | virtual void setShowZoomer(bool); | 39 | virtual void setShowZoomer(bool); |
32 | 40 | ||
33 | enum Rotation { | 41 | virtual bool AutoRotate()const; |
34 | Rotate0, | 42 | virtual bool AutoScale()const; |
35 | Rotate90, | 43 | virtual bool ShowZoomer()const; |
36 | Rotate180, | 44 | |
37 | Rotate270 | 45 | public slots: |
38 | }; | 46 | virtual void setImage(const QImage&); |
47 | virtual void setImage( const QString& path ); | ||
48 | |||
39 | 49 | ||
40 | signals: | 50 | signals: |
41 | void sig_return(); | ||
42 | void imageSizeChanged( const QSize& ); | 51 | void imageSizeChanged( const QSize& ); |
43 | void viewportSizeChanged( const QSize& ); | 52 | void viewportSizeChanged( const QSize& ); |
44 | 53 | ||
45 | protected: | 54 | protected: |
46 | virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph ); | 55 | virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph ); |
47 | void init(); | 56 | void init(); |
48 | 57 | ||
49 | Opie::MM::OImageZoomer *_zoomer; | 58 | Opie::MM::OImageZoomer *_zoomer; |
50 | QImage _image_data; | 59 | QImage _image_data; |
51 | QImage _original_data; | 60 | QImage _original_data; |
52 | QPixmap _pdata; | 61 | QPixmap _pdata; |
53 | 62 | ||
54 | int _mouseStartPosX,_mouseStartPosY; | 63 | int _mouseStartPosX,_mouseStartPosY; |
55 | 64 | ||
56 | bool scale_to_fit; | 65 | QBitArray m_states; |
57 | bool rotate_to_fit; | 66 | |
58 | bool show_zoomer; | 67 | Rotation m_last_rot; |
59 | bool first_resize_done; | ||
60 | bool image_is_jpeg; | ||
61 | bool image_scaled_loaded; | ||
62 | Rotation last_rot; | ||
63 | QString m_lastName; | 68 | QString m_lastName; |
64 | virtual void rescaleImage(int w, int h); | 69 | virtual void rescaleImage(int w, int h); |
65 | 70 | ||
66 | virtual void rotate_into_data(Rotation r); | 71 | virtual void rotate_into_data(Rotation r); |
67 | virtual void generateImage(); | 72 | virtual void generateImage(); |
68 | virtual void loadJpeg(bool interncall = false); | 73 | virtual void loadJpeg(bool interncall = false); |
69 | bool image_fit_into(const QSize&s); | 74 | bool image_fit_into(const QSize&s); |
70 | void check_zoomer(); | 75 | void check_zoomer(); |
71 | 76 | ||
77 | /* internal bitset manipulation */ | ||
78 | virtual bool ImageIsJpeg()const; | ||
79 | virtual void setImageIsJpeg(bool how); | ||
80 | virtual bool ImageScaledLoaded()const; | ||
81 | virtual void setImageScaledLoaded(bool how); | ||
82 | virtual bool FirstResizeDone()const; | ||
83 | virtual void setFirstResizeDone(bool how); | ||
84 | |||
72 | protected slots: | 85 | protected slots: |
73 | virtual void viewportMouseMoveEvent(QMouseEvent* e); | 86 | virtual void viewportMouseMoveEvent(QMouseEvent* e); |
74 | virtual void contentsMousePressEvent ( QMouseEvent * e); | 87 | virtual void contentsMousePressEvent ( QMouseEvent * e); |
75 | virtual void resizeEvent(QResizeEvent * e); | 88 | virtual void resizeEvent(QResizeEvent * e); |
76 | virtual void keyPressEvent(QKeyEvent * e); | 89 | virtual void keyPressEvent(QKeyEvent * e); |
77 | }; | 90 | }; |
91 | |||
92 | } | ||
93 | } | ||
94 | |||
78 | #endif | 95 | #endif |