return window_->IsFullscreen();
}
-void Window::SetBounds(mate::Arguments* args) {
- gfx::Rect rect;
+void Window::SetBounds(const gfx::Rect& bounds, mate::Arguments* args) {
bool animate = false;
- if (!args->GetNext(&rect) ||
- (args->Length() == 2 && !args->GetNext(&animate))) {
- args->ThrowError();
- return;
- }
- window_->SetBounds(rect, animate);
+ args->GetNext(&animate);
+ window_->SetBounds(bounds, animate);
}
gfx::Rect Window::GetBounds() {
return window_->GetBounds();
}
-void Window::SetSize(mate::Arguments* args) {
- int width = 0, height = 0;
+void Window::SetSize(int width, int height, mate::Arguments* args) {
bool animate = false;
- if (!args->GetNext(&width) || !args->GetNext(&height) ||
- (args->Length() == 3 && !args->GetNext(&animate))) {
- args->ThrowError();
- return;
- }
+ args->GetNext(&animate);
window_->SetSize(gfx::Size(width, height), animate);
}
return result;
}
-void Window::SetContentSize(mate::Arguments* args) {
- int width = 0, height = 0;
+void Window::SetContentSize(int width, int height, mate::Arguments* args) {
bool animate = false;
- if (!args->GetNext(&width) || !args->GetNext(&height) ||
- (args->Length() == 3 && !args->GetNext(&animate))) {
- args->ThrowError();
- return;
- }
+ args->GetNext(&animate);
window_->SetContentSize(gfx::Size(width, height), animate);
}
window_->Center();
}
-void Window::SetPosition(mate::Arguments* args) {
- int x = 0, y = 0;
+void Window::SetPosition(int x, int y, mate::Arguments* args) {
bool animate = false;
- if (!args->GetNext(&x) || !args->GetNext(&y) ||
- (args->Length() == 3 && !args->GetNext(&animate))) {
- args->ThrowError();
- return;
- }
+ args->GetNext(&animate);
window_->SetPosition(gfx::Point(x, y), animate);
}
bool IsMinimized();
void SetFullScreen(bool fullscreen);
bool IsFullscreen();
- void SetBounds(mate::Arguments* args);
+ void SetBounds(const gfx::Rect& bounds, mate::Arguments* args);
gfx::Rect GetBounds();
- void SetSize(mate::Arguments* args);
+ void SetSize(int width, int height, mate::Arguments* args);
std::vector<int> GetSize();
- void SetContentSize(mate::Arguments* args);
+ void SetContentSize(int width, int height, mate::Arguments* args);
std::vector<int> GetContentSize();
void SetMinimumSize(int width, int height);
std::vector<int> GetMinimumSize();
void SetAlwaysOnTop(bool top);
bool IsAlwaysOnTop();
void Center();
- void SetPosition(mate::Arguments* args);
+ void SetPosition(int x, int y, mate::Arguments* args);
std::vector<int> GetPosition();
void SetTitle(const std::string& title);
std::string GetTitle();
int x = -1, y = -1;
bool center;
if (options.Get(options::kX, &x) && options.Get(options::kY, &y)) {
- SetPosition(gfx::Point(x, y), false);
+ SetPosition(gfx::Point(x, y));
} else if (options.Get(options::kCenter, ¢er) && center) {
Center();
}
virtual bool IsMinimized() = 0;
virtual void SetFullScreen(bool fullscreen) = 0;
virtual bool IsFullscreen() const = 0;
- virtual void SetBounds(const gfx::Rect& bounds, bool animate) = 0;
+ virtual void SetBounds(const gfx::Rect& bounds, bool animate = false) = 0;
virtual gfx::Rect GetBounds() = 0;
- virtual void SetSize(const gfx::Size& size, bool animate);
+ virtual void SetSize(const gfx::Size& size, bool animate = false);
virtual gfx::Size GetSize();
- virtual void SetPosition(const gfx::Point& position, bool animate);
+ virtual void SetPosition(const gfx::Point& position, bool animate = false);
virtual gfx::Point GetPosition();
- virtual void SetContentSize(const gfx::Size& size, bool animate);
+ virtual void SetContentSize(const gfx::Size& size, bool animate = false);
virtual gfx::Size GetContentSize();
virtual void SetSizeConstraints(
const extensions::SizeConstraints& size_constraints);
bool IsMinimized() override;
void SetFullScreen(bool fullscreen) override;
bool IsFullscreen() const override;
- void SetBounds(const gfx::Rect& bounds, bool animate) override;
+ void SetBounds(const gfx::Rect& bounds, bool animate = false) override;
gfx::Rect GetBounds() override;
void SetContentSizeConstraints(
const extensions::SizeConstraints& size_constraints) override;
bool use_content_size = false;
options.Get(options::kUseContentSize, &use_content_size);
if (!has_frame() || !use_content_size)
- SetSize(gfx::Size(width, height), false);
+ SetSize(gfx::Size(width, height));
// Enable the NSView to accept first mouse event.
bool acceptsFirstMouse = false;
return window_->IsFullscreen();
}
-void NativeWindowViews::SetBounds(const gfx::Rect& bounds, bool animate) {
+void NativeWindowViews::SetBounds(const gfx::Rect& bounds, bool animate = false) {
#if defined(USE_X11)
// On Linux the minimum and maximum size should be updated with window size
// when window is not resizable.
SetContentSizeConstraints(constraints);
// Resize the window to make sure content size is not changed.
- SetContentSize(content_size, false);
+ SetContentSize(content_size);
}
}
}
// When the window is restored we resize it to the previous known
// normal size.
- NativeWindow::SetSize(last_normal_size_, false);
+ NativeWindow::SetSize(last_normal_size_);
NotifyWindowUnmaximize();
break;
// When the window is restored we resize it to the previous known
// normal size.
- NativeWindow::SetSize(last_normal_size_, false);
+ NativeWindow::SetSize(last_normal_size_);
NotifyWindowRestore();
}
### `win.setBounds(options[, animate])`
-`options` Object, properties:
+* `options` Object, properties:
-* `x` Integer
-* `y` Integer
-* `width` Integer
-* `height` Integer
+ * `x` Integer
+ * `y` Integer
+ * `width` Integer
+ * `height` Integer
-`animate` Boolean (optional) _OS X_
+* `animate` Boolean (optional) _OS X_
Resizes and moves the window to `width`, `height`, `x`, `y`.