diff options
| author | Max Horn | 2003-11-01 21:15:33 +0000 | 
|---|---|---|
| committer | Max Horn | 2003-11-01 21:15:33 +0000 | 
| commit | 72bee75297bb42703c5825027cd3a4c11dd9347a (patch) | |
| tree | 690e8f374bf4ff0b7b9b4f3fe3e8c93e3ac1ea66 | |
| parent | f7ab7f62075107a8afbc071555b25612320664b9 (diff) | |
| download | scummvm-rg350-72bee75297bb42703c5825027cd3a4c11dd9347a.tar.gz scummvm-rg350-72bee75297bb42703c5825027cd3a4c11dd9347a.tar.bz2 scummvm-rg350-72bee75297bb42703c5825027cd3a4c11dd9347a.zip | |
modified MessageDialog to allow for custom button texts
svn-id: r11034
| -rw-r--r-- | gui/message.cpp | 16 | ||||
| -rw-r--r-- | gui/message.h | 2 | ||||
| -rw-r--r-- | scumm/resource.cpp | 1 | ||||
| -rw-r--r-- | scumm/scummvm.cpp | 2 | 
4 files changed, 10 insertions, 11 deletions
| diff --git a/gui/message.cpp b/gui/message.cpp index 8c6f8c30ec..830c790668 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -29,7 +29,7 @@ enum {  	kCancelCmd = 'CNCL'  }; -MessageDialog::MessageDialog(NewGui *gui, const String &message, bool showOkButton, bool showCancelButton) +MessageDialog::MessageDialog(NewGui *gui, const String &message, const char *defaultButton, const char *altButton)  	: Dialog(gui, 30, 20, 260, 124) {  	// First, determine the size the dialog needs. For this we have to break  	// down the string into lines, and taking the maximum of their widths. @@ -60,7 +60,7 @@ MessageDialog::MessageDialog(NewGui *gui, const String &message, bool showOkButt  	_w = maxlineWidth + 20;  	lineCount = lines.size();  	_h = lineCount * kLineHeight + 16; -	if (showOkButton || showCancelButton) +	if (defaultButton || altButton)  		_h += 24;  	if (_h > 180) { @@ -77,18 +77,18 @@ MessageDialog::MessageDialog(NewGui *gui, const String &message, bool showOkButt  	// FIXME - allow for multiple buttons, and return in runModal() which one  	// was selected. -	if (showOkButton && showCancelButton) {  +	if (defaultButton && altButton) {   		okButtonPos = (_w - (kButtonWidth * 2))/2;  		cancelButtonPos = ((_w - (kButtonWidth * 2))/2) + kButtonWidth + 10;  	} else {  		okButtonPos = cancelButtonPos = (_w-kButtonWidth)/2;  	} -	if (showOkButton) -		addButton(okButtonPos, _h - 24, "OK", kOkCmd, '\n');	// Confirm dialog +	if (defaultButton) +		addButton(okButtonPos, _h - 24, defaultButton, kOkCmd, '\n');	// Confirm dialog -	if (showCancelButton) -		addButton(cancelButtonPos, _h - 24, "CANCEL", kCancelCmd, '\27');	// Cancel dialog +	if (altButton) +		addButton(cancelButtonPos, _h - 24, altButton, kCancelCmd, '\27');	// Cancel dialog  }  int MessageDialog::addLine(StringList &lines, const char *line, int size) { @@ -149,7 +149,7 @@ void MessageDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data  }  TimedMessageDialog::TimedMessageDialog(NewGui *gui, const Common::String &message, uint32 timer) -	: MessageDialog(gui, message, false, false) { +	: MessageDialog(gui, message, 0, 0) {  	_timer = _gui->get_time() + timer;  } diff --git a/gui/message.h b/gui/message.h index 8635d08245..42879b84eb 100644 --- a/gui/message.h +++ b/gui/message.h @@ -32,7 +32,7 @@ class MessageDialog : public Dialog {  	typedef Common::String String;  	typedef Common::StringList StringList;  public: -	MessageDialog(NewGui *gui, const Common::String &message, bool showOKButton = true, bool showCancelButton = false); +	MessageDialog(NewGui *gui, const Common::String &message, const char *defaultButton = "OK", const char *altButton = 0);  	void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); diff --git a/scumm/resource.cpp b/scumm/resource.cpp index b3be071cee..a15585c298 100644 --- a/scumm/resource.cpp +++ b/scumm/resource.cpp @@ -23,7 +23,6 @@  #include "stdafx.h"  #include "common/map.h"  #include "common/str.h" -#include "gui/message.h"  #include "scumm/bundle.h"  #include "scumm/dialogs.h"  #include "scumm/imuse.h" diff --git a/scumm/scummvm.cpp b/scumm/scummvm.cpp index 306016ccde..50a694a130 100644 --- a/scumm/scummvm.cpp +++ b/scumm/scummvm.cpp @@ -2496,7 +2496,7 @@ char ScummEngine::displayError(bool showCancel, const char *message, ...) {  	vsprintf(buf, message, va);  	va_end(va); -	MessageDialog dialog(_newgui, buf, true, showCancel); +	MessageDialog dialog(_newgui, buf, "OK", "Cancel");  	return runDialog(dialog);  } | 
