GPU: Add Dummy Backend For Unsupported Platforms #110919
|
@ -267,6 +267,22 @@ class GHOST_SystemCocoa : public GHOST_System {
|
|||
*/
|
||||
GHOST_TSuccess handleKeyEvent(void *eventPtr);
|
||||
|
||||
/**
|
||||
* Show a system message box
|
||||
* \param title: The title of the message box.
|
||||
* \param message: The message to display.
|
||||
* \param help_label: Help button label.
|
||||
* \param continue_label: Continue button label.
|
||||
* \param link: An optional hyperlink.
|
||||
* \param dialog_options: Options how to display the message.
|
||||
*/
|
||||
virtual GHOST_TSuccess showMessageBox(const char *title,
|
||||
const char *message,
|
||||
const char *help_label,
|
||||
const char *continue_label,
|
||||
const char *link,
|
||||
GHOST_DialogOptions dialog_options) const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Initializes the system.
|
||||
|
|
|
@ -2013,3 +2013,44 @@ void GHOST_SystemCocoa::putClipboard(const char *buffer, bool selection) const
|
|||
[pasteBoard setString:textToCopy forType:NSPasteboardTypeString];
|
||||
}
|
||||
}
|
||||
|
||||
GHOST_TSuccess GHOST_SystemCocoa::showMessageBox(const char *title,
|
||||
const char *message,
|
||||
const char *help_label,
|
||||
const char *continue_label,
|
||||
const char *link,
|
||||
GHOST_DialogOptions dialog_options) const
|
||||
{
|
||||
@autoreleasepool {
|
||||
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
||||
Jeroen-Bakker marked this conversation as resolved
|
||||
NSString *titleString = [NSString stringWithCString:title];
|
||||
NSString *messageString = [NSString stringWithCString:message];
|
||||
NSString *continueString = [NSString stringWithCString:continue_label];
|
||||
NSString *helpString = [NSString stringWithCString:help_label];
|
||||
|
||||
if (dialog_options == GHOST_DialogError) {
|
||||
[alert setAlertStyle:NSAlertStyleCritical];
|
||||
}
|
||||
else if (dialog_options == GHOST_DialogWarning) {
|
||||
[alert setAlertStyle:NSAlertStyleWarning];
|
||||
}
|
||||
else {
|
||||
[alert setAlertStyle:NSAlertStyleInformational];
|
||||
}
|
||||
|
||||
[alert setMessageText:titleString];
|
||||
[alert setInformativeText:messageString];
|
||||
|
||||
[alert addButtonWithTitle:continueString];
|
||||
if (strlen(link)) {
|
||||
[alert addButtonWithTitle:helpString];
|
||||
}
|
||||
|
||||
NSModalResponse response = [alert runModal];
|
||||
if (response == NSAlertSecondButtonReturn) {
|
||||
NSString *linkString = [NSString stringWithCString:link];
|
||||
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:linkString]];
|
||||
}
|
||||
}
|
||||
return GHOST_kSuccess;
|
||||
}
|
||||
|
|
|
@ -2588,8 +2588,8 @@ GHOST_TSuccess GHOST_SystemWin32::showMessageBox(const char *title,
|
|||
config.pszWindowTitle = L"Blender";
|
||||
config.pszMainInstruction = title_16;
|
||||
config.pszContent = message_16;
|
||||
config.pButtons = (link) ? buttons : buttons + 1;
|
||||
config.cButtons = (link) ? 2 : 1;
|
||||
config.pButtons = strlen(link) ? buttons : buttons + 1;
|
||||
Jeroen-Bakker marked this conversation as resolved
Outdated
Clément Foucault
commented
`link` is documented as being optional so I would still check for nullptr before strlen.
|
||||
config.cButtons = strlen(link) ? 2 : 1;
|
||||
|
||||
TaskDialogIndirect(&config, &nButtonPressed, nullptr, nullptr);
|
||||
switch (nButtonPressed) {
|
||||
|
|
Loading…
Reference in New Issue
Nitpicky, but can we make this dialog a bit wider?
https://stackoverflow.com/a/26502127