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

#define UIG_DEF_COMBO_ITEM_HEIGHT 25

namespace UIGQtLib
{
	class UIGQComboList;
	class UIGQComboBoxImpl;
    class UIGEARSQTLIB_EXPORT UIGQComboBox : public QComboBox, public IUIGQWidgetBase
    {
        Q_OBJECT

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

		UIG_QT_CTRL_DEF("qtcombobox", UIGQComboBox);

		void initDemoData();

		void setBackground(UIGQtLib::CtrlState state, const FillStyle& style);
		const FillStyle& getBackground(UIGQtLib::CtrlState state);

		void setBtnBackground(UIGQtLib::CtrlState state, const FillStyle& style);
		const FillStyle& getBtnBackground(UIGQtLib::CtrlState state);

		void setBtnIcon(UIGQtLib::CtrlState state, const QString& path);
		const QString& getBtnIcon(UIGQtLib::CtrlState state);
		
		const QString& getNormalBtnIcon();
		void setNormalBtnIcon(const QString& path);

		const QString& getHotBtnIcon();
		void setHotBtnIcon(const QString& path);
			
		void setTextStyle(UIGQtLib::CtrlState state, const TextStyleDesc& style);
		const TextStyleDesc& getTextStyle(UIGQtLib::CtrlState state);

		void setPopupBackground(UIGQtLib::CtrlState state, const FillStyle& style);
		const FillStyle& getPopupBackground(UIGQtLib::CtrlState state);

		void setItemBackground(UIGQtLib::CtrlState state, const FillStyle& style);
		const FillStyle& getItemBackground(UIGQtLib::CtrlState state);

		void setItemTextStyle(UIGQtLib::CtrlState state, const TextStyleDesc& style);
		const TextStyleDesc& getItemTextStyle(UIGQtLib::CtrlState state);

		void setItemHeight(int height);
		int getItemHeight();

	protected:
		void paintEvent(QPaintEvent * evt);

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

	private:
		UIGQComboBoxImpl*	_ctrlImpl;
		UIGQComboList*		_comboList;

		UIGQT_GET_CONTROLBASE;
	};
}
