~ubuntu-branches/ubuntu/oneiric/qwt/oneiric-proposed

« back to all changes in this revision

Viewing changes to qwt/src/qwt_painter.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2011-06-10 11:22:47 UTC
  • mfrom: (1.1.6 upstream) (2.1.4 sid)
  • Revision ID: james.westby@ubuntu.com-20110610112247-0i1019vvmzaq6p86
Tags: 6.0.0-1
* New upstream release (Closes: #624107):
  - drop Qt3 support. (Closes: #604379, #626868)
* Register documentation with doc-base. (Closes: #626567)
* Drop patches:
  - 01_makefiles.diff
  - 02_add_missing_warnings.diff
  - 03_qwt_branch_pull_r544.diff
* Add qwt_install_paths.patch to fix the hardcoded installation paths.
* Update debian/control:
  - drop libqt3-mt-dev build dependency.
  - bump Standards-Version to 3.9.2 (no changes).
  - drop Qt3 related packages.
  - due to bump soname (and as we dropper Qt3 support):
    - libqwt5-qt4-dev -> libqwt-dev
    - libqwt5-qt4 -> libqwt6
    - libqwt5-doc -> libqwt-doc
* Update debian/copyright file.
* Update debian/rules: drop Qt3 packages support.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2
 
 * Qwt Widget Library
3
 
 * Copyright (C) 1997   Josef Wilgen
4
 
 * Copyright (C) 2002   Uwe Rathmann
5
 
 * 
6
 
 * This library is free software; you can redistribute it and/or
7
 
 * modify it under the terms of the Qwt License, Version 1.0
8
 
 *****************************************************************************/
9
 
 
10
 
#ifndef QWT_PAINTER_H
11
 
#define QWT_PAINTER_H
12
 
 
13
 
#include <qpoint.h>
14
 
#include <qrect.h>
15
 
#include <qpen.h>
16
 
#include "qwt_global.h"
17
 
#include "qwt_layout_metrics.h"
18
 
#include "qwt_polygon.h"
19
 
 
20
 
class QPainter;
21
 
class QBrush;
22
 
class QColor;
23
 
class QWidget;
24
 
class QwtScaleMap;
25
 
class QwtColorMap;
26
 
class QwtDoubleInterval;
27
 
 
28
 
#if QT_VERSION < 0x040000
29
 
class QColorGroup;
30
 
class QSimpleRichText;
31
 
#else
32
 
class QPalette;
33
 
class QTextDocument;
34
 
#endif
35
 
 
36
 
#if defined(Q_WS_X11)
37
 
// Warning: QCOORD_MIN, QCOORD_MAX are wrong on X11.
38
 
#define QWT_COORD_MAX 16384
39
 
#define QWT_COORD_MIN (-QWT_COORD_MAX - 1)
40
 
#else
41
 
#define QWT_COORD_MAX 2147483647
42
 
#define QWT_COORD_MIN -QWT_COORD_MAX - 1
43
 
#endif
44
 
 
45
 
/*!
46
 
  \brief A collection of QPainter workarounds
47
 
 
48
 
  1) Clipping to coordinate system limits (Qt3 only)
49
 
 
50
 
  On X11 pixel coordinates are stored in shorts. Qt 
51
 
  produces overruns when mapping QCOORDS to shorts. 
52
 
 
53
 
  2) Scaling to device metrics
54
 
 
55
 
  QPainter scales fonts, line and fill patterns to the metrics
56
 
  of the paint device. Other values like the geometries of rects, points
57
 
  remain device independend. To enable a device independent widget 
58
 
  implementation, QwtPainter adds scaling of these geometries.
59
 
  (Unfortunately QPainter::scale scales both types of paintings,
60
 
   so the objects of the first type would be scaled twice).
61
 
*/
62
 
 
63
 
class QWT_EXPORT QwtPainter
64
 
{
65
 
public:
66
 
    static void setMetricsMap(const QPaintDevice *layout,
67
 
        const QPaintDevice *device);
68
 
    static void setMetricsMap(const QwtMetricsMap &);
69
 
    static void resetMetricsMap();
70
 
    static const QwtMetricsMap &metricsMap();
71
 
 
72
 
    static void setDeviceClipping(bool);
73
 
    static bool deviceClipping();
74
 
    static const QRect &deviceClipRect();
75
 
 
76
 
    static void setClipRect(QPainter *, const QRect &);
77
 
 
78
 
    static void drawText(QPainter *, int x, int y, 
79
 
        const QString &);
80
 
    static void drawText(QPainter *, const QPoint &, 
81
 
        const QString &);
82
 
    static void drawText(QPainter *, int x, int y, int w, int h, 
83
 
        int flags, const QString &);
84
 
    static void drawText(QPainter *, const QRect &, 
85
 
        int flags, const QString &);
86
 
 
87
 
#ifndef QT_NO_RICHTEXT
88
 
#if QT_VERSION < 0x040000
89
 
    static void drawSimpleRichText(QPainter *, const QRect &,
90
 
        int flags, QSimpleRichText &);
91
 
#else
92
 
    static void drawSimpleRichText(QPainter *, const QRect &,
93
 
        int flags, QTextDocument &);
94
 
#endif
95
 
#endif
96
 
 
97
 
    static void drawRect(QPainter *, int x, int y, int w, int h);
98
 
    static void drawRect(QPainter *, const QRect &rect);
99
 
    static void fillRect(QPainter *, const QRect &, const QBrush &); 
100
 
 
101
 
    static void drawEllipse(QPainter *, const QRect &);
102
 
    static void drawPie(QPainter *, const QRect & r, int a, int alen);
103
 
 
104
 
    static void drawLine(QPainter *, int x1, int y1, int x2, int y2);
105
 
    static void drawLine(QPainter *, const QPoint &p1, const QPoint &p2);
106
 
    static void drawPolygon(QPainter *, const QwtPolygon &pa);
107
 
    static void drawPolyline(QPainter *, const QwtPolygon &pa);
108
 
    static void drawPoint(QPainter *, int x, int y);
109
 
 
110
 
#if QT_VERSION < 0x040000
111
 
    static void drawRoundFrame(QPainter *, const QRect &,
112
 
        int width, const QColorGroup &cg, bool sunken);
113
 
#else
114
 
    static void drawRoundFrame(QPainter *, const QRect &,
115
 
        int width, const QPalette &, bool sunken);
116
 
#endif
117
 
    static void drawFocusRect(QPainter *, QWidget *);
118
 
    static void drawFocusRect(QPainter *, QWidget *, const QRect &);
119
 
 
120
 
    static void drawColorBar(QPainter *painter, 
121
 
        const QwtColorMap &, const QwtDoubleInterval &,
122
 
        const QwtScaleMap &, Qt::Orientation, const QRect &);
123
 
 
124
 
#if QT_VERSION < 0x040000
125
 
    static void setSVGMode(bool on);
126
 
    static bool isSVGMode();
127
 
#endif
128
 
 
129
 
    static QPen scaledPen(const QPen &);
130
 
 
131
 
private:
132
 
    static void drawColoredArc(QPainter *, const QRect &,
133
 
        int peak, int arc, int intervall, const QColor &c1, const QColor &c2);
134
 
 
135
 
    static bool d_deviceClipping;
136
 
    static QwtMetricsMap d_metricsMap;
137
 
#if QT_VERSION < 0x040000
138
 
    static bool d_SVGMode;
139
 
#endif
140
 
};
141
 
 
142
 
//!  Wrapper for QPainter::drawLine()
143
 
inline void QwtPainter::drawLine(QPainter *painter,
144
 
    const QPoint &p1, const QPoint &p2)
145
 
{
146
 
    drawLine(painter, p1.x(), p1.y(), p2.x(), p2.y());
147
 
}
148
 
 
149
 
/*!
150
 
  Returns whether device clipping is enabled. On X11 the default
151
 
  is enabled, otherwise it is disabled.
152
 
  \sa QwtPainter::setDeviceClipping()
153
 
*/
154
 
inline bool QwtPainter::deviceClipping()
155
 
{
156
 
    return d_deviceClipping;
157
 
}
158
 
 
159
 
#endif