Make InfoDialog::setInfoText a bit more useful, by making it public & reusable

svn-id: r27050
This commit is contained in:
Max Horn 2007-06-02 12:01:09 +00:00
parent 8ca6751b21
commit f85871b1fc
2 changed files with 13 additions and 5 deletions

View File

@ -749,21 +749,28 @@ void HelpDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {
InfoDialog::InfoDialog(ScummEngine *scumm, int res) InfoDialog::InfoDialog(ScummEngine *scumm, int res)
: ScummDialog("scummDummyDialog"), _vm(scumm) { // dummy x and w : ScummDialog("scummDummyDialog"), _vm(scumm) { // dummy x and w
setInfoText(queryResString(res));
_message = queryResString(res);
// Width and height are dummy
_text = new StaticTextWidget(this, 4, 4, 10, 10, _message, kTextAlignCenter);
} }
InfoDialog::InfoDialog(ScummEngine *scumm, const String& message) InfoDialog::InfoDialog(ScummEngine *scumm, const String& message)
: ScummDialog("scummDummyDialog"), _vm(scumm) { // dummy x and w : ScummDialog("scummDummyDialog"), _vm(scumm) { // dummy x and w
setInfoText(message);
}
void InfoDialog::setInfoText(const String& message) {
_message = message; _message = message;
// Width and height are dummy // Width and height are dummy
_text = new StaticTextWidget(this, 4, 4, 10, 10, _message, kTextAlignCenter); _text = new StaticTextWidget(this, 4, 4, 10, 10, _message, kTextAlignCenter);
} }
void InfoDialog::setInfoText(const String& message) {
_message = message;
_text->setLabel(_message);
//reflowLayout(); // FIXME: Should we call this here? Depends on the usage patterns, I guess...
}
void InfoDialog::reflowLayout() { void InfoDialog::reflowLayout() {
const int screenW = g_system->getOverlayWidth(); const int screenW = g_system->getOverlayWidth();
const int screenH = g_system->getOverlayHeight(); const int screenH = g_system->getOverlayHeight();

View File

@ -165,6 +165,8 @@ public:
// from resources // from resources
InfoDialog(ScummEngine *scumm, int res); InfoDialog(ScummEngine *scumm, int res);
void setInfoText(const String& message);
virtual void handleMouseDown(int x, int y, int button, int clickCount) { virtual void handleMouseDown(int x, int y, int button, int clickCount) {
setResult(0); setResult(0);
close(); close();
@ -177,7 +179,6 @@ public:
virtual void reflowLayout(); virtual void reflowLayout();
protected: protected:
void setInfoText (const String& message);
// Query a string from the resources // Query a string from the resources
const String queryResString(int stringno); const String queryResString(int stringno);