Show();
}
+void NativeWindow::SetSize(const gfx::Size& size) {
+ SetBounds(gfx::Rect(GetPosition(), size));
+}
+
+gfx::Size NativeWindow::GetSize() {
+ return GetBounds().size();
+}
+
+void NativeWindow::SetPosition(const gfx::Point& position) {
+ SetBounds(gfx::Rect(position, GetSize()));
+}
+
+gfx::Point NativeWindow::GetPosition() {
+ return GetBounds().origin();
+}
+
void NativeWindow::SetRepresentedFilename(const std::string& filename) {
}
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 SetSize(const gfx::Size& size);
+ virtual gfx::Size GetSize();
+ virtual void SetPosition(const gfx::Point& position);
+ virtual gfx::Point GetPosition();
virtual void SetContentSize(const gfx::Size& size) = 0;
virtual gfx::Size GetContentSize() = 0;
virtual void SetMinimumSize(const gfx::Size& size) = 0;
virtual void SetAlwaysOnTop(bool top) = 0;
virtual bool IsAlwaysOnTop() = 0;
virtual void Center() = 0;
- virtual void SetPosition(const gfx::Point& position) = 0;
- virtual gfx::Point GetPosition() = 0;
virtual void SetTitle(const std::string& title) = 0;
virtual std::string GetTitle() = 0;
virtual void FlashFrame(bool flash) = 0;
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;
gfx::Size GetContentSize() override;
void SetMinimumSize(const gfx::Size& size) override;
void SetAlwaysOnTop(bool top) override;
bool IsAlwaysOnTop() override;
void Center() override;
- void SetPosition(const gfx::Point& position) override;
- gfx::Point GetPosition() override;
void SetTitle(const std::string& title) override;
std::string GetTitle() override;
void FlashFrame(bool flash) override;
return bounds;
}
-void NativeWindowMac::SetSize(const gfx::Size& size) {
- NSRect frame = [window_ frame];
- frame.origin.y -= size.height() - frame.size.height;
- frame.size.width = size.width();
- frame.size.height = size.height();
-
- [window_ setFrame:frame display:YES];
-}
-
-gfx::Size NativeWindowMac::GetSize() {
- return GetBounds().size();
-}
-
void NativeWindowMac::SetContentSize(const gfx::Size& size) {
NSRect frame_nsrect = [window_ frame];
NSSize frame = frame_nsrect.size;
[window_ center];
}
-void NativeWindowMac::SetPosition(const gfx::Point& position) {
- SetBounds(gfx::Rect(position, GetSize()));
-}
-
-gfx::Point NativeWindowMac::GetPosition() {
- return GetBounds().origin();
-}
-
void NativeWindowMac::SetTitle(const std::string& title) {
// We don't want the title to show in transparent window.
if (transparent_)
return window_->GetWindowBoundsInScreen();
}
-void NativeWindowViews::SetSize(const gfx::Size& size) {
-#if defined(USE_X11)
- // On Linux the minimum and maximum size should be updated with window size
- // when window is not resizable.
- if (!resizable_) {
- SetMaximumSize(size);
- SetMinimumSize(size);
- }
-#endif
-
- window_->SetSize(size);
-}
-
-gfx::Size NativeWindowViews::GetSize() {
- return GetBounds().size();
-}
-
void NativeWindowViews::SetContentSize(const gfx::Size& size) {
if (!has_frame_) {
- SetSize(size);
+ NativeWindow::SetSize(size);
return;
}
gfx::Rect bounds = window_->GetWindowBoundsInScreen();
- SetSize(ContentBoundsToWindowBounds(gfx::Rect(bounds.origin(), size)).size());
+ bounds.set_size(size);
+ SetBounds(ContentBoundsToWindowBounds(bounds));
}
gfx::Size NativeWindowViews::GetContentSize() {
window_->CenterWindow(GetSize());
}
-void NativeWindowViews::SetPosition(const gfx::Point& position) {
- window_->SetBounds(gfx::Rect(position, GetSize()));
-}
-
-gfx::Point NativeWindowViews::GetPosition() {
-#if defined(OS_WIN)
- if (IsMinimized())
- return window_->GetRestoredBounds().origin();
-#endif
-
- return window_->GetWindowBoundsInScreen().origin();
-}
-
void NativeWindowViews::SetTitle(const std::string& title) {
title_ = title;
window_->UpdateWindowTitle();
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;
gfx::Size GetContentSize() override;
void SetMinimumSize(const gfx::Size& size) override;
void SetAlwaysOnTop(bool top) override;
bool IsAlwaysOnTop() override;
void Center() override;
- void SetPosition(const gfx::Point& position) override;
- gfx::Point GetPosition() override;
void SetTitle(const std::string& title) override;
std::string GetTitle() override;
void FlashFrame(bool flash) override;