Qucs-GUI  0.0.19
/home/travis/build/Qucs/qucs/qucs/qucs/viewpainter.h
Go to the documentation of this file.
00001 /***************************************************************************
00002                                viewpainter.h
00003                               ---------------
00004     begin                : Tue Oct 05 2004
00005     copyright            : (C) 2004 by Michael Margraf
00006     email                : michael.margraf@alumni.tu-berlin.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef VIEWPAINTER_H
00019 #define VIEWPAINTER_H
00020 
00021 class QPainter;
00022 class QString;
00023 class QColor;
00024 
00025 #define TO_INT(f)   (f > 0.0 ? int(f + 0.5) : int(f - 0.5))
00026 
00027 /* This class is neccessary because scaled fonts looks very ungly.
00028    Avoiding this is unfortunately not easy.
00029    This class scales the font point size instead of the font glyphes.
00030    But this has the disadvantage, that the text size does not increase
00031    equally with the rest of the drawing. We therefore must compute
00032    some thing anew each time the paint function is called. The class
00033    "ViewPainter" supports this. */
00034 
00035 class ViewPainter {
00036 public:
00037   ViewPainter(QPainter *p=0);
00038  ~ViewPainter();
00039 
00040   void init(QPainter*, float, int, int, int, int, 
00041       float FontScale_=0.0, float PrintScale_=1.0);
00042   void map(int, int, int&, int&);
00043   void drawPoint(int, int);
00044   void drawLine (int, int, int, int);
00045   void drawRect (int, int, int, int);
00046   void drawRectD(int, int, int, int);
00047   void drawRoundRect(int, int, int, int);
00048   void drawEllipse(int, int, int, int);
00049   void drawArc(int, int, int, int, int, int);
00050   int  drawText(const QString&, int, int, int *Height=0);
00051   int  drawTextMapped(const QString&, int, int, int *Height=0);
00052   void fillRect(int, int, int, int, const QColor&);
00053   void eraseRect(int, int, int, int);
00054   void drawResizeRect(int, int);
00055 
00056   QPainter *Painter;
00057   float Scale, FontScale, PrintScale, DX , DY;
00058   int LineSpacing;   // updated by init(), just for info
00059 };
00060 
00061 #endif
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines