diff options
Diffstat (limited to 'gui/widgets')
-rw-r--r-- | gui/widgets/list.cpp | 6 | ||||
-rw-r--r-- | gui/widgets/list.h | 1 | ||||
-rw-r--r-- | gui/widgets/scrollcontainer.cpp | 6 | ||||
-rw-r--r-- | gui/widgets/scrollcontainer.h | 2 | ||||
-rw-r--r-- | gui/widgets/tab.cpp | 7 | ||||
-rw-r--r-- | gui/widgets/tab.h | 2 |
6 files changed, 24 insertions, 0 deletions
diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp index f6e5c67510..48d181e5ec 100644 --- a/gui/widgets/list.cpp +++ b/gui/widgets/list.cpp @@ -101,6 +101,12 @@ ListWidget::~ListWidget() { delete[] _textWidth; } +bool ListWidget::containsWidget(Widget *w) const { + if (w == _scrollBar || _scrollBar->containsWidget(w)) + return true; + return false; +} + Widget *ListWidget::findWidget(int x, int y) { if (x >= _w - _scrollBarWidth) return _scrollBar; diff --git a/gui/widgets/list.h b/gui/widgets/list.h index 1abb2b810e..44366be3e9 100644 --- a/gui/widgets/list.h +++ b/gui/widgets/list.h @@ -89,6 +89,7 @@ public: ListWidget(Dialog *boss, int x, int y, int w, int h, const char *tooltip = 0, uint32 cmd = 0); virtual ~ListWidget(); + virtual bool containsWidget(Widget *) const; virtual Widget *findWidget(int x, int y); void setList(const StringArray &list, const ColorList *colors = 0); diff --git a/gui/widgets/scrollcontainer.cpp b/gui/widgets/scrollcontainer.cpp index 9a7792730d..7c5ab6112c 100644 --- a/gui/widgets/scrollcontainer.cpp +++ b/gui/widgets/scrollcontainer.cpp @@ -144,6 +144,12 @@ void ScrollContainerWidget::drawWidget() { g_gui.theme()->drawDialogBackgroundClip(Common::Rect(_x, _y, _x + _w, _y + getHeight() - 1), getBossClipRect(), ThemeEngine::kDialogBackgroundDefault); } +bool ScrollContainerWidget::containsWidget(Widget *w) const { + if (w == _verticalScroll || _verticalScroll->containsWidget(w)) + return true; + return containsWidgetInChain(_firstWidget, w); +} + Widget *ScrollContainerWidget::findWidget(int x, int y) { if (_verticalScroll->isVisible() && x >= _w - _verticalScroll->getWidth()) return _verticalScroll; diff --git a/gui/widgets/scrollcontainer.h b/gui/widgets/scrollcontainer.h index c2d47370ee..9366a0b658 100644 --- a/gui/widgets/scrollcontainer.h +++ b/gui/widgets/scrollcontainer.h @@ -46,6 +46,8 @@ public: virtual void handleCommand(CommandSender *sender, uint32 cmd, uint32 data); virtual void reflowLayout(); + virtual bool containsWidget(Widget *) const; + protected: // We overload getChildY to make sure child widgets are positioned correctly. // Essentially this compensates for the space taken up by the tab title header. diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp index 9bf9527c4f..e2e3e72db0 100644 --- a/gui/widgets/tab.cpp +++ b/gui/widgets/tab.cpp @@ -334,6 +334,13 @@ void TabWidget::draw() { } } +bool TabWidget::containsWidget(Widget *w) const { + if (w == _navLeft || w == _navRight || _navLeft->containsWidget(w) || _navRight->containsWidget(w)) + return true; + return containsWidgetInChain(_firstWidget, w); +} + + Widget *TabWidget::findWidget(int x, int y) { if (y < _tabHeight) { if (_navButtonsVisible) { diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h index a1a5e06481..fe5e4d82bc 100644 --- a/gui/widgets/tab.h +++ b/gui/widgets/tab.h @@ -107,6 +107,8 @@ public: virtual int getFirstVisible() const; virtual void setFirstVisible(int tabID, bool adjustIfRoom = false); + virtual bool containsWidget(Widget *) const; + virtual void reflowLayout(); virtual void draw(); |