Subversion Repositories HomeAutomation

Rev

Blame | Last modification | View Log | SVN | RSS feed

  1.  
  2. function MainMenuItem(parentDisplay, ks0108Object)
  3. {
  4.     this.parentDisplay = parentDisplay;
  5.     this.display = ks0108Object;
  6. }
  7.  
  8. /* the display object who created the menu item */
  9. MainMenuItem.prototype.parentDisplay = null;
  10. /* the display that we are writing to */
  11. MainMenuItem.prototype.display = null;
  12.  
  13. /* what MainMenuItem is left of this item, if used */
  14. MainMenuItem.prototype.LeftItem = null;
  15. /* what MainMenuItem is right of this item, if used */
  16. MainMenuItem.prototype.RightItem = null;
  17. /* what MainMenuItem is after of this item, if used */
  18. MainMenuItem.prototype.PressEnterItem = null;
  19. /* what MainMenuItem is before of this item, if used */
  20. MainMenuItem.prototype.PressBackItem = null;
  21. /* what MainMenuItem is below of this item, if used */
  22. MainMenuItem.prototype.DownItem = null;
  23. /* what MainMenuItem is abowe of this item, if used */
  24. MainMenuItem.prototype.UpItem = null;
  25.  
  26. /*
  27. Standard events can be:
  28. left, right, enter, back, up, down....
  29. */
  30. MainMenuItem.prototype.processEvent = function (event)
  31. {
  32.         switch (event)
  33.     {
  34.     case "left":
  35.         this.parentDisplay.changeToLeft();
  36.         break;
  37.  
  38.     case "right":
  39.         this.parentDisplay.changeToRight();
  40.         break;
  41.    
  42.     case "up":
  43. this.display.printText(3,3,"up  ","Standard","Standard");
  44.         //parentDisplay.changeToUp();
  45.         break;
  46.    
  47.     case "down":
  48. this.display.printText(3,3,"down ","Standard","Standard");
  49.         //parentDisplay.changeToDown();
  50.         break;
  51.    
  52.     case "enter":
  53. this.display.printText(3,3,"enter ","Standard","Standard");
  54.         //parentDisplay.changeToEnter();
  55.         break;
  56.    
  57.     case "back":
  58. this.display.printText(3,3,"back ","Standard","Standard");
  59.         //parentDisplay.changeToBack();
  60.         break;
  61.     }
  62. }
  63.  
  64. MainMenuItem.prototype.onEnter = function ()
  65. {
  66.     this.display.clearScreen("Standard");
  67. }
  68. MainMenuItem.prototype.update = function ()
  69. {
  70.     this.display.printText(2,2,"mainMenu","Standard","Standard");
  71. }
  72. MainMenuItem.prototype.onExit = function ()
  73. {
  74.    
  75. }
  76.  
  77.