kivio

kivio_connector_point.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_CONNECTOR_POINT_H
00020 #define KIVIO_CONNECTOR_POINT_H
00021 
00022 #include <qdom.h>
00023 
00024 #include <KoPoint.h>
00025 #include <koffice_export.h>
00026 class KivioConnectorTarget;
00027 class KivioStencil;
00028 
00029 
00030 class KIVIO_EXPORT KivioConnectorPoint
00031 {
00032 protected:
00033     // The position of this connector point
00034     KoPoint m_pos;
00035 
00036     // The target this connector is connected to
00037     KivioConnectorTarget *m_pTarget;
00038 
00039     // The stencil this point belongs to
00040     KivioStencil *m_pStencil;
00041 
00042     int m_targetId;
00043 
00044     bool m_connectable;
00045 
00046 
00047 public:
00048     KivioConnectorPoint( KivioStencil *, bool conn=true );
00049     KivioConnectorPoint();
00050     virtual ~KivioConnectorPoint();
00051 
00052     bool loadXML( const QDomElement & );
00053     QDomElement saveXML( QDomDocument & );
00054 
00055     KivioConnectorTarget *target() const { return m_pTarget; }
00056     void setTarget( KivioConnectorTarget * );
00057 
00058     KivioStencil *stencil() const { return m_pStencil; }
00059     void setStencil( KivioStencil *p ) { m_pStencil=p; }
00060 
00061     void setTargetId( int i ) { m_targetId = i; }
00062     int targetId() const { return m_targetId; }
00063 
00064     double x() const { return m_pos.x(); }
00065     double y() const { return m_pos.y(); }
00066     KoPoint position() const { return m_pos; }
00067 
00068     void setX( double, bool updateStencil = true );
00069     void setY( double, bool updateStencil = true );
00070     void setPosition( double, double, bool updateStencil = true );
00071     void moveBy( double _x, double _y, bool updateStencil = true );
00072 
00073     bool connectable() const { return m_connectable; }
00074     void setConnectable( bool b ) { m_connectable = b; if( b==false ) { disconnect(); } }
00075 
00076     void disconnect(bool removeFromTargetList = true);
00077     bool isConnected();
00078 };
00079 
00080 #endif
00081 
KDE Home | KDE Accessibility Home | Description of Access Keys