diff --git a/source/code/menu/MenuItem.hpp b/source/code/menu/MenuItem.hpp new file mode 100644 index 0000000..1ba634c --- /dev/null +++ b/source/code/menu/MenuItem.hpp @@ -0,0 +1,25 @@ +/* + * File: MenuItem.hpp + * Author: poul + * + * Created on 11. marts 2011, 20:41 + */ + +#ifndef _MENUITEM_HPP +#define _MENUITEM_HPP + +#include + +using namespace std; + +class MenuItem { + virtual void SetSelected(bool selected) = 0; + virtual void Activated() = 0; + virtual string GetText() = 0; + virtual void GetType() = 0; + virtual void SetText(string text) = 0; +}; + + +#endif /* _MENUITEM_HPP */ + diff --git a/source/code/menu/MenuItemCommand.cpp b/source/code/menu/MenuItemCommand.cpp new file mode 100644 index 0000000..2045d77 --- /dev/null +++ b/source/code/menu/MenuItemCommand.cpp @@ -0,0 +1,45 @@ +/* + * File: MenuItemCommand.cpp + * Author: poul + * + * Created on 11. marts 2011, 20:46 + */ + +#include "MenuItemCommand.hpp" + +MenuItemCommand::MenuItemCommand() { + selected = false; +} + +MenuItemCommand::MenuItemCommand(string text, void(*pt2Function)() ) { + this->text = text; + command = pt2Function; + selected = false; +} + +MenuItemCommand::MenuItemCommand(const MenuItemCommand& orig) { +} + +MenuItemCommand::~MenuItemCommand() { +} + +void MenuItemCommand::SetSelected(bool selected) { + this->selected = selected; +} + +void MenuItemCommand::Activated() { + //Add execode + command(); +} + +string MenuItemCommand::GetType() { + return "MenuItemCommand"; +} + +string MenuItemCommand::GetText() { + return text; +} + +void MenuItemCommand::SetText(string text) { + this->text = text; +} \ No newline at end of file diff --git a/source/code/menu/MenuItemCommand.hpp b/source/code/menu/MenuItemCommand.hpp new file mode 100644 index 0000000..682f47a --- /dev/null +++ b/source/code/menu/MenuItemCommand.hpp @@ -0,0 +1,31 @@ +/* + * File: MenuItemCommand.hpp + * Author: poul + * + * Created on 11. marts 2011, 20:46 + */ + +#ifndef _MENUITEMCOMMAND_HPP +#define _MENUITEMCOMMAND_HPP + +#include "MenuItem.hpp" + +class MenuItemCommand : MenuItem{ +public: + MenuItemCommand(); + MenuItemCommand(string text, void (*pt2Function)(void)); + MenuItemCommand(const MenuItemCommand& orig); + virtual ~MenuItemCommand(); + void SetSelected(bool selected); + void Activated(); + string GetText(); + string GetType(); + void SetText(string text); +private: + bool selected; + string text; + void (*command)(void); +}; + +#endif /* _MENUITEMCOMMAND_HPP */ +