Scribus
Open source desktop publishing at your fingertips
canvasmode_edittable.h
1 /*
2 Copyright (C) 2011 Elvis Stansvik <elvstone@gmail.com>
3 
4 For general Scribus (>=1.3.2) copyright and licensing information please refer
5 to the COPYING file provided with the program. Following this notice may exist
6 a copyright and/or license notice that predates the release of Scribus 1.3.2
7 for which a new license (GPL+exception) is in place.
8 */
9 #ifndef CANVASMODE_EDITTABLE_H
10 #define CANVASMODE_EDITTABLE_H
11 
12 #include <QCursor>
13 #include <QObject>
14 #include <QTime>
15 
16 #include "canvasmode.h"
17 #include "cellarea.h"
18 
19 class CanvasGesture;
20 class CellSelect;
21 class ColumnResize;
22 class PageItem_Table;
23 class QMouseEvent;
24 class QPainter;
25 class QTimer;
26 class RowResize;
27 class ScribusMainWindow;
28 class ScribusView;
29 class TableResize;
30 
35 {
36  Q_OBJECT
37 
38 public:
39  explicit CanvasMode_EditTable(ScribusView* view);
40  virtual ~CanvasMode_EditTable();
41 
42  virtual void activate(bool fromGesture);
43  virtual void deactivate(bool forGesture);
44  virtual bool handleKeyEvents() { return true; }
45  virtual void keyPressEvent(QKeyEvent* event);
46  virtual void mouseMoveEvent(QMouseEvent* event);
47  virtual void mousePressEvent(QMouseEvent* event);
48  virtual void mouseReleaseEvent(QMouseEvent* event);
49  virtual void mouseDoubleClickEvent(QMouseEvent* event);
50  virtual void drawControls(QPainter* p);
51 
52 private slots:
58  void updateCanvas(bool force = false);
59 
60 private:
62  void handleMouseDrag(QMouseEvent* event);
64  void drawTextCursor(QPainter* p);
66  void makeLongTextCursorBlink();
68  void createContextMenu(PageItem *currItem, double mx, double my);
69 
70 private:
72  PageItem_Table *m_table;
73 
75  QTimer* m_canvasUpdateTimer;
76 
78  QTime m_blinkTime;
80  bool m_longBlink;
82  bool m_cursorVisible;
83 
84  // Last cursor position pressed with the mouse, or <code>-1</code>.
85  int m_lastCursorPos;
86 
88  QCursor m_selectRowCursor;
90  QCursor m_selectColumnCursor;
91 
93  TableResize* m_tableResizeGesture;
95  RowResize* m_rowResizeGesture;
97  ColumnResize* m_columnResizeGesture;
99  CellSelect* m_cellSelectGesture;
100 
102  ScribusMainWindow* m_ScMW;
103 };
104 
105 #endif // CANVASMODE_EDITTABLE_H
Definition: canvasgesture_tableresize.h:29
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 activate(bool fromGesture)
Definition: canvasmode_edittable.cpp:68
Definition: canvasgesture_cellselect.h:31
Definition: canvasmode.h:72
Definition: canvasgesture.h:47
Definition: canvasgesture_rowresize.h:29
virtual void drawControls(QPainter *p)
Definition: canvasmode_edittable.cpp:307
Definition: canvasmode_edittable.h:34
Definition: pageitem.h:92
Definition: canvasgesture_columnresize.h:29
Definition: scribusview.h:87
Definition: pageitem_table.h:49
virtual void deactivate(bool forGesture)
Definition: canvasmode_edittable.cpp:85