diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 1fdf8726653..e48602a95f2 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 f418772ef0e..7fe33fe3f49 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 3a3527523ff..4649eda5c42 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 b352a1ec863..4e93e6b5b38 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 6e941dd7875..cc63d39692f 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 00000000000..c93ee4bc9a4 --- /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 f6702921a10..bc87ad65ec0 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; }