-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathstatusDisplay.cc
More file actions
48 lines (38 loc) · 1.11 KB
/
statusDisplay.cc
File metadata and controls
48 lines (38 loc) · 1.11 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
#include "statusDisplay.h"
#include "border.h"
#include <ncurses.h>
#include <memory>
#include <typeinfo>
#include <iostream>
using namespace std;
StatusDisplay::StatusDisplay() {}
StatusDisplay::StatusDisplay(std::initializer_list<string> init) {
for (auto elem : init) {
messages.push_back(elem);
}
}
StatusDisplay::~StatusDisplay() {}
void StatusDisplay::setMessages(vector<string> messages) {
this->messages = messages;
}
void StatusDisplay::addMessage(string message) {
messages.push_back(message);
}
vector<string> StatusDisplay::getMessages() {
return messages;
}
void StatusDisplay::doDisplay() {
clearStatusArea();
shared_ptr<Border> border = make_shared<Border>();
for (int i = 0; i < messages.size(); i++) {
mvprintw(border->getBorderHeight() + i, 0, messages[i].c_str());
}
}
void StatusDisplay::clearStatusArea() {
shared_ptr<Border> border = make_shared<Border>();
for (int i = 0; i < messages.size(); i++) {
for (int j = 0; j < border->getBorderLength(); j++) {
mvaddch(i + border->getBorderHeight(), j, ' ');
}
}
}