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

namespace UIGQtLib
{
	class UIGQSliderImpl;
	class UIGEARSQTLIB_EXPORT UIGQSlider : public QSlider, public IUIGQWidgetBase
	{
        Q_OBJECT

	public:
		UIGQSlider(QWidget* pParent = nullptr, Qt::Orientation orientation = Qt::Horizontal);
		~UIGQSlider();

		UIG_QT_CTRL_DEF("qtslider", UIGQSlider);

		void paintEvent(QPaintEvent *ev);

		void setBackgroundStyle(CommonCtrlState eState, const FillStyle& style);
		const FillStyle& getBackgroundStyle(CommonCtrlState eState);

		void setForegroundStyle(CommonCtrlState eState, const FillStyle& style);
		const FillStyle& getForegroundStyle(CommonCtrlState eState);

		void setThumbStyle(CtrlState eState, const FillStyle& style);
		const FillStyle& getThumbStyle(CtrlState eState);

		void setIsHorizontal(bool isHor);
		bool getIsHorizontal();

		void setThumbSize(int width, int height);
		void getThumbSize(int& width, int& height);

		QSize getThumbBtnSize() const;
		QRect getThumbRect() const;

		void setChannelHeight(int channelHeight);
		int getChannelHeight();

		int  getSliderLength() const;

		friend class UIGQSliderImpl;

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


	private:
		UIGQSliderImpl* _ctrlImpl;

		UIGQT_GET_CONTROLBASE;
	};
}

