Animate window resizing on OS X

This commit is contained in:
evgenyzinoviev 2016-01-15 05:54:12 +01:00
parent d4b8c65017
commit 2598b00b41
10 changed files with 68 additions and 36 deletions

View file

@ -338,16 +338,30 @@ bool Window::IsFullscreen() {
return window_->IsFullscreen();
}
void Window::SetBounds(const gfx::Rect& bounds) {
window_->SetBounds(bounds);
void Window::SetBounds(mate::Arguments* args) {
gfx::Rect rect;
bool animate = false;
if (!args->GetNext(&rect) ||
(args->Length() == 2 && !args->GetNext(&animate))) {
args->ThrowError();
return;
}
window_->SetBounds(rect, animate);
}
gfx::Rect Window::GetBounds() {
return window_->GetBounds();
}
void Window::SetSize(int width, int height) {
window_->SetSize(gfx::Size(width, height));
void Window::SetSize(mate::Arguments* args) {
int width = 0, height = 0;
bool animate = false;
if (!args->GetNext(&width) || !args->GetNext(&height) ||
(args->Length() == 3 && !args->GetNext(&animate))) {
args->ThrowError();
return;
}
window_->SetSize(gfx::Size(width, height), animate);
}
std::vector<int> Window::GetSize() {
@ -358,8 +372,15 @@ std::vector<int> Window::GetSize() {
return result;
}
void Window::SetContentSize(int width, int height) {
window_->SetContentSize(gfx::Size(width, height));
void Window::SetContentSize(mate::Arguments* args) {
int width = 0, height = 0;
bool animate = false;
if (!args->GetNext(&width) || !args->GetNext(&height) ||
(args->Length() == 3 && !args->GetNext(&animate))) {
args->ThrowError();
return;
}
window_->SetContentSize(gfx::Size(width, height), animate);
}
std::vector<int> Window::GetContentSize() {
@ -414,8 +435,15 @@ void Window::Center() {
window_->Center();
}
void Window::SetPosition(int x, int y) {
window_->SetPosition(gfx::Point(x, y));
void Window::SetPosition(mate::Arguments* args) {
int x = 0, y = 0;
bool animate = false;
if (!args->GetNext(&x) || !args->GetNext(&y) ||
(args->Length() == 3 && !args->GetNext(&animate))) {
args->ThrowError();
return;
}
window_->SetPosition(gfx::Point(x, y), animate);
}
std::vector<int> Window::GetPosition() {