GUI: Don't display the ScrollContainer background inside tabs

Fixes #10645.
This commit is contained in:
Bastien Bouclet 2018-11-14 20:16:34 +01:00
parent 91c463184d
commit 7c570d9b25
4 changed files with 13 additions and 2 deletions

View File

@ -187,6 +187,7 @@ EditGameDialog::EditGameDialog(const String &domain)
//
_graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
ScrollContainerWidget *graphicsContainer = new ScrollContainerWidget(tab, "GameOptions_Graphics.Container", kGraphicsTabContainerReflowCmd);
graphicsContainer->setBackgroundType(ThemeEngine::kDialogBackgroundNone);
graphicsContainer->setTarget(this);
if (g_system->getOverlayWidth() > 320)

View File

@ -1523,6 +1523,7 @@ void GlobalOptionsDialog::build() {
_graphicsTabId = tab->addTab(g_system->getOverlayWidth() > 320 ? _("Graphics") : _("GFX"));
ScrollContainerWidget *graphicsContainer = new ScrollContainerWidget(tab, "GlobalOptions_Graphics.Container", kGraphicsTabContainerReflowCmd);
graphicsContainer->setTarget(this);
graphicsContainer->setBackgroundType(ThemeEngine::kDialogBackgroundNone);
addGraphicControls(graphicsContainer, "GlobalOptions_Graphics_Container.");
//
@ -1718,6 +1719,7 @@ void GlobalOptionsDialog::build() {
ScrollContainerWidget *container = new ScrollContainerWidget(tab, "GlobalOptions_Cloud.Container", kCloudTabContainerReflowCmd);
container->setTarget(this);
container->setBackgroundType(ThemeEngine::kDialogBackgroundNone);
_storagePopUpDesc = new StaticTextWidget(container, "GlobalOptions_Cloud_Container.StoragePopupDesc", _("Storage:"), _("Active cloud storage"));
_storagePopUp = new PopUpWidget(container, "GlobalOptions_Cloud_Container.StoragePopup");

View File

@ -41,6 +41,7 @@ ScrollContainerWidget::ScrollContainerWidget(GuiObject *boss, const Common::Stri
void ScrollContainerWidget::init() {
setFlags(WIDGET_ENABLED);
_type = kScrollContainerWidget;
_backgroundType = ThemeEngine::kDialogBackgroundDefault;
_verticalScroll = new ScrollBarWidget(this, _w-16, 0, 16, _h);
_verticalScroll->setTarget(this);
_scrolledX = 0;
@ -145,8 +146,7 @@ void ScrollContainerWidget::reflowLayout() {
}
void ScrollContainerWidget::drawWidget() {
g_gui.theme()->drawDialogBackground(Common::Rect(_x, _y, _x + _w, _y + getHeight() - 1),
ThemeEngine::kDialogBackgroundDefault);
g_gui.theme()->drawDialogBackground(Common::Rect(_x, _y, _x + _w, _y + getHeight() - 1), _backgroundType);
}
bool ScrollContainerWidget::containsWidget(Widget *w) const {
@ -169,4 +169,8 @@ Common::Rect ScrollContainerWidget::getClipRect() const {
return Common::Rect(getAbsX(), getAbsY(), getAbsX() + _w, getAbsY() + getHeight());
}
void ScrollContainerWidget::setBackgroundType(ThemeEngine::DialogBackground backgroundType) {
_backgroundType = backgroundType;
}
} // End of namespace GUI

View File

@ -34,6 +34,7 @@ class ScrollContainerWidget: public Widget, public CommandSender {
int16 _scrolledX, _scrolledY;
uint16 _limitH;
uint32 _reflowCmd;
ThemeEngine::DialogBackground _backgroundType;
void recalc();
@ -51,6 +52,9 @@ public:
Common::Rect getClipRect() const override;
void handleMouseWheel(int x, int y, int direction);
void setBackgroundType(ThemeEngine::DialogBackground backgroundType);
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.