kivio
kivio_base_connector_stencil.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 KIVIO_BASE_CONNECTOR_STENCIL_H 00020 #define KIVIO_BASE_CONNECTOR_STENCIL_H 00021 00022 #ifdef HAVE_CONFIG_H 00023 #include <config.h> 00024 #endif 00025 00026 #include <qdom.h> 00027 #include <qptrlist.h> 00028 00029 #include "kivio_stencil.h" 00030 00031 class KivioArrowHead; 00032 class KivioConnectorPoint; 00033 class KivioCustomDragData; 00034 class KivioFillStyle; 00035 class KivioLineStyle; 00036 class KivioIntraStencilData; 00037 class KivioStencil; 00038 00039 class KivioBaseConnectorStencil : public KivioStencil 00040 { 00041 protected: 00042 QPtrList <KivioConnectorPoint> *m_pConnectorPoints; 00043 00044 KivioFillStyle *m_pFillStyle; 00045 KivioLineStyle *m_pLineStyle; 00046 00047 00048 // Utility routines 00049 bool boolAllTrue( bool *, int ); 00050 bool boolContainsFalse( bool *, int ); 00051 00052 QDomElement saveConnectors( QDomDocument &doc ); 00053 bool loadConnectors( const QDomElement & ); 00054 00055 QDomElement saveProperties( QDomDocument &doc ); 00056 bool loadProperties( const QDomElement & ); 00057 00058 public: 00059 KivioBaseConnectorStencil(); 00060 virtual ~KivioBaseConnectorStencil(); 00061 00062 // fg color functions 00063 virtual void setFGColor( QColor c ); 00064 virtual QColor fgColor(); 00065 00066 00067 // bg color functions 00068 virtual void setBGColor( QColor c ); 00069 virtual QColor bgColor(); 00070 00071 00072 // line width functions 00073 virtual void setLineWidth( double f ); 00074 virtual double lineWidth(); 00075 00076 00077 // position functions 00078 virtual void setX( double ); 00079 virtual void setY( double ); 00080 virtual void setPosition( double, double ); 00081 00082 00083 // required for connector tool 00084 virtual void setStartPoint( double, double ); 00085 virtual void setEndPoint( double, double ); 00086 00087 00088 // painting functions 00089 virtual void paint( KivioIntraStencilData * ); 00090 virtual void paintOutline( KivioIntraStencilData * ); 00091 virtual void paintConnectorTargets( KivioIntraStencilData * ); 00092 virtual void paintSelectionHandles( KivioIntraStencilData * ); 00093 00094 00095 // collision detection 00096 virtual KivioCollisionType checkForCollision( KoPoint *, double ); 00097 00098 00099 // custom dragging 00100 virtual void customDrag( KivioCustomDragData * ); 00101 00102 00103 // geometry management 00104 virtual void updateGeometry(); 00105 00106 00107 // file i/o routines 00108 virtual bool loadXML( const QDomElement & ); 00109 virtual QDomElement saveXML( QDomDocument & ); 00110 00111 00112 // duplication routines 00113 virtual KivioStencil* duplicate(); 00114 00115 00116 // connection search routines 00117 virtual void searchForConnections( KivioPage * ); 00118 00119 00120 // returns which resize handles are valid 00121 virtual int resizeHandlePositions(); 00122 00123 }; 00124 00125 #endif 00126