kivio
tool_select.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef TOOL_SELECT_H
00021 #define TOOL_SELECT_H
00022
00023 #include <qptrlist.h>
00024 #include <KoPoint.h>
00025 #include <KoRect.h>
00026 #include "kivio_mousetool.h"
00027
00028 class KivioView;
00029 class KivioPage;
00030 class QMouseEvent;
00031 class QKeyEvent;
00032 class KPopupMenu;
00033 class KRadioAction;
00034 class KAction;
00035
00036 class KivioStencil;
00037
00038 class KivioSelectDragData
00039 {
00040 public:
00041 KoRect rect;
00042 };
00043
00044 enum {
00045 stCut=1,
00046 stCopy,
00047 stPaste,
00048 stSendToBack,
00049 stBringToFront,
00050 stGroup,
00051 stUngroup
00052 };
00053
00054 class SelectTool : public Kivio::MouseTool
00055 {
00056 Q_OBJECT
00057 public:
00058 SelectTool( KivioView* parent );
00059 ~SelectTool();
00060
00061 virtual bool processEvent(QEvent* e);
00062
00063 void select(const QRect&);
00064
00065 public slots:
00066 void setActivated(bool a);
00067
00068 signals:
00069 void operationDone();
00070
00071 protected slots:
00072 void editText(QPtrList<KivioStencil>* stencils);
00073 void showProperties();
00074 void editStencilText();
00075
00076 protected:
00077 void mousePress(const QPoint&);
00078 void mouseMove(QMouseEvent*);
00079 void mouseRelease(const QPoint&);
00080 void leftDoubleClick(const QPoint&);
00081
00082 bool startResizing(const QPoint&);
00083 bool startDragging(const QPoint&, bool);
00084 bool startCustomDragging(const QPoint&, bool);
00085 bool startRubberBanding(const QPoint&);
00086
00087 void continueDragging(const QPoint&, bool ignoreGridGuides = false);
00088 void continueCustomDragging(const QPoint&);
00089 void continueResizing(const QPoint&, bool ignoreGridGuides = false);
00090 void continueRubberBanding(const QPoint&);
00091
00092 void endResizing(const QPoint&);
00093 void endDragging(const QPoint&);
00094 void endCustomDragging(const QPoint&);
00095 void endRubberBanding(const QPoint&);
00096
00097 void showPopupMenu(const QPoint&);
00098
00099 void changeMouseCursor(const QPoint&);
00100 int isOverResizeHandle( KivioStencil *pStencil, const double x, const double y );
00101
00102 void keyPress(QKeyEvent* e);
00103
00104 QPoint m_startPoint, m_releasePoint;
00105 KoPoint m_lastPoint;
00106 KoPoint m_origPoint;
00107
00108
00109 enum {
00110 stmNone,
00111 stmDrawRubber,
00112 stmDragging,
00113 stmCustomDragging,
00114 stmResizing
00115 };
00116
00117 private:
00118 int m_mode;
00119 KivioStencil *m_pResizingStencil;
00120 KivioStencil *m_pCustomDraggingStencil;
00121 int m_resizeHandle;
00122 bool m_controlKey;
00123 int m_customDragID;
00124 QPtrList <KivioSelectDragData> m_lstOldGeometry;
00125 KoRect m_selectedRect;
00126 KoPoint m_customDragOrigPoint;
00127
00128 KRadioAction* m_selectAction;
00129 KAction* m_arrowHeadAction;
00130 KAction* m_textEditAction;
00131
00132 bool m_firstTime;
00133 };
00134
00135 #endif
|