aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gui/dialog.cpp6
-rw-r--r--gui/dialog.h2
-rw-r--r--gui/launcher.cpp2
-rw-r--r--gui/module.mk1
-rw-r--r--gui/newgui.cpp5
-rw-r--r--gui/object.cpp45
-rw-r--r--gui/object.h3
7 files changed, 51 insertions, 13 deletions
diff --git a/gui/dialog.cpp b/gui/dialog.cpp
index 1fdf872665..e48602a95f 100644
--- a/gui/dialog.cpp
+++ b/gui/dialog.cpp
@@ -323,7 +323,7 @@ Widget *Dialog::findWidget(const char *name) {
return Widget::findWidgetInChain(_firstWidget, name);
}
-void Dialog::deleteWidget(Widget *del) {
+void Dialog::removeWidget(Widget *del) {
if (del == _mouseWidget)
_mouseWidget = NULL;
if (del == _focusedWidget)
@@ -362,8 +362,4 @@ ButtonWidget *Dialog::addButton(GuiObject *boss, int x, int y, const Common::Str
return new ButtonWidget(boss, x, y, w, h, label, cmd, hotkey);
}
-uint32 GuiObject::getMillis() {
- return g_system->getMillis();
-}
-
} // End of namespace GUI
diff --git a/gui/dialog.h b/gui/dialog.h
index f418772ef0..7fe33fe3f4 100644
--- a/gui/dialog.h
+++ b/gui/dialog.h
@@ -82,7 +82,7 @@ protected:
Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
Widget *findWidget(const char *name);
- void deleteWidget(Widget *widget);
+ void removeWidget(Widget *widget);
ButtonWidget *addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey);
diff --git a/gui/launcher.cpp b/gui/launcher.cpp
index 3a3527523f..4649eda5c4 100644
--- a/gui/launcher.cpp
+++ b/gui/launcher.cpp
@@ -892,7 +892,7 @@ void LauncherDialog::reflowLayout() {
}
if (_logo) {
- deleteWidget(_logo);
+ removeWidget(_logo);
_logo->setNext(0);
delete _logo;
_logo = 0;
diff --git a/gui/module.mk b/gui/module.mk
index b352a1ec86..4e93e6b5b3 100644
--- a/gui/module.mk
+++ b/gui/module.mk
@@ -15,6 +15,7 @@ MODULE_OBJS := \
massadd.o \
message.o \
newgui.o \
+ object.o \
options.o \
PopUpWidget.o \
ScrollBarWidget.o \
diff --git a/gui/newgui.cpp b/gui/newgui.cpp
index 6e941dd787..cc63d39692 100644
--- a/gui/newgui.cpp
+++ b/gui/newgui.cpp
@@ -54,11 +54,6 @@ enum {
kKeyRepeatSustainDelay = 100
};
-// HACK. FIXME. This doesn't belong here. But otherwise it creates compilation problems
-GuiObject::GuiObject(const Common::String &name) : _firstWidget(0) {
- _name = name;
-}
-
void GuiObject::reflowLayout() {
if (!_name.empty()) {
if ((_x = g_gui.evaluator()->getVar(_name + ".x")) == EVAL_UNDEF_VAR)
diff --git a/gui/object.cpp b/gui/object.cpp
new file mode 100644
index 0000000000..c93ee4bc9a
--- /dev/null
+++ b/gui/object.cpp
@@ -0,0 +1,45 @@
+/* ScummVM - Scumm Interpreter
+ * Copyright (C) 2002-2007 The ScummVM project
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ * $URL$
+ * $Id$
+ */
+
+#include "common/stdafx.h"
+#include "common/system.h"
+#include "gui/object.h"
+#include "gui/widget.h"
+
+namespace GUI {
+
+GuiObject::GuiObject(const Common::String &name) : _firstWidget(0) {
+ _name = name;
+}
+
+GuiObject::~GuiObject() {
+/* TODO: Enable this at some point? Right now it causes crashes
+ delete _firstWidget;
+ _firstWidget = 0;
+*/
+}
+
+uint32 GuiObject::getMillis() {
+ return g_system->getMillis();
+}
+
+
+} // End of namespace GUI
diff --git a/gui/object.h b/gui/object.h
index f6702921a1..bc87ad65ec 100644
--- a/gui/object.h
+++ b/gui/object.h
@@ -1,5 +1,5 @@
/* ScummVM - Scumm Interpreter
- * Copyright (C) 2002-2006 The ScummVM project
+ * Copyright (C) 2002-2007 The ScummVM project
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@@ -66,6 +66,7 @@ protected:
public:
GuiObject(int x, int y, int w, int h) : _x(x), _y(y), _w(w), _h(h), _name(""), _firstWidget(0) { }
GuiObject(const Common::String &name);
+ ~GuiObject();
virtual int16 getAbsX() const { return _x; }
virtual int16 getAbsY() const { return _y; }