#ifndef CANDIS_SCREEN_MAINMENU_HPP
#define CANDIS_SCREEN_MAINMENU_HPP
//----------------------------------------------------------------------------
///
/// \brief   CANDis screen showing can messages
///
///          Static table
///
/// \date   20220903
/// \author Maximilian Seesslen <mes@seesslen.net>
///
//----------------------------------------------------------------------------


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


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

//#include <candis.h>
#include <ocelli/screen.hpp>
#include <biwak/gdisplay.h>
#include <ocelli/clock.hpp>
#include <ocelli/button.hpp>
#include <list>
#include <theme.hpp>
#include <common.hpp>
#include <button_grid.h>


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


struct SApp
{
   EScreen screen;
   const OIconRef* const icon;
};


class CButtonApp: public OButton
{
   private:
      const EScreen m_screen;

   public:
      CSignal<void, const EScreen> signalSetApp;

      CButtonApp( const OPoint p1, const OPoint p2, const char *text, const EScreen screen)
         : OButton( p1, p2, text, OButton::EButtonStyle::flat)
         , m_screen(screen)
      {
         eventSignal.connect(this,  &CButtonApp::slotAppPressed );
      }

      void slotAppPressed(const Ocelli::SEvent&)
      {
         signalSetApp.emitSignal(m_screen);
      }
};

class CScreenMainMenu: public OScreen, public CButtonGrid
{
   private:

      static const SApp items[];

   public:
      CButtonApp *m_pButtonApp[9];
      CSignal<void, const EScreen> signalSetScreen;

      CScreenMainMenu( );
      virtual void draw() override
      {
         OWidget::display().clear( black );
         OScreen::draw();
      }
      virtual void eventLoop() override
      {
      }
      void slotSetApp(const EScreen e)
      {
         signalSetScreen.emitSignal(e);
      }

};


//---fin----------------------------------------------------------------------
#endif // ? ! CANDIS_SCREEN_MAINMENU_HPP
