~ubuntu-branches/ubuntu/raring/goldencheetah/raring

« back to all changes in this revision

Viewing changes to qwt/src/qwt_magnifier.h

  • Committer: Bazaar Package Importer
  • Author(s): Tatsuya Kinoshita
  • Date: 2011-04-29 16:37:36 UTC
  • Revision ID: james.westby@ubuntu.com-20110429163736-u8eto8uixxvv4f1u
Tags: upstream-2.0.0
ImportĀ upstreamĀ versionĀ 2.0.0

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
#ifndef QWT_MAGNIFIER_H
 
11
#define QWT_MAGNIFIER_H 1
 
12
 
 
13
#include "qwt_global.h"
 
14
#include <qobject.h>
 
15
 
 
16
class QWidget;
 
17
class QMouseEvent;
 
18
class QWheelEvent;
 
19
class QKeyEvent;
 
20
 
 
21
/*!
 
22
  \brief QwtMagnifier provides zooming, by magnifying in steps.
 
23
 
 
24
  Using QwtMagnifier a plot can be zoomed in/out in steps using
 
25
  keys, the mouse wheel or moving a mouse button in vertical direction.
 
26
*/
 
27
class QWT_EXPORT QwtMagnifier: public QObject
 
28
{
 
29
    Q_OBJECT
 
30
 
 
31
public:
 
32
    explicit QwtMagnifier(QWidget *);
 
33
    virtual ~QwtMagnifier();
 
34
 
 
35
    QWidget *parentWidget();
 
36
    const QWidget *parentWidget() const;
 
37
 
 
38
    void setEnabled(bool);
 
39
    bool isEnabled() const;
 
40
 
 
41
    // mouse
 
42
    void setMouseFactor(double);
 
43
    double mouseFactor() const;
 
44
 
 
45
    void setMouseButton(int button, int buttonState = Qt::NoButton);
 
46
    void getMouseButton(int &button, int &buttonState) const;
 
47
 
 
48
    // mouse wheel
 
49
    void setWheelFactor(double);
 
50
    double wheelFactor() const;
 
51
 
 
52
    void setWheelButtonState(int buttonState);
 
53
    int wheelButtonState() const;
 
54
 
 
55
    // keyboard
 
56
    void setKeyFactor(double);
 
57
    double keyFactor() const;
 
58
 
 
59
    void setZoomInKey(int key, int modifiers);
 
60
    void getZoomInKey(int &key, int &modifiers) const;
 
61
 
 
62
    void setZoomOutKey(int key, int modifiers);
 
63
    void getZoomOutKey(int &key, int &modifiers) const;
 
64
 
 
65
    virtual bool eventFilter(QObject *, QEvent *);
 
66
 
 
67
protected:
 
68
    /*!
 
69
       Rescale the parent widget
 
70
       \param factor Scale factor
 
71
     */
 
72
    virtual void rescale(double factor) = 0;
 
73
 
 
74
    virtual void widgetMousePressEvent(QMouseEvent *);
 
75
    virtual void widgetMouseReleaseEvent(QMouseEvent *);
 
76
    virtual void widgetMouseMoveEvent(QMouseEvent *);
 
77
    virtual void widgetWheelEvent(QWheelEvent *);
 
78
    virtual void widgetKeyPressEvent(QKeyEvent *);
 
79
    virtual void widgetKeyReleaseEvent(QKeyEvent *);
 
80
 
 
81
private:
 
82
    class PrivateData;
 
83
    PrivateData *d_data;
 
84
};
 
85
 
 
86
#endif