Website Summary Files Commits Branches @commit @diff @stats
path: root / src / UserInterface / UserInterface.cpp
blob: f216afa96d35c2c9b560d95b10c25b11d7d66b76 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
#include "UserInterface.h"
#include "../Generic/List/List.hpp"
#include "../Generic/String/String.h"
#include "../Generic/ConsoleInterface/Toolbox.hpp"
#include <stdexcept>

/* Private (static) */

Table* UserInterface::table = nullptr;

void UserInterface::com_print(const char* params) {
	List<String> cells = table->getAllCells();
	table(cells, table.get_cols());
}

void UserInterface::com_edit(const char* params) {
	//TODO
}

/* Public */

UserInterface::UserInterface(Table* inTable) : menu() {
	if (table == nullptr)
		table = inTable;

	menu.addCommand(Command("print", com_print));
	menu.addCommand(Command("edit", com_edit));
}

void UserInterface::run() {
	menu.navigate();
}