mirror of
https://github.com/electron/electron.git
synced 2026-04-10 03:01:51 -04:00
feat: add width option to dialog.showMessageBox() (#30474)
This commit is contained in:
@@ -38,6 +38,7 @@ struct MessageBoxSettings {
|
||||
std::string checkbox_label;
|
||||
bool checkbox_checked = false;
|
||||
gfx::ImageSkia icon;
|
||||
int text_width = 0;
|
||||
|
||||
MessageBoxSettings();
|
||||
MessageBoxSettings(const MessageBoxSettings&);
|
||||
|
||||
@@ -98,6 +98,12 @@ NSAlert* CreateNSAlert(const MessageBoxSettings& settings) {
|
||||
[alert setIcon:image];
|
||||
}
|
||||
|
||||
if (settings.text_width > 0) {
|
||||
NSRect rect = NSMakeRect(0, 0, settings.text_width, 0);
|
||||
NSView* accessoryView = [[NSView alloc] initWithFrame:rect];
|
||||
[alert setAccessoryView:[accessoryView autorelease]];
|
||||
}
|
||||
|
||||
return alert;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user