Animate window resizing on OS X
This commit is contained in:
parent
d4b8c65017
commit
2598b00b41
10 changed files with 68 additions and 36 deletions
|
@ -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() {
|
||||
|
|
|
@ -94,11 +94,11 @@ class Window : public mate::TrackableObject<Window>,
|
|||
bool IsMinimized();
|
||||
void SetFullScreen(bool fullscreen);
|
||||
bool IsFullscreen();
|
||||
void SetBounds(const gfx::Rect& bounds);
|
||||
void SetBounds(mate::Arguments* args);
|
||||
gfx::Rect GetBounds();
|
||||
void SetSize(int width, int height);
|
||||
void SetSize(mate::Arguments* args);
|
||||
std::vector<int> GetSize();
|
||||
void SetContentSize(int width, int height);
|
||||
void SetContentSize(mate::Arguments* args);
|
||||
std::vector<int> GetContentSize();
|
||||
void SetMinimumSize(int width, int height);
|
||||
std::vector<int> GetMinimumSize();
|
||||
|
@ -109,7 +109,7 @@ class Window : public mate::TrackableObject<Window>,
|
|||
void SetAlwaysOnTop(bool top);
|
||||
bool IsAlwaysOnTop();
|
||||
void Center();
|
||||
void SetPosition(int x, int y);
|
||||
void SetPosition(mate::Arguments* args);
|
||||
std::vector<int> GetPosition();
|
||||
void SetTitle(const std::string& title);
|
||||
std::string GetTitle();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue