#if ! defined ( LIBOCELLI_BUTTON_SWITCH )
#define LIBOCELLI_BUTTON_SWITCH
//----------------------------------------------------------------------------
///
/// \file   buttonSwitch.hpp
///
/// \brief  WIdget for a graphical switching button
///
/// \date   20221224
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


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


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


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

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

#include <ocelli/button.hpp>


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


class OButtonSwitch: public OButton
{
   private:
      bool m_value=false;

   public:
      constexpr OButtonSwitch(int x1, int y1, int x2, int y2, const char *text, EButtonStyle style = EButtonStyle::bar )
         :OButton( x1, y1, x2, y2, text, style )
      {
      }
      constexpr OButtonSwitch( const OPoint p1, const OPoint p2, const char *text, EButtonStyle style = EButtonStyle::bar)
         :OButton( p1, p2, text, style )
      {
      }
      virtual void update( const Ocelli::SEvent &event ) override;
      int getValue()
      {
         return(m_value);
      };
      void setSwitchValue(bool value)
      {
         static const Ocelli::SEvent event{
            .x=0,
            .y=0,
            .type=Ocelli::EEventType::modified
         };
         m_value=value;
         update( event );
      }
};


//---fin-----------------------------------------------------------------------
#endif // ? ! LIBOCELLI_BUTTON_SWITCH
