Scribus
Open source desktop publishing at your fingertips
canvasgesture_rulermove.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_RULERMOVE_H
19 #define CANVAS_GESTURE_RULERMOVE_H
20 
21 #include <QPoint>
22 
23 class QCursor;
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 #include "scribusapi.h"
35 #include "canvas.h"
36 #include "canvasgesture.h"
37 #include "canvasmode.h"
38 #include "fpoint.h"
39 
40 class ScribusMainWindow;
41 class ScribusView;
42 
46 class SCRIBUS_API RulerGesture : public CanvasGesture
47 {
48  Q_OBJECT
49 public:
50  enum Mode { HORIZONTAL, VERTICAL, ORIGIN };
51  RulerGesture (ScribusView* view, Mode mode);
52  virtual ~RulerGesture() {}
53 
58  void prepare(Mode mode);
59  void clear();
60 
61  virtual void drawControls(QPainter* p);
62  virtual void activate(bool);
63  virtual void deactivate(bool);
64  virtual void mouseReleaseEvent(QMouseEvent *m);
65  virtual void mouseMoveEvent(QMouseEvent *m);
70  virtual void mousePressEvent(QMouseEvent *m);
71 
72  Mode getMode() { return m_mode; }
77  bool mouseHitsGuide(FPoint mousePointDoc);
82  void mouseSelectGuide(QMouseEvent *m);
83 private:
84  ScribusMainWindow* m_ScMW;
85  Mode m_mode;
86  bool m_haveGuide;
87  int m_page;
88  double m_guide;
89  double m_currentGuide;
90  bool m_haveCursor;
91  QCursor m_cursor;
92  QPoint m_xy;
93  FPoint m_mousePoint;
94  void movePoint(QMouseEvent *m, bool mouseRelease);
95 
96  signals:
97  void guideInfo(int /*direction*/, qreal /*position*/);
98 };
99 
100 
101 #endif
Definition: canvasgesture_rulermove.h:46
virtual void deactivate(bool forGesture)
Definition: canvasmode.h:91
This Class is the base class for your application. It sets up the main window and providing a menubar...
Definition: scribus.h:123
virtual void drawControls(QPainter *p)
Definition: canvasmode.h:121
A point with floating point precision.
Definition: fpoint.h:43
Definition: canvasgesture.h:47
Definition: scribusview.h:87
virtual void activate(bool fromGesture)
Definition: canvasmode.h:86