From 64a79fd1ab4270ed50ef62cf0a795c842eb4d72a Mon Sep 17 00:00:00 2001 From: Alexander Tkachev Date: Tue, 12 Jul 2016 22:37:57 +0600 Subject: GUI: Fix TabWidget height issues Changes theme stx files to specify TabWidget's type. That fixes wrong TabWidget height. Changes TabWidget's getHeight() to return not only "children" height, but also tabs height. That fixes wrong clipping area. Changes Widget's findWidget to use getHeight(). That fixes bug when widgets in the bottom of TabWidget were not reacting to the mouse events. --- gui/themes/scummclassic.zip | Bin 112109 -> 115643 bytes gui/themes/scummclassic/classic_layout.stx | 6 +++--- gui/themes/scummclassic/classic_layout_lowres.stx | 8 ++++---- gui/themes/scummmodern.zip | Bin 1491605 -> 1491681 bytes gui/themes/scummmodern/scummmodern_layout.stx | 4 ++-- .../scummmodern/scummmodern_layout_lowres.stx | 4 ++-- gui/widget.cpp | 2 +- gui/widgets/tab.cpp | 8 ++++++++ gui/widgets/tab.h | 1 + 9 files changed, 21 insertions(+), 12 deletions(-) (limited to 'gui') diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip index 43fcea12fd..561f2a5dd3 100644 Binary files a/gui/themes/scummclassic.zip and b/gui/themes/scummclassic.zip differ diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 65724d9faf..5172326859 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -222,7 +222,7 @@ - + - + - + - + - + - + - + - + - + - + = w->_x && x < w->_x + w->_w && y >= w->_y && y < w->_y + w->_h) + if (x >= w->_x && x < w->_x + w->_w && y >= w->_y && y < w->_y + w->getHeight()) break; w = w->_next; } diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp index 784e438952..15e6a9d370 100644 --- a/gui/widgets/tab.cpp +++ b/gui/widgets/tab.cpp @@ -85,6 +85,14 @@ int16 TabWidget::getChildY() const { return getAbsY() + _tabHeight; } +uint16 TabWidget::getHeight() const { + // NOTE: if you change that, make sure to do the same + // changes in the ThemeLayoutTabWidget (gui/ThemeLayout.cpp) + // NOTE: this height is used for clipping, so it *includes* + // tabs, because it starts from getAbsY(), not getChildY() + return _h + _tabHeight; +} + int TabWidget::addTab(const String &title) { // Add a new tab page Tab newTab; diff --git a/gui/widgets/tab.h b/gui/widgets/tab.h index 148f164fbb..17b85986b5 100644 --- a/gui/widgets/tab.h +++ b/gui/widgets/tab.h @@ -110,6 +110,7 @@ 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. virtual int16 getChildY() const; + virtual uint16 getHeight() const; virtual void drawWidget(); -- cgit v1.2.3