qwt_abstract_scale_draw.h
Go to the documentation of this file.
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_ABSTRACT_SCALE_DRAW_H
11 #define QWT_ABSTRACT_SCALE_DRAW_H
12 
13 #include "qwt_global.h"
14 #include "qwt_scale_div.h"
15 #include "qwt_text.h"
16 
17 class QPalette;
18 class QPainter;
19 class QFont;
20 class QwtTransform;
21 class QwtScaleMap;
22 
32 {
33 public:
34 
40  {
42  Backbone = 0x01,
43 
45  Ticks = 0x02,
46 
48  Labels = 0x04
49  };
50 
52  typedef QFlags<ScaleComponent> ScaleComponents;
53 
55  virtual ~QwtAbstractScaleDraw();
56 
57  void setScaleDiv( const QwtScaleDiv &s );
58  const QwtScaleDiv& scaleDiv() const;
59 
60  void setTransformation( QwtTransform * );
61  const QwtScaleMap &scaleMap() const;
62  QwtScaleMap &scaleMap();
63 
64  void enableComponent( ScaleComponent, bool enable = true );
65  bool hasComponent( ScaleComponent ) const;
66 
67  void setTickLength( QwtScaleDiv::TickType, double length );
68  double tickLength( QwtScaleDiv::TickType ) const;
69  double maxTickLength() const;
70 
71  void setSpacing( double margin );
72  double spacing() const;
73 
74  void setPenWidth( int width );
75  int penWidth() const;
76 
77  virtual void draw( QPainter *, const QPalette & ) const;
78 
79  virtual QwtText label( double ) const;
80 
93  virtual double extent( const QFont &font ) const = 0;
94 
95  void setMinimumExtent( double );
96  double minimumExtent() const;
97 
98  void invalidateCache();
99 
100 protected:
110  virtual void drawTick( QPainter *painter, double value, double len ) const = 0;
111 
118  virtual void drawBackbone( QPainter *painter ) const = 0;
119 
128  virtual void drawLabel( QPainter *painter, double value ) const = 0;
129 
130  const QwtText &tickLabel( const QFont &, double value ) const;
131 
132 private:
133  Q_DISABLE_COPY(QwtAbstractScaleDraw)
134 
135  class PrivateData;
136  PrivateData *d_data;
137 };
138 
139 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtAbstractScaleDraw::ScaleComponents )
140 
141 #endif
A abstract base class for drawing scales.
#define QWT_EXPORT
Definition: qwt_global.h:38
A class representing a scale division.
Definition: qwt_scale_div.h:36
TickType
Scale tick types.
Definition: qwt_scale_div.h:40
A transformation between coordinate systems.
Definition: qwt_transform.h:35
A class representing a text.
Definition: qwt_text.h:51
A scale map.
Definition: qwt_scale_map.h:30
QFlags< ScaleComponent > ScaleComponents
Scale components.


plotjuggler
Author(s): Davide Faconti
autogenerated on Sat Jul 6 2019 03:44:17