kivio

straight_connector.h

00001 /*
00002  * Kivio - Visual Modelling and Flowcharting
00003  * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 #ifndef STRAIGHT_CONNECTOR_H
00020 #define STRAIGHT_CONNECTOR_H
00021 
00022 
00023 #include "kivio_arrowhead.h"
00024 #include "kivio_connector_point.h"
00025 #include "kivio_custom_drag_data.h"
00026 #include "kivio_intra_stencil_data.h"
00027 #include "kiviostencilfactory.h"
00028 #include "kivio_point.h"
00029 #include "kivio_stencil.h"
00030 
00031 class KivioPage;
00032 
00033 #include <qcolor.h>
00034 #include <qdom.h>
00035 
00036 #include "kivio_1d_stencil.h"
00037 
00038 
00039 class KivioStraightConnector : public Kivio1DStencil
00040 {
00041   protected:
00042     KivioArrowHead *m_startAH;
00043     KivioArrowHead *m_endAH;
00044 
00045     bool loadArrowHeads( const QDomElement & );
00046     QDomElement saveArrowHeads( QDomDocument & );
00047 
00048   public:
00049     KivioStraightConnector();
00050     virtual ~KivioStraightConnector();
00051 
00052     virtual void setStartPoint( double, double );
00053     virtual void setEndPoint( double, double );
00054 
00055     virtual KivioCollisionType checkForCollision( KoPoint *, double );
00056 
00057     virtual KivioStencil* duplicate();
00058 
00059     virtual void paint( KivioIntraStencilData * );
00060     virtual void paintOutline( KivioIntraStencilData * );
00061 
00062     virtual bool loadCustom( const QDomElement & );
00063     virtual bool saveCustom( QDomElement &, QDomDocument & );
00064 
00065 
00066     virtual void setStartAHType( int i )        { m_startAH->setType(i); }
00067     virtual void setStartAHWidth( double f )     { m_startAH->setWidth(f); }
00068     virtual void setStartAHLength( double f )    { m_startAH->setLength(f); }
00069     virtual void setEndAHType( int i )          { m_endAH->setType(i); }
00070     virtual void setEndAHWidth( double f )       { m_endAH->setWidth(f); }
00071     virtual void setEndAHLength( double f )      { m_endAH->setLength(f); }
00072 
00073     virtual int startAHType()                   { return m_startAH->type(); }
00074     virtual double startAHWidth()                { return m_startAH->width(); }
00075     virtual double startAHLength()               { return m_startAH->length(); }
00076     virtual int endAHType()                     { return m_endAH->type(); }
00077     virtual double endAHWidth()                  { return m_endAH->width(); }
00078     virtual double endAHLength()                 { return m_endAH->length(); }
00079 
00080     virtual bool hasTextBox() const;
00081 };
00082 
00083 class KIVIOPLUGINS_EXPORT KivioConnectorFactory : public KivioStencilFactory
00084 {
00085   Q_OBJECT
00086   public:
00087     KivioConnectorFactory(QObject *parent=0, const char* name=0, const QStringList& args = QStringList());
00088     KivioStencil *NewStencil(const QString& name);
00089     KivioStencil *NewStencil();
00090     QPixmap *GetIcon();
00091     KivioStencilSpawnerInfo *GetSpawnerInfo();
00092 };
00093 
00094 #endif
00095 
KDE Home | KDE Accessibility Home | Description of Access Keys