Download the file
  1. #include "menu.h"
  2. #include "hsphoto.h"
  3.  
  4. void Menu::clockwise() {
  5. if (!enabled) {
  6. enable();
  7. return;
  8. }
  9. Screen * s = screens[current_screen];
  10. if (! s->clockwise()) {
  11. for (int i=1; i < nb_screens; i++) {
  12. if (screens[((current_screen + i) % nb_screens)]->is_enabled()) {
  13. s->hide();
  14. current_screen = (current_screen + i) % nb_screens;
  15. screens[current_screen]->refresh();
  16. break;
  17. }
  18. }
  19. }
  20. }
  21.  
  22.  
  23. void Menu::counter_clockwise() {
  24. if (!enabled) {
  25. enable();
  26. return;
  27. }
  28. Screen * s = screens[current_screen];
  29. if (! s->counter_clockwise()) {
  30. for (int i=nb_screens-1; i >= 0; i--) {
  31. if (screens[((current_screen + i) % nb_screens)]->is_enabled()) {
  32. s->hide();
  33. current_screen = (current_screen + i) % nb_screens;
  34. screens[current_screen]->refresh();
  35. break;
  36. }
  37. }
  38. }
  39. }
  40.  
  41. void Menu::click() {
  42. if (!enabled) {
  43. enable();
  44. return;
  45. }
  46. Screen * s = screens[current_screen];
  47. s->click();
  48. }
  49.  
  50. void Menu::refresh() {
  51. Screen * s = screens[current_screen];
  52. s->refresh();
  53.  
  54. }
  55.  
  56. // vim:ft=arduino
  57.