summaryrefslogtreecommitdiff
path: root/examples/widgets/symbianvibration/vibrationsurface.h
blob: eee629165864a8ad99f30d20944fb3dde4b6d750 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#ifndef TOUCHAREA_H
#define TOUCHAREA_H

#include <QWidget>

class XQVibra;

//! [0]
class VibrationSurface : public QWidget
{
    Q_OBJECT
public:
    explicit VibrationSurface(XQVibra *vibra, QWidget *parent = 0);

protected:
    virtual void mousePressEvent(QMouseEvent *);
    virtual void mouseMoveEvent(QMouseEvent *);
    virtual void mouseReleaseEvent(QMouseEvent *);
    virtual void paintEvent(QPaintEvent *);

private:

    int getIntensity(int x, int y);
    void applyIntensity(int x, int y);

    XQVibra *vibra;
    int lastIntensity;
};
//! [0]

#endif // TOUCHAREA_H