#ifndef __USE_VideoViewHost_H__
#define __USE_VideoViewHost_H__

#include "videoview.h"

#include "qtsolutions/qtwinmigrate/src/qwinhost.h"
#include <qt_windows.h>

class CVideoViewHost
	: public QWinHost, public IVideoView
{
public:
	Q_OBJECT
public:
	CVideoViewHost(QWidget* parent);
	virtual ~CVideoViewHost();
	void updateViewSize(int width, int height);
protected:
	HWND createWindow(HWND parent, HINSTANCE instance);
public:
	static void RegistRenderWndClass();
	virtual void resizeEvent(QResizeEvent* event);
	virtual void onCreateWnd(HWND hwnd) = 0;
	//
	void paintEvent(QPaintEvent *event);
	void setBorder(bool hasBorder);
	QPaintEngine * paintEngine() const { return 0; }
	void mouseDoubleClickEvent(QMouseEvent* event);
	void mousePressEvent(QMouseEvent *event);
	void mouseReleaseEvent(QMouseEvent *event);
	void focusOutEvent(QFocusEvent *event){}
signals:
	void doubleClick();
	void click();
protected:
	static LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
protected:
	HWND	 m_hwnd;
	QWidget* _parent;
};

#endif //__USE_VideoViewHost_H__
