floatpump-firmware/Middlewares/floatpump/Src/Menu_Entry.cpp

35 lines
870 B
C++
Raw Normal View History

2023-01-04 12:22:45 +00:00
//
// Created by robtor on 04.01.23.
//
#include "Menu_Entry.h"
namespace floatpump {
namespace menu {
2023-01-06 12:51:07 +00:00
std::string Menu_Entry::printLine() {
//We have 19 characters width for displaying the entry -> fill with spaces
int spaces = 19 - (m_name.length() + m_type.toString().length());
2023-01-06 12:51:07 +00:00
std::string spacer;
if(spaces > 0)
spacer.append(spaces, ' ');
return m_name + spacer + m_type.toString();
2023-01-06 12:51:07 +00:00
}
void Menu_Entry::action_press() {
m_type.u_press();
2023-01-06 12:51:07 +00:00
}
void Menu_Entry::action_increase() {
m_type.u_increase(1);
2023-01-06 12:51:07 +00:00
}
void Menu_Entry::action_decrease() {
m_type.u_decrease(1);
2023-01-06 12:51:07 +00:00
}
bool Menu_Entry::isEntered() {
return m_type.isEntered();
2023-01-06 12:51:07 +00:00
}
2023-01-04 12:22:45 +00:00
} // floatpump
} // menu