#if ! defined ( LIBOCELLI_CLOCK_HPP )
#define LIBOCELLI_CLOCK_HPP
//----------------------------------------------------------------------------
///
/// \file   clock.hpp
///
/// \brief  class for graphical clock widget
///
/// \date   20220619
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


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


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


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

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

#include <ocelli/widget.hpp>
#include <ocelli/icon.hpp>


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


class OClock: public OWidget
{

private:

   OPoint secDots[60];
   OPoint minDots[60];
   const char* const m_text;
   const char *m_state;
   const char *m_topic;
   int m_min=-1;
   int m_sec=-1;
   int m_subSec=-1;

   enum class eKind
   {
      reset,
      min,
      sec,
      subSec
   };
   const OIconRef *m_pIcon=nullptr;

public:
   OClock(int x1, int y1, int x2, int y2, const char *text);

   virtual void draw() override;
   virtual void update( const Ocelli::SEvent &event ) override
   {};

   void calcDots(OPoint *dots, int radius);
   void updateSecDot(int sec, eKind kind = eKind::sec) const;
   void updateMinDot(int min, eKind kind = eKind::min) const;
   void update(int hour, int min, int sec, int subSec);

   void setTopic(const char *topic);
   void setState( const char *state );
   void setIcon(const OIconRef *icon){ m_pIcon=icon; };

   void drawTopic( ) const;
   void drawState( ) const;
   void drawIcon( ) const;
};


//---fin-----------------------------------------------------------------------
#endif // ? ! LIBOCELLI_CLOCK_HPP
