Scribus
Open source desktop publishing at your fingertips
canvasmode_normal.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_MODE_NORMAL_H
19 #define CANVAS_MODE_NORMAL_H
20 
21 #include <QObject>
22 #include <QTime>
23 
24 #include "canvasmode.h"
25 #include "fpointarray.h"
26 
27 class LineMove;
28 class PageItem;
29 class ResizeGesture;
30 class RulerGesture;
31 class ScribusMainWindow;
32 class ScribusView;
33 
34 
35 // This class encapsulate the old code for mouse interaction from scribusview.cpp
36 
38 {
39  Q_OBJECT
40 
41 public:
42  explicit CanvasMode_Normal(ScribusView* view);
43  virtual ~CanvasMode_Normal() {}
44 
45  virtual void enterEvent(QEvent *);
46  virtual void leaveEvent(QEvent *);
47 
48  virtual void activate(bool);
49  virtual void deactivate(bool);
50  virtual void mouseDoubleClickEvent(QMouseEvent *m);
51  virtual void mouseReleaseEvent(QMouseEvent *m);
52  virtual void mouseMoveEvent(QMouseEvent *m);
53  virtual void mousePressEvent(QMouseEvent *m);
54  virtual void drawControls(QPainter* p);
55 
56  virtual void keyPressEvent(QKeyEvent *e);
57  virtual void keyReleaseEvent(QKeyEvent *e);
58 
59  virtual bool handleKeyEvents() { return true; }
60 
61 private:
62  inline bool GetItem(PageItem** pi);
63  void handleCheckBoxPress(PageItem* currItem);
64  void handlePushButtonPress(PageItem* currItem);
65  void handleRadioButtonPress(PageItem* currItem);
66  void handleCheckBoxRelease(PageItem* currItem);
67  void handlePushButtonRelease(PageItem* currItem);
68  void handleRadioButtonRelease(PageItem* currItem);
69  void handleJavaAction(PageItem* currItem, int event);
70  void handleNamedAction(PageItem* currItem);
71  void handleLinkAnnotation(PageItem* currItem);
72  void handleFocusOut(PageItem* currItem);
73  void handleFocusIn(PageItem* currItem);
74  void handleMouseLeave(PageItem* currItem);
75  void handleMouseEnter(PageItem* currItem);
76  bool SeleItem(QMouseEvent *m);
77  void createContextMenu(PageItem *currItem, double mx, double my);
78 
79  FPoint m_mousePressPoint;
80  FPoint m_mouseCurrentPoint;
81  FPoint m_mouseSavedPoint;
82  FPoint m_objectDeltaPos;
83 
84  bool shiftSelItems;
85  int frameResizeHandle;
86  int dragConstrainInitPtX, dragConstrainInitPtY;
87  ScribusMainWindow* m_ScMW;
88  ResizeGesture* resizeGesture;
89  LineMove* lineMoveGesture;
90  RulerGesture* guideMoveGesture;
91  bool m_lastPosWasOverGuide;
92  PageItem* m_hoveredItem;
93 
94 public slots:
95  void importToPage();
96 };
97 
98 
99 #endif
Definition: canvasgesture_rulermove.h:46
Definition: canvasgesture_resize.h:47
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_normal.cpp:97
A point with floating point precision.
Definition: fpoint.h:43
Definition: canvasmode.h:72
Definition: canvasgesture_linemove.h:49
virtual void activate(bool)
Definition: canvasmode_normal.cpp:119
Definition: canvasmode_normal.h:37
Definition: pageitem.h:92
virtual void deactivate(bool)
Definition: canvasmode_normal.cpp:143
Definition: scribusview.h:87