#pragma once

#include <qwidget.h>
#include <qpushbutton.h>
#include <qlabel.h>

class Pagination : public QWidget {
	Q_OBJECT

public:
	Pagination(QWidget* parent = nullptr);
	~Pagination();

	void setPageCount(int count);
	void setRecordCount(int count);
	int currentPage();
    void setCurrent(int btnIndex);

signals:
	void selectPage(int value);

private:
	QPushButton* btn[13];
	QLabel* lblRecordCount;
	int curBtnIndex = 0;
	int btnValue[13];
	int pageCount;
	int recordCount;
	int lastValue = -1;

private:
	void clicked(int btnIndex);
	void clickedValue(int curValue);
	void gotoPage(int pageValue);

protected:
	void paintEvent(QPaintEvent*) override;
};

