VAPOR3 3.9.4
GLWidget.h
Go to the documentation of this file.
1//-- GLWidget.h ---------------------------------------------------------
2//
3// Copyright (C) 2006 Kenny Gruchalla. All rights reserved.
4//
5// Abstract base class for OpenGL-based widgets that provides a common
6// interface for selecting, moving, and drawing.
7//
8//----------------------------------------------------------------------------
9
10#ifndef GLWidget_H
11#define GLWidget_H
12
13#include <qobject.h>
14
15#include <qnamespace.h>
16#include <list>
17
18class QWidget;
19
20class GLWidget : public QObject {
21 Q_OBJECT
22
23protected:
24 enum { NONE = -1 };
25
26public:
27 GLWidget(QWidget *parent = 0);
28 virtual ~GLWidget();
29
30 virtual int paintGL() = 0;
31
32 virtual void move(float dx, float dy = 0.0, float dz = 0.0) = 0;
33 virtual void drag(float dx, float dy = 0.0, float dz = 0.0) = 0;
34
35 virtual bool selected() { return _selected != NONE; }
36 virtual void deselect() { _selected = NONE; }
37 virtual void select(int handle, Qt::KeyboardModifiers) { _selected = handle; }
38
39 virtual bool enabled() const { return _enabled; }
40 virtual void enable(bool flag) { _enabled = flag; }
41
42 virtual void setGeometry(float x0, float x1, float y0, float y1);
43
44 int id() const { return _id; }
45
46signals:
47
48 void startChange(QString);
49 void endChange();
50
51protected:
52 static unsigned int createId();
53
54 unsigned int _id;
57
58 float _minX;
59 float _maxX;
60 float _minY;
61 float _maxY;
62};
63
64#endif // GLWidget_H
virtual void setGeometry(float x0, float x1, float y0, float y1)
virtual int paintGL()=0
void endChange()
virtual bool enabled() const
Definition: GLWidget.h:39
virtual ~GLWidget()
virtual bool selected()
Definition: GLWidget.h:35
unsigned int _id
Definition: GLWidget.h:54
virtual void enable(bool flag)
Definition: GLWidget.h:40
void startChange(QString)
virtual void select(int handle, Qt::KeyboardModifiers)
Definition: GLWidget.h:37
int _selected
Definition: GLWidget.h:55
virtual void deselect()
Definition: GLWidget.h:36
virtual void move(float dx, float dy=0.0, float dz=0.0)=0
virtual void drag(float dx, float dy=0.0, float dz=0.0)=0
float _minY
Definition: GLWidget.h:60
float _minX
Definition: GLWidget.h:58
float _maxX
Definition: GLWidget.h:59
bool _enabled
Definition: GLWidget.h:56
@ NONE
Definition: GLWidget.h:24
GLWidget(QWidget *parent=0)
static unsigned int createId()
int id() const
Definition: GLWidget.h:44
float _maxY
Definition: GLWidget.h:61