/**
** This file is owned by VisualGear Technology Co., Ltd.
** Unauthorized copying of this file, via any medium is strictly prohibited
** Otherwise VisualGear Technology Co., Ltd. will have the right to pursue
** maximum responsibilities within scope of legal.
**
** Copyright 2018-2020 VisualGear All rights reserved.
**/

#pragma once

#include "UIGQWidgetBase.h"
#include <QtWidgets/QDialog>
#include <QtWidgets/QMainWindow>

namespace UIGQtLib
{
	class UIGEARSQTLIB_EXPORT UIGQView : public QWidget
	{

	};

	class UIGEARSQTLIB_EXPORT UIGQMDIArea : public QWidget
	{
	private:
		QVector<UIGQView*> _views;
	};

	class UIGEARSQTLIB_EXPORT UIGQDockFrame : public QWidget
	{

	};

	class UIGQWindowImpl;
    class UIGEARSQTLIB_EXPORT UIGQWindow : public QDialog
	{
	public:
		UIGQWindow(QWidget *parent = NULL);
		~UIGQWindow();

		static QString typeName() { return "UIGWindow";  }

		void setShowBackground(bool show);
		void setTransparent(bool enable);
		void centerWindow();
		void setResizeable(bool enable);
		void setBackgroundImage(const QString& imagePath, const ImageDesc& imageDesc);
		void setBackgroundColor(const FillRes& fillRes);
		void setUseFillColor(bool useFillColor);
		void setMinWidth(int minWidth);
		void setMinHeight(int minHeight);
		void setCanDrag(bool bCanDrag);
		bool getCanGrag();
		void setOnlyDragCaption(bool bOnlyCanCaption);
		bool getOnlyDragCaption();
		void setCaptionHeight(int captionHeight);
		bool getCaptionHeight();
		void setX(int x);
		void setY(int y);
		void setMDIArea(UIGQMDIArea* pMdiArea);
		UIGQMDIArea* getMDIArea();
		QWidget* hitTest(QWidget* pParent, int x, int y);

		void doModal();
		void closeModal();

		void ToJsonString(QString& content);

	protected:
		void mouseReleaseEvent(QMouseEvent *e);
		void mousePressEvent(QMouseEvent *e);
		void mouseMoveEvent(QMouseEvent *e);
		void mouseDoubleClickEvent(QMouseEvent *e);
		void resizeEvent(QResizeEvent *event);
		void paintEvent(QPaintEvent *event);
		void closeEvent(QCloseEvent *event);

	private:
		UIGQWindowImpl* _windowImpl;		
	};


	class UIGEARSQTLIB_EXPORT UIGQSubWin : public QWidget
	{
	public:
		UIGQSubWin(QWidget *parent);
		~UIGQSubWin();

		static QString typeName() { return "UIGSubWin"; }

		void setShowBackground(bool show);
		void setTransparent(bool enable);
		void centerWindow();
		void setResizeable(bool enable);
		void setBackgroundImage(const QString& imagePath, const ImageDesc& imageDesc);
		void setBackgroundColor(const FillRes& fillRes);
		void setUseFillColor(bool useFillColor);
		void setMinWidth(int minWidth);
		void setMinHeight(int minHeight);
		void setCanDrag(bool bCanDrag);
		bool getCanGrag();
		void setOnlyDragCaption(bool bOnlyCanCaption);
		bool getOnlyDragCaption();
		void setCaptionHeight(int captionHeight);
		bool getCaptionHeight();
		void setX(int x);
		void setY(int y);
		QWidget* hitTest(QWidget* pParent, int x, int y);


	protected:
		void mouseReleaseEvent(QMouseEvent *e);
		void mousePressEvent(QMouseEvent *e);
		void mouseMoveEvent(QMouseEvent *e);
		void mouseDoubleClickEvent(QMouseEvent *e);
		void resizeEvent(QResizeEvent *event);
		void paintEvent(QPaintEvent *event);
		void closeEvent(QCloseEvent *event);

	private:
		UIGQWindowImpl* _windowImpl;
	};
}  

