Qwt User's Guide  6.0.2
qwt_plot_layout.h
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 
24 class QWT_EXPORT QwtPlotLayout
25 {
26 public:
31  enum Option
32  {
34  AlignScales = 0x01,
35 
40  IgnoreScrollbars = 0x02,
41 
43  IgnoreFrames = 0x04,
44 
46  IgnoreLegend = 0x08
47  };
48 
50  typedef QFlags<Option> Options;
51 
52  explicit QwtPlotLayout();
53  virtual ~QwtPlotLayout();
54 
55  void setCanvasMargin( int margin, int axis = -1 );
56  int canvasMargin( int axis ) const;
57 
58  void setAlignCanvasToScales( bool );
59  bool alignCanvasToScales() const;
60 
61  void setSpacing( int );
62  int spacing() const;
63 
64  void setLegendPosition( QwtPlot::LegendPosition pos, double ratio );
65  void setLegendPosition( QwtPlot::LegendPosition pos );
66  QwtPlot::LegendPosition legendPosition() const;
67 
68  void setLegendRatio( double ratio );
69  double legendRatio() const;
70 
71  virtual QSize minimumSizeHint( const QwtPlot * ) const;
72 
73  virtual void activate( const QwtPlot *,
74  const QRectF &rect, Options options = 0x00 );
75 
76  virtual void invalidate();
77 
78  const QRectF &titleRect() const;
79  const QRectF &legendRect() const;
80  const QRectF &scaleRect( int axis ) const;
81  const QRectF &canvasRect() const;
82 
83  class LayoutData;
84 
85 protected:
86 
87  QRectF layoutLegend( Options options, const QRectF & ) const;
88  QRectF alignLegend( const QRectF &canvasRect,
89  const QRectF &legendRect ) const;
90 
91  void expandLineBreaks( int options, const QRectF &rect,
92  int &dimTitle, int dimAxes[QwtPlot::axisCnt] ) const;
93 
94  void alignScales( int options, QRectF &canvasRect,
95  QRectF scaleRect[QwtPlot::axisCnt] ) const;
96 
97 private:
98  class PrivateData;
99 
100  PrivateData *d_data;
101 };
102 
103 Q_DECLARE_OPERATORS_FOR_FLAGS( QwtPlotLayout::Options )
104 
105 #endif