Qwt User's Guide: qwt_painter.h Source File

Qwt User's Guide 6.0.1

- Main Page
- Related Pages
- Classes
- Files

- File List

# qwt_painter.h

    00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
    00002  * Qwt Widget Library
    00003  * Copyright (C) 1997   Josef Wilgen
    00004  * Copyright (C) 2002   Uwe Rathmann
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the Qwt License, Version 1.0
    00008  *****************************************************************************/
    00009
    00010 #ifndef QWT_PAINTER_H
    00011 #define QWT_PAINTER_H
    00012
    00013 #include "qwt_global.h"
    00014
    00015 #include <qpoint.h>
    00016 #include <qrect.h>
    00017 #include <qpen.h>
    00018 #include <qline.h>
    00019
    00020 class QPainter;
    00021 class QBrush;
    00022 class QColor;
    00023 class QWidget;
    00024 class QPolygonF;
    00025 class QRectF;
    00026 class QImage;
    00027 class QPixmap;
    00028 class QwtScaleMap;
    00029 class QwtColorMap;
    00030 class QwtInterval;
    00031
    00032 class QPalette;
    00033 class QTextDocument;
    00034 class QPainterPath;
    00035
    00039 class QWT_EXPORT QwtPainter
    00040 {
    00041 public:
    00042     static void setPolylineSplitting( bool );
    00043     static bool polylineSplitting();
    00044
    00045     static void setRoundingAlignment( bool );
    00046     static bool roundingAlignment();
    00047     static bool roundingAlignment(QPainter *);
    00048
    00049     static void drawText( QPainter *, double x, double y, const QString & );
    00050     static void drawText( QPainter *, const QPointF &, const QString & );
    00051     static void drawText( QPainter *, double x, double y, double w, double h,
    00052         int flags, const QString & );
    00053     static void drawText( QPainter *, const QRectF &,
    00054         int flags, const QString & );
    00055
    00056 #ifndef QT_NO_RICHTEXT
    00057     static void drawSimpleRichText( QPainter *, const QRectF &,
    00058         int flags, const QTextDocument & );
    00059 #endif
    00060
    00061     static void drawRect( QPainter *, double x, double y, double w, double h );
    00062     static void drawRect( QPainter *, const QRectF &rect );
    00063     static void fillRect( QPainter *, const QRectF &, const QBrush & );
    00064
    00065     static void drawEllipse( QPainter *, const QRectF & );
    00066     static void drawPie( QPainter *, const QRectF & r, int a, int alen );
    00067
    00068     static void drawLine( QPainter *, double x1, double y1, double x2, double y2 );
    00069     static void drawLine( QPainter *, const QPointF &p1, const QPointF &p2 );
    00070     static void drawLine( QPainter *, const QLineF & );
    00071
    00072     static void drawPolygon( QPainter *, const QPolygonF &pa );
    00073     static void drawPolyline( QPainter *, const QPolygonF &pa );
    00074     static void drawPolyline( QPainter *, const QPointF *, int pointCount );
    00075
    00076     static void drawPoint( QPainter *, double x, double y );
    00077     static void drawPoint( QPainter *, const QPointF & );
    00078
    00079     static void drawPath( QPainter *, const QPainterPath & );
    00080     static void drawImage( QPainter *, const QRectF &, const QImage & );
    00081     static void drawPixmap( QPainter *, const QRectF &, const QPixmap & );
    00082
    00083     static void drawRoundedFrame( QPainter *,
    00084         const QRectF &, double xRadius, double yRadius,
    00085         const QPalette &, int lineWidth, int frameStyle );
    00086
    00087     static void drawFocusRect( QPainter *, QWidget * );
    00088     static void drawFocusRect( QPainter *, QWidget *, const QRect & );
    00089
    00090     static void drawColorBar( QPainter *painter,
    00091         const QwtColorMap &, const QwtInterval &,
    00092         const QwtScaleMap &, Qt::Orientation, const QRectF & );
    00093
    00094     static bool isAligning( QPainter *painter );
    00095
    00096 private:
    00097     static bool d_polylineSplitting;
    00098     static bool d_roundingAlignment;
    00099 };
    00100
    00102 inline void QwtPainter::drawPoint( QPainter *painter, double x, double y )
    00103 {
    00104     QwtPainter::drawPoint( painter, QPointF( x, y ) );
    00105 }
    00106
    00108 inline void QwtPainter::drawLine( QPainter *painter,
    00109     double x1, double y1, double x2, double y2 )
    00110 {
    00111     QwtPainter::drawLine( painter, QPointF( x1, y1 ), QPointF( x2, y2 ) );
    00112 }
    00113
    00115 inline void QwtPainter::drawLine( QPainter *painter, const QLineF &line )
    00116 {
    00117     QwtPainter::drawLine( painter, line.p1(), line.p2() );
    00118 }
    00119
    00124 inline bool QwtPainter::polylineSplitting()
    00125 {
    00126     return d_polylineSplitting;
    00127 }
    00128
    00136 inline bool QwtPainter::roundingAlignment()
    00137 {
    00138     return d_roundingAlignment;
    00139 }
    00140
    00145 inline bool QwtPainter::roundingAlignment(QPainter *painter)
    00146 {
    00147     return d_roundingAlignment && isAligning(painter);
    00148 }
    00149 #endif