#ifndef SCROLL_SPIN_BOX_H
#define SCROLL_SPIN_BOX_H

#include <QWidget>
#include "qad_export.h"


namespace Ui {
	class ScrollSpinBox;
}


class EvalSpinBox;


class QAD_EXPORT ScrollSpinBox: public QWidget
{
	Q_OBJECT
	Q_PROPERTY(double sensivity READ sensivity WRITE setSensivity)
	Q_PROPERTY(double value READ value WRITE setValue)
public:
	explicit ScrollSpinBox(QWidget * parent = 0);

	EvalSpinBox * spin();
	double value() const;
	double sensivity() const {return sensivity_;}

protected:
	void changeEvent(QEvent * e);
	void resizeEvent(QResizeEvent * e);
	bool eventFilter(QObject * o, QEvent * e);
	void mousePress(QMouseEvent * e);
	void mouseRelease(QMouseEvent * e);
	void mouseMove(QMouseEvent * e);

	Ui::ScrollSpinBox * ui;
	QPoint down_pos;
	QString last_text;
	double last_value, scroll_scale, sensivity_;
	bool canceled;

public slots:
	void setSensivity(double s) {sensivity_ = s;}
	void setValue(double v);

signals:
	void valueChanged(double);

};

#endif // SCROLL_SPIN_BOX_H
