[Scummvm-cvs-logs] CVS: scummvm/gui message.cpp,1.11,1.12 message.h,1.7,1.8
Max Horn
fingolfin at users.sourceforge.net
Sat Nov 1 13:16:04 CET 2003
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv27556/gui
Modified Files:
message.cpp message.h
Log Message:
modified MessageDialog to allow for custom button texts
Index: message.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/message.cpp,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- message.cpp 1 Nov 2003 20:52:41 -0000 1.11
+++ message.cpp 1 Nov 2003 21:15:32 -0000 1.12
@@ -29,7 +29,7 @@
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 @@
_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 @@
// 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 @@
}
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;
}
Index: message.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/message.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- message.h 1 Nov 2003 20:52:41 -0000 1.7
+++ message.h 1 Nov 2003 21:15:32 -0000 1.8
@@ -32,7 +32,7 @@
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);
More information about the Scummvm-git-logs
mailing list