| 1 |
#ifndef HEADER_SLIDER_H |
| 2 |
#define HEADER_SLIDER_H |
| 3 |
|
| 4 |
#include "IWidget.h" |
| 5 |
|
| 6 |
/** |
| 7 |
* Slider for option value. |
| 8 |
*/ |
| 9 |
class Slider : public IWidget { |
| 10 |
private: |
| 11 |
static const int PIXELS_PER_VALUE = 2; |
| 12 |
static const int HEIGHT = 30; |
| 13 |
std::string m_param; |
| 14 |
int m_min; |
| 15 |
int m_max; |
| 16 |
private: |
| 17 |
int value2slide(int value); |
| 18 |
int slide2value(int slide); |
| 19 |
virtual void own_mouseButton(const MouseStroke &stroke); |
| 20 |
public: |
| 21 |
Slider(const std::string ¶m, int minValue=0, int maxValue=100); |
| 22 |
virtual int getW() const { return (m_max - m_min) * PIXELS_PER_VALUE; } |
| 23 |
virtual int getH() const { return HEIGHT; } |
| 24 |
|
| 25 |
virtual void drawOn(SDL_Surface *screen); |
| 26 |
}; |
| 27 |
|
| 28 |
#endif |