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 #include <lib/renderingintent.h>
29 
30 // KF
31 
32 class QGraphicsSceneHoverEvent;
33 
34 namespace Gwenview
35 {
36 class AbstractRasterImageViewTool;
37 
38 struct RasterImageViewPrivate;
39 class GWENVIEWLIB_EXPORT RasterImageView : public AbstractImageView
40 {
41     Q_OBJECT
42 public:
43     explicit RasterImageView(QGraphicsItem *parent = nullptr);
44     ~RasterImageView() override;
45 
46     void setCurrentTool(AbstractRasterImageViewTool *tool);
47     AbstractRasterImageViewTool *currentTool() const;
48 
49     void setRenderingIntent(const RenderingIntent::Enum &renderingIntent);
50     void resetMonitorICC();
51 
52 Q_SIGNALS:
53     void currentToolChanged(AbstractRasterImageViewTool *);
54     void imageRectUpdated();
55 
56 protected:
57     void loadFromDocument() override;
58     void onZoomChanged() override;
59     void onImageOffsetChanged() override;
60     void onScrollPosChanged(const QPointF &oldPos) override;
61     void mousePressEvent(QGraphicsSceneMouseEvent *event) override;
62     void mouseDoubleClickEvent(QGraphicsSceneMouseEvent *event) override;
63     void mouseMoveEvent(QGraphicsSceneMouseEvent *event) override;
64     void mouseReleaseEvent(QGraphicsSceneMouseEvent *event) override;
65     void wheelEvent(QGraphicsSceneWheelEvent *event) override;
66     void keyPressEvent(QKeyEvent *event) override;
67     void keyReleaseEvent(QKeyEvent *event) override;
68     void hoverMoveEvent(QGraphicsSceneHoverEvent *) override;
69 
70 private Q_SLOTS:
71     void slotDocumentMetaInfoLoaded();
72     void slotDocumentIsAnimatedUpdated();
73     void finishSetDocument();
74 
75 private:
76     RasterImageViewPrivate *const d;
77 };
78 
79 } // namespace
80 
81 #endif /* RASTERIMAGEVIEW_H */
82