53 lines
1.2 KiB
C++
53 lines
1.2 KiB
C++
//
|
|
// Created by robtor on 04.01.23.
|
|
//
|
|
|
|
#ifndef FLOATPUMP_MENU_ENTRY_H
|
|
#define FLOATPUMP_MENU_ENTRY_H
|
|
|
|
#include <Menu_Entry_Type_Delegate.h>
|
|
#include <Config_Entry_Delegate.h>
|
|
|
|
|
|
namespace floatpump {
|
|
namespace menu {
|
|
|
|
class Menu_Entry {
|
|
public:
|
|
menu::Menu_Entry_Type_Delegate *m_type;
|
|
config::Config_Entry_Delegate *m_config;
|
|
|
|
Menu_Entry(Menu_Entry_Type_Delegate *type, std::string name) : m_type(type), m_name(name) {};
|
|
|
|
std::string printLine() {
|
|
int spaces = 19 - (m_name.length() + m_type->toString().length());
|
|
std::string spacer;
|
|
spacer.append(spaces, ' ');
|
|
return m_name + spacer + m_type->toString();
|
|
}
|
|
|
|
void action_press() {
|
|
m_type->u_press();
|
|
}
|
|
|
|
void action_increase() {
|
|
m_type->u_increase(1);
|
|
}
|
|
|
|
void action_decrease() {
|
|
m_type->u_decrease(1);
|
|
}
|
|
|
|
bool isEntered() {
|
|
return m_type->isEntered();
|
|
}
|
|
|
|
private:
|
|
std::string m_name;
|
|
};
|
|
|
|
} // floatpump
|
|
} // menu
|
|
|
|
#endif //FLOATPUMP_MENU_ENTRY_H
|