(options: BaseWindowOptions = {})
| 25 | isClosed = false; |
| 26 | |
| 27 | constructor(options: BaseWindowOptions = {}) { |
| 28 | super(); |
| 29 | |
| 30 | this.window = gui.Window.create(options); |
| 31 | if (process.platform == 'win32') |
| 32 | this.window.setBackgroundColor('#F5F5F5'); |
| 33 | if (process.platform != 'darwin') { |
| 34 | this.menuBar = new WindowMenuBar(this, options.viewClass); |
| 35 | this.window.setMenuBar(this.menuBar.menu); |
| 36 | if (!options.showMenuBar) |
| 37 | this.window.setMenuBarVisible(false); |
| 38 | } |
| 39 | |
| 40 | if (options.pressEscToClose) { |
| 41 | this.window.onKeyUp = (window, event) => { |
| 42 | if (event.key == 'Escape') |
| 43 | this.window.close(); |
| 44 | }; |
| 45 | } |
| 46 | |
| 47 | if (!options.useClassicBackground && process.platform == 'darwin') { |
| 48 | const vibrant = gui.Vibrant.create(); |
| 49 | vibrant.setMaterial('window-background'); |
| 50 | this.contentView = vibrant; |
| 51 | } else { |
| 52 | this.contentView = gui.Container.create(); |
| 53 | } |
| 54 | this.window.setContentView(this.contentView); |
| 55 | |
| 56 | windowManager.addWindow(this); |
| 57 | this.window.onClose = () => { |
| 58 | this.isClosed = true; |
| 59 | this.destructor(); |
| 60 | windowManager.removeWindow(this); |
| 61 | }; |
| 62 | } |
| 63 | |
| 64 | destructor() { |
| 65 | super.destructor(); |
nothing calls this directly
no test coverage detected