~ubuntu-branches/ubuntu/precise/gwenview/precise-proposed

« back to all changes in this revision

Viewing changes to lib/documentview/rasterimageview.h

  • Committer: Package Import Robot
  • Author(s): Jonathan Riddell
  • Date: 2011-12-15 14:17:54 UTC
  • mto: This revision was merged to the branch mainline in revision 12.
  • Revision ID: package-import@ubuntu.com-20111215141754-z043hyx69dulbggf
Tags: upstream-4.7.90
Import upstream version 4.7.90

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// vim: set tabstop=4 shiftwidth=4 expandtab:
 
2
/*
 
3
Gwenview: an image viewer
 
4
Copyright 2011 Aurélien Gâteau <agateau@kde.org>
 
5
 
 
6
This program is free software; you can redistribute it and/or
 
7
modify it under the terms of the GNU General Public License
 
8
as published by the Free Software Foundation; either version 2
 
9
of the License, or (at your option) any later version.
 
10
 
 
11
This program is distributed in the hope that it will be useful,
 
12
but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
GNU General Public License for more details.
 
15
 
 
16
You should have received a copy of the GNU General Public License
 
17
along with this program; if not, write to the Free Software
 
18
Foundation, Inc., 51 Franklin Street, Fifth Floor, Cambridge, MA 02110-1301, USA.
 
19
 
 
20
*/
 
21
#ifndef RASTERIMAGEVIEW_H
 
22
#define RASTERIMAGEVIEW_H
 
23
 
 
24
#include <lib/gwenviewlib_export.h>
 
25
 
 
26
// Local
 
27
#include <lib/documentview/abstractimageview.h>
 
28
 
 
29
// KDE
 
30
 
 
31
class QGraphicsSceneHoverEvent;
 
32
 
 
33
namespace Gwenview
 
34
{
 
35
 
 
36
class AbstractRasterImageViewTool;
 
37
 
 
38
class RasterImageViewPrivate;
 
39
class GWENVIEWLIB_EXPORT RasterImageView : public AbstractImageView
 
40
{
 
41
    Q_OBJECT
 
42
public:
 
43
    enum AlphaBackgroundMode {
 
44
        AlphaBackgroundCheckBoard,
 
45
        AlphaBackgroundSolid
 
46
    };
 
47
 
 
48
    RasterImageView(QGraphicsItem* parent = 0);
 
49
    ~RasterImageView();
 
50
 
 
51
    void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget);
 
52
 
 
53
    void setCurrentTool(AbstractRasterImageViewTool* tool);
 
54
    AbstractRasterImageViewTool* currentTool() const;
 
55
 
 
56
    void setAlphaBackgroundMode(AlphaBackgroundMode mode);
 
57
    void setAlphaBackgroundColor(const QColor& color);
 
58
 
 
59
Q_SIGNALS:
 
60
    void currentToolChanged(AbstractRasterImageViewTool*);
 
61
 
 
62
protected:
 
63
    void loadFromDocument();
 
64
    void onZoomChanged();
 
65
    void onImageOffsetChanged();
 
66
    void onScrollPosChanged(const QPointF& oldPos);
 
67
    void resizeEvent(QGraphicsSceneResizeEvent* event);
 
68
    void mousePressEvent(QGraphicsSceneMouseEvent* event);
 
69
    void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
 
70
    void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
 
71
    void wheelEvent(QGraphicsSceneWheelEvent* event);
 
72
    void keyPressEvent(QKeyEvent* event);
 
73
    void keyReleaseEvent(QKeyEvent* event);
 
74
    void hoverMoveEvent(QGraphicsSceneHoverEvent*);
 
75
 
 
76
private Q_SLOTS:
 
77
    void slotDocumentMetaInfoLoaded();
 
78
    void slotDocumentIsAnimatedUpdated();
 
79
    void finishSetDocument();
 
80
    void updateFromScaler(int, int, const QImage&);
 
81
    void updateImageRect(const QRect& imageRect);
 
82
    void updateBuffer(const QRegion& region = QRegion());
 
83
 
 
84
private:
 
85
    RasterImageViewPrivate* const d;
 
86
};
 
87
 
 
88
} // namespace
 
89
 
 
90
#endif /* RASTERIMAGEVIEW_H */