kivioconnectortool/tool_connector.h
1/*
2 * Kivio - Visual Modelling and Flowcharting
3 * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
4 * Copyright (C) 2003-2005 Peter Simonsson <psn@linux.se>
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 2
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
19 */
20#ifndef TOOL_CONNECTOR_H
21#define TOOL_CONNECTOR_H
22
23#include "kivio_mousetool.h"
24#include <KoPoint.h>
25
26class TQMouseEvent;
27class TQCursor;
28
29namespace Kivio {
30 class MouseToolAction;
31}
32
33class KivioView;
34class KivioPage;
35class Kivio1DStencil;
36class KivioCustomDragData;
37
38class ConnectorTool : public Kivio::MouseTool
39{
40 TQ_OBJECT
41
42 public:
43 ConnectorTool( KivioView* parent );
44 ~ConnectorTool();
45
46 virtual bool processEvent(TQEvent* e);
47
48 void connector(TQRect);
49
50 public slots:
51 void setActivated(bool a);
52
53 protected slots:
54 void activateStraight();
55 void activatePolyline();
56
57 void makePermanent();
58
59 signals:
60 void operationDone();
61
62 protected:
63 void mousePress(TQMouseEvent *);
64 void mouseMove(TQMouseEvent *);
65 void mouseRelease(TQMouseEvent *);
66
67 bool startRubberBanding(TQMouseEvent*);
68 void continueRubberBanding(TQMouseEvent *);
69 void endRubberBanding(TQMouseEvent *);
70
71 TQPoint m_startPoint, m_releasePoint;
72
73 // Connector Tool Mode
74 enum
75 {
76 stmNone,
77 stmDrawRubber
78 };
79
80 enum {
81 StraightConnector,
82 PolyLineConnector
83 };
84
85 private:
86 int m_mode; // Flag to indicate that we are drawing a rubber band
87 int m_type; // Type of connector
88 TQCursor* m_pConnectorCursor1;
89 TQCursor* m_pConnectorCursor2;
90 Kivio1DStencil* m_pStencil;
91 KoPoint startPoint;
92 KivioCustomDragData* m_pDragData;
93
94 Kivio::MouseToolAction* m_connectorAction;
95 Kivio::MouseToolAction* m_polyLineAction;
96
97 bool m_permanent;
98};
99
100#endif
101
102
Baseclass for mouse tools (like eg the select tool)