Move "setSheetOffset" to the BrowserWindow
This commit is contained in:
parent
1976c271ec
commit
8f89cd2d59
7 changed files with 27 additions and 33 deletions
|
@ -66,10 +66,6 @@ void ShowMessageBox(int type,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetSheetOffset(atom::NativeWindow* window, const double offset) {
|
|
||||||
window->SetSheetOffset(offset);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ShowOpenDialog(const std::string& title,
|
void ShowOpenDialog(const std::string& title,
|
||||||
const base::FilePath& default_path,
|
const base::FilePath& default_path,
|
||||||
const file_dialog::Filters& filters,
|
const file_dialog::Filters& filters,
|
||||||
|
@ -116,7 +112,6 @@ void Initialize(v8::Local<v8::Object> exports, v8::Local<v8::Value> unused,
|
||||||
dict.SetMethod("showMessageBox", &ShowMessageBox);
|
dict.SetMethod("showMessageBox", &ShowMessageBox);
|
||||||
dict.SetMethod("showErrorBox", &atom::ShowErrorBox);
|
dict.SetMethod("showErrorBox", &atom::ShowErrorBox);
|
||||||
dict.SetMethod("showOpenDialog", &ShowOpenDialog);
|
dict.SetMethod("showOpenDialog", &ShowOpenDialog);
|
||||||
dict.SetMethod("setSheetOffset", &SetSheetOffset);
|
|
||||||
dict.SetMethod("showSaveDialog", &ShowSaveDialog);
|
dict.SetMethod("showSaveDialog", &ShowSaveDialog);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -514,6 +514,10 @@ std::vector<int> Window::GetPosition() {
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Window::SetSheetOffset(double offset) {
|
||||||
|
window_->SetSheetOffset(offset);
|
||||||
|
}
|
||||||
|
|
||||||
void Window::SetTitle(const std::string& title) {
|
void Window::SetTitle(const std::string& title) {
|
||||||
window_->SetTitle(title);
|
window_->SetTitle(title);
|
||||||
}
|
}
|
||||||
|
@ -763,6 +767,7 @@ void Window::BuildPrototype(v8::Isolate* isolate,
|
||||||
.SetMethod("center", &Window::Center)
|
.SetMethod("center", &Window::Center)
|
||||||
.SetMethod("setPosition", &Window::SetPosition)
|
.SetMethod("setPosition", &Window::SetPosition)
|
||||||
.SetMethod("getPosition", &Window::GetPosition)
|
.SetMethod("getPosition", &Window::GetPosition)
|
||||||
|
.SetMethod("setSheetOffset", &Window::SetSheetOffset)
|
||||||
.SetMethod("setTitle", &Window::SetTitle)
|
.SetMethod("setTitle", &Window::SetTitle)
|
||||||
.SetMethod("getTitle", &Window::GetTitle)
|
.SetMethod("getTitle", &Window::GetTitle)
|
||||||
.SetMethod("flashFrame", &Window::FlashFrame)
|
.SetMethod("flashFrame", &Window::FlashFrame)
|
||||||
|
|
|
@ -110,6 +110,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 SetResizable(bool resizable);
|
void SetResizable(bool resizable);
|
||||||
bool IsResizable();
|
bool IsResizable();
|
||||||
void SetMovable(bool movable);
|
void SetMovable(bool movable);
|
||||||
|
|
|
@ -201,14 +201,6 @@ gfx::Size NativeWindow::GetContentSize() {
|
||||||
return WindowSizeToContentSize(GetSize());
|
return WindowSizeToContentSize(GetSize());
|
||||||
}
|
}
|
||||||
|
|
||||||
void NativeWindow::SetSheetOffset(const double offset) {
|
|
||||||
sheet_offset_ = offset;
|
|
||||||
}
|
|
||||||
|
|
||||||
double NativeWindow::GetSheetOffset() {
|
|
||||||
return sheet_offset_;
|
|
||||||
}
|
|
||||||
|
|
||||||
void NativeWindow::SetSizeConstraints(
|
void NativeWindow::SetSizeConstraints(
|
||||||
const extensions::SizeConstraints& window_constraints) {
|
const extensions::SizeConstraints& window_constraints) {
|
||||||
extensions::SizeConstraints content_constraints;
|
extensions::SizeConstraints content_constraints;
|
||||||
|
@ -262,6 +254,14 @@ gfx::Size NativeWindow::GetMaximumSize() {
|
||||||
return GetSizeConstraints().GetMaximumSize();
|
return GetSizeConstraints().GetMaximumSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NativeWindow::SetSheetOffset(const double offset) {
|
||||||
|
sheet_offset_ = offset;
|
||||||
|
}
|
||||||
|
|
||||||
|
double NativeWindow::GetSheetOffset() {
|
||||||
|
return sheet_offset_;
|
||||||
|
}
|
||||||
|
|
||||||
void NativeWindow::SetRepresentedFilename(const std::string& filename) {
|
void NativeWindow::SetRepresentedFilename(const std::string& filename) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -675,6 +675,17 @@ 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)`
|
||||||
|
|
||||||
|
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 a HTML-rendered
|
||||||
|
toolbar. For example:
|
||||||
|
|
||||||
|
```
|
||||||
|
var toolbarRect = document.getElementById('toolbar').getBoundingClientRect();
|
||||||
|
win.setSheetOffset(toolbarRect.height);
|
||||||
|
```
|
||||||
|
|
||||||
### `win.flashFrame(flag)`
|
### `win.flashFrame(flag)`
|
||||||
|
|
||||||
* `flag` Boolean
|
* `flag` Boolean
|
||||||
|
|
|
@ -129,19 +129,5 @@ On Mac OS X, dialogs are presented as sheets attached to a window if you provide
|
||||||
a `BrowserWindow` reference in the `browserWindow` parameter, or modals if no
|
a `BrowserWindow` reference in the `browserWindow` parameter, or modals if no
|
||||||
window is provided.
|
window is provided.
|
||||||
|
|
||||||
### `dialog.setSheetOffset(browserWindow, offset)`
|
You can call `BrowserWindow.getCurrentWindow().setSheetOffset(offset)` to change
|
||||||
|
the offset from the window frame where sheets are attached.
|
||||||
* `browserWindow` BrowserWindow (optional)
|
|
||||||
|
|
||||||
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 a HTML-rendered
|
|
||||||
toolbar. For example:
|
|
||||||
```
|
|
||||||
const {remote} = require('electron');
|
|
||||||
const browserWindow = remote.getCurrentWindow();
|
|
||||||
|
|
||||||
var toolbarRect = document.getElementById('toolbar').getBoundingClientRect();
|
|
||||||
remote.dialog.setSheetOffset(browserWindow, toolbarRect.height);
|
|
||||||
|
|
||||||
... show dialog ...
|
|
||||||
```
|
|
||||||
|
|
|
@ -49,10 +49,6 @@ var checkAppInitialized = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
setSheetOffset: function (window, offset) {
|
|
||||||
return binding.setSheetOffset(window, offset)
|
|
||||||
},
|
|
||||||
|
|
||||||
showOpenDialog: function (...args) {
|
showOpenDialog: function (...args) {
|
||||||
var prop, properties, value, wrappedCallback
|
var prop, properties, value, wrappedCallback
|
||||||
checkAppInitialized()
|
checkAppInitialized()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue