Molecule Viewer
 All Classes Functions Variables Enumerations Pages
widget.h
1 #ifndef WIDGET_H
2 #define WIDGET_H
3 
4 #include "common.hpp"
5 #include "AppMain.hpp"
6 #include <QGLWidget>
7 #include <QElapsedTimer>
8 #include <QtDebug>
9 #include <QFile>
10 #include <QKeyEvent>
11 #include <QWheelEvent>
12 #include <QTimer>
13 
14 namespace Ui {
15 class Widget;
16 }
17 
18 
20 class Widget : public QGLWidget
21 {
22  Q_OBJECT
23 
24 public:
25 
27  explicit Widget(QWidget *parent = 0);
28 
30  explicit Widget(QWidget *parent, QGLFormat const &p_format);
31 
33  ~Widget();
34 
36 
37  void setMainApp(AppMain * mainapp);
38 
39 
40 protected:
41 
43  virtual void initializeGL();
44 
46  virtual void paintGL();
47 
49 
53  virtual void resizeGL(int w, int h);
54 
56 
63  virtual void mouseMoveEvent(QMouseEvent *event);
64 
66  virtual void mousePressEvent(QMouseEvent *event);
67 
69  virtual void mouseReleaseEvent( QMouseEvent *event);
70 
72 
73  virtual void wheelEvent( QWheelEvent *event);
74 
75 private:
76 
78  AppMain * _mainapp;
79 
81  bool _mouseLeftPressed;
82 
84  bool _mouseMiddlePressed;
85 
87  bool _mouseRightPressed;
88 
90  int _mousePosX;
91 
93  int _mousePosY;
94 
95  //GL Context initialized?
96  bool _initialized;
97 
98 };
99 
100 #endif // WIDGET_H