summaryrefslogtreecommitdiffstats
path: root/kivio/kiviopart/kiviosdk/kivio_base_target_stencil.h
blob: 7af497187d187a692adb4d05d31ac3aa8bbfb54e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
/*
 * Kivio - Visual Modelling and Flowcharting
 * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */
#ifndef KIVIO_BASE_TARGET_STENCIL_H
#define KIVIO_BASE_TARGET_STENCIL_H

#include <qfont.h>
#include <qcolor.h>
#include <qdom.h>
#include <qptrlist.h>

class KivioCustomDragData;
class KivioConnectorPoint;
class KivioConnectorTarget;
class KivioFillStyle;
class KivioIntraStencilData;
class KivioLineStyle;
class KivioPage;
class KivioStencilSpawner;
class KivioTextStyle;

#include "kivio_stencil.h"


class KivioBaseTargetStencil : public KivioStencil
{
protected:
    KivioLineStyle *m_pLineStyle;
    KivioFillStyle *m_pFillStyle;
    KivioTextStyle *m_pTextStyle;

    QPtrList<KivioConnectorTarget> *m_pTargets;

    virtual QDomElement createRootElement( QDomDocument & );

    virtual bool saveCustom( QDomElement &, QDomDocument & );
    virtual QDomElement saveProperties( QDomDocument & );
    virtual QDomElement saveTargets( QDomDocument & );

    virtual bool loadCustom( const QDomElement & );
    virtual bool loadProperties( const QDomElement & );
    virtual bool loadTargets( const QDomElement & );

    virtual void copyBasicInto( KivioBaseTargetStencil * );

public:
    KivioBaseTargetStencil();
    virtual ~KivioBaseTargetStencil();

    virtual KivioStencil *duplicate() { return NULL; }


    //////////////////////////////
    //
    // KivioLineStyle
    //
    //////////////////////////////
    virtual QColor fgColor();
    virtual void setFGColor( QColor c );

    virtual void setLineWidth( double l );
    virtual double lineWidth();



    //////////////////////////////
    //
    // KivioFillStyle
    //
    //////////////////////////////
    virtual void setBGColor( QColor c );
    virtual QColor bgColor();

    virtual KivioFillStyle *fillStyle();



    //////////////////////////////
    //
    // KivioTextStyle
    //
    //////////////////////////////
    virtual QColor textColor();
    virtual void setTextColor( QColor c );

    virtual QFont textFont();
    virtual void setTextFont( const QFont &f );

    virtual int hTextAlign();
    virtual int vTextAlign();

    virtual void setHTextAlign(int a);
    virtual void setVTextAlign(int a);

    virtual void setText( const QString &a );
    virtual QString text();



    ///////////////////////////////
    //
    // Paint Routines
    //
    ///////////////////////////////
    virtual void paint( KivioIntraStencilData * );
    virtual void paintOutline( KivioIntraStencilData * );
    virtual void paintConnectorTargets( KivioIntraStencilData * );



    ///////////////////////////////
    //
    // File I/O
    //
    ///////////////////////////////
    virtual bool loadXML( const QDomElement & );
    virtual QDomElement saveXML( QDomDocument & );



    ///////////////////////////////
    //
    // Geometry
    //
    ///////////////////////////////
    virtual void updateGeometry();



    ///////////////////////////////
    //
    // Connection Routines
    //
    ///////////////////////////////
    // This attempts to connect based on position
    virtual KivioConnectorTarget *connectToTarget( KivioConnectorPoint *, double );

    // This attempts to connect based on a targetID.  This should  ***ONLY*** be used
    // right after a load
    virtual KivioConnectorTarget *connectToTarget( KivioConnectorPoint *, int );


    ///////////////////////////////
    //
    // ID Generation
    //
    ///////////////////////////////
    virtual int generateIds( int );



    virtual int resizeHandlePositions();
};

#endif