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

namespace UIGQtLib
{
	class UIGQMenuBarImpl;
	class UIGEARSQTLIB_EXPORT UIGQMenuBar : public QMenuBar, public IUIGQWidgetBase
	{
		Q_OBJECT   
	public:
		UIGQMenuBar(QWidget* pParent = nullptr);
		~UIGQMenuBar();

		UIG_QT_CTRL_DEF("qtmenubar", UIGQMenuBar);

		void setBackground(UIGQtLib::CommonCtrlState state, const FillStyle& fillRes);
		const FillStyle& getBackground(UIGQtLib::CommonCtrlState state);

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

		void setTextStyle(UIGQtLib::CtrlState state, const TextStyleDesc& textStyle);
		const TextStyleDesc& getTextStyle(UIGQtLib::CtrlState state);

		void setPopupBackground(UIGQtLib::CommonCtrlState state, const FillStyle& fillRes);
		const FillStyle& getPopupBackground(UIGQtLib::CommonCtrlState state);

		void setPopupItemBackground(UIGQtLib::CtrlState state, const FillStyle& fillRes);
		const FillStyle& getPopupItemBackground(UIGQtLib::CtrlState state);

		void setPopupTextStyle(UIGQtLib::CtrlState state, const TextStyleDesc& textStyle);
		const TextStyleDesc& getPopupTextStyle(UIGQtLib::CtrlState state);

		QAction* addMenu(QMenu *menu);

		QRect actionGeometry(QAction* pAct) const;

	protected:
		void mouseMoveEvent(QMouseEvent * evt);
		void mousePressEvent(QMouseEvent * evt);
		void mouseReleaseEvent(QMouseEvent * evt);
		void leaveEvent(QEvent * evt);
		void paintEvent(QPaintEvent * evt);

	private:
		UIGQMenuBarImpl* _ctrlImpl;

		UIGQT_GET_CONTROLBASE;
	};
}
