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

« back to all changes in this revision

Viewing changes to src/qwt_symbol.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_SYMBOL_H
 
11
#define QWT_SYMBOL_H
 
12
 
 
13
#include "qwt_global.h"
 
14
#include <QPolygonF>
 
15
 
 
16
class QPainter;
 
17
class QRect;
 
18
class QSize;
 
19
class QBrush;
 
20
class QPen;
 
21
class QColor;
 
22
class QPointF;
 
23
 
 
24
//! A class for drawing symbols
 
25
class QWT_EXPORT QwtSymbol
 
26
{
 
27
public:
 
28
    /*!
 
29
      Symbol Style
 
30
      \sa setStyle(), style()
 
31
     */
 
32
    enum Style
 
33
    {
 
34
        //! No Style. The symbol cannot be drawn.
 
35
        NoSymbol = -1,
 
36
 
 
37
        //! Ellipse or circle
 
38
        Ellipse,
 
39
 
 
40
        //! Rectangle
 
41
        Rect,
 
42
 
 
43
        //!  Diamond
 
44
        Diamond,
 
45
 
 
46
        //! Triangle pointing upwards
 
47
        Triangle,
 
48
 
 
49
        //! Triangle pointing downwards
 
50
        DTriangle,
 
51
 
 
52
        //! Triangle pointing upwards
 
53
        UTriangle,
 
54
 
 
55
        //! Triangle pointing left
 
56
        LTriangle,
 
57
 
 
58
        //! Triangle pointing right
 
59
        RTriangle,
 
60
 
 
61
        //! Cross (+)
 
62
        Cross,
 
63
 
 
64
        //! Diagonal cross (X)
 
65
        XCross,
 
66
 
 
67
        //! Horizontal line
 
68
        HLine,
 
69
 
 
70
        //! Vertical line
 
71
        VLine,
 
72
 
 
73
        //! X combined with +
 
74
        Star1,
 
75
 
 
76
        //! Six-pointed star
 
77
        Star2,
 
78
 
 
79
        //! Hexagon
 
80
        Hexagon,
 
81
 
 
82
        /*!
 
83
         Styles >= QwtSymbol::UserSymbol are reserved for derived
 
84
         classes of QwtSymbol that overload drawSymbols() with
 
85
         additional application specific symbol types.
 
86
         */
 
87
        UserStyle = 1000
 
88
    };
 
89
 
 
90
public:
 
91
    QwtSymbol( Style = NoSymbol );
 
92
    QwtSymbol( Style, const QBrush &, const QPen &, const QSize & );
 
93
    QwtSymbol( const QwtSymbol & );
 
94
    virtual ~QwtSymbol();
 
95
 
 
96
    QwtSymbol &operator=( const QwtSymbol & );
 
97
    bool operator==( const QwtSymbol & ) const;
 
98
    bool operator!=( const QwtSymbol & ) const;
 
99
 
 
100
    void setSize( const QSize & );
 
101
    void setSize( int width, int height = -1 );
 
102
    const QSize& size() const;
 
103
 
 
104
    virtual void setColor( const QColor & );
 
105
 
 
106
    void setBrush( const QBrush& b );
 
107
    const QBrush& brush() const;
 
108
 
 
109
    void setPen( const QPen & );
 
110
    const QPen& pen() const;
 
111
 
 
112
    void setStyle( Style );
 
113
    Style style() const;
 
114
 
 
115
    void drawSymbol( QPainter *, const QPointF & ) const;
 
116
    void drawSymbols( QPainter *, const QPolygonF & ) const;
 
117
 
 
118
    virtual QSize boundingSize() const;
 
119
 
 
120
protected:
 
121
    virtual void drawSymbols( QPainter *,
 
122
        const QPointF *, int numPoints ) const;
 
123
 
 
124
private:
 
125
    class PrivateData;
 
126
    PrivateData *d_data;
 
127
};
 
128
 
 
129
/*!
 
130
  \brief Draw the symbol at a specified position
 
131
 
 
132
  \param painter Painter
 
133
  \param pos Position of the symbol in screen coordinates
 
134
*/
 
135
inline void QwtSymbol::drawSymbol(
 
136
    QPainter *painter, const QPointF &pos ) const
 
137
{
 
138
    drawSymbols( painter, &pos, 1 );
 
139
}
 
140
 
 
141
/*!
 
142
  \brief Draw symbols at the specified points
 
143
 
 
144
  \param painter Painter
 
145
  \param points Positions of the symbols in screen coordinates
 
146
*/
 
147
 
 
148
inline void QwtSymbol::drawSymbols(
 
149
    QPainter *painter, const QPolygonF &points ) const
 
150
{
 
151
    drawSymbols( painter, points.data(), points.size() );
 
152
}
 
153
 
 
154
#endif