author | alwin <alwin> | 2004-04-14 20:50:42 (UTC) |
---|---|---|
committer | alwin <alwin> | 2004-04-14 20:50:42 (UTC) |
commit | fe6808b41795d1b6000932bf84d74dbd24c4ed95 (patch) (unidiff) | |
tree | aa351edbbd788708629cf4ad45f617e891c534a6 /libopie2/opiemm/oimagescrollview.h | |
parent | a9c1e1a5903f4cf21bcbd5ffd1df46c8211ca502 (diff) | |
download | opie-fe6808b41795d1b6000932bf84d74dbd24c4ed95.zip opie-fe6808b41795d1b6000932bf84d74dbd24c4ed95.tar.gz opie-fe6808b41795d1b6000932bf84d74dbd24c4ed95.tar.bz2 |
added the image-display widgets to lib 'cause it may used in other
applications
ToDo: Interface description
Diffstat (limited to 'libopie2/opiemm/oimagescrollview.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | libopie2/opiemm/oimagescrollview.h | 95 |
1 files changed, 95 insertions, 0 deletions
diff --git a/libopie2/opiemm/oimagescrollview.h b/libopie2/opiemm/oimagescrollview.h new file mode 100644 index 0000000..3d2ea38 --- a/dev/null +++ b/libopie2/opiemm/oimagescrollview.h | |||
@@ -0,0 +1,95 @@ | |||
1 | #ifndef _IMAGE_SCROLL_VIEW_H | ||
2 | #define _IMAGE_SCROLL_VIEW_H | ||
3 | |||
4 | #include <qscrollview.h> | ||
5 | #include <qimage.h> | ||
6 | #include <qpixmap.h> | ||
7 | #include <qstring.h> | ||
8 | #include <qdialog.h> | ||
9 | #include <qbitarray.h> | ||
10 | |||
11 | |||
12 | class QPainter; | ||
13 | |||
14 | namespace Opie { namespace MM { | ||
15 | |||
16 | class OImageZoomer; | ||
17 | |||
18 | class OImageScrollView:public QScrollView | ||
19 | { | ||
20 | Q_OBJECT | ||
21 | public: | ||
22 | enum Rotation { | ||
23 | Rotate0, | ||
24 | Rotate90, | ||
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 | |||
34 | |||
35 | virtual void setDestructiveClose(); | ||
36 | |||
37 | virtual void setAutoRotate(bool); | ||
38 | virtual void setAutoScale(bool); | ||
39 | virtual void setShowZoomer(bool); | ||
40 | |||
41 | virtual bool AutoRotate()const; | ||
42 | virtual bool AutoScale()const; | ||
43 | virtual bool ShowZoomer()const; | ||
44 | |||
45 | public slots: | ||
46 | virtual void setImage(const QImage&); | ||
47 | virtual void setImage( const QString& path ); | ||
48 | |||
49 | |||
50 | signals: | ||
51 | void imageSizeChanged( const QSize& ); | ||
52 | void viewportSizeChanged( const QSize& ); | ||
53 | |||
54 | protected: | ||
55 | virtual void drawContents ( QPainter * p, int clipx, int clipy, int clipw, int cliph ); | ||
56 | void init(); | ||
57 | |||
58 | Opie::MM::OImageZoomer *_zoomer; | ||
59 | QImage _image_data; | ||
60 | QImage _original_data; | ||
61 | QPixmap _pdata; | ||
62 | |||
63 | int _mouseStartPosX,_mouseStartPosY; | ||
64 | |||
65 | QBitArray m_states; | ||
66 | |||
67 | Rotation m_last_rot; | ||
68 | QString m_lastName; | ||
69 | virtual void rescaleImage(int w, int h); | ||
70 | |||
71 | virtual void rotate_into_data(Rotation r); | ||
72 | virtual void generateImage(); | ||
73 | virtual void loadJpeg(bool interncall = false); | ||
74 | bool image_fit_into(const QSize&s); | ||
75 | void check_zoomer(); | ||
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 | |||
85 | protected slots: | ||
86 | virtual void viewportMouseMoveEvent(QMouseEvent* e); | ||
87 | virtual void contentsMousePressEvent ( QMouseEvent * e); | ||
88 | virtual void resizeEvent(QResizeEvent * e); | ||
89 | virtual void keyPressEvent(QKeyEvent * e); | ||
90 | }; | ||
91 | |||
92 | } | ||
93 | } | ||
94 | |||
95 | #endif | ||