🍎 add default button index for osx

This commit is contained in:
leethomas 2016-01-07 20:46:45 -08:00
parent 5514e89276
commit f1edd5f26f
4 changed files with 28 additions and 9 deletions

View file

@ -41,6 +41,7 @@ namespace {
void ShowMessageBox(int type,
const std::vector<std::string>& buttons,
int default_button_index,
int cancel_id,
int options,
const std::string& title,
@ -54,11 +55,11 @@ void ShowMessageBox(int type,
if (mate::Converter<atom::MessageBoxCallback>::FromV8(args->isolate(),
peek,
&callback)) {
atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons, cancel_id,
options, title, message, detail, icon, callback);
atom::ShowMessageBox(window, (atom::MessageBoxType)type, buttons, default_button_index,
cancel_id, options, title, message, detail, icon, callback);
} else {
int chosen = atom::ShowMessageBox(window, (atom::MessageBoxType)type,
buttons, cancel_id, options, title,
buttons, default_button_index, cancel_id, options, title,
message, detail, icon);
args->Return(chosen);
}

View file

@ -91,10 +91,11 @@ module.exports =
throw new TypeError('Buttons need to be array') unless Array.isArray options.buttons
options.title ?= ''
options.message ?= ''
options.detail ?= ''
options.icon ?= null
options.title ?= ''
options.message ?= ''
options.detail ?= ''
options.icon ?= null
options.defaultButtonIndex ?= -1
# Choose a default button to get selected when dialog is cancelled.
unless options.cancelId?
@ -108,6 +109,7 @@ module.exports =
binding.showMessageBox messageBoxType,
options.buttons,
options.defaultButtonIndex,
options.cancelId,
flags,
options.title,