Scribus
Open source desktop publishing at your fingertips
canvasgesture_rectselect.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_RECTSELECT_H
19 #define CANVAS_GESTURE_RECTSELECT_H
20 
21 #include <QRectF>
22 
23 #include "scribusapi.h"
24 #include "canvasgesture.h"
25 #include "canvasmode.h"
26 
27 class QDragEnterEvent;
28 class QDragMoveEvent;
29 class QDragLeaveEvent;
30 class QDropEvent;
31 class QEvent;
32 class QInputMethodEvent;
33 class QMouseEvent;
34 class QKeyEvent;
35 class QPainter;
37 
48 class SCRIBUS_API RectSelect : public CanvasGesture
49 {
50 public:
51  explicit RectSelect (CanvasMode* parent) : CanvasGesture(parent), m_start(0,0), m_selectionRubberBand(0) {};
52  virtual ~RectSelect() {}
53 
54  void prepare(QPoint globalStartPos);
55  void clear();
56 
57  virtual void enterEvent(QEvent * e);
58  virtual void leaveEvent(QEvent * e);
59 
60  virtual void activate(bool);
61  virtual void deactivate(bool);
62  virtual void mouseReleaseEvent(QMouseEvent *m);
63  virtual void mouseMoveEvent(QMouseEvent *m);
67  virtual void mousePressEvent(QMouseEvent *m);
68  virtual void drawControls(QPainter*);
69 
70  QRectF result() const ;
71 private:
72  void setStart(QPoint globalPos);
73  void setEnd(QPoint globalPos);
74 
75  QPoint m_start;
76  SelectionRubberBand* m_selectionRubberBand;
77 };
78 
79 
80 #endif
virtual void deactivate(bool forGesture)
Definition: canvasmode.h:91
virtual void drawControls(QPainter *p)
Definition: canvasmode.h:121
Definition: selectionrubberband.h:9
Definition: canvasmode.h:72
Definition: canvasgesture.h:47
Definition: canvasgesture_rectselect.h:48
virtual void activate(bool fromGesture)
Definition: canvasmode.h:86