diff options
Diffstat (limited to 'gui/widgets')
-rw-r--r-- | gui/widgets/list.cpp | 10 | ||||
-rw-r--r-- | gui/widgets/scrollcontainer.cpp | 8 | ||||
-rw-r--r-- | gui/widgets/scrollcontainer.h | 3 | ||||
-rw-r--r-- | gui/widgets/tab.cpp | 7 | ||||
-rw-r--r-- | gui/widgets/tab.h | 3 |
5 files changed, 18 insertions, 13 deletions
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp index 3ef365ba5c..9144282e65 100644 --- a/gui/widgets/list.cpp +++ b/gui/widgets/list.cpp @@ -36,10 +36,7 @@ namespace GUI { ListWidget::ListWidget(Dialog *boss, const String &name, const char *tooltip, uint32 cmd) : EditableWidget(boss, name, tooltip), _cmd(cmd) { - _scrollBar = NULL; - - // This ensures that _entriesPerPage is properly initialized. - reflowLayout(); + _entriesPerPage = 0; _scrollBar = new ScrollBarWidget(this, _w - _scrollBarWidth, 0, _scrollBarWidth, _h); _scrollBar->setTarget(this); @@ -69,10 +66,7 @@ ListWidget::ListWidget(Dialog *boss, const String &name, const char *tooltip, ui ListWidget::ListWidget(Dialog *boss, int x, int y, int w, int h, const char *tooltip, uint32 cmd) : EditableWidget(boss, x, y, w, h, tooltip), _cmd(cmd) { - _scrollBar = NULL; - - // This ensures that _entriesPerPage is properly initialized. - reflowLayout(); + _entriesPerPage = 0; _scrollBar = new ScrollBarWidget(this, _w - _scrollBarWidth, 0, _scrollBarWidth, _h); _scrollBar->setTarget(this); diff --git a/gui/widgets/scrollcontainer.cpp b/gui/widgets/scrollcontainer.cpp index c136c57a81..e0680e123b 100644 --- a/gui/widgets/scrollcontainer.cpp +++ b/gui/widgets/scrollcontainer.cpp @@ -33,8 +33,8 @@ ScrollContainerWidget::ScrollContainerWidget(GuiObject *boss, int x, int y, int init(); } -ScrollContainerWidget::ScrollContainerWidget(GuiObject *boss, const Common::String &name, uint32 reflowCmd) - : Widget(boss, name), CommandSender(nullptr), _reflowCmd(reflowCmd) { +ScrollContainerWidget::ScrollContainerWidget(GuiObject *boss, const Common::String &name, const Common::String &dialogName, uint32 reflowCmd) + : Widget(boss, name), CommandSender(nullptr), _reflowCmd(reflowCmd), _dialogName(dialogName) { init(); } @@ -119,6 +119,10 @@ void ScrollContainerWidget::handleCommand(CommandSender *sender, uint32 cmd, uin void ScrollContainerWidget::reflowLayout() { Widget::reflowLayout(); + if (!_dialogName.empty()) { + g_gui.xmlEval()->reflowDialogLayout(_dialogName, _firstWidget); + } + //reflow layout of inner widgets Widget *ptr = _firstWidget; while (ptr) { diff --git a/gui/widgets/scrollcontainer.h b/gui/widgets/scrollcontainer.h index c034cab4fd..fd8db765a3 100644 --- a/gui/widgets/scrollcontainer.h +++ b/gui/widgets/scrollcontainer.h @@ -35,12 +35,13 @@ class ScrollContainerWidget: public Widget, public CommandSender { uint16 _limitH; uint32 _reflowCmd; ThemeEngine::DialogBackground _backgroundType; + Common::String _dialogName; void recalc(); public: ScrollContainerWidget(GuiObject *boss, int x, int y, int w, int h, uint32 reflowCmd = 0); - ScrollContainerWidget(GuiObject *boss, const Common::String &name, uint32 reflowCmd = 0); + ScrollContainerWidget(GuiObject *boss, const Common::String &name, const Common::String &dialogName, uint32 reflowCmd = 0); ~ScrollContainerWidget() override; void init(); diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp index d373bc9222..1ca61565aa 100644 --- a/gui/widgets/tab.cpp +++ b/gui/widgets/tab.cpp @@ -104,10 +104,11 @@ uint16 TabWidget::getHeight() const { return _h + _tabHeight; } -int TabWidget::addTab(const String &title) { +int TabWidget::addTab(const String &title, const String &dialogName) { // Add a new tab page Tab newTab; newTab.title = title; + newTab.dialogName = dialogName; newTab.firstWidget = 0; // Determine the new tab width @@ -300,6 +301,10 @@ void TabWidget::reflowLayout() { _tabs[_activeTab].firstWidget = _firstWidget; for (uint i = 0; i < _tabs.size(); ++i) { + if (!_tabs[i].dialogName.empty()) { + g_gui.xmlEval()->reflowDialogLayout(_tabs[i].dialogName, _tabs[i].firstWidget); + } + Widget *w = _tabs[i].firstWidget; while (w) { w->reflowLayout(); diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h index 8411509bd0..1aa9ded031 100644 --- a/gui/widgets/tab.h +++ b/gui/widgets/tab.h @@ -38,6 +38,7 @@ class TabWidget : public Widget { typedef Common::String String; struct Tab { String title; + String dialogName; Widget *firstWidget; int _tabWidth; }; @@ -73,7 +74,7 @@ public: * Add a new tab with the given title. Returns a unique ID which can be used * to identify the tab (to remove it / activate it etc.). */ - int addTab(const String &title); + int addTab(const String &title, const String &dialogName); /** * Remove the tab with the given tab ID. Disposes all child widgets of that tab. |