mirror of
https://github.com/libretro/scummvm.git
synced 2025-01-31 07:53:36 +00:00
GUI: Make container widget a bit more container like.
Now it is possible to add sub widgets to a ContainerWidget and allow for these to get events too.
This commit is contained in:
parent
049e61b445
commit
0cf00ddfe2
@ -711,6 +711,26 @@ ContainerWidget::ContainerWidget(GuiObject *boss, const Common::String &name) :
|
|||||||
_type = kContainerWidget;
|
_type = kContainerWidget;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ContainerWidget::~ContainerWidget() {
|
||||||
|
// We also remove the widget from the boss to avoid segfaults, when the
|
||||||
|
// deleted widget is an active widget in the boss.
|
||||||
|
for (Widget *w = _firstWidget; w; w = w->next()) {
|
||||||
|
_boss->removeWidget(w);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Widget *ContainerWidget::findWidget(int x, int y) {
|
||||||
|
return findWidgetInChain(_firstWidget, x, y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ContainerWidget::removeWidget(Widget *widget) {
|
||||||
|
// We also remove the widget from the boss to avoid a reference to a
|
||||||
|
// widget not in the widget chain anymore.
|
||||||
|
_boss->removeWidget(widget);
|
||||||
|
|
||||||
|
Widget::removeWidget(widget);
|
||||||
|
}
|
||||||
|
|
||||||
void ContainerWidget::drawWidget() {
|
void ContainerWidget::drawWidget() {
|
||||||
g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h), 0, ThemeEngine::kWidgetBackgroundBorder);
|
g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x + _w, _y + _h), 0, ThemeEngine::kWidgetBackgroundBorder);
|
||||||
}
|
}
|
||||||
|
@ -368,7 +368,10 @@ class ContainerWidget : public Widget {
|
|||||||
public:
|
public:
|
||||||
ContainerWidget(GuiObject *boss, int x, int y, int w, int h);
|
ContainerWidget(GuiObject *boss, int x, int y, int w, int h);
|
||||||
ContainerWidget(GuiObject *boss, const Common::String &name);
|
ContainerWidget(GuiObject *boss, const Common::String &name);
|
||||||
|
~ContainerWidget();
|
||||||
|
|
||||||
|
virtual Widget *findWidget(int x, int y);
|
||||||
|
virtual void removeWidget(Widget *widget);
|
||||||
protected:
|
protected:
|
||||||
void drawWidget();
|
void drawWidget();
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user