[89] | 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 |
|
---|
| 24 | class QWT_EXPORT QwtPlotLayout
|
---|
| 25 | {
|
---|
| 26 | public:
|
---|
| 27 | /*!
|
---|
| 28 | Options to configure the plot layout engine
|
---|
| 29 |
|
---|
| 30 | - AlignScales\n
|
---|
| 31 | Unused
|
---|
| 32 | - IgnoreScrollbars\n
|
---|
| 33 | Ignore the dimension of the scrollbars. There are no
|
---|
| 34 | scrollbars, when the plot is rendered to a paint device
|
---|
| 35 | (QwtPlot::print() ).
|
---|
| 36 | - IgnoreFrames\n
|
---|
| 37 | Ignore all frames. QwtPlot::print() doesn't paint them.
|
---|
| 38 | - IgnoreMargin\n
|
---|
| 39 | Ignore the margin().
|
---|
| 40 | - IgnoreLegend\n
|
---|
| 41 | Ignore the legend.
|
---|
| 42 |
|
---|
| 43 | \sa activate()
|
---|
| 44 | */
|
---|
| 45 | enum Options
|
---|
| 46 | {
|
---|
| 47 | AlignScales = 1,
|
---|
| 48 | IgnoreScrollbars = 2,
|
---|
| 49 | IgnoreFrames = 4,
|
---|
| 50 | IgnoreMargin = 8,
|
---|
| 51 | IgnoreLegend = 16
|
---|
| 52 | };
|
---|
| 53 |
|
---|
| 54 | explicit QwtPlotLayout();
|
---|
| 55 | virtual ~QwtPlotLayout();
|
---|
| 56 |
|
---|
| 57 | void setMargin(int);
|
---|
| 58 | int margin() const;
|
---|
| 59 |
|
---|
| 60 | void setCanvasMargin(int margin, int axis = -1);
|
---|
| 61 | int canvasMargin(int axis) const;
|
---|
| 62 |
|
---|
| 63 | void setAlignCanvasToScales(bool);
|
---|
| 64 | bool alignCanvasToScales() const;
|
---|
| 65 |
|
---|
| 66 | void setSpacing(int);
|
---|
| 67 | int spacing() const;
|
---|
| 68 |
|
---|
| 69 | void setLegendPosition(QwtPlot::LegendPosition pos, double ratio);
|
---|
| 70 | void setLegendPosition(QwtPlot::LegendPosition pos);
|
---|
| 71 | QwtPlot::LegendPosition legendPosition() const;
|
---|
| 72 |
|
---|
| 73 | void setLegendRatio(double ratio);
|
---|
| 74 | double legendRatio() const;
|
---|
| 75 |
|
---|
| 76 | virtual QSize minimumSizeHint(const QwtPlot *) const;
|
---|
| 77 |
|
---|
| 78 | virtual void activate(const QwtPlot *,
|
---|
| 79 | const QRect &rect, int options = 0);
|
---|
| 80 |
|
---|
| 81 | virtual void invalidate();
|
---|
| 82 |
|
---|
| 83 | const QRect &titleRect() const;
|
---|
| 84 | const QRect &legendRect() const;
|
---|
| 85 | const QRect &scaleRect(int axis) const;
|
---|
| 86 | const QRect &canvasRect() const;
|
---|
| 87 |
|
---|
| 88 | class LayoutData;
|
---|
| 89 |
|
---|
| 90 | protected:
|
---|
| 91 |
|
---|
| 92 | QRect layoutLegend(int options, const QRect &) const;
|
---|
| 93 | QRect alignLegend(const QRect &canvasRect,
|
---|
| 94 | const QRect &legendRect) const;
|
---|
| 95 |
|
---|
| 96 | void expandLineBreaks(int options, const QRect &rect,
|
---|
| 97 | int &dimTitle, int dimAxes[QwtPlot::axisCnt]) const;
|
---|
| 98 |
|
---|
| 99 | void alignScales(int options, QRect &canvasRect,
|
---|
| 100 | QRect scaleRect[QwtPlot::axisCnt]) const;
|
---|
| 101 |
|
---|
| 102 | private:
|
---|
| 103 | class PrivateData;
|
---|
| 104 |
|
---|
| 105 | PrivateData *d_data;
|
---|
| 106 | };
|
---|
| 107 |
|
---|
| 108 | #endif
|
---|