Window.js 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. o2.widget = o2.widget || {};
  2. o2.require("o2.widget.Dialog", null, false);
  3. o2.widget.Window = new Class({
  4. Extends: o2.widget.Dialog,
  5. Implements: [Options, Events],
  6. options: {
  7. "style": "default",
  8. "title": "window",
  9. "width": "600",
  10. "height": "500",
  11. "top": "0",
  12. "left": "0",
  13. "fromTop": "0",
  14. "fromLeft": "0",
  15. "mark": false,
  16. "html": "",
  17. "text": "",
  18. "url": "",
  19. "content": null,
  20. "isMax": true,
  21. "isClose": true,
  22. "isResize": true,
  23. "isMove": true,
  24. "buttons": null,
  25. "buttonList": null
  26. },
  27. initialize: function(options){
  28. var position = layout.desktop.desktopNode.getPosition();
  29. var size = layout.desktop.desktopNode.getSize();
  30. this.options.top = parseFloat(this.options.top)+position.y;
  31. this.options.fromTop = parseFloat(this.options.fromTop)+position.y;
  32. this.parent(options);
  33. },
  34. getDialogNode: function(){
  35. this.node.set("styles", this.css.from);
  36. this.node.inject($(document.body));
  37. this.title = this.node.getElement(".MWF_dialod_title");
  38. this.titleCenter = this.node.getElement(".MWF_dialod_title_center");
  39. this.titleText = this.node.getElement(".MWF_dialod_title_text");
  40. this.titleAction = this.node.getElement(".MWF_dialod_title_action");
  41. this.content = this.node.getElement(".MWF_dialod_content");
  42. this.bottom = this.node.getElement(".MWF_dialod_bottom");
  43. this.resizeNode = this.node.getElement(".MWF_dialod_bottom_resize");
  44. this.button = this.node.getElement(".MWF_dialod_button");
  45. if (this.title){
  46. this.title.addEvent("mousedown", function(){
  47. this.containerDrag = new Drag.Move(this.node);
  48. }.bind(this));
  49. this.title.addEvent("mouseup", function(){
  50. this.node.removeEvents("mousedown");
  51. this.title.addEvent("mousedown", function(){
  52. this.containerDrag = new Drag.Move(this.node);
  53. }.bind(this));
  54. }.bind(this));
  55. }
  56. // if (this.titleText) this.getTitle();
  57. if (this.content) this.getContent();
  58. if (this.titleAction) this.getAction();
  59. if (this.resizeNode) this.setResizeNode();
  60. // if (this.button) this.getButton();
  61. if (this.content) this.setContentSize();
  62. }
  63. });