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

namespace UIGQtLib
{
	class UIGQCheckBoxImpl;
	class UIGEARSQTLIB_EXPORT UIGQCheckBox : public QCheckBox, public IUIGQWidgetBase
	{
		Q_OBJECT

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

		UIG_QT_CTRL_DEF("qtcheckbox", UIGQCheckBox);

		UIGQCheckBoxImpl* getImpl() { return _ctrlImpl; }
		
		friend class UIGQCheckBoxImpl;
	protected:
		void mousePressEvent(QMouseEvent *event);
		void mouseReleaseEvent(QMouseEvent *event);
		void enterEvent(QEvent *event);
		void leaveEvent(QEvent *event);
		void mouseMoveEvent(QMouseEvent *event);
		void paintEvent(QPaintEvent * evt);

	public:
		void setUncheckIcon(const QString& iconPath);
		QString getUncheckIcon() const;
		void setUncheckHotIcon(const QString& iconPath);
		QString getUncheckHotIcon() const;
		void setCheckedIcon(const QString& iconPath);
		QString getCheckedIcon() const;
		void setCheckedHotIcon(const QString& iconPath);
		QString getCheckedHotIcon() const;
		void setDisableCheckIcon(const QString& iconPath);
		QString getDisableCheckIcon() const;
		void setDisableUncheckIcon(const QString& iconPath);
		QString getDisableUncheckIcon() const;
		void setShowText(bool bShow);
		bool getShowText() const;
		void setShowIcon(bool bShow);
		bool getShowIcon() const;
		const IconStyleDesc& getIconStyle() const;
		void setIconStyle(const IconStyleDesc& style);

		void setTextStyle(bool isChecked, const TextStyleDesc& desc);
		const TextStyleDesc& getTextStyle(bool isChecked) const;

		void setDisableTextStyle(const TextStyleDesc& desc);
		const TextStyleDesc& getDisableTextStyle() const;

		void setTextStyleByState(CheckBoxTextState state, const TextStyleDesc& desc);
		const TextStyleDesc& getTextStyleByState(CheckBoxTextState state);

		void setBackground(CtrlState eState, const FillStyle& desc);
		const FillStyle& getBackground(CtrlState eState);

		void setCheckedBackground(CtrlState eState, const FillStyle& desc);
		const FillStyle& getCheckedBackground(CtrlState eState);
		
		DockLayoutType getIconHorAlign() const;
		void setIconHorAlign(DockLayoutType type);

		DockLayoutType getIconVerAlign() const;
		void setIconVerAlign(DockLayoutType type);

		void setIconOffsetX(int x);
		int getIconOffsetX() const;

		void setIconOffsetY(int y);
		int getIconOffsetY() const;

	private:
		UIGQT_GET_CONTROLBASE;

		UIGQCheckBoxImpl* _ctrlImpl;
	};
}