#include "native_mate/callback.h"
#include "native_mate/constructor.h"
#include "native_mate/dictionary.h"
+#include "ui/gfx/geometry/rect.h"
#include "atom/common/node_includes.h"
return window_->IsFullscreen();
}
+void Window::SetBounds(const gfx::Rect& bounds) {
+ window_->SetBounds(bounds);
+}
+
+gfx::Rect Window::GetBounds() {
+ return window_->GetBounds();
+}
+
void Window::SetSize(int width, int height) {
window_->SetSize(gfx::Size(width, height));
}
.SetMethod("isMinimized", &Window::IsMinimized)
.SetMethod("setFullScreen", &Window::SetFullScreen)
.SetMethod("isFullScreen", &Window::IsFullscreen)
+ .SetMethod("getBounds", &Window::GetBounds)
+ .SetMethod("setBounds", &Window::SetBounds)
.SetMethod("getSize", &Window::GetSize)
.SetMethod("setSize", &Window::SetSize)
.SetMethod("getContentSize", &Window::GetContentSize)
class GURL;
+namespace gfx {
+class Rect;
+}
+
namespace mate {
class Arguments;
class Dictionary;
bool IsMinimized();
void SetFullScreen(bool fullscreen);
bool IsFullscreen();
+ void SetBounds(const gfx::Rect& bounds);
+ gfx::Rect GetBounds();
void SetSize(int width, int height);
std::vector<int> GetSize();
void SetContentSize(int width, int height);
virtual bool IsMinimized() = 0;
virtual void SetFullScreen(bool fullscreen) = 0;
virtual bool IsFullscreen() const = 0;
+ virtual void SetBounds(const gfx::Rect& bounds) = 0;
+ virtual gfx::Rect GetBounds() = 0;
virtual void SetSize(const gfx::Size& size) = 0;
virtual gfx::Size GetSize() = 0;
virtual void SetContentSize(const gfx::Size& size) = 0;
bool IsMinimized() override;
void SetFullScreen(bool fullscreen) override;
bool IsFullscreen() const override;
+ void SetBounds(const gfx::Rect& bounds) override;
+ gfx::Rect GetBounds() override;
void SetSize(const gfx::Size& size) override;
gfx::Size GetSize() override;
void SetContentSize(const gfx::Size& size) override;
return [window_ styleMask] & NSFullScreenWindowMask;
}
+void NativeWindowMac::SetBounds(const gfx::Rect& bounds) {
+ Move(bounds);
+}
+
+gfx::Rect NativeWindowMac::GetBounds() {
+ return gfx::Rect(GetPosition(),
+ GetSize());
+}
+
void NativeWindowMac::SetSize(const gfx::Size& size) {
NSRect frame = [window_ frame];
frame.origin.y -= size.height() - frame.size.height;
return window_->IsFullscreen();
}
+void NativeWindowViews::SetBounds(const gfx::Rect& bounds) {
+ window_->SetBoundsConstrained(bounds);
+}
+
+gfx::Rect NativeWindowViews::GetBounds() {
+ return window_->GetRestoredBounds();
+}
+
void NativeWindowViews::SetSize(const gfx::Size& size) {
#if defined(USE_X11)
// On Linux the minimum and maximum size should be updated with window size
bool IsMinimized() override;
void SetFullScreen(bool fullscreen) override;
bool IsFullscreen() const override;
+ void SetBounds(const gfx::Rect& bounds) override;
+ gfx::Rect GetBounds() override;
void SetSize(const gfx::Size& size) override;
gfx::Size GetSize() override;
void SetContentSize(const gfx::Size& size) override;
Returns whether the window is in fullscreen mode.
+### BrowserWindow.setBounds(options)
+
+* `options` Object
+ * `x` Integer
+ * `y` Integer
+ * `width` Integer
+ * `height` Integer
+
+Resizes and moves the window to `width`, `height`, `x`, `y`.
+
+### BrowserWindow.getBounds()
+
+Returns an object that contains window's width, height, x and y values.
+
### BrowserWindow.setSize(width, height)
* `width` Integer