diff --git a/source/shoh/src/threads/manager/Menu.cpp b/source/shoh/src/threads/manager/Menu.cpp new file mode 100644 index 0000000..23a4edc --- /dev/null +++ b/source/shoh/src/threads/manager/Menu.cpp @@ -0,0 +1,37 @@ +/* + * Menu.cpp + * + * Created on: 29 Apr 2023 + * Author: dave + */ + +#include "Menu.h" + +Menu::Menu() +{ + // TODO Auto-generated constructor stub + +} + +Menu::~Menu() +{ + // TODO Auto-generated destructor stub +} + +void Menu::HandleEventPair (Event::EventPair *ep) +{ + return; +} + +void Menu::SetEvent (obj_pointer newevent) +{ + (this->*current) (MenuObjEvent (MenuObjEvent::eUnFocus)); + current = newevent; + (this->*current) (MenuObjEvent (MenuObjEvent::eFocus)); +} + +void Menu::HandleObj (const MenuObjEvent &event) +{ + (this->*current) (event); +} + diff --git a/source/shoh/src/threads/manager/Menu.h b/source/shoh/src/threads/manager/Menu.h new file mode 100644 index 0000000..ef432d4 --- /dev/null +++ b/source/shoh/src/threads/manager/Menu.h @@ -0,0 +1,34 @@ +/* + * Menu.h + * + * Created on: 29 Apr 2023 + * Author: dave + */ + +#include "Counter.h" +#include "MenuObjEvent.h" +#include "ThreadCommon.h" +#include "Event.h" + +#ifndef THREADS_MANAGER_MENU_H_ +#define THREADS_MANAGER_MENU_H_ + +class Menu; +typedef void (Menu::*obj_pointer) (const MenuObjEvent &); + +class Menu +{ +public: + Menu (); + virtual ~Menu (); + void HandleEventPair (Event::EventPair *ep); + +private: + /* Variables and objects */ + obj_pointer current; + /* Methods */ + void SetEvent (obj_pointer newevent); + void HandleObj (const MenuObjEvent &event); +}; + +#endif /* THREADS_MANAGER_MENU_H_ */ diff --git a/source/shoh/src/threads/manager/MenuObjEvent.h b/source/shoh/src/threads/manager/MenuObjEvent.h new file mode 100644 index 0000000..2123817 --- /dev/null +++ b/source/shoh/src/threads/manager/MenuObjEvent.h @@ -0,0 +1,37 @@ +/* + * MenuObjEvent.h + * + * Created on: Dec 11, 2022 + * Author: tylen + */ + +#ifndef MENU_MENUOBJEVENT_H_ +#define MENU_MENUOBJEVENT_H_ + +class MenuObjEvent +{ +public: + virtual ~MenuObjEvent (){}; + + enum EventType + { + /** Start of the event */ + eFocus, + /** End of the event*/ + eUnFocus, + /** Refresh event */ + eRefresh, + /** Button toggle event type */ + eClick, + /** Rotary clockwise */ + eRollClockWise, + /** Rotary counter clockwise */ + eRollCClockWise, + }; + MenuObjEvent (EventType e = eFocus) : type (e){}; + EventType type; +}; + + + +#endif /* MENU_MENUOBJEVENT_H_ */