kivio

kivio_painter.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_PAINTER_H
20#define KIVIO_PAINTER_H
21
22#include <tqfont.h>
23#include <tqptrlist.h>
24#include <tqpaintdevice.h>
25#include <tqpixmap.h>
26#include <tqpointarray.h>
27#include <tqwmatrix.h>
28
29#include "kivio_fill_style.h"
30
31class KivioPoint;
32class KivioFillStyle;
33class KivioLineStyle;
34
35class KivioPainter
36{
37protected:
38 KivioFillStyle *m_pFillStyle;
39 KivioLineStyle *m_pLineStyle;
40
41 TQColor m_textColor;
42
43public:
44 KivioPainter();
45 virtual ~KivioPainter();
46
47 virtual bool start( TQPaintDevice * ) { return false;}
48 virtual bool stop() { return false;}
49
50
51 /*\
52 |*|
53 |*|
54 |*| PROPERTY SETTINGS
55 |*|
56 |*| (probably don't need to reimplement -- unless you are optimizing)
57 \*/
58 virtual float lineWidth() const;
59 virtual void setLineWidth( const float &f );
60
61 // virtual void setClipRect( TQRect * );
62 // virtual TQRect *clipRect();
63
64 virtual TQColor fgColor() const;
65 virtual void setFGColor( const TQColor &c );
66
67 virtual TQColor bgColor() const { return m_pFillStyle->color(); }
68 virtual void setBGColor( const TQColor &c ) { m_pFillStyle->setColor(c); }
69
70 virtual TQColor textColor() const { return m_textColor; }
71 virtual void setTextColor( const TQColor &c ) { m_textColor = c; }
72
73 virtual KivioFillStyle *fillStyle() { return m_pFillStyle; }
74
75 virtual void setLineStyle( KivioLineStyle * );
76 virtual void setFillStyle( KivioFillStyle * );
77
78 /*\
79 |*|
80 |*|
81 |*| PRIMITIVE FUNCTIONS
82 |*|
83 |*| (all descendants *must* reimplement these)
84 \*/
85 virtual void drawLine( float, float, float, float ) {;}
86 virtual void drawArc( float, float, float, float, float, float ) {;}
87
88 virtual void drawBezier( TQPtrList<KivioPoint> * ) {;}
89 virtual void drawBezier( TQPointArray & ) {;}
90
91 virtual void drawRect( float, float, float, float ) {;}
92 virtual void fillRect( float, float, float, float ) {;}
93
94 virtual void drawRoundRect( float, float, float, float, float, float ) {;}
95 virtual void fillRoundRect( float, float, float, float, float, float ) {;}
96
97 virtual void drawEllipse( float, float, float, float ) {;}
98 virtual void fillEllipse( float, float, float, float ) {;}
99
100 virtual void drawPie( float, float, float, float, float, float ) {;}
101 virtual void fillPie( float, float, float, float, float, float ) {;}
102
103 virtual void drawChord( float, float, float, float, float, float ) {;}
104 virtual void fillChord( float, float, float, float, float, float ) {;}
105
106 virtual void drawOpenPath( TQPtrList<KivioPoint> * ) {;}
107 virtual void drawClosedPath( TQPtrList<KivioPoint> * ) {;}
108
109 virtual void drawLineArray( TQPtrList<KivioPoint> * ) {;}
110 virtual void drawPolyline( TQPtrList<KivioPoint> * ) {;}
111 virtual void drawPolygon( TQPtrList<KivioPoint> * ) {;}
112
113 virtual void drawLineArray( TQPointArray & ) {;}
114 virtual void drawPolyline( TQPointArray & ) {;}
115 virtual void drawPolygon( TQPointArray & ) {;}
116
117 virtual void setFont( const TQFont & ) {;}
118 virtual void drawText( int, int, int, int, int, const TQString & ) {;}
119 virtual TQRect boundingRect( int, int, int, int, int, const TQString & ) { return TQRect(0,0,100,100); }
120
121
122 // These shouldn't be used for anything except the screen painter right now...
123 virtual void drawPixmap( float, float, const TQPixmap & ) {;}
124
125 /*\
126 |*| Miscellaneous Functions
127 |*| note: These don't need to be implemented by everything
128 \*/
129 // connector point flags
130 enum {
131 cpfConnectable=0x1,
132 cpfStart=0x2,
133 cpfEnd=0x4,
134 cpfConnected=0x8,
135 cpfLock=0x10
136 };
137 virtual void drawHandle( float, float, int ) { ; }
138 virtual void drawSelectionBox( const TQRect& ) { ; }
139
140 virtual void saveState() {;}
141 virtual void restoreState() {;}
142 virtual void setTranslation(float, float) {;}
143 virtual void translateBy(float, float) {;}
144 virtual void setRotation(int) {;}
145 virtual void rotateBy(int) {;}
146 virtual int rotation() { return 0; }
147
148 virtual void setWorldMatrix(TQWMatrix, bool) {;}
149};
150
151#endif
152
153