kivio
sml_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 SML_CONNECTOR_H 00020 #define SML_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_text_style.h" 00029 #include "kivio_point.h" 00030 #include "kivio_stencil.h" 00031 00032 class KivioPage; 00033 class KivioShape; 00034 #include <qstringlist.h> 00035 #include <qcolor.h> 00036 #include <qdom.h> 00037 00038 #include "kivio_1d_stencil.h" 00039 00040 00041 class KivioSMLConnector : public Kivio1DStencil 00042 { 00043 private: 00044 bool loadPath(const QString &file); 00045 //void drawOpenPath( KivioShape *, KivioIntraStencilData * ); 00046 KivioShape *m_shape; 00047 QPtrList<KivioConnectorPoint> m_PointList; 00048 00049 QString m_name; 00050 protected: 00051 00052 KivioArrowHead *m_startAH; 00053 KivioArrowHead *m_endAH; 00054 00055 bool loadArrowHeads( const QDomElement & ); 00056 QDomElement saveArrowHeads( QDomDocument & ); 00057 virtual bool loadCustom( const QDomElement & ); 00058 virtual bool saveCustom( QDomElement &, QDomDocument & ); 00059 00060 public: 00061 KivioSMLConnector(const QString& name); 00062 virtual ~KivioSMLConnector(); 00063 00064 virtual void setStartPoint( double, double ); 00065 virtual void setEndPoint( double, double ); 00066 00067 virtual KivioCollisionType checkForCollision( KivioPoint *, double ); 00068 00069 virtual KivioStencil* duplicate(); 00070 00071 virtual void paint( KivioIntraStencilData * ); 00072 virtual void paintOutline( KivioIntraStencilData * ); 00073 00074 00075 00076 00077 virtual void setStartAHType( int i ) { m_startAH->setType(i); } 00078 virtual void setStartAHWidth( double f ) { m_startAH->setWidth(f); } 00079 virtual void setStartAHLength( double f ) { m_startAH->setLength(f); } 00080 virtual void setEndAHType( int i ) { m_endAH->setType(i); } 00081 virtual void setEndAHWidth( double f ) { m_endAH->setWidth(f); } 00082 virtual void setEndAHLength( double f ) { m_endAH->setLength(f); } 00083 00084 virtual int startAHType() { return m_startAH->type(); } 00085 virtual double startAHWidth() { return m_startAH->width(); } 00086 virtual double startAHLength() { return m_startAH->length(); } 00087 virtual int endAHType() { return m_endAH->type(); } 00088 virtual double endAHWidth() { return m_endAH->width(); } 00089 virtual double endAHLength() { return m_endAH->length(); } 00090 00091 }; 00092 00093 class KivioSMLConnectorFactory : public KivioStencilFactory 00094 { 00095 Q_OBJECT 00096 public: 00097 KivioSMLConnectorFactory(QObject *parent=0, const char* name=0, const QStringList& args = QStringList()); 00098 KivioStencil *NewStencil(const QString& name); 00099 KivioStencil *NewStencil(); 00100 QPixmap *GetIcon(); 00101 KivioStencilSpawnerInfo *GetSpawnerInfo(); 00102 }; 00103 #endif 00104