blob: bc76dad7faad569578c959c9ccaf5f6d84d790fb (
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
|
/****************************************************************************
**
** Copyright (C) 1992-2008 Trolltech ASA. All rights reserved.
**
** This file is part of an example program for TQt. This example
** program may be used, distributed and modified without limitation.
**
*****************************************************************************/
#include <ntqpen.h>
#include <ntqpixmap.h>
#include <ntqpoint.h>
#include <ntqpointarray.h>
#include <ntqwidget.h>
#ifndef _MY_CANVAS_
#define _MY_CANVAS_
class Canvas : public TQWidget
{
Q_OBJECT
public:
Canvas( TQWidget *parent = 0, const char *name = 0, WFlags fl = 0 );
virtual ~Canvas() {};
void setPenColor( const TQColor &c )
{ saveColor = c;
pen.setColor( saveColor ); }
void setPenWidth( int w )
{ pen.setWidth( w ); }
TQColor penColor()
{ return pen.color(); }
int penWidth()
{ return pen.width(); }
void save( const TQString &filename, const TQString &format );
void clearScreen();
protected:
virtual void mousePressEvent( TQMouseEvent *e );
virtual void mouseReleaseEvent( TQMouseEvent *e );
virtual void mouseMoveEvent( TQMouseEvent *e );
virtual void resizeEvent( TQResizeEvent *e );
virtual void paintEvent( TQPaintEvent *e );
virtual void tabletEvent( TQTabletEvent *e );
TQPen pen;
TQPointArray polyline;
bool mousePressed;
int oldPressure;
TQColor saveColor;
TQPixmap buffer;
};
#endif
|