Diffstat (limited to 'pwmanager/pwmanager/printtext.h') (more/less context) (ignore whitespace changes)
-rw-r--r-- | pwmanager/pwmanager/printtext.h | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/pwmanager/pwmanager/printtext.h b/pwmanager/pwmanager/printtext.h new file mode 100644 index 0000000..82e31b0 --- a/dev/null +++ b/pwmanager/pwmanager/printtext.h | |||
@@ -0,0 +1,68 @@ | |||
1 | /*************************************************************************** | ||
2 | * * | ||
3 | * copyright (C) 2003 by Michael Buesch * | ||
4 | * email: mbuesch@freenet.de * | ||
5 | * * | ||
6 | * This program is free software; you can redistribute it and/or modify * | ||
7 | * it under the terms of the GNU General Public License version 2 * | ||
8 | * as published by the Free Software Foundation. * | ||
9 | * * | ||
10 | ***************************************************************************/ | ||
11 | |||
12 | #ifndef PRINTTEXT_H | ||
13 | #define PRINTTEXT_H | ||
14 | |||
15 | #include <kprinter.h> | ||
16 | |||
17 | #include <qpainter.h> | ||
18 | #include <qpaintdevicemetrics.h> | ||
19 | #include <qrect.h> | ||
20 | #include <qpoint.h> | ||
21 | |||
22 | /** prints text "raw" to a printer */ | ||
23 | class PrintText : public KPrinter | ||
24 | { | ||
25 | public: | ||
26 | PrintText(); | ||
27 | ~PrintText(); | ||
28 | |||
29 | /** begin printing. Call this before drawing to the device! */ | ||
30 | void beginPrint(); | ||
31 | /** prints a line */ | ||
32 | void printLine(QString t); | ||
33 | /** returns a pointer to the paint object */ | ||
34 | QPainter* getPaint() | ||
35 | { return paint; } | ||
36 | /** sets the header-text */ | ||
37 | void setHeader(const QString &left, const QString &middle); | ||
38 | /** returns the header-text */ | ||
39 | void getHeader(QString *left, QString *middle); | ||
40 | |||
41 | protected: | ||
42 | /** painter object */ | ||
43 | QPainter *paint; | ||
44 | /** metrics */ | ||
45 | QPaintDeviceMetrics *metrics; | ||
46 | /** left field of header */ | ||
47 | QString headerLeft; | ||
48 | /** middle field of header */ | ||
49 | QString headerMiddle; | ||
50 | /** right field of header */ | ||
51 | QString headerRight; | ||
52 | /** current Y-Position */ | ||
53 | int curYPos; | ||
54 | /** text-body rectangle */ | ||
55 | QRect body; | ||
56 | /** line-spacing */ | ||
57 | int ls; | ||
58 | /** top-left point for beginning printing */ | ||
59 | QPoint topLeft; | ||
60 | /** current page number */ | ||
61 | int page; | ||
62 | |||
63 | protected: | ||
64 | /** prints the header on the page */ | ||
65 | void printHeader(); | ||
66 | }; | ||
67 | |||
68 | #endif | ||