Qwt User's Guide
|
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 00026 class QWT_EXPORT QwtPlotLayout 00027 { 00028 public: 00033 enum Option 00034 { 00036 AlignScales = 0x01, 00037 00042 IgnoreScrollbars = 0x02, 00043 00045 IgnoreFrames = 0x04, 00046 00048 IgnoreLegend = 0x08, 00049 00051 IgnoreTitle = 0x10, 00052 00054 IgnoreFooter = 0x20 00055 }; 00056 00058 typedef QFlags<Option> Options; 00059 00060 explicit QwtPlotLayout(); 00061 virtual ~QwtPlotLayout(); 00062 00063 void setCanvasMargin( int margin, int axis = -1 ); 00064 int canvasMargin( int axis ) const; 00065 00066 void setAlignCanvasToScales( bool ); 00067 00068 void setAlignCanvasToScale( int axisId, bool ); 00069 bool alignCanvasToScale( int axisId ) const; 00070 00071 void setSpacing( int ); 00072 int spacing() const; 00073 00074 void setLegendPosition( QwtPlot::LegendPosition pos, double ratio ); 00075 void setLegendPosition( QwtPlot::LegendPosition pos ); 00076 QwtPlot::LegendPosition legendPosition() const; 00077 00078 void setLegendRatio( double ratio ); 00079 double legendRatio() const; 00080 00081 virtual QSize minimumSizeHint( const QwtPlot * ) const; 00082 00083 virtual void activate( const QwtPlot *, 00084 const QRectF &rect, Options options = 0x00 ); 00085 00086 virtual void invalidate(); 00087 00088 QRectF titleRect() const; 00089 QRectF footerRect() const; 00090 QRectF legendRect() const; 00091 QRectF scaleRect( int axis ) const; 00092 QRectF canvasRect() const; 00093 00094 class LayoutData; 00095 00096 protected: 00097 00098 void setTitleRect( const QRectF & ); 00099 void setFooterRect( const QRectF & ); 00100 void setLegendRect( const QRectF & ); 00101 void setScaleRect( int axis, const QRectF & ); 00102 void setCanvasRect( const QRectF & ); 00103 00104 QRectF layoutLegend( Options options, const QRectF & ) const; 00105 QRectF alignLegend( const QRectF &canvasRect, 00106 const QRectF &legendRect ) const; 00107 00108 void expandLineBreaks( Options options, const QRectF &rect, 00109 int &dimTitle, int &dimFooter, int dimAxes[QwtPlot::axisCnt] ) const; 00110 00111 void alignScales( Options options, QRectF &canvasRect, 00112 QRectF scaleRect[QwtPlot::axisCnt] ) const; 00113 00114 private: 00115 class PrivateData; 00116 00117 PrivateData *d_data; 00118 }; 00119 00120 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotLayout::Options ) 00121 00122 #endif