/**
** 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 <QtWidgets/QLabel>
#include "UIGQMacro.h"
#include "UIGQWidgetBase.h"

namespace UIGQtLib
{
	class UIGQImageImpl;
	class UIGEARSQTLIB_EXPORT UIGQImage : public QWidget, public IUIGQWidgetBase
	{
		Q_OBJECT
	public:
		UIGQImage(QWidget* pParent = nullptr);
		~UIGQImage();

		UIG_QT_CTRL_DEF("qtpicture", UIGQImage);

		void setStretchDraw(bool bStretch);
		bool getStretchDraw();
		void setImagePath(const QString& imagePath);
		const QString& getImagePath();
		void setSvgPath(const QString& svgPath);
		const QString& getSvgPath();
		void setSvgColor(const QColor& color);
		QColor getSvgColor() const;
		void setUseSvgColor(bool useColor);
		bool getUseSvgColor() const;
		void setAlignType(DockLayoutType hor, DockLayoutType ver);
		void setImage(const QImage* pImage);
		const QImage* getImage();
		void loadGif(const QString& path);
		void startAnimate();
		void stopAnimate();

	Q_SIGNALS:
		void movieFinished();
        void clicked();

	protected:
		void paintEvent(QPaintEvent * evt);
		void resizeEvent(QResizeEvent* evt);
        void mouseReleaseEvent(QMouseEvent *event);

	private:
		UIGQImageImpl* _ctrlImpl;

		UIGQT_GET_CONTROLBASE;
	};
}
