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

« back to all changes in this revision

Viewing changes to qwt/src/qwt_compass_rose.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2009-07-01 16:08:21 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090701160821-gog44m4w7x2f4u6o
Tags: 5.2.0-1
* New upstream release.
* Add branch pull patch from svn r544.
* Bump Standards-Version to 3.8.2. No changes needed.
* Update installed manpages.
* Use qwt as base name for directory (drop version).
* Add missing warnings patch.
* Rewrite debian/rules: use dh.

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_COMPASS_ROSE_H
 
11
#define QWT_COMPASS_ROSE_H 1
 
12
 
 
13
#include <qpalette.h>
 
14
#include "qwt_global.h"
 
15
 
 
16
class QPainter;
 
17
 
 
18
/*!
 
19
  \brief Abstract base class for a compass rose
 
20
*/
 
21
class QWT_EXPORT QwtCompassRose
 
22
{
 
23
public:
 
24
    virtual ~QwtCompassRose() {};
 
25
 
 
26
    //! Assign a palette
 
27
    virtual void setPalette(const QPalette &p) { d_palette = p; }
 
28
 
 
29
    //! \return Current palette
 
30
    const QPalette &palette() const { return d_palette; }
 
31
 
 
32
    /*!
 
33
        Draw the rose
 
34
 
 
35
        \param painter Painter
 
36
        \param center Center point
 
37
        \param radius Radius of the rose
 
38
        \param north Position
 
39
        \param colorGroup Color group
 
40
     */
 
41
    virtual void draw(QPainter *painter, const QPoint &center, 
 
42
        int radius, double north, 
 
43
        QPalette::ColorGroup colorGroup = QPalette::Active) const = 0;
 
44
 
 
45
private:
 
46
    QPalette d_palette;
 
47
};
 
48
 
 
49
/*!
 
50
  \brief A simple rose for QwtCompass
 
51
*/
 
52
class QWT_EXPORT QwtSimpleCompassRose: public QwtCompassRose
 
53
{
 
54
public:
 
55
    QwtSimpleCompassRose(int numThorns = 8, int numThornLevels = -1);
 
56
 
 
57
    void setWidth(double w);
 
58
 
 
59
    //! \sa setWidth()
 
60
    double width() const { return d_width; }
 
61
 
 
62
    void setNumThorns(int count);
 
63
    int numThorns() const;
 
64
 
 
65
    void setNumThornLevels(int count);
 
66
    int numThornLevels() const;
 
67
 
 
68
    void setShrinkFactor(double factor) { d_shrinkFactor = factor; }
 
69
    double shrinkFactor() const { return d_shrinkFactor; }
 
70
 
 
71
    virtual void draw(QPainter *, const QPoint &center, int radius, 
 
72
        double north, QPalette::ColorGroup = QPalette::Active) const;
 
73
 
 
74
    static void drawRose(QPainter *, 
 
75
#if QT_VERSION < 0x040000
 
76
        const QColorGroup &,
 
77
#else
 
78
        const QPalette &,
 
79
#endif
 
80
        const QPoint &center, int radius, double origin, double width, 
 
81
        int numThorns, int numThornLevels, double shrinkFactor);
 
82
 
 
83
private:
 
84
    double d_width;     
 
85
    int d_numThorns;        
 
86
    int d_numThornLevels; 
 
87
    double d_shrinkFactor;
 
88
};
 
89
 
 
90
#endif // QWT_COMPASS_ROSE_H