feat: add property support for remainder of BrowserWindow (#22771)
Adds property-based support for the remainder of primitive gette/setter pairs on `BrowserWindow`. Namely: - `win.simpleFullScreen` - `win.title` - `win.visibleOnAllWorkspaces` - `win.documentEdited` - `win.representedFilename` - `win.shadow` - `win.kiosk` - `win.menuBarVisible`
This commit is contained in:
parent
5715e94db0
commit
da67cbf551
5 changed files with 330 additions and 90 deletions
|
@ -17,6 +17,83 @@ TopLevelWindow.prototype._init = function () {
|
|||
}
|
||||
};
|
||||
|
||||
// Properties
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'autoHideMenuBar', {
|
||||
get: function () { return this.isMenuBarAutoHide(); },
|
||||
set: function (autoHide) { this.setAutoHideMenuBar(autoHide); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'visibleOnAllWorkspaces', {
|
||||
get: function () { return this.isVisibleOnAllWorkspaces(); },
|
||||
set: function (visible) { this.setVisibleOnAllWorkspaces(visible); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'simpleFullScreen', {
|
||||
get: function () { return this.isSimpleFullScreen(); },
|
||||
set: function (simple) { this.setSimpleFullScreen(simple); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'kiosk', {
|
||||
get: function () { return this.isKiosk(); },
|
||||
set: function (kiosk) { this.setKiosk(kiosk); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'documentEdited', {
|
||||
get: function () { return this.isFullscreen(); },
|
||||
set: function (edited) { this.setDocumentEdited(edited); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'shadow', {
|
||||
get: function () { return this.hasShadow(); },
|
||||
set: function (shadow) { this.setHasShadow(shadow); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'representedFilename', {
|
||||
get: function () { return this.getRepresentedFilename(); },
|
||||
set: function (filename) { this.setRepresentedFilename(filename); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'minimizable', {
|
||||
get: function () { return this.isMinimizable(); },
|
||||
set: function (min) { this.setMinimizable(min); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'title', {
|
||||
get: function () { return this.getTitle(); },
|
||||
set: function (title) { this.setTitle(title); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'maximizable', {
|
||||
get: function () { return this.isMaximizable(); },
|
||||
set: function (max) { this.setMaximizable(max); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'resizable', {
|
||||
get: function () { return this.isResizable(); },
|
||||
set: function (res) { this.setResizable(res); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'menuBarVisible', {
|
||||
get: function () { return this.isMenuBarVisible(); },
|
||||
set: function (visible) { this.setMenuBarVisibility(visible); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'fullScreenable', {
|
||||
get: function () { return this.isFullScreenable(); },
|
||||
set: function (full) { this.setFullScreenable(full); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'closable', {
|
||||
get: function () { return this.isClosable(); },
|
||||
set: function (close) { this.setClosable(close); }
|
||||
});
|
||||
|
||||
Object.defineProperty(TopLevelWindow.prototype, 'movable', {
|
||||
get: function () { return this.isMovable(); },
|
||||
set: function (move) { this.setMovable(move); }
|
||||
});
|
||||
|
||||
TopLevelWindow.getFocusedWindow = () => {
|
||||
return TopLevelWindow.getAllWindows().find((win) => win.isFocused());
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue