Newer
Older
ice111_watering_system / watering_system_mini_project / MenuItem.h
  1. #ifndef MenuItem_h
  2. #define MenuItem_h
  3.  
  4. #include "Arduino.h"
  5.  
  6. class MenuItem {
  7. public:
  8. MenuItem();
  9. MenuItem(const char* name);
  10. const char* name;
  11. MenuItem* parent;
  12. MenuItem* next;
  13. MenuItem* goBack();
  14. MenuItem* goDown();
  15. MenuItem* goRight();
  16. String display();
  17. // void addChild(MenuItem* c) {
  18. // if (!child) child = c;
  19. // c->parent = this;
  20. // }
  21. };
  22.  
  23. class BranchMenuItem: public MenuItem {
  24. public:
  25. using MenuItem::MenuItem;
  26. BranchMenuItem(const char* name, const MenuItem* child);
  27. MenuItem* child;
  28. MenuItem* goRight();
  29. String display();
  30. };
  31.  
  32. class IntValueItem: public MenuItem {
  33. public:
  34. IntValueItem(const char* name, const int initialValue);
  35. int value;
  36. MenuItem* IntValueItem::goRight();
  37. String IntValueItem::display();
  38. };
  39.  
  40. class BoolValueItem: public MenuItem {
  41. public:
  42. BoolValueItem(const char* name, const bool initialValue);
  43. bool value;
  44. MenuItem* BoolValueItem::goRight();
  45. String BoolValueItem::display();
  46. };
  47.  
  48. #endif