Fix selection background colour in wxHtmlWindow

Use inactive selection colour when the window doesn't have focus.
This commit is contained in:
Pavel Kalugin
2019-04-09 04:51:26 +03:00
committed by Vadim Zeitlin
parent 244547a010
commit ef524931cc
4 changed files with 19 additions and 3 deletions

View File

@@ -65,7 +65,12 @@ wxColour
wxDefaultHtmlRenderingStyle::
GetSelectedTextBgColour(const wxColour& WXUNUSED(clr))
{
return wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT);
// By default we use the fixed standard selection colour, but if we're
// associated with a window use the colour appropriate for the window
// state, i.e. grey out selection when it's not in focus.
return wxSystemSettings::GetColour(!m_wnd || m_wnd->HasFocus() ?
wxSYS_COLOUR_HIGHLIGHT : wxSYS_COLOUR_BTNSHADOW);
}

View File

@@ -1138,7 +1138,7 @@ void wxHtmlWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
dc->SetLayoutDirection(GetLayoutDirection());
wxHtmlRenderingInfo rinfo;
wxDefaultHtmlRenderingStyle rstyle;
wxDefaultHtmlRenderingStyle rstyle(this);
rinfo.SetSelection(m_selection);
rinfo.SetStyle(&rstyle);
m_Cell->Draw(*dc, 0, 0,