[Scummvm-cvs-logs] CVS: scummvm/gui message.cpp,1.10,1.11 message.h,1.6,1.7
Max Horn
fingolfin at users.sourceforge.net
Sat Nov 1 12:53:19 CET 2003
Update of /cvsroot/scummvm/scummvm/gui
In directory sc8-pr-cvs1:/tmp/cvs-serv23378/gui
Modified Files:
message.cpp message.h
Log Message:
cleanup: new MessageDialog subclass TimedMessageDialog
Index: message.cpp
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/message.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- message.cpp 6 Mar 2003 21:45:42 -0000 1.10
+++ message.cpp 1 Nov 2003 20:52:41 -0000 1.11
@@ -19,15 +19,17 @@
*/
#include "stdafx.h"
-#include "message.h"
-#include "newgui.h"
+#include "gui/message.h"
+#include "gui/newgui.h"
+#include "common/str.h"
+#include "common/list.h"
enum {
kOkCmd = 'OK ',
kCancelCmd = 'CNCL'
};
-MessageDialog::MessageDialog(NewGui *gui, const String &message, uint32 timer, bool showOkButton, bool showCancelButton)
+MessageDialog::MessageDialog(NewGui *gui, const String &message, bool showOkButton, bool showCancelButton)
: 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.
@@ -87,17 +89,6 @@
if (showCancelButton)
addButton(cancelButtonPos, _h - 24, "CANCEL", kCancelCmd, '\27'); // Cancel dialog
-
- if (timer)
- _timer = _gui->get_time() + timer;
- else
- _timer = 0;
-}
-
-void MessageDialog::handleTickle() {
- Dialog::handleTickle();
- if (_timer && _gui->get_time() > _timer)
- close();
}
int MessageDialog::addLine(StringList &lines, const char *line, int size) {
@@ -157,3 +148,13 @@
}
}
+TimedMessageDialog::TimedMessageDialog(NewGui *gui, const Common::String &message, uint32 timer)
+ : MessageDialog(gui, message, false, false) {
+ _timer = _gui->get_time() + timer;
+}
+
+void TimedMessageDialog::handleTickle() {
+ MessageDialog::handleTickle();
+ if (_gui->get_time() > _timer)
+ close();
+}
Index: message.h
===================================================================
RCS file: /cvsroot/scummvm/scummvm/gui/message.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- message.h 2 Oct 2003 17:43:02 -0000 1.6
+++ message.h 1 Nov 2003 20:52:41 -0000 1.7
@@ -21,23 +21,34 @@
#ifndef MESSAGE_DIALOG_H
#define MESSAGE_DIALOG_H
-#include "dialog.h"
-#include "common/str.h"
-#include "common/list.h"
+#include "gui/dialog.h"
+
+namespace Common {
+ class String;
+ class StringList;
+}
class MessageDialog : public Dialog {
typedef Common::String String;
typedef Common::StringList StringList;
public:
- MessageDialog(NewGui *gui, const String &message, uint32 timer = 0, bool showOKButton = true, bool showCancelButton = false);
-
- void handleTickle();
+ MessageDialog(NewGui *gui, const Common::String &message, bool showOKButton = true, bool showCancelButton = false);
+
void handleCommand(CommandSender *sender, uint32 cmd, uint32 data);
protected:
- uint32 _timer;
+ int addLine(Common::StringList &lines, const char *line, int size);
+};
- int addLine(StringList &lines, const char *line, int size);
+class TimedMessageDialog : public MessageDialog {
+public:
+ TimedMessageDialog(NewGui *gui, const Common::String &message, uint32 timer);
+
+ void handleTickle();
+
+protected:
+ uint32 _timer;
};
+
#endif
More information about the Scummvm-git-logs
mailing list