aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
authorMax Horn2002-07-07 21:46:53 +0000
committerMax Horn2002-07-07 21:46:53 +0000
commit2b50e2a7c0d6ed250a4b58fa0fa1bf18c458d091 (patch)
tree21d2206732b1c818858a160a23d3dee8ae8762fd /gui
parentaec25305294920da84a7d0721a2fd4e7f2547c74 (diff)
downloadscummvm-rg350-2b50e2a7c0d6ed250a4b58fa0fa1bf18c458d091.tar.gz
scummvm-rg350-2b50e2a7c0d6ed250a4b58fa0fa1bf18c458d091.tar.bz2
scummvm-rg350-2b50e2a7c0d6ed250a4b58fa0fa1bf18c458d091.zip
added dialog nesting code (for now using std::stack, I will provide my own stack class later
svn-id: r4483
Diffstat (limited to 'gui')
-rw-r--r--gui/dialog.cpp12
-rw-r--r--gui/widget.cpp8
-rw-r--r--gui/widget.h4
3 files changed, 12 insertions, 12 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index 4523e473cd..36694ab8ff 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -74,11 +74,7 @@ Widget *Dialog::findWidget(int x, int y)
void Dialog::close()
{
- // FIXME - this code should be inside the Gui class, and should be
- // extended to support nested dialogs.
- _gui->restoreState();
- _gui->_active = false;
- _gui->_activeDialog = 0;
+ _gui->closeTopDialog();
}
void Dialog::addResText(int x, int y, int w, int h, int resID)
@@ -116,7 +112,7 @@ enum {
};
SaveLoadDialog::SaveLoadDialog(NewGui *gui)
-:Dialog (gui, 30, 20, 260, 124)
+ : Dialog (gui, 30, 20, 260, 124)
{
addResText(10, 7, 240, 16, 1);
// addResText(10, 7, 240, 16, 2);
@@ -135,6 +131,8 @@ void SaveLoadDialog::handleCommand(uint32 cmd)
case kSaveCmd:
break;
case kLoadCmd:
+ // FIXME HACK - just to demo the nesting ability
+ _gui->pauseDialog();
break;
case kPlayCmd:
close();
@@ -152,7 +150,7 @@ void SaveLoadDialog::handleCommand(uint32 cmd)
PauseDialog::PauseDialog(NewGui *gui)
-:Dialog (gui, 50, 80, 220, 16)
+ : Dialog (gui, 50, 80, 220, 16)
{
addResText(2, 2, 220, 16, 10);
}
diff --git a/gui/widget.cpp b/gui/widget.cpp
index 8384089541..0fbcfd20ba 100644
--- a/gui/widget.cpp
+++ b/gui/widget.cpp
@@ -25,7 +25,7 @@
Widget::Widget (Dialog *boss, int x, int y, int w, int h)
-: _boss(boss), _x(x), _y(y), _w(w), _h(h), _id(0), _flags(0)
+ : _boss(boss), _x(x), _y(y), _w(w), _h(h), _id(0), _flags(0)
{
// Insert into the widget list of the boss
_next = _boss->_firstWidget;
@@ -51,6 +51,7 @@ void Widget::draw()
_x += 4;
_y += 4;
}
+
// Now perform the actual widget draw
drawWidget(_flags & WIDGET_HILITED);
@@ -58,6 +59,7 @@ void Widget::draw()
_x -= 4;
_y -= 4;
}
+
// Restore x/y
_x -= _boss->_x;
_y -= _boss->_y;
@@ -68,7 +70,7 @@ void Widget::draw()
StaticTextWidget::StaticTextWidget(Dialog *boss, int x, int y, int w, int h, const char *text)
-:Widget (boss, x, y, w, h)
+ : Widget (boss, x, y, w, h)
{
// FIXME - maybe we should make a real copy of the string?
_text = text;
@@ -85,7 +87,7 @@ void StaticTextWidget::drawWidget(bool hilite)
ButtonWidget::ButtonWidget(Dialog *boss, int x, int y, int w, int h, const char *label, uint32 cmd)
-:StaticTextWidget(boss, x, y, w, h, label), _cmd(cmd), _hotkey(0)
+ : StaticTextWidget(boss, x, y, w, h, label), _cmd(cmd), _hotkey(0)
{
_flags = WIDGET_ENABLED | WIDGET_BORDER /* | WIDGET_CLEARBG */ ;
}
diff --git a/gui/widget.h b/gui/widget.h
index ec83d723ad..58e04d48a9 100644
--- a/gui/widget.h
+++ b/gui/widget.h
@@ -87,8 +87,8 @@ public:
uint32 getCmd();
void handleClick(int button);
- void handleMouseEntered(int button) { printf("handleMouseEntered\n"); setFlags(WIDGET_HILITED); draw(); }
- void handleMouseLeft(int button) { printf("handleMouseLeft\n"); clearFlags(WIDGET_HILITED); draw(); }
+ void handleMouseEntered(int button) { setFlags(WIDGET_HILITED); draw(); }
+ void handleMouseLeft(int button) { clearFlags(WIDGET_HILITED); draw(); }
};