Merge pull request #6654 from electron/content-bounds

Add BrowserWindow.get/setContentBounds()
This commit is contained in:
Cheng Zhao 2016-08-05 17:23:24 +09:00 committed by GitHub
commit 8a33464d41
10 changed files with 153 additions and 58 deletions

View file

@ -366,6 +366,16 @@ gfx::Rect Window::GetBounds() {
return window_->GetBounds();
}
void Window::SetContentBounds(const gfx::Rect& bounds, mate::Arguments* args) {
bool animate = false;
args->GetNext(&animate);
window_->SetContentBounds(bounds, animate);
}
gfx::Rect Window::GetContentBounds() {
return window_->GetContentBounds();
}
void Window::SetSize(int width, int height, mate::Arguments* args) {
bool animate = false;
args->GetNext(&animate);
@ -785,6 +795,8 @@ void Window::BuildPrototype(v8::Isolate* isolate,
.SetMethod("setBounds", &Window::SetBounds)
.SetMethod("getSize", &Window::GetSize)
.SetMethod("setSize", &Window::SetSize)
.SetMethod("getContentBounds", &Window::GetContentBounds)
.SetMethod("setContentBounds", &Window::SetContentBounds)
.SetMethod("getContentSize", &Window::GetContentSize)
.SetMethod("setContentSize", &Window::SetContentSize)
.SetMethod("setMinimumSize", &Window::SetMinimumSize)

View file

@ -112,6 +112,8 @@ class Window : public mate::TrackableObject<Window>,
std::vector<int> GetSize();
void SetContentSize(int width, int height, mate::Arguments* args);
std::vector<int> GetContentSize();
void SetContentBounds(const gfx::Rect& bounds, mate::Arguments* args);
gfx::Rect GetContentBounds();
void SetMinimumSize(int width, int height);
std::vector<int> GetMinimumSize();
void SetMaximumSize(int width, int height);