canvasgesture_linemove.h
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018 #ifndef CANVAS_GESTURE_LINEMOVE_H
00019 #define CANVAS_GESTURE_LINEMOVE_H
00020
00021 #include <QRectF>
00022
00023 #include "scribusapi.h"
00024 #include "canvasgesture.h"
00025 #include "canvasmode.h"
00026
00027 class QDragEnterEvent;
00028 class QDragMoveEvent;
00029 class QDragLeaveEvent;
00030 class QDropEvent;
00031 class QEvent;
00032 class QInputMethodEvent;
00033 class QMouseEvent;
00034 class QKeyEvent;
00035 class QPainter;
00036 class QRubberBand;
00037 class PageItem;
00038 class PageItem_Line;
00039
00049 class SCRIBUS_API LineMove : public CanvasGesture
00050 {
00051 public:
00052 LineMove (CanvasMode* parent): CanvasGesture(parent), m_haveLineItem(false), m_bounds(0,0,0,0) {};
00053 ~LineMove() {}
00054
00058 void prepare(QPointF start, QPointF end);
00059
00063 void prepare(PageItem_Line* line, bool useOriginAsEndpoint = false);
00064
00065 void clear();
00066
00067 virtual void activate(bool);
00068 virtual void deactivate(bool);
00069 virtual void mouseReleaseEvent(QMouseEvent *m);
00070 virtual void mouseMoveEvent(QMouseEvent *m);
00075 virtual void mousePressEvent(QMouseEvent *m);
00076 virtual void drawControls(QPainter*);
00077
00078 void setStartPoint(QPointF canvasStart);
00079 void setEndPoint(QPointF canvasEnd);
00080
00081 QPointF startPoint() const { return m_bounds.topLeft(); }
00082 QPointF endPoint() const { return m_bounds.bottomRight(); }
00083
00084 bool haveLineItem() const { return m_haveLineItem; }
00085
00086 private:
00087 bool m_haveLineItem;
00088 bool m_useOriginAsEndpoint;
00089 QRectF m_bounds;
00090 PageItem* m_line;
00091 void adjustBounds(QMouseEvent* m);
00092 void doResize();
00093 void setRotation(double rot);
00094 double rotation() const;
00095 double length() const;
00096 };
00097
00098
00099 #endif