summaryrefslogtreecommitdiffstats
path: root/examples/demo/opengl/glcontrolwidget.h
blob: 7942c31ef5e2bc6f6a9985060e40821ff767570b (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 <ntqgl.h>

class GLControlWidget : public TQGLWidget
{
    TQ_OBJECT

public:
    GLControlWidget( TQWidget *parent, const char *name = 0, TQGLWidget *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( TQMouseEvent *e );
    void		mouseReleaseEvent( TQMouseEvent *e );
    void		mouseMoveEvent( TQMouseEvent * );
    void		mouseDoubleClickEvent( TQMouseEvent * );
    void		wheelEvent( TQWheelEvent * );

    void		showEvent( TQShowEvent * );
    void		hideEvent( TQHideEvent * );

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

protected slots:
    virtual void	animate();

private:
    bool wasAnimated;
    TQPoint oldPos;
    TQTimer* timer;
    int delay;
};

#endif