ewol/ewol/widget/Slider.h

61 lines
1.8 KiB
C++

/**
* @author Edouard DUPIN
*
* @copyright 2011, Edouard DUPIN, all right reserved
*
* @license APACHE v2.0 (see license file)
*/
#pragma once
#include <etk/types.h>
#include <etk/Color.h>
#include <ewol/debug.h>
#include <ewol/widget/Widget.h>
#include <ewol/compositing/Drawing.h>
#include <esignal/ISignal.h>
namespace ewol {
namespace widget {
/**
* @ingroup ewolWidgetGroup
*/
class Slider : public ewol::Widget {
public: // signals
esignal::ISignal<float> signalChange;
public:
//eproperty::Value<std::string> propertyShape; //!< name of the shape used
eproperty::Value<float> propertyValue; //!< current value of the Slider
eproperty::Value<float> propertyMinimum; //!< minimum value of the slider
eproperty::Value<float> propertyMaximum; //!< maximum value of the slider
eproperty::Value<float> propertyStep; //!< step of every iteration of the slider (increment/precision)
protected:
Slider();
void init();
public:
DECLARE_WIDGET_FACTORY(Slider, "Slider");
virtual ~Slider();
public:
// TODO : Rewoek the color in the theme ...
void setColor(etk::Color<> _newColor) {
m_textColorFg = _newColor;
};
protected:
ewol::compositing::Drawing m_draw; //!< drawing tool.
etk::Color<> m_textColorFg; //!< Text color
etk::Color<> m_textColorBg; //!< Background color
void updateValue(float _newValue);
public: // Derived function
virtual void onDraw();
virtual void calculateMinMaxSize();
virtual void onRegenerateDisplay();
virtual bool onEventInput(const ewol::event::Input& _event);
protected:
virtual void onChangePropertyValue();
virtual void onChangePropertyMinimum();
virtual void onChangePropertyMaximum();
virtual void onChangePropertyStep();
};
}
}