source: ntrip/trunk/BNC/qwt/qwt_plot_scaleitem.h@ 4720

Last change on this file since 4720 was 4271, checked in by mervart, 13 years ago
File size: 2.5 KB
RevLine 
[4271]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_PLOT_SCALE_ITEM_H
11#define QWT_PLOT_SCALE_ITEM_H
12
13#include "qwt_global.h"
14#include "qwt_plot_item.h"
15#include "qwt_scale_draw.h"
16
17class QPalette;
18
19/*!
20 \brief A class which draws a scale inside the plot canvas
21
22 QwtPlotScaleItem can be used to draw an axis inside the plot canvas.
23 It might by synchronized to one of the axis of the plot, but can
24 also display its own ticks and labels.
25
26 It is allowed to synchronize the scale item with a disabled axis.
27 In plots with vertical and horizontal scale items, it might be
28 necessary to remove ticks at the intersections, by overloading
29 updateScaleDiv().
30
31 The scale might be at a specific position (f.e 0.0) or it might be
32 aligned to a canvas border.
33
34 \par Example
35 The following example shows how to replace the left axis, by a scale item
36 at the x position 0.0.
37 \verbatim
38QwtPlotScaleItem *scaleItem =
39 new QwtPlotScaleItem(QwtScaleDraw::RightScale, 0.0);
40scaleItem->setFont(plot->axisWidget(QwtPlot::yLeft)->font());
41scaleItem->attach(plot);
42
43plot->enableAxis(QwtPlot::yLeft, false);
44\endverbatim
45*/
46
47class QWT_EXPORT QwtPlotScaleItem: public QwtPlotItem
48{
49public:
50 explicit QwtPlotScaleItem(
51 QwtScaleDraw::Alignment = QwtScaleDraw::BottomScale,
52 const double pos = 0.0 );
53
54 virtual ~QwtPlotScaleItem();
55
56 virtual int rtti() const;
57
58 void setScaleDiv( const QwtScaleDiv& );
59 const QwtScaleDiv& scaleDiv() const;
60
61 void setScaleDivFromAxis( bool on );
62 bool isScaleDivFromAxis() const;
63
64 void setPalette( const QPalette & );
65 QPalette palette() const;
66
67 void setFont( const QFont& );
68 QFont font() const;
69
70 void setScaleDraw( QwtScaleDraw * );
71
72 const QwtScaleDraw *scaleDraw() const;
73 QwtScaleDraw *scaleDraw();
74
75 void setPosition( double pos );
76 double position() const;
77
78 void setBorderDistance( int numPixels );
79 int borderDistance() const;
80
81 void setAlignment( QwtScaleDraw::Alignment );
82
83 virtual void draw( QPainter *p,
84 const QwtScaleMap &xMap, const QwtScaleMap &yMap,
85 const QRectF &rect ) const;
86
87 virtual void updateScaleDiv( const QwtScaleDiv &, const QwtScaleDiv & );
88
89private:
90 class PrivateData;
91 PrivateData *d_data;
92};
93
94#endif
Note: See TracBrowser for help on using the repository browser.