From: Cheng Zhao Date: Wed, 8 Jul 2015 06:46:06 +0000 (+0800) Subject: Show icon according to dialog's type X-Git-Tag: v0.30.0~45^2~5 X-Git-Url: http://git.khamidou.com/?a=commitdiff_plain;h=6fb8b2ce4f79f3ebffe50704d2c9a78f28216ae8;p=electron.git Show icon according to dialog's type --- diff --git a/atom/browser/ui/message_box_win.cc b/atom/browser/ui/message_box_win.cc index f78dc39d..be2afb1a 100644 --- a/atom/browser/ui/message_box_win.cc +++ b/atom/browser/ui/message_box_win.cc @@ -22,6 +22,7 @@ namespace { const int kIDStart = 100; int ShowMessageBoxUTF16(HWND parent, + MessageBoxType type, const std::vector& buttons, int cancel_id, const base::string16& title, @@ -44,6 +45,19 @@ int ShowMessageBoxUTF16(HWND parent, config.pButtons = &dialog_buttons.front(); config.cButtons = dialog_buttons.size(); + // Show icon according to dialog's type. + switch (type) { + case MESSAGE_BOX_TYPE_INFORMATION: + config.pszMainIcon = TD_INFORMATION_ICON; + break; + case MESSAGE_BOX_TYPE_WARNING: + config.pszMainIcon = TD_WARNING_ICON; + break; + case MESSAGE_BOX_TYPE_ERROR: + config.pszMainIcon = TD_ERROR_ICON; + break; + } + // If "detail" is empty then don't make message hilighted. if (detail.empty()) { config.pszContent = message.c_str(); @@ -98,6 +112,7 @@ int ShowMessageBox(NativeWindow* parent, NativeWindow::DialogScope dialog_scope(parent); return ShowMessageBoxUTF16(hwnd_parent, + type, utf16_buttons, cancel_id, base::UTF8ToUTF16(title),