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.
7
/***************************************************************************
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. *
14
***************************************************************************/
18
#ifndef CANVAS_GESTURE_H
19
#define CANVAS_GESTURE_H
21
#include "scribusapi.h"
22
#include "canvasmode.h"
24
class QDragEnterEvent;
26
class QDragLeaveEvent;
29
class QInputMethodEvent;
35
struct CanvasViewMode;
42
This class is a superclass for canvas gestures. CanvasGestures are
43
temporary canvasmodes which have a pointer to the CanvasMode in which they
44
started. ScribusView::stopGesture() will return control to that mode.
45
By default, all events are delegated to the canvas mode.
47
class SCRIBUS_API CanvasGesture : public CanvasMode
50
CanvasGesture (CanvasMode* parent) : CanvasMode(parent->view()), m_delegate(parent) {};
51
CanvasGesture (ScribusView* view) : CanvasMode(view), m_delegate(NULL) {};
54
virtual void enterEvent(QEvent * e) { m_delegate->enterEvent(e); }
55
virtual void leaveEvent(QEvent * e) { m_delegate->leaveEvent(e); }
57
virtual void dragEnterEvent(QDragEnterEvent *e) { m_delegate->dragEnterEvent(e); }
58
virtual void dragMoveEvent(QDragMoveEvent *e) { m_delegate->dragMoveEvent(e); }
59
virtual void dragLeaveEvent(QDragLeaveEvent *e) { m_delegate->dragLeaveEvent(e); }
60
virtual void dropEvent(QDropEvent *e) { m_delegate->dropEvent(e); }
62
virtual void mouseDoubleClickEvent(QMouseEvent *m) { m_delegate->mouseDoubleClickEvent(m); }
63
virtual void mouseReleaseEvent(QMouseEvent *m) { m_delegate->mouseReleaseEvent(m); }
64
virtual void mouseMoveEvent(QMouseEvent *m) { m_delegate->mouseMoveEvent(m); }
65
virtual void mousePressEvent(QMouseEvent *m) { m_delegate->mousePressEvent(m); }
67
virtual void keyPressEvent(QKeyEvent *e) { m_delegate->keyPressEvent(e); }
68
virtual void keyReleaseEvent(QKeyEvent *e) { m_delegate->keyReleaseEvent(e); }
69
virtual void inputMethodEvent(QInputMethodEvent *e) { m_delegate->inputMethodEvent(e); }
71
CanvasMode* delegate() { return m_delegate; }
72
void setDelegate(CanvasMode* delegate) { if (delegate) m_delegate = delegate; }
75
CanvasMode* m_delegate;