Main.js 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. MWF.xApplication.Console.Main = new Class({
  2. Extends: MWF.xApplication.Common.Main,
  3. Implements: [Options, Events],
  4. options: {
  5. "style": "default",
  6. "name": "Console",
  7. "icon": "icon.png",
  8. "width": "800",
  9. "height": "600",
  10. "title": MWF.xApplication.Console.LP.title
  11. },
  12. onQueryLoad: function(){
  13. this.lp = MWF.xApplication.Console.LP;
  14. },
  15. loadApplication: function(callback){
  16. this.status = "stop";
  17. this.node = new Element("div", {"styles": this.css.contentNode}).inject(this.content);
  18. this.toolbarNode = new Element("div", {"styles": this.css.toolbarNode}).inject(this.node);
  19. this.screenNode = new Element("div", {"styles": this.css.screenNode}).inject(this.node);
  20. this.bottomNode = new Element("div", {"styles": this.css.bottomNode}).inject(this.node);
  21. this.loadToolbar();
  22. this.loadScreen();
  23. },
  24. loadToolbar: function(){
  25. this.beginButton = new Element("div", {"styles": this.css.toolbarButton}).inject(this.toolbarNode);
  26. this.pauseButton = new Element("div", {"styles": this.css.toolbarButton}).inject(this.toolbarNode);
  27. this.stopButton = new Element("div", {"styles": this.css.toolbarButton}).inject(this.toolbarNode);
  28. this.beginButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/play.png)");
  29. this.pauseButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/pause_gray.png)");
  30. this.stopButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/stop_gray.png)");
  31. this.beginButton.addEvents({
  32. "mouseover": function(){if (this.status != "begin") this.beginButton.setStyles(this.css.toolbarButton_over);}.bind(this),
  33. "mousedown": function(){if (this.status != "begin") this.beginButton.setStyles(this.css.toolbarButton_down);}.bind(this),
  34. "mouseup": function(){if (this.status != "begin") this.beginButton.setStyles(this.css.toolbarButton_over);}.bind(this),
  35. "mouseout": function(){this.beginButton.setStyles(this.css.toolbarButton);}.bind(this),
  36. "click": function(){if (this.status != "begin") this.begin();}.bind(this)
  37. });
  38. this.pauseButton.addEvents({
  39. "mouseover": function(){if (this.status == "begin") this.pauseButton.setStyles(this.css.toolbarButton_over);}.bind(this),
  40. "mousedown": function(){if (this.status == "begin") this.pauseButton.setStyles(this.css.toolbarButton_down);}.bind(this),
  41. "mouseup": function(){if (this.status == "begin") this.pauseButton.setStyles(this.css.toolbarButton_over);}.bind(this),
  42. "mouseout": function(){this.pauseButton.setStyles(this.css.toolbarButton);}.bind(this),
  43. "click": function(){if (this.status == "begin") this.pause();}.bind(this)
  44. });
  45. this.stopButton.addEvents({
  46. "mouseover": function(){if (this.status != "stop") this.stopButton.setStyles(this.css.toolbarButton_over);}.bind(this),
  47. "mousedown": function(){if (this.status != "stop") this.stopButton.setStyles(this.css.toolbarButton_down);}.bind(this),
  48. "mouseup": function(){if (this.status != "stop") this.stopButton.setStyles(this.css.toolbarButton_over);}.bind(this),
  49. "mouseout": function(){this.stopButton.setStyles(this.css.toolbarButton);}.bind(this),
  50. "click": function(){if (this.status != "stop") this.stop();}.bind(this)
  51. });
  52. },
  53. begin: function(){
  54. this.beginButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/play_gray.png)");
  55. this.pauseButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/pause.png)");
  56. this.stopButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/stop.png)");
  57. this.status = "begin";
  58. },
  59. pause: function(){
  60. this.beginButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/play.png)");
  61. this.pauseButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/pause_gray.png)");
  62. this.stopButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/stop.png)");
  63. this.status = "pause";
  64. },
  65. stop: function(){
  66. this.beginButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/play.png)");
  67. this.pauseButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/pause_gray.png)");
  68. this.stopButton.setStyle("background-image", "url("+"/x_component_Console/$Main/default/stop_gray.png)");
  69. this.status = "stop";
  70. },
  71. loadScreen: function(){
  72. this.screenScrollNode = new Element("div", {"styles": this.css.screenScrollNode}).inject(this.screenNode);
  73. this.screenInforAreaNode = new Element("div", {"styles": this.css.screenInforAreaNode}).inject(this.screenScrollNode);
  74. MWF.require("MWF.widget.ScrollBar", function(){
  75. new MWF.widget.ScrollBar(this.screenScrollNode, {
  76. "style":"xApp_console", "where": "before", "indent": false, "distance": 50, "friction": 6, "axis": {"x": false, "y": true}
  77. });
  78. }.bind(this));
  79. this.setScreenHeight();
  80. this.addEvent("resize", this.setScreenHeight.bind(this));
  81. },
  82. setScreenHeight: function(){
  83. var size = this.node.getSize();
  84. var toolbarSize = this.toolbarNode.getSize();
  85. var bottomSize = this.bottomNode.getSize();
  86. var y = size.y-toolbarSize.y-bottomSize.y;
  87. this.screenNode.setStyle("height", ""+y+"px");
  88. }
  89. });