kivio

straight_connector.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 STRAIGHT_CONNECTOR_H
20#define STRAIGHT_CONNECTOR_H
21
22
23#include "kivio_arrowhead.h"
24#include "kivio_connector_point.h"
25#include "kivio_custom_drag_data.h"
26#include "kivio_intra_stencil_data.h"
27#include "kiviostencilfactory.h"
28#include "kivio_point.h"
29#include "kivio_stencil.h"
30
31class KivioPage;
32
33#include <tqcolor.h>
34#include <tqdom.h>
35
36#include "kivio_1d_stencil.h"
37
38
39class KivioStraightConnector : public Kivio1DStencil
40{
41 protected:
42 KivioArrowHead *m_startAH;
43 KivioArrowHead *m_endAH;
44
45 bool loadArrowHeads( const TQDomElement & );
46 TQDomElement saveArrowHeads( TQDomDocument & );
47
48 public:
49 KivioStraightConnector();
50 virtual ~KivioStraightConnector();
51
52 virtual void setStartPoint( double, double );
53 virtual void setEndPoint( double, double );
54
55 virtual KivioCollisionType checkForCollision( KoPoint *, double );
56
57 virtual KivioStencil* duplicate();
58
59 virtual void paint( KivioIntraStencilData * );
60 virtual void paintOutline( KivioIntraStencilData * );
61
62 virtual bool loadCustom( const TQDomElement & );
63 virtual bool saveCustom( TQDomElement &, TQDomDocument & );
64
65
66 virtual void setStartAHType( int i ) { m_startAH->setType(i); }
67 virtual void setStartAHWidth( double f ) { m_startAH->setWidth(f); }
68 virtual void setStartAHLength( double f ) { m_startAH->setLength(f); }
69 virtual void setEndAHType( int i ) { m_endAH->setType(i); }
70 virtual void setEndAHWidth( double f ) { m_endAH->setWidth(f); }
71 virtual void setEndAHLength( double f ) { m_endAH->setLength(f); }
72
73 virtual int startAHType() { return m_startAH->type(); }
74 virtual double startAHWidth() { return m_startAH->width(); }
75 virtual double startAHLength() { return m_startAH->length(); }
76 virtual int endAHType() { return m_endAH->type(); }
77 virtual double endAHWidth() { return m_endAH->width(); }
78 virtual double endAHLength() { return m_endAH->length(); }
79
80 virtual bool hasTextBox() const;
81};
82
83class KIVIOPLUGINS_EXPORT KivioConnectorFactory : public KivioStencilFactory
84{
85 TQ_OBJECT
86
87 public:
88 KivioConnectorFactory(TQObject *parent=0, const char* name=0, const TQStringList& args = TQStringList());
89 KivioStencil *NewStencil(const TQString& name);
90 KivioStencil *NewStencil();
91 TQPixmap *GetIcon();
92 KivioStencilSpawnerInfo *GetSpawnerInfo();
93};
94
95#endif
96