From e7141058b73bf2010c60d344cbdc60884881b6da Mon Sep 17 00:00:00 2001 From: jules Date: Thu, 26 Sep 2013 16:46:15 +0100 Subject: [PATCH] Tab button background colour fix when no tabs present. --- .../juce_gui_basics/layout/juce_TabbedButtonBar.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/modules/juce_gui_basics/layout/juce_TabbedButtonBar.cpp b/modules/juce_gui_basics/layout/juce_TabbedButtonBar.cpp index 7026345aab..ee2ab169a6 100644 --- a/modules/juce_gui_basics/layout/juce_TabbedButtonBar.cpp +++ b/modules/juce_gui_basics/layout/juce_TabbedButtonBar.cpp @@ -335,8 +335,10 @@ void TabbedButtonBar::setCurrentTabIndex (int newIndex, const bool sendChangeMes TabBarButton* TabbedButtonBar::getTabButton (const int index) const { - TabInfo* const tab = tabs[index]; - return tab == nullptr ? nullptr : static_cast (tab->button); + if (TabInfo* tab = tabs[index]) + return static_cast (tab->button); + + return nullptr; } int TabbedButtonBar::indexOfTabButton (const TabBarButton* button) const @@ -483,8 +485,10 @@ void TabbedButtonBar::resized() //============================================================================== Colour TabbedButtonBar::getTabBackgroundColour (const int tabIndex) { - TabInfo* const tab = tabs [tabIndex]; - return tab == nullptr ? Colours::white : tab->colour; + if (TabInfo* tab = tabs [tabIndex]) + return tab->colour; + + return Colours::transparentBlack; } void TabbedButtonBar::setTabBackgroundColour (const int tabIndex, Colour newColour)