HUGO: Improve message boxes
- Use OK and YES/NO messages boxes when required - Empty messages are no longer displayed svn-id: r52960
This commit is contained in:
parent
7296a2d8d0
commit
cc69fa8297
1 changed files with 23 additions and 4 deletions
|
@ -100,12 +100,31 @@ char *Utils::Box(box_t dismiss, const char *s, ...) {
|
||||||
vsprintf(buffer, s, marker); // Format string into buffer
|
vsprintf(buffer, s, marker); // Format string into buffer
|
||||||
va_end(marker);
|
va_end(marker);
|
||||||
|
|
||||||
//Warn(false, "BOX: %s", buffer);
|
if (buffer[0] == '\0')
|
||||||
int boxTime = strlen(buffer) * 30;
|
return(NULL);
|
||||||
GUI::TimedMessageDialog dialog(buffer, MAX(1500, boxTime));
|
|
||||||
dialog.runModal();
|
|
||||||
|
|
||||||
|
switch(dismiss) {
|
||||||
|
case BOX_ANY:
|
||||||
|
case BOX_OK: {
|
||||||
|
GUI::MessageDialog dialog(buffer, "OK");
|
||||||
|
dialog.runModal();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOX_YESNO: {
|
||||||
|
GUI::MessageDialog dialog(buffer, "YES", "NO");
|
||||||
|
if (dialog.runModal() == GUI::kMessageOK)
|
||||||
|
return(buffer);
|
||||||
|
return 0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case BOX_PROMPT:
|
||||||
|
warning("Box: unhandled BOX_PROMPT");
|
||||||
|
int boxTime = strlen(buffer) * 30;
|
||||||
|
GUI::TimedMessageDialog dialog(buffer, MAX(1500, boxTime));
|
||||||
|
dialog.runModal();
|
||||||
// TODO: Some boxes (i.e. the combination code for the shed), needs to return an input.
|
// TODO: Some boxes (i.e. the combination code for the shed), needs to return an input.
|
||||||
|
}
|
||||||
|
|
||||||
return buffer;
|
return buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue