aboutsummaryrefslogtreecommitdiff
path: root/gui
diff options
context:
space:
mode:
Diffstat (limited to 'gui')
-rw-r--r--gui/dialog.cpp25
-rw-r--r--gui/dialog.h4
2 files changed, 21 insertions, 8 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index c2b96fe824..82a98085a0 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -57,6 +57,24 @@ void Dialog::teardownScreenBuf()
}
}
+void Dialog::open()
+{
+ _gui->openDialog(this);
+}
+
+void Dialog::close()
+{
+ if (_mouseWidget) {
+ _mouseWidget->handleMouseLeft(0);
+ _mouseWidget = 0;
+ }
+ if (_focusedWidget) {
+ _focusedWidget->lostFocus();
+ _focusedWidget = 0;
+ }
+ _gui->closeTopDialog();
+}
+
void Dialog::draw()
{
Widget *w = _firstWidget;
@@ -220,13 +238,6 @@ Widget *Dialog::findWidget(int x, int y)
return w;
}
-void Dialog::close()
-{
- _mouseWidget = 0;
- _focusedWidget = 0;
- _gui->closeTopDialog();
-}
-
void Dialog::addResText(int x, int y, int w, int h, int resID)
{
// Get the string
diff --git a/gui/dialog.h b/gui/dialog.h
index 63b1544950..45deb91f3f 100644
--- a/gui/dialog.h
+++ b/gui/dialog.h
@@ -54,6 +54,9 @@ public:
{}
virtual ~Dialog();
+ virtual void open();
+ virtual void close();
+
virtual void draw();
virtual void handleTickle(); // Called periodically (in every guiloop() )
@@ -71,7 +74,6 @@ public:
protected:
Widget* findWidget(int x, int y); // Find the widget at pos x,y if any
- void close();
void addResText(int x, int y, int w, int h, int resID);
void addButton(int x, int y, int w, int h, const char *label, uint32 cmd, char hotkey);