////////////////////////////////////////////////////////////////////////////////
// GLSlider.h
// Copyright Bjoern Ganster 
// Developed since 2007
////////////////////////////////////////////////////////////////////////////////

#ifndef GLSlider__H
#define GLSlider__H

#include "GLWindow.h"

////////////////////////////////////////////////////////////////////////////////
// Base class for a button

class GLSlider: public GLWindow {
public:
	Color dialColor;

	// Constructor
	GLSlider (GLWindow* _parent = NULL, int _left = 0, int _top = 0, 
				int _width = 0, int _height = 0);

	// Destructor
	~GLSlider() OVERRIDE;

	// Render
	void render(int x, int y, int w, int h) OVERRIDE;

	// Events
	void keypressed (BGKey /*key*/, bool /*shiftHeld*/, 
		bool /*ctrlHeld*/, bool /*down*/, bool /*repeat*/) OVERRIDE;

	// Button state changed over a window: returns child that was clicked
	GLWindow* buttonStateChanged (int button, bool down, int /*x*/, int /*y*/) OVERRIDE;
   
	void mouseMoved (int x, int /*y*/) OVERRIDE;

	// Get/Set minimum, maximum value
	void setMinMax(double newMin, double newMax);
	double getMin() const;
	double getMax() const;

	// Get/Set value
	bool setValue(double newVal);
	double getValue() const;

	// Get/set number of steps, zero steps: continuous values
	void setDialCount(int newCount);
	int getDialCount();
protected:
   double mMin, mMax, mCurrValue;
   int mSteps; // 0: continuous
   bool mLeftButtonDown;
   Color mLineColor, mGaugeColor;
};

#endif
