#ifndef CAL_H
#define CAL_H

#include <qwidget.h>
#include <qdatetime.h>
#include <qlayout.h>
#include <set>

class QLabel;


class Cal : public QWidget
{
	Q_OBJECT
	
public slots:
		void scrollBack();
		void scrollForward();
signals:
	void clicked();

public:
	Cal(QWidget *);
	~Cal();
protected:
void paintEvent(QPaintEvent *e);


private:
//	QLabel * newVsep();
//	QLabel * newHsep();
	QLabel * Cal::newLabel(char * str);
	QLabel * Cal::newLabel(QString);
	QLabel * Cal::newLabel(int);
	void initModel();
	QDate weeks[6];
	QLabel *labels[40];
	void updateYear( set<int> years);
	int year;
	QLabel *year_label;
	QGridLayout *grid ;


	void buildMonthLabel(QGridLayout *grid);
	void updateMonthLabel();

	void createWeek(QGridLayout *grid, int row);
	void updateWeek(int row);

	QDate getWeek(int n);
	QLabel * createDay(int num);

};
#endif //  CAL_H
