source: ntrip/trunk/BNC/qwt/qwt_plot_layout.h@ 6157

Last change on this file since 6157 was 4271, checked in by mervart, 12 years ago
File size: 2.7 KB
Line 
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_LAYOUT_H
11#define QWT_PLOT_LAYOUT_H
12
13#include "qwt_global.h"
14#include "qwt_plot.h"
15
16/*!
17 \brief Layout engine for QwtPlot.
18
19 It is used by the QwtPlot widget to organize its internal widgets
20 or by QwtPlot::print() to render its content to a QPaintDevice like
21 a QPrinter, QPixmap/QImage or QSvgRenderer.
22*/
23
24class QWT_EXPORT QwtPlotLayout
25{
26public:
27 /*!
28 Options to configure the plot layout engine
29 \sa activate(), QwtPlotRenderer
30 */
31 enum Option
32 {
33 //! Unused
34 AlignScales = 0x01,
35
36 /*!
37 Ignore the dimension of the scrollbars. There are no
38 scrollbars, when the plot is not rendered to widgets.
39 */
40 IgnoreScrollbars = 0x02,
41
42 //! Ignore all frames.
43 IgnoreFrames = 0x04,
44
45 //! Ignore the legend.
46 IgnoreLegend = 0x08
47 };
48
49 //! Layout options
50 typedef QFlags<Option> Options;
51
52 explicit QwtPlotLayout();
53 virtual ~QwtPlotLayout();
54
55 void setCanvasMargin( int margin, int axis = -1 );
56 int canvasMargin( int axis ) const;
57
58 void setAlignCanvasToScales( bool );
59 bool alignCanvasToScales() const;
60
61 void setSpacing( int );
62 int spacing() const;
63
64 void setLegendPosition( QwtPlot::LegendPosition pos, double ratio );
65 void setLegendPosition( QwtPlot::LegendPosition pos );
66 QwtPlot::LegendPosition legendPosition() const;
67
68 void setLegendRatio( double ratio );
69 double legendRatio() const;
70
71 virtual QSize minimumSizeHint( const QwtPlot * ) const;
72
73 virtual void activate( const QwtPlot *,
74 const QRectF &rect, Options options = 0x00 );
75
76 virtual void invalidate();
77
78 const QRectF &titleRect() const;
79 const QRectF &legendRect() const;
80 const QRectF &scaleRect( int axis ) const;
81 const QRectF &canvasRect() const;
82
83 class LayoutData;
84
85protected:
86
87 QRectF layoutLegend( Options options, const QRectF & ) const;
88 QRectF alignLegend( const QRectF &canvasRect,
89 const QRectF &legendRect ) const;
90
91 void expandLineBreaks( int options, const QRectF &rect,
92 int &dimTitle, int dimAxes[QwtPlot::axisCnt] ) const;
93
94 void alignScales( int options, QRectF &canvasRect,
95 QRectF scaleRect[QwtPlot::axisCnt] ) const;
96
97private:
98 class PrivateData;
99
100 PrivateData *d_data;
101};
102
103Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotLayout::Options )
104
105#endif
Note: See TracBrowser for help on using the repository browser.