Diffstat (limited to 'noncore/graphics/opie-eye/lib/oimagezoomer.cpp') (more/less context) (ignore whitespace changes)
-rw-r--r-- | noncore/graphics/opie-eye/lib/oimagezoomer.cpp | 90 |
1 files changed, 90 insertions, 0 deletions
diff --git a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp b/noncore/graphics/opie-eye/lib/oimagezoomer.cpp index ffa3c0c..4df5dcc 100644 --- a/noncore/graphics/opie-eye/lib/oimagezoomer.cpp +++ b/noncore/graphics/opie-eye/lib/oimagezoomer.cpp | |||
@@ -9,23 +9,78 @@ | |||
9 | 9 | ||
10 | namespace Opie { | 10 | namespace Opie { |
11 | namespace MM { | 11 | namespace MM { |
12 | |||
13 | /** | ||
14 | * \brief The most simple c'tor | ||
15 | * The main c'tor. You still need to set a QPixmap/QIMage, | ||
16 | * setImageSize,setViewPortSize,setVisiblePoint | ||
17 | * | ||
18 | * @param parent The parent widget | ||
19 | * @param name A name for this widget | ||
20 | * @param fl The widget flags | ||
21 | * | ||
22 | */ | ||
12 | OImageZoomer::OImageZoomer( QWidget* parent, const char* name, WFlags fl ) | 23 | OImageZoomer::OImageZoomer( QWidget* parent, const char* name, WFlags fl ) |
13 | : QFrame( parent, name, fl ) { | 24 | : QFrame( parent, name, fl ) { |
14 | init(); | 25 | init(); |
15 | } | 26 | } |
16 | 27 | ||
28 | |||
29 | /** | ||
30 | * \brief This c'tor takes a QPixmap additional | ||
31 | * | ||
32 | * You initially set the QPixmap but you still need to provide | ||
33 | * the additional data to make this widget useful | ||
34 | * | ||
35 | * @param pix A Pixmap it'll be converted to a QImage later! | ||
36 | * @param par The parent widget | ||
37 | * @param name The name of this widget | ||
38 | * @param fl The widget flags | ||
39 | */ | ||
17 | OImageZoomer::OImageZoomer( const QPixmap& pix, QWidget* par, const char* name, WFlags fl ) | 40 | OImageZoomer::OImageZoomer( const QPixmap& pix, QWidget* par, const char* name, WFlags fl ) |
18 | : QFrame( par, name, fl ) { | 41 | : QFrame( par, name, fl ) { |
19 | init(); | 42 | init(); |
20 | setImage( pix ); | 43 | setImage( pix ); |
21 | } | 44 | } |
22 | 45 | ||
46 | |||
47 | /** | ||
48 | * \brief This c'tor takes a QImage instead | ||
49 | * You just provide a QImage which is saved. It behaves the same as the others. | ||
50 | * | ||
51 | * @param img A Image which will be used for the zoomer content | ||
52 | * @param par The parent of the widget | ||
53 | * @param name The name of the widget | ||
54 | * @param fl The widgets flags | ||
55 | */ | ||
56 | OImageZoomer::OImageZoomer( const QImage& img, QWidget* par, const char* name, WFlags fl) | ||
57 | : QFrame( par, name, fl ) { | ||
58 | init(); | ||
59 | setImage( img ); | ||
60 | } | ||
61 | |||
62 | |||
63 | /** | ||
64 | * \brief overloaded c'tor | ||
65 | * | ||
66 | * This differs only in the arguments it takes | ||
67 | * | ||
68 | * | ||
69 | * @param pSize The size of the Page you show | ||
70 | * @param vSize The size of the viewport. The size of the visible part of the widget | ||
71 | * @param par The parent of the widget | ||
72 | * @param name The name | ||
73 | * @param fl The window flags | ||
74 | */ | ||
23 | OImageZoomer::OImageZoomer( const QSize& pSize, const QSize& vSize, QWidget* par, | 75 | OImageZoomer::OImageZoomer( const QSize& pSize, const QSize& vSize, QWidget* par, |
24 | const char* name, WFlags fl ) | 76 | const char* name, WFlags fl ) |
25 | : QFrame( par, name, fl ), m_imgSize( pSize ),m_visSize( vSize ) { | 77 | : QFrame( par, name, fl ), m_imgSize( pSize ),m_visSize( vSize ) { |
26 | init(); | 78 | init(); |
27 | } | 79 | } |
28 | 80 | ||
81 | /** | ||
82 | * d'tor | ||
83 | */ | ||
29 | OImageZoomer::~OImageZoomer() { | 84 | OImageZoomer::~OImageZoomer() { |
30 | 85 | ||
31 | } | 86 | } |
@@ -34,26 +89,61 @@ void OImageZoomer::init() { | |||
34 | setFrameStyle( Panel | Sunken ); | 89 | setFrameStyle( Panel | Sunken ); |
35 | } | 90 | } |
36 | 91 | ||
92 | |||
93 | /** | ||
94 | * \brief set the page/image size | ||
95 | * Tell us the QSize of the Data you show to the user. We need this | ||
96 | * to do the calculations | ||
97 | * | ||
98 | * @param size The size of the stuff you want to zoom on | ||
99 | */ | ||
37 | void OImageZoomer::setImageSize( const QSize& size ) { | 100 | void OImageZoomer::setImageSize( const QSize& size ) { |
38 | m_imgSize = size; | 101 | m_imgSize = size; |
39 | repaint(); | 102 | repaint(); |
40 | } | 103 | } |
104 | |||
105 | /** | ||
106 | * \brief Set the size of the viewport | ||
107 | * Tell us the QSize of the viewport. The viewport is the part | ||
108 | * of the widget which is exposed on the screen | ||
109 | * | ||
110 | * @param size Te size of the viewport | ||
111 | * | ||
112 | * @see QScrollView::viewport() | ||
113 | */ | ||
41 | void OImageZoomer::setViewPortSize( const QSize& size ) { | 114 | void OImageZoomer::setViewPortSize( const QSize& size ) { |
42 | m_visSize = size; | 115 | m_visSize = size; |
43 | repaint(); | 116 | repaint(); |
44 | } | 117 | } |
45 | 118 | ||
119 | /** | ||
120 | * \brief the point in the topleft corner which is currently visible | ||
121 | * Set the visible point. This most of the times relate to QScrollView::contentsX() | ||
122 | * and QScrollView::contentsY() | ||
123 | * | ||
124 | * @see setVisiblePoint(int,int) | ||
125 | */ | ||
46 | void OImageZoomer::setVisiblePoint( const QPoint& pt ) { | 126 | void OImageZoomer::setVisiblePoint( const QPoint& pt ) { |
47 | m_visPt = pt; | 127 | m_visPt = pt; |
48 | repaint(); | 128 | repaint(); |
49 | } | 129 | } |
50 | 130 | ||
131 | |||
132 | /** | ||
133 | * Set the Image. The image will be resized on resizeEvent | ||
134 | * and it'll set the QPixmap background | ||
135 | * | ||
136 | * @param img The image will be stored internally and used as the background | ||
137 | */ | ||
51 | void OImageZoomer::setImage( const QImage& img) { | 138 | void OImageZoomer::setImage( const QImage& img) { |
52 | m_img = img; | 139 | m_img = img; |
53 | resizeEvent( 0 ); | 140 | resizeEvent( 0 ); |
54 | repaint(); | 141 | repaint(); |
55 | } | 142 | } |
56 | 143 | ||
144 | /** | ||
145 | * overloaded function it calls the QImage version | ||
146 | */ | ||
57 | void OImageZoomer::setImage( const QPixmap& pix) { | 147 | void OImageZoomer::setImage( const QPixmap& pix) { |
58 | setImage( pix.convertToImage() ); | 148 | setImage( pix.convertToImage() ); |
59 | } | 149 | } |