kivio

kivio_connector_point.h
1/*
2 * Kivio - Visual Modelling and Flowcharting
3 * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 */
19#ifndef KIVIO_CONNECTOR_POINT_H
20#define KIVIO_CONNECTOR_POINT_H
21
22#include <tqdom.h>
23
24#include <KoPoint.h>
25#include <koffice_export.h>
26class KivioConnectorTarget;
27class KivioStencil;
28
29
30class KIVIO_EXPORT KivioConnectorPoint
31{
32protected:
33 // The position of this connector point
34 KoPoint m_pos;
35
36 // The target this connector is connected to
37 KivioConnectorTarget *m_pTarget;
38
39 // The stencil this point belongs to
40 KivioStencil *m_pStencil;
41
42 int m_targetId;
43
44 bool m_connectable;
45
46
47public:
48 KivioConnectorPoint( KivioStencil *, bool conn=true );
49 KivioConnectorPoint();
50 virtual ~KivioConnectorPoint();
51
52 bool loadXML( const TQDomElement & );
53 TQDomElement saveXML( TQDomDocument & );
54
55 KivioConnectorTarget *target() const { return m_pTarget; }
56 void setTarget( KivioConnectorTarget * );
57
58 KivioStencil *stencil() const { return m_pStencil; }
59 void setStencil( KivioStencil *p ) { m_pStencil=p; }
60
61 void setTargetId( int i ) { m_targetId = i; }
62 int targetId() const { return m_targetId; }
63
64 double x() const { return m_pos.x(); }
65 double y() const { return m_pos.y(); }
66 KoPoint position() const { return m_pos; }
67
68 void setX( double, bool updateStencil = true );
69 void setY( double, bool updateStencil = true );
70 void setPosition( double, double, bool updateStencil = true );
71 void moveBy( double _x, double _y, bool updateStencil = true );
72
73 bool connectable() const { return m_connectable; }
74 void setConnectable( bool b ) { m_connectable = b; if( b==false ) { disconnect(); } }
75
76 void disconnect(bool removeFromTargetList = true);
77 bool isConnected();
78};
79
80#endif
81