diff options
| author | Max Horn | 2003-11-03 20:16:23 +0000 | 
|---|---|---|
| committer | Max Horn | 2003-11-03 20:16:23 +0000 | 
| commit | 3f1476788406b0dba63c5c1f315c87206b89a50a (patch) | |
| tree | 6b0af625d6090a73e28f65007f04da87a0b8d407 /gui/chooser.cpp | |
| parent | d2285e386fc555b0e2c02171e46eed8e4e120c0d (diff) | |
| download | scummvm-rg350-3f1476788406b0dba63c5c1f315c87206b89a50a.tar.gz scummvm-rg350-3f1476788406b0dba63c5c1f315c87206b89a50a.tar.bz2 scummvm-rg350-3f1476788406b0dba63c5c1f315c87206b89a50a.zip | |
Make ChooserDialog height & button label customizable; make its ListWidget available to the outside, to allow custom modifications (hack!); fixed bug where the cancel button didn't yield -1 as result
svn-id: r11110
Diffstat (limited to 'gui/chooser.cpp')
| -rw-r--r-- | gui/chooser.cpp | 17 | 
1 files changed, 9 insertions, 8 deletions
| diff --git a/gui/chooser.cpp b/gui/chooser.cpp index b62dabdd70..dbcde18441 100644 --- a/gui/chooser.cpp +++ b/gui/chooser.cpp @@ -27,23 +27,20 @@ enum {  	kChooseCmd = 'Chos'  }; -ChooserDialog::ChooserDialog(const String title, const StringList& list) -	: Dialog(8, 24, 320 -2 * 8, 141) { +ChooserDialog::ChooserDialog(const String &title, const StringList& list, const String &buttonLabel, int height) +	: Dialog(8, (200 - height) / 2, 320 -2 * 8, height) {  	// Headline -	new StaticTextWidget(this, 10, 8, _w - 2 * 10, kLineHeight, title, kTextAlignCenter); +	new StaticTextWidget(this, 10, 6, _w - 2 * 10, kLineHeight, title, kTextAlignCenter);  	// Add choice list -	_list = new ListWidget(this, 10, 22, _w - 2 * 10, _h - 22 - 24 - 10); +	_list = new ListWidget(this, 10, 18, _w - 2 * 10, _h - 14 - 24 - 10);  	_list->setNumberingMode(kListNumberingOff);  	_list->setList(list);  	// Buttons  	addButton(_w - 2 * (kButtonWidth + 10), _h - 24, "Cancel", kCloseCmd, 0); -	_chooseButton = addButton(_w-(kButtonWidth + 10), _h - 24, "Choose", kChooseCmd, 0); +	_chooseButton = addButton(_w-(kButtonWidth + 10), _h - 24, buttonLabel, kChooseCmd, 0);  	_chooseButton->setEnabled(false); - -	// Result = -1 -> no choice was made -	setResult(-1);  }  void ChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { @@ -58,6 +55,10 @@ void ChooserDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data  		_chooseButton->setEnabled(item >= 0);  		_chooseButton->draw();  		break; +	case kCloseCmd: +		setResult(-1); +		close(); +		break;  	default:  		Dialog::handleCommand(sender, cmd, data);  	} | 
