~ubuntu-branches/ubuntu/intrepid/gwenview/intrepid

« back to all changes in this revision

Viewing changes to gwenview/scrollpixmapview.h

  • Committer: Bazaar Package Importer
  • Author(s): Christopher Martin
  • Date: 2005-04-06 11:33:06 UTC
  • mfrom: (1.2.1 upstream) (2.1.1 warty)
  • Revision ID: james.westby@ubuntu.com-20050406113306-7zovl7z0io5bacpd
Tags: 1.2.0-1
* New upstream release.
  + Fixes crashes when using "Back" to navigate. (Closes: #301811)
* Enable KIPI support.
* Add a doc-base file for the handbook.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/*
2
 
Gwenview - A simple image viewer for KDE
3
 
Copyright (C) 2000-2002 Aur�lien G�teau
4
 
 
5
 
This program is free software; you can redistribute it and/or
6
 
modify it under the terms of the GNU General Public License
7
 
as published by the Free Software Foundation; either version 2
8
 
of the License, or (at your option) any later version.
9
 
 
10
 
This program is distributed in the hope that it will be useful,
11
 
but WITHOUT ANY WARRANTY; without even the implied warranty of
12
 
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13
 
GNU General Public License for more details.
14
 
 
15
 
You should have received a copy of the GNU General Public License
16
 
along with this program; if not, write to the Free Software
17
 
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
18
 
 
19
 
*/
20
 
 
21
 
 
22
 
#ifndef SCROLLPIXMAPVIEW_H
23
 
#define SCROLLPIXMAPVIEW_H
24
 
 
25
 
// Qt includes
26
 
#include <qpixmap.h>
27
 
#include <qscrollview.h>
28
 
 
29
 
class QPainter;
30
 
class QPopupMenu;
31
 
class QMouseEvent;
32
 
class QWheelEvent;
33
 
 
34
 
class KAccel;
35
 
class KAction;
36
 
class KConfig;
37
 
class KToggleAction;
38
 
 
39
 
class GVPixmap;
40
 
 
41
 
class ScrollPixmapView : public QScrollView {
42
 
Q_OBJECT
43
 
public:
44
 
        ScrollPixmapView(QWidget* parent,GVPixmap*,bool);
45
 
        void enableView(bool);
46
 
        void plugActionsToAccel(KAccel*);
47
 
        void readConfig(KConfig* config, const QString& group);
48
 
        void writeConfig(KConfig* config, const QString& group) const;
49
 
        void installRBPopup(QPopupMenu*);
50
 
 
51
 
// Properties
52
 
        double zoom() const { return mZoom; }
53
 
        void setZoom(double zoom);
54
 
        double zoomStep() const { return mZoomStep; }
55
 
        void setZoomStep(double zoom);
56
 
 
57
 
        KToggleAction* autoZoom() const { return mAutoZoom; }
58
 
        KAction* zoomIn() const { return mZoomIn; }
59
 
        KAction* zoomOut() const { return mZoomOut; }
60
 
        KAction* resetZoom() const { return mResetZoom; }
61
 
 
62
 
 
63
 
public slots:
64
 
        void updateView();
65
 
 
66
 
        void slotAutoZoom();
67
 
        void slotZoomIn();
68
 
        void slotZoomOut();
69
 
        void slotResetZoom();
70
 
 
71
 
signals:
72
 
        void selectPrevious();
73
 
        void selectNext();
74
 
        void zoomChanged(double);
75
 
 
76
 
 
77
 
private:
78
 
        GVPixmap* mGVPixmap;
79
 
        QPopupMenu* mPopupMenu;
80
 
 
81
 
// Offset to center images
82
 
        int mXOffset,mYOffset;
83
 
 
84
 
// Zoom info
85
 
        double mZoom;
86
 
        double mOldZoom; // Zoom value before switch to auto zoom
87
 
        double mZoomStep;
88
 
 
89
 
// Drag info
90
 
        bool mDragStarted; // Indicates that the user is scrolling the image by dragging it
91
 
        int mScrollStartX,mScrollStartY;
92
 
 
93
 
// Our actions
94
 
        KToggleAction* mAutoZoom;
95
 
        KAction* mZoomIn;
96
 
        KAction* mZoomOut;
97
 
        KAction* mResetZoom;
98
 
 
99
 
        void updateZoomActions();
100
 
        void updateImageOffset();
101
 
        void updateContentSize();
102
 
        double computeAutoZoomValue() const;
103
 
        
104
 
protected:
105
 
// Overloaded methods
106
 
        void viewportMousePressEvent(QMouseEvent*);
107
 
        void viewportMouseMoveEvent(QMouseEvent*);
108
 
        void wheelEvent(QWheelEvent*);
109
 
        void viewportMouseReleaseEvent(QMouseEvent*);
110
 
        void resizeEvent(QResizeEvent* event);
111
 
        void drawContents(QPainter* p,int clipx,int clipy,int clipw,int cliph);
112
 
};
113
 
 
114
 
 
115
 
#endif