QtMainWindowWidget.h
Go to the documentation of this file.
00001 // ****************************************************************************
00002 // Filename:  QtMainWindowWidget.h
00003 // Author:    Florian Hecht
00004 // Date:      2008
00005 // ****************************************************************************
00006 
00007 
00008 #ifndef _QT_MAIN_WINDOW_WIDGET_H_
00009 #define _QT_MAIN_WINDOW_WIDGET_H_
00010 
00011 
00012 // ****************************************************************************
00013 // Includes
00014 // ****************************************************************************
00015 
00016 #include <qwidget.h>
00017 
00018 
00019 // ****************************************************************************
00020 // Forward declarations
00021 // ****************************************************************************
00022 
00023 class CQtMainWindow;
00024 class CByteImage;
00025 
00026 
00027 // ****************************************************************************
00028 // Enums
00029 // ****************************************************************************
00030 
00031 enum QtWidgetType
00032 {
00033         eImage = 0,
00034         eButton,
00035         eLabel,
00036         eCheckBox,
00037         eTextEdit,
00038         eSlider,
00039         eComboBox,
00040         eGLWidget
00041 };
00042 
00043 
00044 
00045 // ****************************************************************************
00046 // CQtMainWindowWidget
00047 // ****************************************************************************
00048 
00049 class CQtMainWindowWidget : public QObject
00050 {
00051         Q_OBJECT
00052         
00053 public:
00054         CQtMainWindowWidget(CQtMainWindow *main_window, QtWidgetType type);
00055         ~CQtMainWindowWidget() {}
00056 
00057 public slots:
00058         void Clicked();
00059         void ValueChanged(int value);
00060         void Toggled(bool flag);
00061         void TextChanged(const QString &str);
00062         
00063 public:
00064         CQtMainWindow   *m_main_window;
00065         QtWidgetType    m_type;
00066         QWidget         *m_widget;
00067 };
00068 
00069 class CQtImageWidget : public QWidget, public CQtMainWindowWidget
00070 {
00071 public:
00072         CQtImageWidget(CQtMainWindow *main_window, QWidget *pParent = 0);
00073         ~CQtImageWidget();
00074         
00075         void SetImage(const CByteImage *pImage);
00076 private:
00077         void paintEvent(QPaintEvent *pPaintEvent);
00078         void mousePressEvent(QMouseEvent *e);
00079         void mouseReleaseEvent(QMouseEvent *e);
00080         void mouseMoveEvent(QMouseEvent *e);
00081         void keyPressEvent(QKeyEvent *e);
00082         void keyReleaseEvent(QKeyEvent *e);
00083 
00084         int m_nWidth;
00085         int m_nHeight;
00086         unsigned char *m_pBuffer;
00087         
00088         bool m_mouse_down;
00089         int m_mouse_start_x;
00090         int m_mouse_start_y;
00091         int m_mouse_current_x;
00092         int m_mouse_current_y;
00093 };
00094 
00095 
00096 
00097 #ifdef USE_OPENGL
00098 
00099 #include <qgl.h>
00100 
00101 // ****************************************************************************
00102 // CQtGLWidget
00103 // ****************************************************************************
00104 
00105 class CQtGLWidget : public QGLWidget, public CQtMainWindowWidget
00106 {
00107 public:
00108         CQtGLWidget(CQtMainWindow *main_window, QWidget *pParent = 0);
00109         ~CQtGLWidget();
00110         
00111 private:
00112         void mousePressEvent(QMouseEvent *e);
00113         void mouseReleaseEvent(QMouseEvent *e);
00114         void mouseMoveEvent(QMouseEvent *e);
00115         void keyPressEvent(QKeyEvent *e);
00116         void keyReleaseEvent(QKeyEvent *e);
00117 }; 
00118 
00119 #endif
00120 
00121 
00122 #endif /* _QT_MAIN_WINDOW_WIDGET_H_ */


asr_ivt
Author(s): Allgeyer Tobias, Hutmacher Robin, Kleinert Daniel, Meißner Pascal, Scholz Jonas, Stöckle Patrick
autogenerated on Thu Jun 6 2019 21:46:58