messed up already
1 parent b2630b6 commit 6712b31a43c65511bccda1194247ad00e397de3e
@Cory Cory authored on 3 May
Showing 3 changed files
View
0
■■■■■
.gitignore 0 → 100644
View
69
MenuItem.cpp 100644 → 0
#include "MenuItem.h"
#include "Arduino.h"
 
MenuItem::MenuItem() {
 
}
 
MenuItem::MenuItem(const char* name) {
MenuItem::name = name;
MenuItem::parent = NULL;
MenuItem::next = NULL;
}
 
MenuItem* MenuItem::goBack() {
return MenuItem::parent;
}
 
MenuItem* MenuItem::goDown() {
return MenuItem::next;
}
 
MenuItem* MenuItem::goRight() {
return NULL;
}
 
String MenuItem::display() {
return MenuItem::name;
}
 
 
BranchMenuItem::BranchMenuItem(const char* name, const MenuItem* child) {
BranchMenuItem::name = name;
BranchMenuItem::child = child;
}
 
MenuItem* BranchMenuItem::goRight() {
return BranchMenuItem::child;
}
 
String BranchMenuItem::display() {
return String(BranchMenuItem::name) + " ->";
}
 
IntValueItem::IntValueItem(char const* name, int initial) {
IntValueItem::name = name;
IntValueItem::value = initial;
}
 
MenuItem* IntValueItem::goRight() { // increment
IntValueItem::value++;
}
 
String IntValueItem::display() {
return String(IntValueItem::name) + ": " + String(IntValueItem::value);
}
 
BoolValueItem::BoolValueItem(char const* name, bool initial) {
BoolValueItem::name = name;
BoolValueItem::value = initial;
}
 
MenuItem* BoolValueItem::goRight() { // toggle
BoolValueItem::value = !BoolValueItem::value;
return NULL;
}
 
String BoolValueItem::display() {
return String(BoolValueItem::name) + ": " + (BoolValueItem::value ? "true" : "false");
}
View
MenuItem.h 100644 → 0