mac: Add win.beginSheet(sheet)/endSheet(sheet) API

This commit is contained in:
Cheng Zhao 2016-06-18 22:53:41 +09:00
parent 2c5f4aadfb
commit f2cbd7cb36
6 changed files with 38 additions and 0 deletions

View file

@ -723,6 +723,18 @@ bool Window::IsModal() const {
return is_modal_;
}
void Window::BeginSheet(mate::Handle<Window> sheet, mate::Arguments* args) {
if (sheet->IsVisible()) {
args->ThrowError("Sheet window must not be visible");
return;
}
window_->BeginSheet(sheet->window_.get());
}
void Window::EndSheet(mate::Handle<Window> sheet) {
window_->EndSheet(sheet->window_.get());
}
v8::Local<v8::Value> Window::GetNativeWindowHandle() {
gfx::AcceleratedWidget handle = window_->GetAcceleratedWidget();
return ToBuffer(
@ -793,6 +805,8 @@ void Window::BuildPrototype(v8::Isolate* isolate,
.SetMethod("getChildWindows", &Window::GetChildWindows)
.SetMethod("setModal", &Window::SetModal)
.SetMethod("isModal", &Window::IsModal)
.SetMethod("beginSheet", &Window::BeginSheet)
.SetMethod("endSheet", &Window::EndSheet)
.SetMethod("getNativeWindowHandle", &Window::GetNativeWindowHandle)
.SetMethod("getBounds", &Window::GetBounds)
.SetMethod("setBounds", &Window::SetBounds)

View file

@ -168,6 +168,8 @@ class Window : public mate::TrackableObject<Window>,
std::vector<v8::Local<v8::Object>> GetChildWindows() const;
void SetModal(bool modal, mate::Arguments* args);
bool IsModal() const;
void BeginSheet(mate::Handle<Window> sheet, mate::Arguments* args);
void EndSheet(mate::Handle<Window> sheet);
v8::Local<v8::Value> GetNativeWindowHandle();
#if defined(OS_WIN)