manager: [#25] menu class init
This commit is contained in:
parent
df6411c76b
commit
01855e2f52
37
source/shoh/src/threads/manager/Menu.cpp
Normal file
37
source/shoh/src/threads/manager/Menu.cpp
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
|
||||||
34
source/shoh/src/threads/manager/Menu.h
Normal file
34
source/shoh/src/threads/manager/Menu.h
Normal file
@ -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_ */
|
||||||
37
source/shoh/src/threads/manager/MenuObjEvent.h
Normal file
37
source/shoh/src/threads/manager/MenuObjEvent.h
Normal file
@ -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_ */
|
||||||
Loading…
x
Reference in New Issue
Block a user