Merged in f5soh/librepilot/update_credits (pull request #529)
[librepilot.git] / ground / gcs / src / libs / qwt / src / qwt_plot_layout.h
blobc72c04fc3f7e3d00d121df75417524a2d2014a26
1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
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 *****************************************************************************/
10 #ifndef QWT_PLOT_LAYOUT_H
11 #define QWT_PLOT_LAYOUT_H
13 #include "qwt_global.h"
14 #include "qwt_plot.h"
16 /*!
17 \brief Layout engine for QwtPlot.
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.
23 \sa QwtPlot::setPlotLayout()
26 class QWT_EXPORT QwtPlotLayout
28 public:
29 /*!
30 Options to configure the plot layout engine
31 \sa activate(), QwtPlotRenderer
33 enum Option
35 //! Unused
36 AlignScales = 0x01,
38 /*!
39 Ignore the dimension of the scrollbars. There are no
40 scrollbars, when the plot is not rendered to widgets.
42 IgnoreScrollbars = 0x02,
44 //! Ignore all frames.
45 IgnoreFrames = 0x04,
47 //! Ignore the legend.
48 IgnoreLegend = 0x08,
50 //! Ignore the title.
51 IgnoreTitle = 0x10,
53 //! Ignore the footer.
54 IgnoreFooter = 0x20
57 //! Layout options
58 typedef QFlags<Option> Options;
60 explicit QwtPlotLayout();
61 virtual ~QwtPlotLayout();
63 void setCanvasMargin( int margin, int axis = -1 );
64 int canvasMargin( int axis ) const;
66 void setAlignCanvasToScales( bool );
68 void setAlignCanvasToScale( int axisId, bool );
69 bool alignCanvasToScale( int axisId ) const;
71 void setSpacing( int );
72 int spacing() const;
74 void setLegendPosition( QwtPlot::LegendPosition pos, double ratio );
75 void setLegendPosition( QwtPlot::LegendPosition pos );
76 QwtPlot::LegendPosition legendPosition() const;
78 void setLegendRatio( double ratio );
79 double legendRatio() const;
81 virtual QSize minimumSizeHint( const QwtPlot * ) const;
83 virtual void activate( const QwtPlot *,
84 const QRectF &rect, Options options = 0x00 );
86 virtual void invalidate();
88 QRectF titleRect() const;
89 QRectF footerRect() const;
90 QRectF legendRect() const;
91 QRectF scaleRect( int axis ) const;
92 QRectF canvasRect() const;
94 class LayoutData;
96 protected:
98 void setTitleRect( const QRectF & );
99 void setFooterRect( const QRectF & );
100 void setLegendRect( const QRectF & );
101 void setScaleRect( int axis, const QRectF & );
102 void setCanvasRect( const QRectF & );
104 QRectF layoutLegend( Options options, const QRectF & ) const;
105 QRectF alignLegend( const QRectF &canvasRect,
106 const QRectF &legendRect ) const;
108 void expandLineBreaks( Options options, const QRectF &rect,
109 int &dimTitle, int &dimFooter, int dimAxes[QwtPlot::axisCnt] ) const;
111 void alignScales( Options options, QRectF &canvasRect,
112 QRectF scaleRect[QwtPlot::axisCnt] ) const;
114 private:
115 class PrivateData;
117 PrivateData *d_data;
120 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotLayout::Options )
122 #endif