summaryrefslogtreecommitdiffstats
path: root/examples/demo/opengl/glcontrolwidget.h
blob: 05d026f8ae32f2b1505fee4461128fab1cd994f4 (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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#ifndef GLCONTROLWIDGET_H
#define GLCONTROLWIDGET_H

#include <qgl.h>

class GLControlWidget : public QGLWidget
{
    Q_OBJECT

public:
    GLControlWidget( QWidget *parent, const char *name = 0, QGLWidget *share = 0, WFlags f = 0 );

    virtual void	transform();

public slots:
    void		setXRotation( double degrees );
    void		setYRotation( double degrees );
    void		setZRotation( double degrees );

    void		setScale( double s );

    void		setXTrans( double x );
    void		setYTrans( double y );
    void		setZTrans( double z );

    virtual void	setRotationImpulse( double x, double y, double z );
    virtual void	setTranslationImpulse( double x, double y, double z );
    void		drawText();

protected:
    void		setAnimationDelay( int ms );
    void		mousePressEvent( QMouseEvent *e );
    void		mouseReleaseEvent( QMouseEvent *e );
    void		mouseMoveEvent( QMouseEvent * );
    void		mouseDoubleClickEvent( QMouseEvent * );
    void		wheelEvent( QWheelEvent * );

    void		showEvent( QShowEvent * );
    void		hideEvent( QHideEvent * );

    GLfloat xRot, yRot, zRot;
    GLfloat xTrans, yTrans, zTrans;
    GLfloat scale;
    bool animation;

protected slots:
    virtual void	animate();

private:
    bool wasAnimated;
    QPoint oldPos;
    QTimer* timer;
    int delay;
};

#endif