mirror of
https://github.com/ElectronNET/Electron.NET.git
synced 2026-09-21 22:45:20 +00:00
Merge pull request #673 from MutatedGamer/parentOption
Add ability to set a window's parent using BrowserWindowOptions
This commit is contained in:
@@ -154,14 +154,14 @@ namespace ElectronNET.API.Entities
|
||||
public bool Frame { get; set; } = true;
|
||||
|
||||
/// <summary>
|
||||
/// Whether this is a modal window. This only works when the window is a child
|
||||
/// window.Default is false.
|
||||
/// Whether this is a modal window. This only works when <see cref="Parent"/> is
|
||||
/// also specified. Default is false.
|
||||
/// </summary>
|
||||
public bool Modal { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether the web view accepts a single mouse-down event that simultaneously
|
||||
/// activates the window.Default is false.
|
||||
/// activates the window. Default is false.
|
||||
/// </summary>
|
||||
public bool AcceptFirstMouse { get; set; }
|
||||
|
||||
@@ -270,5 +270,11 @@ namespace ElectronNET.API.Entities
|
||||
/// These will only be used if the Proxy field is also set.
|
||||
/// </summary>
|
||||
public string ProxyCredentials { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The window to use as the created window's parent.
|
||||
/// </summary>
|
||||
[DefaultValue(null)]
|
||||
public BrowserWindow Parent { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,6 +182,9 @@ module.exports = (socket, app) => {
|
||||
else if (!options.webPreferences) {
|
||||
options = { ...options, webPreferences: { nodeIntegration: true, contextIsolation: false } };
|
||||
}
|
||||
if (options.parent) {
|
||||
options.parent = electron_1.BrowserWindow.fromId(options.parent.id);
|
||||
}
|
||||
// we dont want to recreate the window when watch is ready.
|
||||
if (app.commandLine.hasSwitch('watch') && app['mainWindowURL'] === loadUrl) {
|
||||
window = app['mainWindow'];
|
||||
|
||||
@@ -216,6 +216,10 @@ export = (socket: Socket, app: Electron.App) => {
|
||||
options = { ...options, webPreferences: { nodeIntegration: true, contextIsolation: false } };
|
||||
}
|
||||
|
||||
if (options.parent) {
|
||||
options.parent = BrowserWindow.fromId(options.parent.id);
|
||||
}
|
||||
|
||||
// we dont want to recreate the window when watch is ready.
|
||||
if (app.commandLine.hasSwitch('watch') && app['mainWindowURL'] === loadUrl) {
|
||||
window = app['mainWindow'];
|
||||
|
||||
Reference in New Issue
Block a user