Main Page | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages

# qwt_plot_layout.h

    00001 /* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
    00002  * Qwt Widget Library
    00003  * Copyright (C) 1997   Josef Wilgen
    00004  * Copyright (C) 2002   Uwe Rathmann
    00005  *
    00006  * This library is free software; you can redistribute it and/or
    00007  * modify it under the terms of the Qwt License, Version 1.0
    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 setCanvasMargin(int margin, int axis = -1);
    00044     int canvasMargin(int axis) const;
    00045
    00046     void setAlignCanvasToScales(bool);
    00047     bool alignCanvasToScales() const;
    00048
    00049     void setSpacing(int);
    00050     int spacing() const;
    00051
    00052     void setLegendPosition(QwtPlot::Position pos, double ratio);
    00053     void setLegendPosition(QwtPlot::Position pos);
    00054     QwtPlot::Position legendPosition() const;
    00055
    00056     void setLegendRatio(double ratio);
    00057     double legendRatio() const;
    00058
    00059 #ifndef QWT_NO_COMPAT
    00060     // The following two functions are deprecated
    00061     void setLegendPos(int pos, double ratio = 0.0);
    00062     int legendPos() const;
    00063 #endif
    00064
    00065     virtual QSize minimumSizeHint(const QwtPlot *) const;
    00066
    00067     virtual void activate(const QwtPlot *,
    00068         const QRect &rect, int options = 0);
    00069
    00070     virtual void invalidate();
    00071
    00072     const QRect &titleRect() const;
    00073     const QRect &legendRect() const;
    00074     const QRect &scaleRect(int axis) const;
    00075     const QRect &canvasRect() const;
    00076
    00077 protected:
    00078
    00079     QRect layoutLegend(int options, const QRect &) const;
    00080     QRect alignLegend(const QRect &canvasRect,
    00081         const QRect &legendRect) const;
    00082
    00083     void expandLineBreaks(int options, const QRect &rect,
    00084         int &dimTitle, int dimAxes[QwtPlot::axisCnt]) const;
    00085
    00086     void alignScales(int options, QRect &canvasRect,
    00087         QRect scaleRect[QwtPlot::axisCnt]) const;
    00088
    00089     QRect d_titleRect;
    00090     QRect d_legendRect;
    00091     QRect d_scaleRect[QwtPlot::axisCnt];
    00092     QRect d_canvasRect;
    00093
    00094     QwtPlotLayoutData *d_layoutData;
    00095
    00096 private:
    00097     QwtPlot::Position d_legendPos;
    00098     double d_legendRatio;
    00099     unsigned int d_margin;
    00100     unsigned int d_spacing;
    00101     unsigned int d_canvasMargin[QwtPlot::axisCnt];
    00102     bool d_alignCanvasToScales;
    00103 };
    00104
    00105 #endif