electron/shell/browser/ui/message_box.h

63 lines
1.5 KiB
C
Raw Normal View History

// Copyright (c) 2013 GitHub, Inc.
2014-04-25 09:49:37 +00:00
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
2019-06-19 20:56:58 +00:00
#ifndef SHELL_BROWSER_UI_MESSAGE_BOX_H_
#define SHELL_BROWSER_UI_MESSAGE_BOX_H_
#include <string>
#include <utility>
#include <vector>
#include "base/callback_forward.h"
#include "ui/gfx/image/image_skia.h"
2015-01-05 23:08:42 +00:00
namespace electron {
2013-06-07 07:59:12 +00:00
class NativeWindow;
enum class MessageBoxType {
kNone = 0,
kInformation,
kWarning,
kError,
kQuestion,
};
using DialogResult = std::pair<int, bool>;
struct MessageBoxSettings {
electron::NativeWindow* parent_window = nullptr;
MessageBoxType type = electron::MessageBoxType::kNone;
std::vector<std::string> buttons;
int default_id;
int cancel_id;
bool no_link = false;
std::string title;
std::string message;
std::string detail;
std::string checkbox_label;
bool checkbox_checked = false;
gfx::ImageSkia icon;
MessageBoxSettings();
MessageBoxSettings(const MessageBoxSettings&);
~MessageBoxSettings();
};
int ShowMessageBoxSync(const MessageBoxSettings& settings);
typedef base::OnceCallback<void(int code, bool checkbox_checked)>
MessageBoxCallback;
void ShowMessageBox(const MessageBoxSettings& settings,
MessageBoxCallback callback);
2014-11-05 08:04:39 +00:00
// Like ShowMessageBox with simplest settings, but safe to call at very early
// stage of application.
void ShowErrorBox(const std::u16string& title, const std::u16string& content);
2014-11-05 08:04:39 +00:00
} // namespace electron
2019-06-19 20:56:58 +00:00
#endif // SHELL_BROWSER_UI_MESSAGE_BOX_H_