Qwt User's Guide
svn
|
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 "qwt_global.h" 00014 #include "qwt_plot.h" 00015 00024 class QWT_EXPORT QwtPlotLayout 00025 { 00026 public: 00031 enum Option 00032 { 00034 AlignScales = 0x01, 00035 00040 IgnoreScrollbars = 0x02, 00041 00043 IgnoreFrames = 0x04, 00044 00046 IgnoreLegend = 0x08 00047 }; 00048 00050 typedef QFlags<Option> Options; 00051 00052 explicit QwtPlotLayout(); 00053 virtual ~QwtPlotLayout(); 00054 00055 void setCanvasMargin( int margin, int axis = -1 ); 00056 int canvasMargin( int axis ) const; 00057 00058 void setAlignCanvasToScales( bool ); 00059 bool alignCanvasToScales() const; 00060 00061 void setSpacing( int ); 00062 int spacing() const; 00063 00064 void setLegendPosition( QwtPlot::LegendPosition pos, double ratio ); 00065 void setLegendPosition( QwtPlot::LegendPosition pos ); 00066 QwtPlot::LegendPosition legendPosition() const; 00067 00068 void setLegendRatio( double ratio ); 00069 double legendRatio() const; 00070 00071 virtual QSize minimumSizeHint( const QwtPlot * ) const; 00072 00073 virtual void activate( const QwtPlot *, 00074 const QRectF &rect, Options options = 0x00 ); 00075 00076 virtual void invalidate(); 00077 00078 const QRectF &titleRect() const; 00079 const QRectF &legendRect() const; 00080 const QRectF &scaleRect( int axis ) const; 00081 const QRectF &canvasRect() const; 00082 00083 class LayoutData; 00084 00085 protected: 00086 00087 QRectF layoutLegend( Options options, const QRectF & ) const; 00088 QRectF alignLegend( const QRectF &canvasRect, 00089 const QRectF &legendRect ) const; 00090 00091 void expandLineBreaks( int options, const QRectF &rect, 00092 int &dimTitle, int dimAxes[QwtPlot::axisCnt] ) const; 00093 00094 void alignScales( int options, QRectF &canvasRect, 00095 QRectF scaleRect[QwtPlot::axisCnt] ) const; 00096 00097 private: 00098 class PrivateData; 00099 00100 PrivateData *d_data; 00101 }; 00102 00103 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotLayout::Options ) 00104 00105 #endif