Merge pull request #5603 from leethomas/osx-horizontal-sheet-offset
Osx horizontal sheet offset
This commit is contained in:
commit
6f3d0e1782
6 changed files with 27 additions and 14 deletions
|
@ -381,8 +381,10 @@ std::vector<int> Window::GetMaximumSize() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetSheetOffset(double offset) {
|
void Window::SetSheetOffset(double offsetY, mate::Arguments* args) {
|
||||||
window_->SetSheetOffset(offset);
|
double offsetX = 0.0;
|
||||||
|
args->GetNext(&offsetX);
|
||||||
|
window_->SetSheetOffset(offsetX, offsetY);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Window::SetResizable(bool resizable) {
|
void Window::SetResizable(bool resizable) {
|
||||||
|
|
|
@ -111,7 +111,7 @@ class Window : public mate::TrackableObject<Window>,
|
||||||
std::vector<int> GetMinimumSize();
|
std::vector<int> GetMinimumSize();
|
||||||
void SetMaximumSize(int width, int height);
|
void SetMaximumSize(int width, int height);
|
||||||
std::vector<int> GetMaximumSize();
|
std::vector<int> GetMaximumSize();
|
||||||
void SetSheetOffset(double offset);
|
void SetSheetOffset(double offsetY, mate::Arguments* args);
|
||||||
void SetResizable(bool resizable);
|
void SetResizable(bool resizable);
|
||||||
bool IsResizable();
|
bool IsResizable();
|
||||||
void SetMovable(bool movable);
|
void SetMovable(bool movable);
|
||||||
|
|
|
@ -52,7 +52,8 @@ NativeWindow::NativeWindow(
|
||||||
enable_larger_than_screen_(false),
|
enable_larger_than_screen_(false),
|
||||||
is_closed_(false),
|
is_closed_(false),
|
||||||
has_dialog_attached_(false),
|
has_dialog_attached_(false),
|
||||||
sheet_offset_(0.0),
|
sheet_offset_x_(0.0),
|
||||||
|
sheet_offset_y_(0.0),
|
||||||
aspect_ratio_(0.0),
|
aspect_ratio_(0.0),
|
||||||
inspectable_web_contents_(inspectable_web_contents),
|
inspectable_web_contents_(inspectable_web_contents),
|
||||||
weak_factory_(this) {
|
weak_factory_(this) {
|
||||||
|
@ -250,12 +251,17 @@ gfx::Size NativeWindow::GetMaximumSize() {
|
||||||
return GetSizeConstraints().GetMaximumSize();
|
return GetSizeConstraints().GetMaximumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::SetSheetOffset(const double offset) {
|
void NativeWindow::SetSheetOffset(const double offsetX, const double offsetY) {
|
||||||
sheet_offset_ = offset;
|
sheet_offset_x_ = offsetX;
|
||||||
|
sheet_offset_y_ = offsetY;
|
||||||
}
|
}
|
||||||
|
|
||||||
double NativeWindow::GetSheetOffset() {
|
double NativeWindow::GetSheetOffsetX() {
|
||||||
return sheet_offset_;
|
return sheet_offset_x_;
|
||||||
|
}
|
||||||
|
|
||||||
|
double NativeWindow::GetSheetOffsetY() {
|
||||||
|
return sheet_offset_y_;
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::SetRepresentedFilename(const std::string& filename) {
|
void NativeWindow::SetRepresentedFilename(const std::string& filename) {
|
||||||
|
|
|
@ -123,8 +123,9 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
virtual gfx::Size GetMinimumSize();
|
virtual gfx::Size GetMinimumSize();
|
||||||
virtual void SetMaximumSize(const gfx::Size& size);
|
virtual void SetMaximumSize(const gfx::Size& size);
|
||||||
virtual gfx::Size GetMaximumSize();
|
virtual gfx::Size GetMaximumSize();
|
||||||
virtual void SetSheetOffset(const double offset);
|
virtual void SetSheetOffset(const double offsetX, const double offsetY);
|
||||||
virtual double GetSheetOffset();
|
virtual double GetSheetOffsetX();
|
||||||
|
virtual double GetSheetOffsetY();
|
||||||
virtual void SetResizable(bool resizable) = 0;
|
virtual void SetResizable(bool resizable) = 0;
|
||||||
virtual bool IsResizable() = 0;
|
virtual bool IsResizable() = 0;
|
||||||
virtual void SetMovable(bool movable) = 0;
|
virtual void SetMovable(bool movable) = 0;
|
||||||
|
@ -316,8 +317,10 @@ class NativeWindow : public base::SupportsUserData,
|
||||||
// it should be cancelled when we can prove that the window is responsive.
|
// it should be cancelled when we can prove that the window is responsive.
|
||||||
base::CancelableClosure window_unresposive_closure_;
|
base::CancelableClosure window_unresposive_closure_;
|
||||||
|
|
||||||
// Used to display sheets at the appropriate vertical offset
|
// Used to display sheets at the appropriate horizontal and vertical offsets
|
||||||
double sheet_offset_;
|
// on OS X.
|
||||||
|
double sheet_offset_x_;
|
||||||
|
double sheet_offset_y_;
|
||||||
|
|
||||||
// Used to maintain the aspect ratio of a view which is inside of the
|
// Used to maintain the aspect ratio of a view which is inside of the
|
||||||
// content view.
|
// content view.
|
||||||
|
|
|
@ -257,7 +257,9 @@ bool ScopedDisableResize::disable_resize_ = false;
|
||||||
- (NSRect)window:(NSWindow*)window
|
- (NSRect)window:(NSWindow*)window
|
||||||
willPositionSheet:(NSWindow*)sheet usingRect:(NSRect)rect {
|
willPositionSheet:(NSWindow*)sheet usingRect:(NSRect)rect {
|
||||||
NSView* view = window.contentView;
|
NSView* view = window.contentView;
|
||||||
rect.origin.y = view.frame.size.height - shell_->GetSheetOffset();
|
|
||||||
|
rect.origin.x = shell_->GetSheetOffsetX();
|
||||||
|
rect.origin.y = view.frame.size.height - shell_->GetSheetOffsetY();
|
||||||
return rect;
|
return rect;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -683,7 +683,7 @@ Returns the title of the native window.
|
||||||
**Note:** The title of web page can be different from the title of the native
|
**Note:** The title of web page can be different from the title of the native
|
||||||
window.
|
window.
|
||||||
|
|
||||||
### `win.setSheetOffset(offset)` _OS X_
|
### `win.setSheetOffset(offsetY[, offsetX])` _OS X_
|
||||||
|
|
||||||
Changes the attachment point for sheets on Mac OS X. By default, sheets are
|
Changes the attachment point for sheets on Mac OS X. By default, sheets are
|
||||||
attached just below the window frame, but you may want to display them beneath
|
attached just below the window frame, but you may want to display them beneath
|
||||||
|
|
Loading…
Reference in a new issue