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
|
/*
* 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_PAINTER_H
#define KIVIO_PAINTER_H
#include <tqfont.h>
#include <tqptrlist.h>
#include <tqpaintdevice.h>
#include <tqpixmap.h>
#include <tqpointarray.h>
#include <tqwmatrix.h>
#include "kivio_fill_style.h"
class KivioPoint;
class KivioFillStyle;
class KivioLineStyle;
class KivioPainter
{
protected:
KivioFillStyle *m_pFillStyle;
KivioLineStyle *m_pLineStyle;
TQColor m_textColor;
public:
KivioPainter();
virtual ~KivioPainter();
virtual bool start( TQPaintDevice * ) { return false;}
virtual bool stop() { return false;}
/*\
|*|
|*|
|*| PROPERTY SETTINGS
|*|
|*| (probably don't need to reimplement -- unless you are optimizing)
\*/
virtual float lineWidth() const;
virtual void setLineWidth( const float &f );
// virtual void setClipRect( TQRect * );
// virtual TQRect *clipRect();
virtual TQColor fgColor() const;
virtual void setFGColor( const TQColor &c );
virtual TQColor bgColor() const { return m_pFillStyle->color(); }
virtual void setBGColor( const TQColor &c ) { m_pFillStyle->setColor(c); }
virtual TQColor textColor() const { return m_textColor; }
virtual void setTextColor( const TQColor &c ) { m_textColor = c; }
virtual KivioFillStyle *fillStyle() { return m_pFillStyle; }
virtual void setLineStyle( KivioLineStyle * );
virtual void setFillStyle( KivioFillStyle * );
/*\
|*|
|*|
|*| PRIMITIVE FUNCTIONS
|*|
|*| (all descendants *must* reimplement these)
\*/
virtual void drawLine( float, float, float, float ) {;}
virtual void drawArc( float, float, float, float, float, float ) {;}
virtual void drawBezier( TQPtrList<KivioPoint> * ) {;}
virtual void drawBezier( TQPointArray & ) {;}
virtual void drawRect( float, float, float, float ) {;}
virtual void fillRect( float, float, float, float ) {;}
virtual void drawRoundRect( float, float, float, float, float, float ) {;}
virtual void fillRoundRect( float, float, float, float, float, float ) {;}
virtual void drawEllipse( float, float, float, float ) {;}
virtual void fillEllipse( float, float, float, float ) {;}
virtual void drawPie( float, float, float, float, float, float ) {;}
virtual void fillPie( float, float, float, float, float, float ) {;}
virtual void drawChord( float, float, float, float, float, float ) {;}
virtual void fillChord( float, float, float, float, float, float ) {;}
virtual void drawOpenPath( TQPtrList<KivioPoint> * ) {;}
virtual void drawClosedPath( TQPtrList<KivioPoint> * ) {;}
virtual void drawLineArray( TQPtrList<KivioPoint> * ) {;}
virtual void drawPolyline( TQPtrList<KivioPoint> * ) {;}
virtual void drawPolygon( TQPtrList<KivioPoint> * ) {;}
virtual void drawLineArray( TQPointArray & ) {;}
virtual void drawPolyline( TQPointArray & ) {;}
virtual void drawPolygon( TQPointArray & ) {;}
virtual void setFont( const TQFont & ) {;}
virtual void drawText( int, int, int, int, int, const TQString & ) {;}
virtual TQRect boundingRect( int, int, int, int, int, const TQString & ) { return TQRect(0,0,100,100); }
// These shouldn't be used for anything except the screen painter right now...
virtual void drawPixmap( float, float, const TQPixmap & ) {;}
/*\
|*| Miscellaneous Functions
|*| note: These don't need to be implemented by everything
\*/
// connector point flags
enum {
cpfConnectable=0x1,
cpfStart=0x2,
cpfEnd=0x4,
cpfConnected=0x8,
cpfLock=0x10
};
virtual void drawHandle( float, float, int ) { ; }
virtual void drawSelectionBox( const TQRect& ) { ; }
virtual void saveState() {;}
virtual void restoreState() {;}
virtual void setTranslation(float, float) {;}
virtual void translateBy(float, float) {;}
virtual void setRotation(int) {;}
virtual void rotateBy(int) {;}
virtual int rotation() { return 0; }
virtual void setWorldMatrix(TQWMatrix, bool) {;}
};
#endif
|