#if ! defined ( LIBOCELLI_SLIDER )
#define LIBOCELLI_SLIDER
//----------------------------------------------------------------------------
///
/// \file   slider.h
///
/// \brief  Slider widger
///
///         The widget has value from 0 ... 9. (Qt: 0..99)
///
/// \date   20221218
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


//---Documentation------------------------------------------------------------


//---Includes -----------------------------------------------------------------


//---General--------------------------

//--- Own ----------------------------

#include <ocelli/widget.hpp>
#include <biwak/touch.h>

//---Declaration---------------------------------------------------------------


class OSlider: public OWidget
{
   public:
      enum class ESliderStyle: int
      {
         bar,
         flat
      };

   private:
      ESliderStyle m_style;
      int m_ledCount = 15;
      
   protected:
      int m_value;

   public:
      CSignal <void, int> valueChangedSignal;

      OSlider(int x1, int y1, int x2, int y2, ESliderStyle style = ESliderStyle::bar )
         :OWidget(x1, y1, x2, y2)
         ,m_style(style)
         ,m_value(0)
      {
      }
      OSlider( const OPoint p1, const OPoint p2, ESliderStyle style = ESliderStyle::bar)
         :OWidget(p1, p2)
         ,m_style(style)
      {
      }
      virtual void draw() override;
      void evaluate(const Ocelli::SEvent &event);
      virtual void update(const Ocelli::SEvent &event) override;
      void updateBars();
      void setSliderValue(int value, bool emitChange = true );
      void setSliderValuePromil(int value, bool emitChange = true );
      int ledCount()
      {
         return( m_ledCount );
      }
};


//---fin-----------------------------------------------------------------------
#endif // ? ! LIBOCELLI_SLIDER
