kivio

tool_connector.h

00001 /*
00002  * Kivio - Visual Modelling and Flowcharting
00003  * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
00004  * Copyright (C) 2003-2005 Peter Simonsson <psn@linux.se>
00005  *
00006  * This program is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU General Public License
00008  * as published by the Free Software Foundation; either version 2
00009  * of the License, or (at your option) any later version.
00010  *
00011  * This program is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU General Public License
00017  * along with this program; if not, write to the Free Software
00018  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00019  */
00020 #ifndef TOOL_CONNECTOR_H
00021 #define TOOL_CONNECTOR_H
00022 
00023 #include "kivio_mousetool.h"
00024 #include <KoPoint.h>
00025 
00026 class QMouseEvent;
00027 class QCursor;
00028 
00029 namespace Kivio {
00030   class MouseToolAction;
00031 }
00032 
00033 class KivioView;
00034 class KivioPage;
00035 class Kivio1DStencil;
00036 class KivioCustomDragData;
00037 
00038 class ConnectorTool : public Kivio::MouseTool
00039 {
00040   Q_OBJECT
00041   public:
00042     ConnectorTool( KivioView* parent );
00043     ~ConnectorTool();
00044 
00045     virtual bool processEvent(QEvent* e);
00046 
00047     void connector(QRect);
00048 
00049   public slots:
00050     void setActivated(bool a);
00051 
00052   protected slots:
00053     void activateStraight();
00054     void activatePolyline();
00055 
00056     void makePermanent();
00057 
00058   signals:
00059     void operationDone();
00060 
00061   protected:
00062     void mousePress(QMouseEvent *);
00063     void mouseMove(QMouseEvent *);
00064     void mouseRelease(QMouseEvent *);
00065 
00066     bool startRubberBanding(QMouseEvent*);
00067     void continueRubberBanding(QMouseEvent *);
00068     void endRubberBanding(QMouseEvent *);
00069 
00070     QPoint m_startPoint, m_releasePoint;
00071 
00072     // Connector Tool Mode
00073     enum
00074     {
00075       stmNone,
00076       stmDrawRubber
00077     };
00078 
00079     enum {
00080       StraightConnector,
00081       PolyLineConnector
00082     };
00083 
00084   private:
00085     int m_mode; // Flag to indicate that we are drawing a rubber band
00086     int m_type; // Type of connector
00087     QCursor* m_pConnectorCursor1;
00088     QCursor* m_pConnectorCursor2;
00089     Kivio1DStencil* m_pStencil;
00090     KoPoint startPoint;
00091     KivioCustomDragData* m_pDragData;
00092 
00093     Kivio::MouseToolAction* m_connectorAction;
00094     Kivio::MouseToolAction* m_polyLineAction;
00095 
00096     bool m_permanent;
00097 };
00098 
00099 #endif
00100 
00101 
KDE Home | KDE Accessibility Home | Description of Access Keys