My Project  0.0.16
QUCS Mapping
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
viewpainter.h
Go to the documentation of this file.
1 /***************************************************************************
2  viewpainter.h
3  ---------------
4  begin : Tue Oct 05 2004
5  copyright : (C) 2004 by Michael Margraf
6  email : michael.margraf@alumni.tu-berlin.de
7  ***************************************************************************/
8 
9 /***************************************************************************
10  * *
11  * This program is free software; you can redistribute it and/or modify *
12  * it under the terms of the GNU General Public License as published by *
13  * the Free Software Foundation; either version 2 of the License, or *
14  * (at your option) any later version. *
15  * *
16  ***************************************************************************/
17 
18 #ifndef VIEWPAINTER_H
19 #define VIEWPAINTER_H
20 
21 #include <qpainter.h>
22 
23 #define TO_INT(f) (f > 0.0 ? int(f + 0.5) : int(f - 0.5))
24 
25 /* This class is neccessary because scaled fonts looks very ungly.
26  Avoiding this is unfortunately not easy.
27  This class scales the font point size instead of the font glyphes.
28  But this has the disadvantage, that the text size does not increase
29  equally with the rest of the drawing. We therefore must compute
30  some thing anew each time the paint function is called. The class
31  "ViewPainter" supports this. */
32 
33 class ViewPainter {
34 public:
35  ViewPainter(QPainter *p=0);
36  ~ViewPainter();
37 
38  void init(QPainter*, float, int, int, int, int, float FontScale_=0.0,
39  float PrintScale_=1.0);
40  void map(int, int, int&, int&);
41  void drawPoint(int, int);
42  void drawLine (int, int, int, int);
43  void drawLines(int, int, float*);
44  void drawRect (int, int, int, int);
45  void drawRectD(int, int, int, int);
46  void drawRoundRect(int, int, int, int);
47  void drawEllipse(int, int, int, int);
48  void drawArc(int, int, int, int, int, int);
49  int drawText(const QString&, int, int, int *Height=0);
50  int drawTextMapped(const QString&, int, int, int *Height=0);
51  void fillRect(int, int, int, int, const QColor&);
52  void eraseRect(int, int, int, int);
53  void drawResizeRect(int, int);
54  void drawStarSymbols(int, int, float*);
55  void drawCircleSymbols(int, int, float*);
56  void drawArrowSymbols(int, int, float*);
57 
58  QPainter *Painter;
60  int LineSpacing; // updated by init(), just for info
61 };
62 
63 #endif