Qwt User's Guide  5.2.3
qwt_plot_canvas.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 // vim: expandtab
11 
12 #ifndef QWT_PLOT_CANVAS_H
13 #define QWT_PLOT_CANVAS_H
14 
15 #include <qframe.h>
16 #include <qpen.h>
17 #include "qwt_global.h"
18 
19 class QwtPlot;
20 class QPixmap;
21 
26 class QWT_EXPORT QwtPlotCanvas : public QFrame
27 {
28  Q_OBJECT
29 
30 public:
31 
54  {
55  PaintCached = 1,
56  PaintPacked = 2
57  };
58 
78  {
79  NoFocusIndicator,
80  CanvasFocusIndicator,
81  ItemFocusIndicator
82  };
83 
84  explicit QwtPlotCanvas(QwtPlot *);
85  virtual ~QwtPlotCanvas();
86 
87  QwtPlot *plot();
88  const QwtPlot *plot() const;
89 
90  void setFocusIndicator(FocusIndicator);
91  FocusIndicator focusIndicator() const;
92 
93  void setPaintAttribute(PaintAttribute, bool on = true);
94  bool testPaintAttribute(PaintAttribute) const;
95 
96  QPixmap *paintCache();
97  const QPixmap *paintCache() const;
98  void invalidatePaintCache();
99 
100  void replot();
101 
102 protected:
103  virtual void hideEvent(QHideEvent *);
104 
105  virtual void paintEvent(QPaintEvent *);
106 
107  virtual void drawContents(QPainter *);
108  virtual void drawFocusIndicator(QPainter *);
109 
110  void drawCanvas(QPainter *painter = NULL);
111 
112 private:
113  void setSystemBackground(bool);
114 
115  class PrivateData;
116  PrivateData *d_data;
117 };
118 
119 #endif