~l3on/ubuntu/oneiric/qwt/fix-921430

« back to all changes in this revision

Viewing changes to qwt-5.0.2/src/qwt_plot_canvas.h

  • Committer: Bazaar Package Importer
  • Author(s): Fathi Boudra
  • Date: 2007-10-05 15:20:41 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20071005152041-qmybqh4fj9jejyo2
Tags: 5.0.2-2
* Handle nostrip build option. (Closes: #437877)
* Build libqwt5-doc package in binary-indep target. (Closes: #443110)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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
 
 
22
/*!
 
23
  \brief Canvas of a QwtPlot. 
 
24
 
 
25
  \sa  QwtPlot 
 
26
*/
 
27
 
 
28
class QWT_EXPORT QwtPlotCanvas : public QFrame
 
29
{
 
30
    Q_OBJECT
 
31
    friend class QwtPlot;
 
32
 
 
33
public:
 
34
 
 
35
    /*!
 
36
      \brief Paint attributes
 
37
 
 
38
      - PaintCached\n
 
39
        Paint double buffered and reuse the content of the pixmap buffer 
 
40
        for some spontaneous repaints that happen when a plot gets unhidden, 
 
41
        deiconified or changes the focus.
 
42
        Disabling the cache will improve the performance for
 
43
        incremental paints (using QwtPlotCurve::draw). 
 
44
 
 
45
      - PaintPacked\n
 
46
        Suppress system background repaints and paint it together with 
 
47
        the canvas contents.
 
48
        Painting packed might avoid flickering for expensive repaints,
 
49
        when there is a notable gap between painting the background
 
50
        and the plot contents.
 
51
 
 
52
      The default setting enables PaintCached and PaintPacked
 
53
 
 
54
      \sa setPaintAttribute(), testPaintAttribute(), paintCache()
 
55
     */
 
56
    enum PaintAttribute
 
57
    {
 
58
        PaintCached = 1,
 
59
        PaintPacked = 2
 
60
    };
 
61
 
 
62
    /*!
 
63
      \brief Focus indicator
 
64
 
 
65
      - NoFocusIndicator\n
 
66
        Don't paint a focus indicator
 
67
 
 
68
      - CanvasFocusIndicator\n
 
69
        The focus is related to the complete canvas.
 
70
        Paint the focus indicator using paintFocus()
 
71
 
 
72
      - ItemFocusIndicator\n
 
73
        The focus is related to an item (curve, point, ...) on
 
74
        the canvas. It is up to the application to display a
 
75
        focus indication using f.e. highlighting.
 
76
 
 
77
      \sa setFocusIndicator(), focusIndicator(), paintFocus()
 
78
    */
 
79
 
 
80
    enum FocusIndicator
 
81
    {
 
82
        NoFocusIndicator,
 
83
        CanvasFocusIndicator,
 
84
        ItemFocusIndicator
 
85
    };
 
86
 
 
87
    void setFocusIndicator(FocusIndicator);
 
88
    FocusIndicator focusIndicator() const;
 
89
 
 
90
    void setPaintAttribute(PaintAttribute, bool on = true);
 
91
    bool testPaintAttribute(PaintAttribute) const;
 
92
 
 
93
    QPixmap *paintCache();
 
94
    const QPixmap *paintCache() const;
 
95
    void invalidatePaintCache();
 
96
 
 
97
protected:
 
98
    explicit QwtPlotCanvas(QwtPlot *);
 
99
    virtual ~QwtPlotCanvas();
 
100
 
 
101
    virtual void hideEvent(QHideEvent *);
 
102
 
 
103
    virtual void paintEvent(QPaintEvent *);
 
104
 
 
105
    virtual void drawContents(QPainter *);
 
106
    virtual void drawFocusIndicator(QPainter *);
 
107
 
 
108
    void drawCanvas(QPainter *painter = NULL);
 
109
 
 
110
private:    
 
111
    void setSystemBackground(bool);
 
112
 
 
113
    class PrivateData;
 
114
    PrivateData *d_data;
 
115
};
 
116
 
 
117
#endif