diff options
Diffstat (limited to 'qtwinmigrate/qwinhost.h')
-rw-r--r-- | qtwinmigrate/qwinhost.h | 57 |
1 files changed, 57 insertions, 0 deletions
diff --git a/qtwinmigrate/qwinhost.h b/qtwinmigrate/qwinhost.h new file mode 100644 index 0000000..bf8686e --- /dev/null +++ b/qtwinmigrate/qwinhost.h @@ -0,0 +1,57 @@ + +// Declaration of the QWinHost classes + +#ifndef QWINHOST_H +#define QWINHOST_H + +#include <QtGui/QWidget> + +#if defined(Q_WS_WIN) +# if !defined(QT_QTWINMIGRATE_EXPORT) && !defined(QT_QTWINMIGRATE_IMPORT) +# define QT_QTWINMIGRATE_EXPORT +# elif defined(QT_QTWINMIGRATE_IMPORT) +# if defined(QT_QTWINMIGRATE_EXPORT) +# undef QT_QTWINMIGRATE_EXPORT +# endif +# define QT_QTWINMIGRATE_EXPORT __declspec(dllimport) +# elif defined(QT_QTWINMIGRATE_EXPORT) +# undef QT_QTWINMIGRATE_EXPORT +# define QT_QTWINMIGRATE_EXPORT __declspec(dllexport) +# endif +#else +# define QT_QTWINMIGRATE_EXPORT +#endif + +#include <windows.h> + +class QT_QTWINMIGRATE_EXPORT QWinHost : public QWidget +{ + Q_OBJECT +public: + QWinHost(QWidget *parent = 0, Qt::WFlags f = 0); + ~QWinHost(); + + void setWindow(HWND); + HWND window() const; + +protected: + virtual HWND createWindow(HWND parent, HINSTANCE instance); + + bool event(QEvent *e); + void showEvent(QShowEvent *); + void focusInEvent(QFocusEvent*); + void resizeEvent(QResizeEvent*); + + bool winEvent(MSG *msg, long *result); + +private: + void fixParent(); + friend void* getWindowProc(QWinHost*); + + void *wndproc; + bool own_hwnd; + HHOOK m_hook; + HWND hwnd; +}; + +#endif // QWINHOST_H |