Use disabled text in message panel when window isn't active

When the window is not active, the status bar uses disabled text,
so the message panel sticks out because it is then using a different
text color. This is most noticable in dark mode.
This commit is contained in:
Ian McInerney 2021-03-25 20:54:31 +00:00
parent d18323dcf0
commit 1d81826409
1 changed files with 12 additions and 3 deletions

View File

@ -33,6 +33,7 @@
#include <wx/dcscreen.h>
#include <wx/dcclient.h>
#include <wx/settings.h>
#include <wx/toplevel.h>
BEGIN_EVENT_TABLE( EDA_MSG_PANEL, wxPanel )
@ -108,8 +109,8 @@ void EDA_MSG_PANEL::OnPaint( wxPaintEvent& aEvent )
dc.SetTextBackground( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
dc.SetFont( wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT ) );
for( unsigned i=0; i<m_Items.size(); ++i )
showItem( dc, m_Items[i] );
for( const MSG_PANEL_ITEM& item : m_Items )
showItem( dc, item );
aEvent.Skip();
}
@ -199,7 +200,15 @@ void EDA_MSG_PANEL::SetMessage( int aXPosition, const wxString& aUpperText,
void EDA_MSG_PANEL::showItem( wxDC& aDC, const MSG_PANEL_ITEM& aItem )
{
COLOR4D color = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
COLOR4D color;
// Change the text to a disabled color when the window isn't active
wxTopLevelWindow* tlw = dynamic_cast<wxTopLevelWindow*>( wxGetTopLevelParent( this ) );
if( tlw && !tlw->IsActive() )
color = wxSystemSettings::GetColour( wxSYS_COLOUR_GRAYTEXT );
else
color = wxSystemSettings::GetColour( wxSYS_COLOUR_WINDOWTEXT );
aDC.SetTextForeground( color.ToColour() );