diff options
| author | André Nusser <andre.nusser@googlemail.com> | 2017-04-16 17:22:07 +0200 | 
|---|---|---|
| committer | André Nusser <andre.nusser@googlemail.com> | 2017-04-16 17:22:07 +0200 | 
| commit | 730597ff95d5dcfa924bc0bb951c02873ccffa8c (patch) | |
| tree | 67904609dc1704e7018740c37060380c82053cea /plugingui/slider.h | |
| parent | ed574c98818610c929ff1ea646a3ac84f7efe7b8 (diff) | |
Add new texture for Slider and adapt functionality.
Diffstat (limited to 'plugingui/slider.h')
| -rw-r--r-- | plugingui/slider.h | 39 | 
1 files changed, 36 insertions, 3 deletions
diff --git a/plugingui/slider.h b/plugingui/slider.h index f11efba..22d162d 100644 --- a/plugingui/slider.h +++ b/plugingui/slider.h @@ -27,6 +27,8 @@  #pragma once  #include "widget.h" +#include "texture.h" +#include "texturedbox.h"  namespace GUI  { @@ -41,8 +43,8 @@ public:  	bool catchMouse() override { return true; }  	bool isFocusable() override { return true; } -	void setValue(float value); -	float value(); +	void setValue(float new_value); +	float value() const;  	Notifier<> clickNotifier; @@ -58,11 +60,42 @@ private:  		down  	}; -	float currentValue; +	float current_value;  	float maximum;  	float minimum;  	State state; + +	TexturedBox bar{getImageCache(), ":slider.png", +			0, 0, // atlas offset (x, y) +			7, 1, 7, // dx1, dx2, dx3 +			7, 1, 7 // dy1, dy2, dy3 +	}; +	TexturedBox inner_bar_green{getImageCache(), ":slider.png", +		30, 0, // atlas offset (x, y) +		2, 1, 2, // dx1, dx2, dx3 +		2, 1, 2 // dy1, dy2, dy3 +	}; +	// TexturedBox inner_bar_red{getImageCache(), ":slider.png", +	//     30, 5, // atlas offset (x, y) +	//     2, 1, 2, // dx1, dx2, dx3 +	//     2, 1, 2 // dy1, dy2, dy3 +	// }; +	// TexturedBox inner_bar_blue{getImageCache(), ":slider.png", +	//     30, 10, // atlas offset (x, y) +	//     2, 1, 2, // dx1, dx2, dx3 +	//     2, 1, 2 // dy1, dy2, dy3 +	// }; +	Texture button{getImageCache(), ":slider.png", +		15, 0, // atlas offset (x, y) +		15, 15 // width, height +	}; + +	std::size_t bar_boundary{5}; +	std::size_t button_offset{7}; + +	std::size_t getControlWidth() const; +	void recomputeCurrentValue(float x);  };  } // GUI::  | 
