~ubuntu-branches/ubuntu/saucy/goldencheetah/saucy

« back to all changes in this revision

Viewing changes to qwt/src/qwt_abstract_scale_draw.h

  • Committer: Package Import Robot
  • Author(s): KURASHIKI Satoru
  • Date: 2013-08-18 07:02:45 UTC
  • mfrom: (4.1.8 sid)
  • Revision ID: package-import@ubuntu.com-20130818070245-zgdvb47e1k3mtgil
Tags: 3.0-3
debian/control: remove needless dependency. (Closes: #719571)

Show diffs side-by-side

added added

removed removed

Lines of Context:
2
2
 * Qwt Widget Library
3
3
 * Copyright (C) 1997   Josef Wilgen
4
4
 * Copyright (C) 2002   Uwe Rathmann
5
 
 * 
 
5
 *
6
6
 * This library is free software; you can redistribute it and/or
7
7
 * modify it under the terms of the Qwt License, Version 1.0
8
8
 *****************************************************************************/
14
14
#include "qwt_scale_div.h"
15
15
#include "qwt_text.h"
16
16
 
17
 
 
18
 
#if QT_VERSION < 0x040000
19
 
class QColorGroup;
20
 
#else
21
17
class QPalette;
22
 
#endif
23
18
class QPainter;
24
19
class QFont;
25
20
class QwtScaleTransformation;
38
33
{
39
34
public:
40
35
 
41
 
     /*!
42
 
        Components of a scale
43
 
 
44
 
        - Backbone
45
 
        - Ticks
46
 
        - Labels
47
 
 
48
 
        \sa enableComponent(), hasComponent
 
36
    /*!
 
37
       Components of a scale
 
38
       \sa enableComponent(), hasComponent
49
39
    */
50
 
 
51
40
    enum ScaleComponent
52
 
    { 
53
 
        Backbone = 1,
54
 
        Ticks = 2,
55
 
        Labels = 4
 
41
    {
 
42
        //! Backbone = the line where the ticks are located
 
43
        Backbone = 0x01,
 
44
 
 
45
        //! Ticks
 
46
        Ticks = 0x02,
 
47
 
 
48
        //! Labels
 
49
        Labels = 0x04
56
50
    };
57
 
 
 
51
 
 
52
    //! Scale components
 
53
    typedef QFlags<ScaleComponent> ScaleComponents;
 
54
 
58
55
    QwtAbstractScaleDraw();
59
 
    QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
60
56
    virtual ~QwtAbstractScaleDraw();
61
57
 
62
 
    QwtAbstractScaleDraw &operator=(const QwtAbstractScaleDraw &);
63
 
    
64
 
    void setScaleDiv(const QwtScaleDiv &s);
 
58
    void setScaleDiv( const QwtScaleDiv &s );
65
59
    const QwtScaleDiv& scaleDiv() const;
66
60
 
67
 
    void setTransformation(QwtScaleTransformation *);
68
 
    const QwtScaleMap &map() const;
69
 
 
70
 
    void enableComponent(ScaleComponent, bool enable = true);
71
 
    bool hasComponent(ScaleComponent) const;
72
 
 
73
 
    void setTickLength(QwtScaleDiv::TickType, int length);
74
 
    int tickLength(QwtScaleDiv::TickType) const;
75
 
    int majTickLength() const;
76
 
 
77
 
    void setSpacing(int margin);
78
 
    int spacing() const;
79
 
        
80
 
#if QT_VERSION < 0x040000
81
 
    virtual void draw(QPainter *, const QColorGroup &) const;
82
 
#else
83
 
    virtual void draw(QPainter *, const QPalette &) const;
84
 
#endif
85
 
 
86
 
    virtual QwtText label(double) const;
87
 
 
88
 
    /*!  
89
 
      Calculate the extent 
 
61
    void setTransformation( QwtScaleTransformation * );
 
62
    const QwtScaleMap &scaleMap() const;
 
63
    QwtScaleMap &scaleMap();
 
64
 
 
65
    void enableComponent( ScaleComponent, bool enable = true );
 
66
    bool hasComponent( ScaleComponent ) const;
 
67
 
 
68
    void setTickLength( QwtScaleDiv::TickType, double length );
 
69
    double tickLength( QwtScaleDiv::TickType ) const;
 
70
    double maxTickLength() const;
 
71
 
 
72
    void setSpacing( double margin );
 
73
    double spacing() const;
 
74
 
 
75
    void setPenWidth( int width );
 
76
    int penWidth() const;
 
77
 
 
78
    virtual void draw( QPainter *, const QPalette & ) const;
 
79
 
 
80
    virtual QwtText label( double ) const;
 
81
 
 
82
    /*!
 
83
      Calculate the extent
90
84
 
91
85
      The extent is the distcance from the baseline to the outermost
92
86
      pixel of the scale draw in opposite to its orientation.
93
87
      It is at least minimumExtent() pixels.
94
 
 
 
88
 
95
89
      \sa setMinimumExtent(), minimumExtent()
96
90
    */
97
 
    virtual int extent(const QPen &, const QFont &) const = 0;
98
 
 
99
 
    void setMinimumExtent(int);
100
 
    int minimumExtent() const;
101
 
 
102
 
    QwtScaleMap &scaleMap();
 
91
    virtual double extent( const QFont & ) const = 0;
 
92
 
 
93
    void setMinimumExtent( double );
 
94
    double minimumExtent() const;
103
95
 
104
96
protected:
105
97
    /*!
106
98
       Draw a tick
107
 
  
 
99
 
108
100
       \param painter Painter
109
101
       \param value Value of the tick
110
102
       \param len Lenght of the tick
111
103
 
112
104
       \sa drawBackbone(), drawLabel()
113
 
    */  
114
 
    virtual void drawTick(QPainter *painter, double value, int len) const = 0;
 
105
    */
 
106
    virtual void drawTick( QPainter *painter, double value, double len ) const = 0;
115
107
 
116
108
    /*!
117
109
      Draws the baseline of the scale
119
111
 
120
112
      \sa drawTick(), drawLabel()
121
113
    */
122
 
    virtual void drawBackbone(QPainter *painter) const = 0;
 
114
    virtual void drawBackbone( QPainter *painter ) const = 0;
123
115
 
124
 
    /*!  
 
116
    /*!
125
117
        Draws the label for a major scale tick
126
 
    
 
118
 
127
119
        \param painter Painter
128
120
        \param value Value
129
121
 
130
 
        \sa drawTick, drawBackbone
131
 
    */ 
132
 
    virtual void drawLabel(QPainter *painter, double value) const = 0;
 
122
        \sa drawTick(), drawBackbone()
 
123
    */
 
124
    virtual void drawLabel( QPainter *painter, double value ) const = 0;
133
125
 
134
126
    void invalidateCache();
135
 
    const QwtText &tickLabel(const QFont &, double value) const;
 
127
    const QwtText &tickLabel( const QFont &, double value ) const;
136
128
 
137
129
private:
138
 
    int operator==(const QwtAbstractScaleDraw &) const;
139
 
    int operator!=(const QwtAbstractScaleDraw &) const;
 
130
    QwtAbstractScaleDraw( const QwtAbstractScaleDraw & );
 
131
    QwtAbstractScaleDraw &operator=( const QwtAbstractScaleDraw & );
140
132
 
141
133
    class PrivateData;
142
134
    PrivateData *d_data;
143
135
};
144
136
 
 
137
Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents )
 
138
 
145
139
#endif