зеркало из https://github.com/electron/electron.git
Get BrowserWindow::getContentSize API.
This commit is contained in:
Родитель
8d5fbe525d
Коммит
76cc3eeb6d
|
@ -181,6 +181,14 @@ std::vector<int> Window::GetSize() {
|
|||
return result;
|
||||
}
|
||||
|
||||
std::vector<int> Window::GetContentSize() {
|
||||
std::vector<int> result(2);
|
||||
gfx::Size size = window_->GetContentSize();
|
||||
result[0] = size.width();
|
||||
result[1] = size.height();
|
||||
return result;
|
||||
}
|
||||
|
||||
void Window::SetMinimumSize(int width, int height) {
|
||||
window_->SetMinimumSize(gfx::Size(width, height));
|
||||
}
|
||||
|
@ -331,6 +339,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
|
|||
.SetMethod("setFullScreen", &Window::SetFullscreen)
|
||||
.SetMethod("isFullScreen", &Window::IsFullscreen)
|
||||
.SetMethod("getSize", &Window::GetSize)
|
||||
.SetMethod("getContentSize", &Window::GetContentSize)
|
||||
.SetMethod("setSize", &Window::SetSize)
|
||||
.SetMethod("setMinimumSize", &Window::SetMinimumSize)
|
||||
.SetMethod("getMinimumSize", &Window::GetMinimumSize)
|
||||
|
|
|
@ -73,6 +73,7 @@ class Window : public mate::EventEmitter,
|
|||
bool IsFullscreen();
|
||||
void SetSize(int width, int height);
|
||||
std::vector<int> GetSize();
|
||||
std::vector<int> GetContentSize();
|
||||
void SetMinimumSize(int width, int height);
|
||||
std::vector<int> GetMinimumSize();
|
||||
void SetMaximumSize(int width, int height);
|
||||
|
|
|
@ -111,6 +111,7 @@ class NativeWindow : public brightray::DefaultWebContentsDelegate,
|
|||
virtual bool IsFullscreen() = 0;
|
||||
virtual void SetSize(const gfx::Size& size) = 0;
|
||||
virtual gfx::Size GetSize() = 0;
|
||||
virtual gfx::Size GetContentSize() = 0;
|
||||
virtual void SetMinimumSize(const gfx::Size& size) = 0;
|
||||
virtual gfx::Size GetMinimumSize() = 0;
|
||||
virtual void SetMaximumSize(const gfx::Size& size) = 0;
|
||||
|
|
|
@ -261,6 +261,12 @@ gfx::Size NativeWindowGtk::GetSize() {
|
|||
return gfx::Size(frame_extents.width, frame_extents.height);
|
||||
}
|
||||
|
||||
gfx::Size NativeWindowGtk::GetContentSize() {
|
||||
gint width, height;
|
||||
gtk_window_get_size(window_, &width, &height);
|
||||
return gfx::Size(width, height);
|
||||
}
|
||||
|
||||
void NativeWindowGtk::SetMinimumSize(const gfx::Size& size) {
|
||||
minimum_size_ = size;
|
||||
|
||||
|
|
|
@ -46,6 +46,7 @@ class NativeWindowGtk : public NativeWindow,
|
|||
virtual bool IsFullscreen() OVERRIDE;
|
||||
virtual void SetSize(const gfx::Size& size) OVERRIDE;
|
||||
virtual gfx::Size GetSize() OVERRIDE;
|
||||
virtual gfx::Size GetContentSize() OVERRIDE;
|
||||
virtual void SetMinimumSize(const gfx::Size& size) OVERRIDE;
|
||||
virtual gfx::Size GetMinimumSize() OVERRIDE;
|
||||
virtual void SetMaximumSize(const gfx::Size& size) OVERRIDE;
|
||||
|
|
|
@ -38,6 +38,7 @@ class NativeWindowMac : public NativeWindow {
|
|||
virtual bool IsFullscreen() OVERRIDE;
|
||||
virtual void SetSize(const gfx::Size& size) OVERRIDE;
|
||||
virtual gfx::Size GetSize() OVERRIDE;
|
||||
virtual gfx::Size GetContentSize() OVERRIDE;
|
||||
virtual void SetMinimumSize(const gfx::Size& size) OVERRIDE;
|
||||
virtual gfx::Size GetMinimumSize() OVERRIDE;
|
||||
virtual void SetMaximumSize(const gfx::Size& size) OVERRIDE;
|
||||
|
|
|
@ -305,6 +305,11 @@ gfx::Size NativeWindowMac::GetSize() {
|
|||
return gfx::Size(frame.size.width, frame.size.height);
|
||||
}
|
||||
|
||||
gfx::Size NativeWindowMac::GetContentSize() {
|
||||
NSRect bounds = [[window_ contentView] bounds];
|
||||
return gfx::Size(bounds.size.width, bounds.size.height);
|
||||
}
|
||||
|
||||
void NativeWindowMac::SetMinimumSize(const gfx::Size& size) {
|
||||
NSSize min_size = NSMakeSize(size.width(), size.height());
|
||||
NSView* content = [window_ contentView];
|
||||
|
|
|
@ -295,6 +295,10 @@ gfx::Size NativeWindowWin::GetSize() {
|
|||
return window_->GetWindowBoundsInScreen().size();
|
||||
}
|
||||
|
||||
gfx::Size NativeWindowWin::GetContentSize() {
|
||||
return window_->GetClientAreaBoundsInScreen().size();
|
||||
}
|
||||
|
||||
void NativeWindowWin::SetMinimumSize(const gfx::Size& size) {
|
||||
minimum_size_ = size;
|
||||
}
|
||||
|
|
|
@ -53,6 +53,7 @@ class NativeWindowWin : public NativeWindow,
|
|||
virtual bool IsFullscreen() OVERRIDE;
|
||||
virtual void SetSize(const gfx::Size& size) OVERRIDE;
|
||||
virtual gfx::Size GetSize() OVERRIDE;
|
||||
virtual gfx::Size GetContentSize() OVERRIDE;
|
||||
virtual void SetMinimumSize(const gfx::Size& size) OVERRIDE;
|
||||
virtual gfx::Size GetMinimumSize() OVERRIDE;
|
||||
virtual void SetMaximumSize(const gfx::Size& size) OVERRIDE;
|
||||
|
|
Загрузка…
Ссылка в новой задаче