Allow sheets to be attached at a custom offset #4679

Adds a new "setSheetOffset" API to the `dialog` module, which allows you to change the attachment point for sheets on Mac OS X. I put the API on the dialog module, even though Mac OS X requires that the native window hold and return the desired offset.

1. I was originally hoping to make this an argument on the actual dialog.show* calls, but it seems the parameter set is defined in `libchromiumcontent` and I wasn't sure it would be appropriate to add there?

2.  The API could also be on the BrowserWindow (eg `BrowserWindow.setSheetOffset`). I don't have a strong preference, but I think it's more discoverable on the `dialog` module.
This commit is contained in:
Ben Gotow 2016-03-26 18:12:25 -07:00
parent 8d08c3241d
commit c87c49f4c8
6 changed files with 54 additions and 5 deletions

View file

@ -49,7 +49,11 @@ var checkAppInitialized = function () {
}
module.exports = {
showOpenDialog: function (...args) {
setSheetOffset: function(window, offset) {
return binding.setSheetOffset(window, offset)
},
showOpenDialog: function(...args) {
var prop, properties, value, wrappedCallback
checkAppInitialized()
let [window, options, callback] = parseArgs.apply(null, args)