/**
** 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/QRadioButton>

namespace UIGQtLib
{
	class UIGQRadioButtonImpl;
	class UIGEARSQTLIB_EXPORT UIGQRadioButton : public QRadioButton, public IUIGQWidgetBase
	{
		Q_OBJECT
	public:
		UIGQRadioButton(QWidget* pParent = nullptr);
		~UIGQRadioButton();

		UIG_QT_CTRL_DEF("qtradiobox", UIGQRadioButton);

		void paintEvent(QPaintEvent * e);

		bool setUncheckIcon(const QString& iconPath);
		const QString&  getUncheckIcon();
		bool setUncheckHotIcon(const QString& iconPath);
		const QString&  getUncheckHotIcon();
		bool setCheckedIcon(const QString& iconPath);
		const QString&  getCheckedIcon();
		bool setCheckedHotIcon(const QString& iconPath);
		const QString&  getCheckedHotIcon();
		bool setDisableIcon(const QString& iconPath);
		const QString&  getDisableIcon();

		void setPushlike(bool bShow);
		bool getPushlike();

		void setShowText(bool bShow);
		bool getShowText() const;
		void setShowIcon(bool bShow);
		bool getShowIcon() const;

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

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

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

		void setSelectedBackground(CtrlState eState, const FillStyle& desc);
		const FillStyle& getSelectedBackground(CtrlState eState) const;
		 
		const IconStyleDesc& getIconStyle();
		void setIcon(RadioIconState state, const QString& path);
		void setIcon(const QString& path);
		void setIconStyle(const IconStyleDesc& iconStyle);
	
		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;

		void mousePressEvent(QMouseEvent *event);
		void mouseReleaseEvent(QMouseEvent *event);
		void enterEvent(QEvent *event);
		void leaveEvent(QEvent *event);
		void mouseMoveEvent(QMouseEvent *event);
		bool hitButton(const QPoint&) const;

	Q_SIGNALS:
		void pressedEvent();

	private:
		UIGQRadioButtonImpl* _ctrlImpl;

		UIGQT_GET_CONTROLBASE;
	};
}

