b15f/driver/ui/view_promt.h

33 lines
826 B
C
Raw Normal View History

2019-04-05 10:07:26 +00:00
#ifndef VIEW_PROMT_H
#define VIEW_PROMT_H
#include <vector>
#include <string>
#include "view.h"
class ViewPromt : public View
{
public:
virtual void draw(void) override;
virtual void setMessage(std::string message);
2019-04-05 12:33:15 +00:00
virtual void setConfirm(std::string name, call_t call);
2019-04-05 10:07:26 +00:00
virtual void setCancel(std::string name, bool cancelable);
virtual std::string getInput(void);
2019-04-05 12:33:15 +00:00
virtual call_t keypress(int& key) override;
2019-04-05 10:07:26 +00:00
protected:
size_t selection = 1;
std::string input;
std::string message = "Input";
std::string label_confirm = "[ OK ]";
std::string sep = " ";
std::string label_cancel = "[ Cancel ]";
2019-04-05 12:33:15 +00:00
call_t call_confirm = nullptr;
2019-04-05 10:07:26 +00:00
bool cancelable = true;
int button_offset_x = 0, button_offset_y = 0;
constexpr static int text_offset_x = 2;
2019-04-05 12:33:15 +00:00
constexpr static int text_offset_y = 2;
2019-04-05 10:07:26 +00:00
};
#endif // VIEW_PROMT_H