#pragma once

#include "UIGQWidgetBase.h"

namespace QtCharts
{
	class QChartView;
	class QChart;
	class QValueAxis;
	class QBarSeries;
	class QBarCategoryAxis;
}

namespace UIGQtLib
{
	class UIGQColumnChartImpl;
	class UIGQColumnChart : public QWidget, public IUIGQWidgetBase
	{
	public:
		UIGQColumnChart(QWidget* pParent = nullptr);
		~UIGQColumnChart();

		UIG_QT_CTRL_DEF("qtcolumnchart", UIGQColumnChart);

		void setBackgroundStyle(const FillStyle& fillStyle);
		const FillStyle& getBackgroundStyle();
		void rebindAxis();

		void initDemoData();

		QtCharts::QChartView*		getChartView() { return	_chartView; }
		QtCharts::QChart*			getChart() { return	_chart; }
		QtCharts::QValueAxis*		getYAxis() { return	_axisY; }
		QtCharts::QBarCategoryAxis*	getXAxis() { return _axisX; }
		QtCharts::QBarSeries*		getBarSeries() { return _barSeries; }

	protected:
		void paintEvent(QPaintEvent * evt);
		void resizeEvent(QResizeEvent * event);

	private:
		UIGQColumnChartImpl* _ctrlImpl;

		QtCharts::QChartView*			_chartView;
		QtCharts::QChart*				_chart;		
		QtCharts::QValueAxis*			_axisY;
		QtCharts::QBarCategoryAxis*		_axisX;
		QtCharts::QBarSeries*			_barSeries;

		UIGQT_GET_CONTROLBASE;
	};
}
