mac: Add win.setParentWindow(parent) API
This commit is contained in:
parent
e4d30ccfc3
commit
fd42e3dc84
7 changed files with 22 additions and 0 deletions
|
@ -650,6 +650,10 @@ void Window::SetAspectRatio(double aspect_ratio, mate::Arguments* args) {
|
||||||
window_->SetAspectRatio(aspect_ratio, extra_size);
|
window_->SetAspectRatio(aspect_ratio, extra_size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::SetParentWindow(NativeWindow* parent) {
|
||||||
|
window_->SetParentWindow(parent);
|
||||||
|
}
|
||||||
|
|
||||||
v8::Local<v8::Value> Window::GetNativeWindowHandle() {
|
v8::Local<v8::Value> Window::GetNativeWindowHandle() {
|
||||||
gfx::AcceleratedWidget handle = window_->GetAcceleratedWidget();
|
gfx::AcceleratedWidget handle = window_->GetAcceleratedWidget();
|
||||||
return ToBuffer(
|
return ToBuffer(
|
||||||
|
@ -697,6 +701,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("setFullScreen", &Window::SetFullScreen)
|
.SetMethod("setFullScreen", &Window::SetFullScreen)
|
||||||
.SetMethod("isFullScreen", &Window::IsFullscreen)
|
.SetMethod("isFullScreen", &Window::IsFullscreen)
|
||||||
.SetMethod("setAspectRatio", &Window::SetAspectRatio)
|
.SetMethod("setAspectRatio", &Window::SetAspectRatio)
|
||||||
|
.SetMethod("setParentWindow", &Window::SetParentWindow)
|
||||||
.SetMethod("getNativeWindowHandle", &Window::GetNativeWindowHandle)
|
.SetMethod("getNativeWindowHandle", &Window::GetNativeWindowHandle)
|
||||||
.SetMethod("getBounds", &Window::GetBounds)
|
.SetMethod("getBounds", &Window::GetBounds)
|
||||||
.SetMethod("setBounds", &Window::SetBounds)
|
.SetMethod("setBounds", &Window::SetBounds)
|
||||||
|
|
|
@ -159,6 +159,7 @@ class Window : public mate::TrackableObject<Window>,
|
||||||
void SetMenuBarVisibility(bool visible);
|
void SetMenuBarVisibility(bool visible);
|
||||||
bool IsMenuBarVisible();
|
bool IsMenuBarVisible();
|
||||||
void SetAspectRatio(double aspect_ratio, mate::Arguments* args);
|
void SetAspectRatio(double aspect_ratio, mate::Arguments* args);
|
||||||
|
void SetParentWindow(NativeWindow* parent);
|
||||||
v8::Local<v8::Value> GetNativeWindowHandle();
|
v8::Local<v8::Value> GetNativeWindowHandle();
|
||||||
|
|
||||||
#if defined(OS_WIN)
|
#if defined(OS_WIN)
|
||||||
|
|
|
@ -158,6 +158,7 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
virtual void SetFocusable(bool focusable);
|
virtual void SetFocusable(bool focusable);
|
||||||
virtual void SetMenu(ui::MenuModel* menu);
|
virtual void SetMenu(ui::MenuModel* menu);
|
||||||
virtual bool HasModalDialog();
|
virtual bool HasModalDialog();
|
||||||
|
virtual void SetParentWindow(NativeWindow* parent) = 0;
|
||||||
virtual gfx::NativeWindow GetNativeWindow() = 0;
|
virtual gfx::NativeWindow GetNativeWindow() = 0;
|
||||||
virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0;
|
virtual gfx::AcceleratedWidget GetAcceleratedWidget() = 0;
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,7 @@ class NativeWindowMac : public NativeWindow {
|
||||||
bool IsDocumentEdited() override;
|
bool IsDocumentEdited() override;
|
||||||
void SetIgnoreMouseEvents(bool ignore) override;
|
void SetIgnoreMouseEvents(bool ignore) override;
|
||||||
bool HasModalDialog() override;
|
bool HasModalDialog() override;
|
||||||
|
void SetParentWindow(NativeWindow* parent) override;
|
||||||
gfx::NativeWindow GetNativeWindow() override;
|
gfx::NativeWindow GetNativeWindow() override;
|
||||||
gfx::AcceleratedWidget GetAcceleratedWidget() override;
|
gfx::AcceleratedWidget GetAcceleratedWidget() override;
|
||||||
void SetProgressBar(double progress) override;
|
void SetProgressBar(double progress) override;
|
||||||
|
|
|
@ -911,6 +911,16 @@ bool NativeWindowMac::HasModalDialog() {
|
||||||
return [window_ attachedSheet] != nil;
|
return [window_ attachedSheet] != nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NativeWindowMac::SetParentWindow(NativeWindow* parent) {
|
||||||
|
// Remove current parent window.
|
||||||
|
if ([window_ parentWindow])
|
||||||
|
[[window_ parentWindow] removeChildWindow:window_];
|
||||||
|
|
||||||
|
// Set new current window.
|
||||||
|
if (parent)
|
||||||
|
[parent->GetNativeWindow() addChildWindow:window_ ordered:NSWindowAbove];
|
||||||
|
}
|
||||||
|
|
||||||
gfx::NativeWindow NativeWindowMac::GetNativeWindow() {
|
gfx::NativeWindow NativeWindowMac::GetNativeWindow() {
|
||||||
return window_;
|
return window_;
|
||||||
}
|
}
|
||||||
|
|
|
@ -772,6 +772,9 @@ void NativeWindowViews::SetMenu(ui::MenuModel* menu_model) {
|
||||||
Layout();
|
Layout();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NativeWindowViews::SetParentWindow(NativeWindow* parent) {
|
||||||
|
}
|
||||||
|
|
||||||
gfx::NativeWindow NativeWindowViews::GetNativeWindow() {
|
gfx::NativeWindow NativeWindowViews::GetNativeWindow() {
|
||||||
return window_->GetNativeWindow();
|
return window_->GetNativeWindow();
|
||||||
}
|
}
|
||||||
|
|
|
@ -94,6 +94,7 @@ class NativeWindowViews : public NativeWindow,
|
||||||
void SetIgnoreMouseEvents(bool ignore) override;
|
void SetIgnoreMouseEvents(bool ignore) override;
|
||||||
void SetFocusable(bool focusable) override;
|
void SetFocusable(bool focusable) override;
|
||||||
void SetMenu(ui::MenuModel* menu_model) override;
|
void SetMenu(ui::MenuModel* menu_model) override;
|
||||||
|
void SetParentWindow(NativeWindow* parent) override;
|
||||||
gfx::NativeWindow GetNativeWindow() override;
|
gfx::NativeWindow GetNativeWindow() override;
|
||||||
void SetOverlayIcon(const gfx::Image& overlay,
|
void SetOverlayIcon(const gfx::Image& overlay,
|
||||||
const std::string& description) override;
|
const std::string& description) override;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue