b15f/driver/ui/view_selection.h

25 lines
513 B
C
Raw Normal View History

2019-04-05 06:33:31 +00:00
#ifndef VIEW_SELECTION_H
#define VIEW_SELECTION_H
2019-04-04 11:19:11 +00:00
#include <vector>
#include <string>
#include "view.h"
2019-04-05 06:33:31 +00:00
class ViewSelection : public View
2019-04-04 11:19:11 +00:00
{
public:
virtual void draw(void) override;
2019-04-05 06:33:31 +00:00
virtual void addChoice(std::string name, std::function<void(int)> call);
2019-04-04 11:19:11 +00:00
virtual std::function<void(int)> keypress(int& key) override;
2019-04-05 06:33:31 +00:00
2019-04-04 11:19:11 +00:00
2019-04-05 06:33:31 +00:00
protected:
size_t selection = 0;
std::vector<std::string> choices;
2019-04-04 11:19:11 +00:00
constexpr static int choice_offset_x = 2;
constexpr static int choice_offset_y = 3;
};
2019-04-05 06:33:31 +00:00
#endif // VIEW_SELECTION_H