00001
00002
00003
00004
00005
00006
00007
00008
00009
00010 #ifndef QWT_PLOT_LAYOUT_H
00011 #define QWT_PLOT_LAYOUT_H
00012
00013 #include <qlayout.h>
00014 #include "qwt_global.h"
00015 #include "qwt_plot.h"
00016
00017 class QwtPlotLayoutData;
00018
00025 class QWT_EXPORT QwtPlotLayout
00026 {
00027 public:
00028 enum Options
00029 {
00030 AlignScales = 1,
00031 IgnoreScrollbars = 2,
00032 IgnoreFrames = 4,
00033 IgnoreMargin = 8,
00034 IgnoreLegend = 16
00035 };
00036
00037 QwtPlotLayout();
00038 virtual ~QwtPlotLayout();
00039
00040 void setMargin(int);
00041 int margin() const;
00042
00043 void setSpacing(int);
00044 int spacing() const;
00045
00046 void setLegendPos(int pos, double ratio = 0.0);
00047 int legendPos() const;
00048 double legendRatio() const;
00049
00050 virtual QSize minimumSizeHint(const QwtPlot *) const;
00051
00052 virtual void activate(const QwtPlot *,
00053 const QRect &rect, int options = 0);
00054
00055 virtual void invalidate();
00056
00057 const QRect &titleRect() const;
00058 const QRect &legendRect() const;
00059 const QRect &scaleRect(int axis) const;
00060 const QRect &canvasRect() const;
00061
00062 protected:
00063
00064 QRect layoutLegend(int options, const QRect &) const;
00065 QRect alignLegend(const QRect &canvasRect,
00066 const QRect &legendRect) const;
00067
00068 void expandLineBreaks(int options, const QRect &rect,
00069 int &dimTitle, int dimAxes[QwtPlot::axisCnt]) const;
00070
00071 void alignScales(int options,
00072 QRect scaleRect[QwtPlot::axisCnt]) const;
00073
00074 QRect d_titleRect;
00075 QRect d_legendRect;
00076 QRect d_scaleRect[QwtPlot::axisCnt];
00077 QRect d_canvasRect;
00078
00079 QwtPlotLayoutData *d_layoutData;
00080
00081 private:
00082 int d_options;
00083
00084 int d_legendPos;
00085 double d_legendRatio;
00086 unsigned int d_margin;
00087 unsigned int d_spacing;
00088 unsigned int d_canvasMargin;
00089 };
00090
00091 #endif