summaryrefslogtreecommitdiffstats
path: root/doc/html/qcanvas-h.html
blob: 61a641b1d62066fab7cda6c3e59c13aef953bd1e (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
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!-- /home/espenr/tmp/qt-3.3.8-espenr-2499/qt-x11-free-3.3.8/include/ntqcanvas.h:1 -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>ntqcanvas.h Include File</title>
<style type="text/css"><!--
fn { margin-left: 1cm; text-indent: -1cm; }
a:link { color: #004faf; text-decoration: none }
a:visited { color: #672967; text-decoration: none }
body { background: #ffffff; color: black; }
--></style>
</head>
<body>

<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr bgcolor="#E5E5E5">
<td valign=center>
 <a href="index.html">
<font color="#004faf">Home</font></a>
 | <a href="classes.html">
<font color="#004faf">All&nbsp;Classes</font></a>
 | <a href="mainclasses.html">
<font color="#004faf">Main&nbsp;Classes</font></a>
 | <a href="annotated.html">
<font color="#004faf">Annotated</font></a>
 | <a href="groups.html">
<font color="#004faf">Grouped&nbsp;Classes</font></a>
 | <a href="functions.html">
<font color="#004faf">Functions</font></a>
</td>
<td align="right" valign="center"><img src="logo32.png" align="right" width="64" height="32" border="0"></td></tr></table><h1 align=center>ntqcanvas.h</h1>

<p>This is the verbatim text of the ntqcanvas.h include file. It is provided only for illustration; the copyright remains with Trolltech.
<hr>
<pre>
/**********************************************************************
** $Id: qt/ntqcanvas.h   3.3.8   edited Jan 11 14:46 $
**
** Definition of TQCanvas classes
**
** Created : 991211
**
** Copyright (C) 1999-2007 Trolltech ASA.  All rights reserved.
**
** This file is part of the canvas module of the TQt GUI Toolkit.
**
** This file may be used under the terms of the GNU General Public
** License versions 2.0 or 3.0 as published by the Free Software
** Foundation and appearing in the file LICENSE.GPL included in the
** packaging of this file. Alternatively you may (at your option) use any
** later version of the GNU General Public License if such license has
** been publicly approved by Trolltech ASA (or its successors, if any)
** and the KDE Free TQt Foundation.
**
** Please review the following information to ensure GNU General
** Public Licensing requirements will be met:
** http://trolltech.com/products/qt/licenses/licensing/opensource/.
** If you are unsure which license is appropriate for your use, please
** review the following information:
** http://trolltech.com/products/qt/licenses/licensing/licensingoverview
** or contact the sales department at [email protected].
**
** This file may be used under the terms of the Q Public License as
** defined by Trolltech ASA and appearing in the file LICENSE.TQPL
** included in the packaging of this file.  Licensees holding valid TQt
** Commercial licenses may use this file in accordance with the TQt
** Commercial License Agreement provided with the Software.
**
** This file is provided "AS IS" with NO WARRANTY OF ANY KIND,
** INCLUDING THE WARRANTIES OF DESIGN, MERCHANTABILITY AND FITNESS FOR
** A PARTICULAR PURPOSE. Trolltech reserves all rights not granted
** herein.
**
**********************************************************************/

#ifndef TQCANVAS_H
#define TQCANVAS_H

#ifndef QT_H
#include "ntqscrollview.h"
#include "ntqpixmap.h"
#include "ntqptrlist.h"
#include "ntqbrush.h"
#include "ntqpen.h"
#include "ntqvaluelist.h"
#include "ntqpointarray.h"
#endif // QT_H

#if !defined( TQT_MODULE_CANVAS ) || defined( QT_LICENSE_PROFESSIONAL ) || defined( QT_INTERNAL_CANVAS )
#define TQM_EXPORT_CANVAS
#define TQM_TEMPLATE_EXTERN_CANVAS
#else
#define TQM_EXPORT_CANVAS Q_EXPORT
#define TQM_TEMPLATE_EXTERN_CANVAS Q_TEMPLATE_EXTERN
#endif

#ifndef TQT_NO_CANVAS


class TQCanvasSprite;
class TQCanvasPolygonalItem;
class TQCanvasRectangle;
class TQCanvasPolygon;
class TQCanvasEllipse;
class TQCanvasText;
class TQCanvasLine;
class TQCanvasChunk;
class TQCanvas;
class TQCanvasItem;
class TQCanvasView;
class TQCanvasPixmap;

#if defined(Q_TEMPLATEDLL) &amp;&amp; ( !defined(Q_CC_BOR) || !defined(QT_MAKEDLL) || defined(Q_EXPORT_TEMPLATES) )
// MOC_SKIP_BEGIN
TQM_TEMPLATE_EXTERN_CANVAS template class TQM_EXPORT_CANVAS TQValueListIterator&lt; TQCanvasItem* &gt;;
TQM_TEMPLATE_EXTERN_CANVAS template class TQM_EXPORT_CANVAS TQValueList&lt; TQCanvasItem* &gt;;
// MOC_SKIP_END
#endif

class TQM_EXPORT_CANVAS TQCanvasItemList : public TQValueList&lt;TQCanvasItem*&gt; {
public:
    void sort();
    void drawUnique( TQPainter&amp; painter );
    TQCanvasItemList operator+(const TQCanvasItemList &amp;l) const;
};


class TQCanvasItemExtra;

class TQM_EXPORT_CANVAS TQCanvasItem : public TQt
{
public:
    TQCanvasItem(TQCanvas* canvas);
    virtual ~TQCanvasItem();

    double x() const
	{ return myx; }
    double y() const
	{ return myy; }
    double z() const
	{ return myz; } // (depth)

    virtual void moveBy(double dx, double dy);
    void move(double x, double y);
    void setX(double a) { move(a,y()); }
    void setY(double a) { move(x(),a); }
    void setZ(double a) { myz=a; changeChunks(); }

    bool animated() const;
    virtual void setAnimated(bool y);
    virtual void setVelocity( double vx, double vy);
    void setXVelocity( double vx ) { setVelocity(vx,yVelocity()); }
    void setYVelocity( double vy ) { setVelocity(xVelocity(),vy); }
    double xVelocity() const;
    double yVelocity() const;
    virtual void advance(int stage);

    virtual bool collidesWith( const TQCanvasItem* ) const=0;

    TQCanvasItemList collisions(bool exact /* NO DEFAULT */ ) const;

    virtual void setCanvas(TQCanvas*);

    virtual void draw(TQPainter&amp;)=0;

    void show();
    void hide();

    virtual void setVisible(bool yes);
    bool isVisible() const
	{ return (bool)vis; }
    virtual void setSelected(bool yes);
    bool isSelected() const
	{ return (bool)sel; }
    virtual void setEnabled(bool yes);
    bool isEnabled() const
	{ return (bool)ena; }
    virtual void setActive(bool yes);
    bool isActive() const
	{ return (bool)act; }
#ifndef TQT_NO_COMPAT
    bool visible() const
	{ return (bool)vis; }
    bool selected() const
	{ return (bool)sel; }
    bool enabled() const
	{ return (bool)ena; }
    bool active() const
	{ return (bool)act; }
#endif

    enum RttiValues {
	Rtti_Item = 0,
	Rtti_Sprite = 1,
	Rtti_PolygonalItem = 2,
	Rtti_Text = 3,
	Rtti_Polygon = 4,
	Rtti_Rectangle = 5,
	Rtti_Ellipse = 6,
	Rtti_Line = 7,
	Rtti_Spline = 8
    };

    virtual int rtti() const;
    static int RTTI;

    virtual TQRect boundingRect() const=0;
    virtual TQRect boundingRectAdvanced() const;

    TQCanvas* canvas() const
	{ return cnv; }

protected:
    void update() { changeChunks(); }

private:
    // For friendly subclasses...

    friend class TQCanvasPolygonalItem;
    friend class TQCanvasSprite;
    friend class TQCanvasRectangle;
    friend class TQCanvasPolygon;
    friend class TQCanvasEllipse;
    friend class TQCanvasText;
    friend class TQCanvasLine;

    virtual TQPointArray chunks() const;
    virtual void addToChunks();
    virtual void removeFromChunks();
    virtual void changeChunks();
    virtual bool collidesWith( const TQCanvasSprite*,
			       const TQCanvasPolygonalItem*,
			       const TQCanvasRectangle*,
			       const TQCanvasEllipse*,
			       const TQCanvasText* ) const = 0;
    // End of friend stuff

    TQCanvas* cnv;
    static TQCanvas* current_canvas;
    double myx,myy,myz;
    TQCanvasItemExtra *ext;
    TQCanvasItemExtra&amp; extra();
    uint ani:1;
    uint vis:1;
    uint val:1;
    uint sel:1;
    uint ena:1;
    uint act:1;
};


class TQCanvasData;

class TQM_EXPORT_CANVAS TQCanvas : public TQObject
{
    TQ_OBJECT
public:
    TQCanvas( TQObject* parent = 0, const char* name = 0 );
    TQCanvas(int w, int h);
    TQCanvas( TQPixmap p, int h, int v, int tilewidth, int tileheight );

    virtual ~TQCanvas();

    virtual void setTiles( TQPixmap tiles, int h, int v,
			   int tilewidth, int tileheight );
    virtual void setBackgroundPixmap( const TQPixmap&amp; p );
    TQPixmap backgroundPixmap() const;

    virtual void setBackgroundColor( const TQColor&amp; c );
    TQColor backgroundColor() const;

    virtual void setTile( int x, int y, int tilenum );
    int tile( int x, int y ) const
	{ return grid[x+y*htiles]; }

    int tilesHorizontally() const
	{ return htiles; }
    int tilesVertically() const
	{ return vtiles; }

    int tileWidth() const
	{ return tilew; }
    int tileHeight() const
	{ return tileh; }

    virtual void resize(int width, int height);
    int width() const
	{ return awidth; }
    int height() const
	{ return aheight; }
    TQSize size() const
	{ return TQSize(awidth,aheight); }
    TQRect rect() const
	{ return TQRect( 0, 0, awidth, aheight ); }
    bool onCanvas( int x, int y ) const
	{ return x&gt;=0 &amp;&amp; y&gt;=0 &amp;&amp; x&lt;awidth &amp;&amp; y&lt;aheight; }
    bool onCanvas( const TQPoint&amp; p ) const
	{ return onCanvas(p.x(),p.y()); }
    bool validChunk( int x, int y ) const
	{ return x&gt;=0 &amp;&amp; y&gt;=0 &amp;&amp; x&lt;chwidth &amp;&amp; y&lt;chheight; }
    bool validChunk( const TQPoint&amp; p ) const
	{ return validChunk(p.x(),p.y()); }

    int chunkSize() const
	{ return chunksize; }
    virtual void retune(int chunksize, int maxclusters=100);

    bool sameChunk(int x1, int y1, int x2, int y2) const
	{ return x1/chunksize==x2/chunksize &amp;&amp; y1/chunksize==y2/chunksize; }
    virtual void setChangedChunk(int i, int j);
    virtual void setChangedChunkContaining(int x, int y);
    virtual void setAllChanged();
    virtual void setChanged(const TQRect&amp; area);
    virtual void setUnchanged(const TQRect&amp; area);

    // These call setChangedChunk.
    void addItemToChunk(TQCanvasItem*, int i, int j);
    void removeItemFromChunk(TQCanvasItem*, int i, int j);
    void addItemToChunkContaining(TQCanvasItem*, int x, int y);
    void removeItemFromChunkContaining(TQCanvasItem*, int x, int y);

    TQCanvasItemList allItems();
    TQCanvasItemList collisions( const TQPoint&amp;) const;
    TQCanvasItemList collisions( const TQRect&amp;) const;
    TQCanvasItemList collisions( const TQPointArray&amp; pa, const TQCanvasItem* item,
				bool exact) const;

    void drawArea(const TQRect&amp;, TQPainter* p, bool double_buffer=FALSE);

    // These are for TQCanvasView to call
    virtual void addView(TQCanvasView*);
    virtual void removeView(TQCanvasView*);
    void drawCanvasArea(const TQRect&amp;, TQPainter* p=0, bool double_buffer=TRUE);
    void drawViewArea( TQCanvasView* view, TQPainter* p, const TQRect&amp; r, bool dbuf );

    // These are for TQCanvasItem to call
    virtual void addItem(TQCanvasItem*);
    virtual void addAnimation(TQCanvasItem*);
    virtual void removeItem(TQCanvasItem*);
    virtual void removeAnimation(TQCanvasItem*);

    virtual void setAdvancePeriod(int ms);
    virtual void setUpdatePeriod(int ms);

    virtual void setDoubleBuffering(bool y);

signals:
    void resized();

public slots:
    virtual void advance();
    virtual void update();

protected:
    virtual void drawBackground(TQPainter&amp;, const TQRect&amp; area);
    virtual void drawForeground(TQPainter&amp;, const TQRect&amp; area);

private:
    void init(int w, int h, int chunksze=16, int maxclust=100);

    TQCanvasChunk&amp; chunk(int i, int j) const;
    TQCanvasChunk&amp; chunkContaining(int x, int y) const;

    TQRect changeBounds(const TQRect&amp; inarea);
    void drawChanges(const TQRect&amp; inarea);

    TQPixmap offscr;
    int awidth,aheight;
    int chunksize;
    int maxclusters;
    int chwidth,chheight;
    TQCanvasChunk* chunks;

    TQCanvasData* d;

    void initTiles(TQPixmap p, int h, int v, int tilewidth, int tileheight);
    ushort *grid;
    ushort htiles;
    ushort vtiles;
    ushort tilew;
    ushort tileh;
    bool oneone;
    TQPixmap pm;
    TQTimer* update_timer;
    TQColor bgcolor;
    bool debug_redraw_areas;
    bool dblbuf;

    friend void qt_unview(TQCanvas* c);

#if defined(TQ_DISABLE_COPY) // Disabled copy constructor and operator=
    TQCanvas( const TQCanvas &amp; );
    TQCanvas &amp;operator=( const TQCanvas &amp; );
#endif
};

class TQCanvasViewData;

class TQM_EXPORT_CANVAS TQCanvasView : public TQScrollView
{
    TQ_OBJECT
public:

    TQCanvasView(TQWidget* parent=0, const char* name=0, WFlags f=0);
    TQCanvasView(TQCanvas* viewing, TQWidget* parent=0, const char* name=0, WFlags f=0);
    ~TQCanvasView();

    TQCanvas* canvas() const
	{ return viewing; }
    void setCanvas(TQCanvas* v);

    const TQWMatrix &amp;worldMatrix() const;
    const TQWMatrix &amp;inverseWorldMatrix() const;
    bool setWorldMatrix( const TQWMatrix &amp; );

protected:
    void drawContents( TQPainter*, int cx, int cy, int cw, int ch );
    TQSize sizeHint() const;

private:
    void drawContents( TQPainter* );
    TQCanvas* viewing;
    TQCanvasViewData* d;
    friend void qt_unview(TQCanvas* c);

private slots:
    void cMoving(int,int);
    void updateContentsSize();

private:
#if defined(TQ_DISABLE_COPY) // Disabled copy constructor and operator=
    TQCanvasView( const TQCanvasView &amp; );
    TQCanvasView &amp;operator=( const TQCanvasView &amp; );
#endif
};


class TQM_EXPORT_CANVAS TQCanvasPixmap : public TQPixmap
{
public:
#ifndef TQT_NO_IMAGEIO
    TQCanvasPixmap(const TQString&amp; datafilename);
#endif
    TQCanvasPixmap(const TQImage&amp; image);
    TQCanvasPixmap(const TQPixmap&amp;, const TQPoint&amp; hotspot);
    ~TQCanvasPixmap();

    int offsetX() const
	{ return hotx; }
    int offsetY() const
	{ return hoty; }
    void setOffset(int x, int y) { hotx = x; hoty = y; }

private:
#if defined(TQ_DISABLE_COPY)
    TQCanvasPixmap( const TQCanvasPixmap &amp; );
    TQCanvasPixmap &amp;operator=( const TQCanvasPixmap &amp; );
#endif
    void init(const TQImage&amp;);
    void init(const TQPixmap&amp; pixmap, int hx, int hy);

    friend class TQCanvasSprite;
    friend class TQCanvasPixmapArray;
    friend bool qt_testCollision(const TQCanvasSprite* s1, const TQCanvasSprite* s2);

    int hotx,hoty;

    TQImage* collision_mask;
};


class TQM_EXPORT_CANVAS TQCanvasPixmapArray
{
public:
    TQCanvasPixmapArray();
#ifndef TQT_NO_IMAGEIO
    TQCanvasPixmapArray(const TQString&amp; datafilenamepattern, int framecount=0);
#endif
    // this form is deprecated
    TQCanvasPixmapArray(TQPtrList&lt;TQPixmap&gt;, TQPtrList&lt;TQPoint&gt; hotspots);

    TQCanvasPixmapArray(TQValueList&lt;TQPixmap&gt;, TQPointArray hotspots = TQPointArray() );
    ~TQCanvasPixmapArray();

#ifndef TQT_NO_IMAGEIO
    bool readPixmaps(const TQString&amp; datafilenamepattern, int framecount=0);
    bool readCollisionMasks(const TQString&amp; filenamepattern);
#endif

    // deprecated
    bool operator!(); // Failure check.
    bool isValid() const;

    TQCanvasPixmap* image(int i) const
	{ return img ? img[i] : 0; }
    void setImage(int i, TQCanvasPixmap* p);
    uint count() const
	{ return (uint)framecount; }

private:
#if defined(TQ_DISABLE_COPY)
    TQCanvasPixmapArray( const TQCanvasPixmapArray &amp; );
    TQCanvasPixmapArray &amp;operator=( const TQCanvasPixmapArray &amp; );
#endif
#ifndef TQT_NO_IMAGEIO
    bool readPixmaps(const TQString&amp; datafilenamepattern, int framecount, bool maskonly);
#endif

    void reset();
    int framecount;
    TQCanvasPixmap** img;
};


class TQM_EXPORT_CANVAS TQCanvasSprite : public TQCanvasItem
{
public:
    TQCanvasSprite(TQCanvasPixmapArray* array, TQCanvas* canvas);

    void setSequence(TQCanvasPixmapArray* seq);

    virtual ~TQCanvasSprite();

    void move(double x, double y);
    virtual void move(double x, double y, int frame);
    void setFrame(int);
    enum FrameAnimationType { Cycle, Oscillate };
    virtual void setFrameAnimation(FrameAnimationType=Cycle, int step=1, int state=0);
    int frame() const
	{ return frm; }
    int frameCount() const
	{ return images-&gt;count(); }

    int rtti() const;
    static int RTTI;

    bool collidesWith( const TQCanvasItem* ) const;

    TQRect boundingRect() const;

    // is there a reason for these to be protected? Lars
//protected:

    int width() const;
    int height() const;

    int leftEdge() const;
    int topEdge() const;
    int rightEdge() const;
    int bottomEdge() const;

    int leftEdge(int nx) const;
    int topEdge(int ny) const;
    int rightEdge(int nx) const;
    int bottomEdge(int ny) const;
    TQCanvasPixmap* image() const
	{ return images-&gt;image(frm); }
    virtual TQCanvasPixmap* imageAdvanced() const;
    TQCanvasPixmap* image(int f) const
	{ return images-&gt;image(f); }
    virtual void advance(int stage);

public:
    void draw(TQPainter&amp; painter);

private:
#if defined(TQ_DISABLE_COPY)
    TQCanvasSprite( const TQCanvasSprite &amp; );
    TQCanvasSprite &amp;operator=( const TQCanvasSprite &amp; );
#endif
    void addToChunks();
    void removeFromChunks();
    void changeChunks();

    int frm;
    ushort anim_val;
    uint anim_state:2;
    uint anim_type:14;
    bool collidesWith( const TQCanvasSprite*,
		       const TQCanvasPolygonalItem*,
		       const TQCanvasRectangle*,
		       const TQCanvasEllipse*,
		       const TQCanvasText* ) const;

    friend bool qt_testCollision( const TQCanvasSprite* s1,
				  const TQCanvasSprite* s2 );

    TQCanvasPixmapArray* images;
};

class TQPolygonalProcessor;

class TQM_EXPORT_CANVAS TQCanvasPolygonalItem : public TQCanvasItem
{
public:
    TQCanvasPolygonalItem(TQCanvas* canvas);
    virtual ~TQCanvasPolygonalItem();

    bool collidesWith( const TQCanvasItem* ) const;

    virtual void setPen(TQPen p);
    virtual void setBrush(TQBrush b);

    TQPen pen() const
	{ return pn; }
    TQBrush brush() const
	{ return br; }

    virtual TQPointArray areaPoints() const=0;
    virtual TQPointArray areaPointsAdvanced() const;
    TQRect boundingRect() const;

    int rtti() const;
    static int RTTI;

protected:
    void draw(TQPainter &amp;);
    virtual void drawShape(TQPainter &amp;) = 0;

    bool winding() const;
    void setWinding(bool);

    void invalidate();
    bool isValid() const
	{ return (bool)val; }

private:
    void scanPolygon( const TQPointArray&amp; pa, int winding,
		      TQPolygonalProcessor&amp; process ) const;
    TQPointArray chunks() const;

    bool collidesWith( const TQCanvasSprite*,
		       const TQCanvasPolygonalItem*,
		       const TQCanvasRectangle*,
		       const TQCanvasEllipse*,
		       const TQCanvasText* ) const;

    TQBrush br;
    TQPen pn;
    uint wind:1;
};


class TQM_EXPORT_CANVAS TQCanvasRectangle : public TQCanvasPolygonalItem
{
public:
    TQCanvasRectangle(TQCanvas* canvas);
    TQCanvasRectangle(const TQRect&amp;, TQCanvas* canvas);
    TQCanvasRectangle(int x, int y, int width, int height, TQCanvas* canvas);

    ~TQCanvasRectangle();

    int width() const;
    int height() const;
    void setSize(int w, int h);
    TQSize size() const
	{ return TQSize(w,h); }
    TQPointArray areaPoints() const;
    TQRect rect() const
	{ return TQRect(int(x()),int(y()),w,h); }

    bool collidesWith( const TQCanvasItem* ) const;

    int rtti() const;
    static int RTTI;

protected:
    void drawShape(TQPainter &amp;);
    TQPointArray chunks() const;

private:
    bool collidesWith(   const TQCanvasSprite*,
			 const TQCanvasPolygonalItem*,
			 const TQCanvasRectangle*,
			 const TQCanvasEllipse*,
			 const TQCanvasText* ) const;

    int w, h;
};


class TQM_EXPORT_CANVAS TQCanvasPolygon : public TQCanvasPolygonalItem
{
public:
    TQCanvasPolygon(TQCanvas* canvas);
    ~TQCanvasPolygon();
    void setPoints(TQPointArray);
    TQPointArray points() const;
    void moveBy(double dx, double dy);

    TQPointArray areaPoints() const;

    int rtti() const;
    static int RTTI;

protected:
    void drawShape(TQPainter &amp;);
    TQPointArray poly;
};


class TQM_EXPORT_CANVAS TQCanvasSpline : public TQCanvasPolygon
{
public:
    TQCanvasSpline(TQCanvas* canvas);
    ~TQCanvasSpline();

    void setControlPoints(TQPointArray, bool closed=TRUE);
    TQPointArray controlPoints() const;
    bool closed() const;

    int rtti() const;
    static int RTTI;

private:
    void recalcPoly();
    TQPointArray bez;
    bool cl;
};


class TQM_EXPORT_CANVAS TQCanvasLine : public TQCanvasPolygonalItem
{
public:
    TQCanvasLine(TQCanvas* canvas);
    ~TQCanvasLine();
    void setPoints(int x1, int y1, int x2, int y2);

    TQPoint startPoint() const
	{ return TQPoint(x1,y1); }
    TQPoint endPoint() const
	{ return TQPoint(x2,y2); }

    int rtti() const;
    static int RTTI;

    void setPen(TQPen p);
    void moveBy(double dx, double dy);

protected:
    void drawShape(TQPainter &amp;);
    TQPointArray areaPoints() const;

private:
    int x1,y1,x2,y2;
};


class TQM_EXPORT_CANVAS TQCanvasEllipse : public TQCanvasPolygonalItem
{

public:
    TQCanvasEllipse( TQCanvas* canvas );
    TQCanvasEllipse( int width, int height, TQCanvas* canvas );
    TQCanvasEllipse( int width, int height, int startangle, int angle,
		    TQCanvas* canvas );

    ~TQCanvasEllipse();

    int width() const;
    int height() const;
    void setSize(int w, int h);
    void setAngles(int start, int length);
    int angleStart() const
	{ return a1; }
    int angleLength() const
	{ return a2; }
    TQPointArray areaPoints() const;

    bool collidesWith( const TQCanvasItem* ) const;

    int rtti() const;
    static int RTTI;

protected:
    void drawShape(TQPainter &amp;);

private:
    bool collidesWith( const TQCanvasSprite*,
		       const TQCanvasPolygonalItem*,
		       const TQCanvasRectangle*,
		       const TQCanvasEllipse*,
		       const TQCanvasText* ) const;
    int w, h;
    int a1, a2;
};


class TQCanvasTextExtra;

class TQM_EXPORT_CANVAS TQCanvasText : public TQCanvasItem
{
public:
    TQCanvasText(TQCanvas* canvas);
    TQCanvasText(const TQString&amp;, TQCanvas* canvas);
    TQCanvasText(const TQString&amp;, TQFont, TQCanvas* canvas);

    virtual ~TQCanvasText();

    void setText( const TQString&amp; );
    void setFont( const TQFont&amp; );
    void setColor( const TQColor&amp; );
    TQString text() const;
    TQFont font() const;
    TQColor color() const;

    void moveBy(double dx, double dy);

    int textFlags() const
	{ return flags; }
    void setTextFlags(int);

    TQRect boundingRect() const;

    bool collidesWith( const TQCanvasItem* ) const;

    int rtti() const;
    static int RTTI;

protected:
    virtual void draw(TQPainter&amp;);

private:
#if defined(TQ_DISABLE_COPY)
    TQCanvasText( const TQCanvasText &amp; );
    TQCanvasText &amp;operator=( const TQCanvasText &amp; );
#endif
    void addToChunks();
    void removeFromChunks();
    void changeChunks();

    void setRect();
    TQRect brect;
    TQString txt;
    int flags;
    TQFont fnt;
    TQColor col;
    TQCanvasTextExtra* extra;

    bool collidesWith(   const TQCanvasSprite*,
			 const TQCanvasPolygonalItem*,
			 const TQCanvasRectangle*,
			 const TQCanvasEllipse*,
			 const TQCanvasText* ) const;
};

#define Q_DEFINED_QCANVAS
#include "ntqwinexport.h"
#endif // TQT_NO_CANVAS

#endif // TQCANVAS_H
</pre>
<!-- eof -->
<p><address><hr><div align=center>
<table width=100% cellspacing=0 border=0><tr>
<td>Copyright &copy; 2007
<a href="troll.html">Trolltech</a><td align=center><a href="trademarks.html">Trademarks</a>
<td align=right><div align=right>TQt 3.3.8</div>
</table></div></address></body>
</html>