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

namespace UIGQtLib
{
	class UIGQPushButtonImpl;
	class UIGEARSQTLIB_EXPORT UIGQPushButton : public QPushButton, public IUIGQWidgetBase
    {
        Q_OBJECT

	public:
		UIGQPushButton(QWidget* pParent = nullptr);
		~UIGQPushButton();

		UIG_QT_CTRL_DEF("qtbutton", UIGQPushButton);

		void setUseFillStyle(CtrlState state, bool bFillStyle);
		bool getUseFillStyle(CtrlState state);
		void setDrawBackground(bool drawBackground);
		bool getDrawBackground() const;
		void setFadeEnabled(bool enabled);
		bool getFadeEnabled() const;
		void setFadeDuration(int duration);
		int getFadeDuration() const;

		void setBackground(CtrlState eCtrlState, const FillStyle& fillStyle);
		const FillStyle&  getBackground(CtrlState eCtrlState);

        void setTextStyle(CtrlState eState, const UIGQtLib::TextStyleDesc& desc);
        const UIGQtLib::TextStyleDesc& getTextStyle(CtrlState eState);

		const IconStyleDesc& getIconStyle();
		void setIconStyle(const IconStyleDesc& style);

		void setIcon(const QString& iconPath);
		const QString getIcon();

		void setIcon(const QIcon& icon);

		void setHotIcon(const QString& iconPath);
		const QString getHotIcon();

		void setPressedIcon(const QString& iconPath);
		const QString getPressedIcon();

		void setUseIcon(bool bUse);
		bool getUseIcon();

		void setShowText(bool bShow);
		bool getShowText();

		void setTextOffsetX(int offsetX);
		int getTextOffsetX();
		void setTextOffsetY(int offsetY);
		int getTextOffsetY();

		void mousePressEvent(QMouseEvent *event);
		void mouseReleaseEvent(QMouseEvent *event);
		void mouseMoveEvent(QMouseEvent *event);
		void enterEvent(QEvent *event);
		void leaveEvent(QEvent *event);

	Q_SIGNALS:
		void enterSignal();

		void leaveSignal();

	protected:
		void paintEvent(QPaintEvent * evt);

	protected:
		UIGQPushButtonImpl* _ctrlImpl;

        UIGQT_GET_CONTROLBASE;
	};
}
