Scribus
Open source desktop publishing at your fingertips
canvasgesture.h
1 /*
2  For general Scribus (>=1.3.2) copyright and licensing information please refer
3  to the COPYING file provided with the program. Following this notice may exist
4  a copyright and/or license notice that predates the release of Scribus 1.3.2
5  for which a new license (GPL+exception) is in place.
6  */
7 /***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15 
16 
17 
18 #ifndef CANVAS_GESTURE_H
19 #define CANVAS_GESTURE_H
20 
21 #include "scribusapi.h"
22 #include "canvasmode.h"
23 
24 class QDragEnterEvent;
25 class QDragMoveEvent;
26 class QDragLeaveEvent;
27 class QDropEvent;
28 class QEvent;
29 class QInputMethodEvent;
30 class QMouseEvent;
31 class QKeyEvent;
32 class QPainter;
33 
34 class Canvas;
35 struct CanvasViewMode;
36 class ScribusDoc;
37 class ScribusView;
38 
39 
40 
47 class SCRIBUS_API CanvasGesture : public CanvasMode
48 {
49 protected:
50  explicit CanvasGesture (CanvasMode* parent) : CanvasMode(parent->view()), m_delegate(parent) {};
51  explicit CanvasGesture (ScribusView* view) : CanvasMode(view), m_delegate(NULL) {};
52 
53 public:
54  virtual ~CanvasGesture() {}
55  virtual void enterEvent(QEvent * e) { m_delegate->enterEvent(e); }
56  virtual void leaveEvent(QEvent * e) { m_delegate->leaveEvent(e); }
57 
58  virtual void dragEnterEvent(QDragEnterEvent *e) { m_delegate->dragEnterEvent(e); }
59  virtual void dragMoveEvent(QDragMoveEvent *e) { m_delegate->dragMoveEvent(e); }
60  virtual void dragLeaveEvent(QDragLeaveEvent *e) { m_delegate->dragLeaveEvent(e); }
61  virtual void dropEvent(QDropEvent *e) { m_delegate->dropEvent(e); }
62 
63  virtual void mouseDoubleClickEvent(QMouseEvent *m) { m_delegate->mouseDoubleClickEvent(m); }
64  virtual void mouseReleaseEvent(QMouseEvent *m) { m_delegate->mouseReleaseEvent(m); }
65  virtual void mouseMoveEvent(QMouseEvent *m) { m_delegate->mouseMoveEvent(m); }
66  virtual void mousePressEvent(QMouseEvent *m) { m_delegate->mousePressEvent(m); }
67 
68  virtual void keyPressEvent(QKeyEvent *e) { m_delegate->keyPressEvent(e); }
69  virtual void keyReleaseEvent(QKeyEvent *e) { m_delegate->keyReleaseEvent(e); }
70  virtual void inputMethodEvent(QInputMethodEvent *e) { m_delegate->inputMethodEvent(e); }
71 
72  CanvasMode* delegate() { return m_delegate; }
73  void setDelegate(CanvasMode* delegate) { if (delegate) m_delegate = delegate; }
74 
75 protected:
76  CanvasMode* m_delegate;
77 };
78 
79 
80 #endif
virtual CanvasMode * delegate()
Definition: canvasmode.h:145
Definition: canvas.h:80
Definition: canvas.h:49
the Document Class
Definition: scribusdoc.h:90
Definition: canvasmode.h:72
Definition: canvasgesture.h:47
CanvasMode * delegate()
Definition: canvasgesture.h:72
Definition: scribusview.h:87