Qwt User's Guide  5.2.3
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:
45  enum Options
46  {
47  AlignScales = 1,
48  IgnoreScrollbars = 2,
49  IgnoreFrames = 4,
50  IgnoreMargin = 8,
51  IgnoreLegend = 16
52  };
53 
54  explicit QwtPlotLayout();
55  virtual ~QwtPlotLayout();
56 
57  void setMargin(int);
58  int margin() const;
59 
60  void setCanvasMargin(int margin, int axis = -1);
61  int canvasMargin(int axis) const;
62 
63  void setAlignCanvasToScales(bool);
64  bool alignCanvasToScales() const;
65 
66  void setSpacing(int);
67  int spacing() const;
68 
69  void setLegendPosition(QwtPlot::LegendPosition pos, double ratio);
70  void setLegendPosition(QwtPlot::LegendPosition pos);
71  QwtPlot::LegendPosition legendPosition() const;
72 
73  void setLegendRatio(double ratio);
74  double legendRatio() const;
75 
76  virtual QSize minimumSizeHint(const QwtPlot *) const;
77 
78  virtual void activate(const QwtPlot *,
79  const QRect &rect, int options = 0);
80 
81  virtual void invalidate();
82 
83  const QRect &titleRect() const;
84  const QRect &legendRect() const;
85  const QRect &scaleRect(int axis) const;
86  const QRect &canvasRect() const;
87 
88  class LayoutData;
89 
90 protected:
91 
92  QRect layoutLegend(int options, const QRect &) const;
93  QRect alignLegend(const QRect &canvasRect,
94  const QRect &legendRect) const;
95 
96  void expandLineBreaks(int options, const QRect &rect,
97  int &dimTitle, int dimAxes[QwtPlot::axisCnt]) const;
98 
99  void alignScales(int options, QRect &canvasRect,
100  QRect scaleRect[QwtPlot::axisCnt]) const;
101 
102 private:
103  class PrivateData;
104 
105  PrivateData *d_data;
106 };
107 
108 #endif