From d466d76701a260ce20d6a2b133034aeb19b4b1a0 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Sat, 16 Nov 2013 23:37:43 +0000 Subject: [PATCH] Allow changing the colour of wxInfoBarGeneric text. Override SetForegroundColour() to forward it to the text control. See #15671. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@75208 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- include/wx/generic/infobar.h | 3 +++ src/generic/infobar.cpp | 11 +++++++++++ 2 files changed, 14 insertions(+) diff --git a/include/wx/generic/infobar.h b/include/wx/generic/infobar.h index 781698ccc9..4a6bf2b3c1 100644 --- a/include/wx/generic/infobar.h +++ b/include/wx/generic/infobar.h @@ -79,6 +79,9 @@ public: // (default font is a larger and bold version of the normal one) virtual bool SetFont(const wxFont& font); + // same thing with the colour: this affects the text colour + virtual bool SetForegroundColour(const wxColor& colour); + protected: // info bar shouldn't have any border by default, the colour difference // between it and the main window separates it well enough diff --git a/src/generic/infobar.cpp b/src/generic/infobar.cpp index b98df0cf29..3ae926223a 100644 --- a/src/generic/infobar.cpp +++ b/src/generic/infobar.cpp @@ -110,6 +110,17 @@ bool wxInfoBarGeneric::SetFont(const wxFont& font) return true; } +bool wxInfoBarGeneric::SetForegroundColour(const wxColor& colour) +{ + if ( !wxInfoBarBase::SetForegroundColour(colour) ) + return false; + + if ( m_text ) + m_text->SetForegroundColour(colour); + + return true; +} + wxInfoBarGeneric::BarPlacement wxInfoBarGeneric::GetBarPlacement() const { wxSizer * const sizer = GetContainingSizer();