Added new file gui/object.cpp (collecting GuiObject methods in there), and renamed Dialog::deleteWidget to Dialog::removeWidget (name was misleading, the removed object does *not* get deleted)
svn-id: r26147
This commit is contained in:
parent
5c91a361c7
commit
a73c6c3670
7 changed files with 51 additions and 13 deletions
|
@ -323,7 +323,7 @@ Widget *Dialog::findWidget(const char *name) {
|
||||||
return Widget::findWidgetInChain(_firstWidget, name);
|
return Widget::findWidgetInChain(_firstWidget, name);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Dialog::deleteWidget(Widget *del) {
|
void Dialog::removeWidget(Widget *del) {
|
||||||
if (del == _mouseWidget)
|
if (del == _mouseWidget)
|
||||||
_mouseWidget = NULL;
|
_mouseWidget = NULL;
|
||||||
if (del == _focusedWidget)
|
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);
|
return new ButtonWidget(boss, x, y, w, h, label, cmd, hotkey);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32 GuiObject::getMillis() {
|
|
||||||
return g_system->getMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // End of namespace GUI
|
} // End of namespace GUI
|
||||||
|
|
|
@ -82,7 +82,7 @@ protected:
|
||||||
|
|
||||||
Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
|
Widget *findWidget(int x, int y); // Find the widget at pos x,y if any
|
||||||
Widget *findWidget(const char *name);
|
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);
|
ButtonWidget *addButton(GuiObject *boss, int x, int y, const Common::String &label, uint32 cmd, char hotkey);
|
||||||
|
|
||||||
|
|
|
@ -892,7 +892,7 @@ void LauncherDialog::reflowLayout() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_logo) {
|
if (_logo) {
|
||||||
deleteWidget(_logo);
|
removeWidget(_logo);
|
||||||
_logo->setNext(0);
|
_logo->setNext(0);
|
||||||
delete _logo;
|
delete _logo;
|
||||||
_logo = 0;
|
_logo = 0;
|
||||||
|
|
|
@ -15,6 +15,7 @@ MODULE_OBJS := \
|
||||||
massadd.o \
|
massadd.o \
|
||||||
message.o \
|
message.o \
|
||||||
newgui.o \
|
newgui.o \
|
||||||
|
object.o \
|
||||||
options.o \
|
options.o \
|
||||||
PopUpWidget.o \
|
PopUpWidget.o \
|
||||||
ScrollBarWidget.o \
|
ScrollBarWidget.o \
|
||||||
|
|
|
@ -54,11 +54,6 @@ enum {
|
||||||
kKeyRepeatSustainDelay = 100
|
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() {
|
void GuiObject::reflowLayout() {
|
||||||
if (!_name.empty()) {
|
if (!_name.empty()) {
|
||||||
if ((_x = g_gui.evaluator()->getVar(_name + ".x")) == EVAL_UNDEF_VAR)
|
if ((_x = g_gui.evaluator()->getVar(_name + ".x")) == EVAL_UNDEF_VAR)
|
||||||
|
|
45
gui/object.cpp
Normal file
45
gui/object.cpp
Normal file
|
@ -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
|
|
@ -1,5 +1,5 @@
|
||||||
/* ScummVM - Scumm Interpreter
|
/* 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
|
* This program is free software; you can redistribute it and/or
|
||||||
* modify it under the terms of the GNU General Public License
|
* modify it under the terms of the GNU General Public License
|
||||||
|
@ -66,6 +66,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
GuiObject(int x, int y, int w, int h) : _x(x), _y(y), _w(w), _h(h), _name(""), _firstWidget(0) { }
|
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(const Common::String &name);
|
||||||
|
~GuiObject();
|
||||||
|
|
||||||
virtual int16 getAbsX() const { return _x; }
|
virtual int16 getAbsX() const { return _x; }
|
||||||
virtual int16 getAbsY() const { return _y; }
|
virtual int16 getAbsY() const { return _y; }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue