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

namespace UIGQtLib
{
	class UIGQMenuImpl;
	class UIGEARSQTLIB_EXPORT UIGQMenu : public QMenu, public IUIGQWidgetBase
	{
	public:
		using QMenu::addAction;

		UIGQMenu(QWidget* pParent = nullptr);
		UIGQMenu(const QString &title, QWidget *pParent = nullptr);
		~UIGQMenu();

		UIG_QT_CTRL_DEF("qtmenu", UIGQMenu);
	
		void setIconOffset(int iconOffset);
		void setBackground(const FillStyle& style);
		void setItemStyle(CtrlState state, const FillStyle& style);
		void setItemTextStyle(CtrlState state, const TextStyleDesc& style);
		QAction* addIconAction(const QString& iconPath, const QString& text);

	protected:
		void paintEvent(QPaintEvent * evt);
		void hideEvent(QHideEvent *evt);
		QSize sizeHint();

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

		friend class UIGQMenuImpl;
	private:
		UIGQMenuImpl* _ctrlImpl;

		UIGQT_GET_CONTROLBASE;
	};
}
