diff --git a/include/wx/html/htmlcell.h b/include/wx/html/htmlcell.h index a4fefc2eee..e3adf20e6e 100644 --- a/include/wx/html/htmlcell.h +++ b/include/wx/html/htmlcell.h @@ -115,8 +115,17 @@ public: class WXDLLIMPEXP_HTML wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle { public: + explicit wxDefaultHtmlRenderingStyle(const wxWindowBase* wnd = NULL) + : m_wnd(wnd) + {} + virtual wxColour GetSelectedTextColour(const wxColour& clr) wxOVERRIDE; virtual wxColour GetSelectedTextBgColour(const wxColour& clr) wxOVERRIDE; + +private: + const wxWindowBase* const m_wnd; + + wxDECLARE_NO_COPY_CLASS(wxDefaultHtmlRenderingStyle); }; diff --git a/src/generic/htmllbox.cpp b/src/generic/htmllbox.cpp index 011f6cc557..e1c3720235 100644 --- a/src/generic/htmllbox.cpp +++ b/src/generic/htmllbox.cpp @@ -159,7 +159,9 @@ private: class wxHtmlListBoxStyle : public wxDefaultHtmlRenderingStyle { public: - wxHtmlListBoxStyle(const wxHtmlListBox& hlbox) : m_hlbox(hlbox) { } + wxHtmlListBoxStyle(const wxHtmlListBox& hlbox) + : wxDefaultHtmlRenderingStyle(&hlbox), m_hlbox(hlbox) + { } virtual wxColour GetSelectedTextColour(const wxColour& colFg) wxOVERRIDE { diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index f5b115823d..0ce3a3e8a3 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -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); } diff --git a/src/html/htmlwin.cpp b/src/html/htmlwin.cpp index d3373316a5..0585f12a1a 100644 --- a/src/html/htmlwin.cpp +++ b/src/html/htmlwin.cpp @@ -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,