ModalWindow.ts 816 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import EditorUI = require("../EditorUI");
  2. class ModalWindow extends Atomic.UIWindow {
  3. constructor() {
  4. super();
  5. var view = EditorUI.getView();
  6. view.addChild(this);
  7. this.setFocus();
  8. this.subscribeToEvent(this, "WidgetDeleted", (event: Atomic.UIWidgetDeletedEvent) => {
  9. this.hide();
  10. });
  11. this.subscribeToEvent(this, "WidgetEvent", (data) => this.handleWidgetEvent(data));
  12. }
  13. hide() {
  14. var modalOps = EditorUI.getModelOps();
  15. modalOps.hide();
  16. }
  17. handleWidgetEvent(ev: Atomic.UIWidgetEvent) {
  18. }
  19. init(windowText: string, uifilename: string) {
  20. this.text = windowText;
  21. this.load(uifilename);
  22. this.resizeToFitContent();
  23. this.center();
  24. }
  25. }
  26. export = ModalWindow;