author | zecke <zecke> | 2004-04-08 16:54:02 (UTC) |
---|---|---|
committer | zecke <zecke> | 2004-04-08 16:54:02 (UTC) |
commit | c8481d7f647ffdc08005f630263dfc05cfd7b230 (patch) (unidiff) | |
tree | 11ef07353b3d519692ad2691646dcf66193945f2 /noncore/graphics/opie-eye/lib/oimagezoomer.h | |
parent | a9d2fd93bcadce196c0bb9f8d112f849fdfc71ea (diff) | |
download | opie-c8481d7f647ffdc08005f630263dfc05cfd7b230.zip opie-c8481d7f647ffdc08005f630263dfc05cfd7b230.tar.gz opie-c8481d7f647ffdc08005f630263dfc05cfd7b230.tar.bz2 |
Add API comments so we can now move it to OpieMM
Diffstat (limited to 'noncore/graphics/opie-eye/lib/oimagezoomer.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/lib/oimagezoomer.h | 84 |
1 files changed, 76 insertions, 8 deletions
diff --git a/noncore/graphics/opie-eye/lib/oimagezoomer.h b/noncore/graphics/opie-eye/lib/oimagezoomer.h index 605416c..2516c61 100644 --- a/noncore/graphics/opie-eye/lib/oimagezoomer.h +++ b/noncore/graphics/opie-eye/lib/oimagezoomer.h | |||
@@ -13,12 +13,29 @@ namespace Opie { | |||
13 | namespace MM { | 13 | namespace MM { |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * \brief small class to zoom over a widget | 16 | * \brief small class to zoom over a Page |
17 | * This class takes a QImage or QPixmap | 17 | * |
18 | * and gets the size of the original image | 18 | * This class represents your page but smaller. |
19 | * and provides depending of this widgets size | 19 | * It can draw a Rect on top of an Image/Pixmap you supply |
20 | * a zoomer and emits the region which should | 20 | * and you can allow the user easily zooming/moving |
21 | * be shown / zoomed to | 21 | * over your widget. |
22 | * All you need to do is to supply a image/pixmap, the visible size | ||
23 | * and the original image/pixmap size and the current visible top/left | ||
24 | * position. | ||
25 | * | ||
26 | * This Image works perfectly with QScrollView as you can connect | ||
27 | * QScrollView::contentsMoving to setVisiblePoint slot and the zoomAreRel | ||
28 | * to the QScrollView::scrollBy slot. Now you would only need to watch | ||
29 | * the resize event anf give us the new information about QScrollView::viewport | ||
30 | * | ||
31 | * You need to position and set the size of this widget! using setFixedSize() is quite | ||
32 | * a good idea for this widget | ||
33 | * | ||
34 | * @see QScrollView | ||
35 | * @see QScrollView::viewport() | ||
36 | * | ||
37 | * @since 1.2 | ||
38 | * | ||
22 | */ | 39 | */ |
23 | class OImageZoomer : public QFrame { | 40 | class OImageZoomer : public QFrame { |
24 | Q_OBJECT | 41 | Q_OBJECT |
@@ -38,18 +55,60 @@ public slots: | |||
38 | void setImage( const QPixmap& ); | 55 | void setImage( const QPixmap& ); |
39 | 56 | ||
40 | signals: | 57 | signals: |
41 | void zoomAreaRel( int,int ); | 58 | /** |
42 | void zoomArea( int,int ); | 59 | * Relative movement in the coordinates of the viewport |
60 | * This signal can easily be connected to QScrollView::scrollBy. | ||
61 | * This signal is emitted from within the mouseMoveEvent of this widget | ||
62 | * | ||
63 | * | ||
64 | * @param x The way to move relative on the X-Axis | ||
65 | * @param y The way to move relative on the Y-Axis | ||
66 | * | ||
67 | * @see setVisiblePoint | ||
68 | * @see QScrollView::scrollBy | ||
69 | */ | ||
70 | void zoomAreaRel( int x,int y); | ||
71 | |||
72 | /** | ||
73 | * Here you get absolute coordinates. | ||
74 | * This slot will be emitted from within the mouseMoveEvent of this widget. | ||
75 | * So you may not delete this widget | ||
76 | * | ||
77 | * @param x The absolute X Coordinate to scroll to. | ||
78 | * @param y The absolute Y Coordinate to scroll to. | ||
79 | * | ||
80 | */ | ||
81 | void zoomArea( int x,int y); | ||
43 | 82 | ||
44 | public: | 83 | public: |
84 | /** | ||
85 | * make sure to call these if you reimplement | ||
86 | * @internal | ||
87 | */ | ||
45 | void resizeEvent( QResizeEvent* ); | 88 | void resizeEvent( QResizeEvent* ); |
46 | 89 | ||
47 | protected: | 90 | protected: |
91 | /** | ||
92 | * make sure to call these if you reimplement | ||
93 | * @internal | ||
94 | */ | ||
48 | void drawContents( QPainter* p ); | 95 | void drawContents( QPainter* p ); |
96 | |||
97 | /** | ||
98 | * make sure to call these if you reimplememt | ||
99 | * @internal | ||
100 | */ | ||
49 | void mousePressEvent( QMouseEvent* ev ); | 101 | void mousePressEvent( QMouseEvent* ev ); |
102 | /** | ||
103 | * make sure to call these if you reimplement | ||
104 | * @internal | ||
105 | */ | ||
50 | void mouseMoveEvent( QMouseEvent* ev ); | 106 | void mouseMoveEvent( QMouseEvent* ev ); |
51 | 107 | ||
52 | private: | 108 | private: |
109 | /** | ||
110 | * @internal | ||
111 | */ | ||
53 | void init(); | 112 | void init(); |
54 | QImage m_img; | 113 | QImage m_img; |
55 | QSize m_imgSize, m_visSize; | 114 | QSize m_imgSize, m_visSize; |
@@ -57,6 +116,15 @@ private: | |||
57 | int m_mouseX, m_mouseY; | 116 | int m_mouseX, m_mouseY; |
58 | }; | 117 | }; |
59 | 118 | ||
119 | /** | ||
120 | * This slot is present for convience. You can connect the | ||
121 | * QScrollView::contentsMoved to this slot and it calls the QPoint | ||
122 | * version for you | ||
123 | * This realtes to QScrollView::contentsX() and QScrollView::contentsY() | ||
124 | * | ||
125 | * @param x The top left x coordinate | ||
126 | * @param y The top left y coorisnate | ||
127 | */ | ||
60 | inline void OImageZoomer::setVisiblePoint( int x, int y ) { | 128 | inline void OImageZoomer::setVisiblePoint( int x, int y ) { |
61 | setVisiblePoint( QPoint( x, y ) ); | 129 | setVisiblePoint( QPoint( x, y ) ); |
62 | } | 130 | } |