Fix selection background colour in wxHtmlWindow
Use inactive selection colour when the window doesn't have focus.
This commit is contained in:
committed by
Vadim Zeitlin
parent
244547a010
commit
ef524931cc
@@ -115,8 +115,17 @@ public:
|
|||||||
class WXDLLIMPEXP_HTML wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle
|
class WXDLLIMPEXP_HTML wxDefaultHtmlRenderingStyle : public wxHtmlRenderingStyle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
explicit wxDefaultHtmlRenderingStyle(const wxWindowBase* wnd = NULL)
|
||||||
|
: m_wnd(wnd)
|
||||||
|
{}
|
||||||
|
|
||||||
virtual wxColour GetSelectedTextColour(const wxColour& clr) wxOVERRIDE;
|
virtual wxColour GetSelectedTextColour(const wxColour& clr) wxOVERRIDE;
|
||||||
virtual wxColour GetSelectedTextBgColour(const wxColour& clr) wxOVERRIDE;
|
virtual wxColour GetSelectedTextBgColour(const wxColour& clr) wxOVERRIDE;
|
||||||
|
|
||||||
|
private:
|
||||||
|
const wxWindowBase* const m_wnd;
|
||||||
|
|
||||||
|
wxDECLARE_NO_COPY_CLASS(wxDefaultHtmlRenderingStyle);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@@ -159,7 +159,9 @@ private:
|
|||||||
class wxHtmlListBoxStyle : public wxDefaultHtmlRenderingStyle
|
class wxHtmlListBoxStyle : public wxDefaultHtmlRenderingStyle
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
wxHtmlListBoxStyle(const wxHtmlListBox& hlbox) : m_hlbox(hlbox) { }
|
wxHtmlListBoxStyle(const wxHtmlListBox& hlbox)
|
||||||
|
: wxDefaultHtmlRenderingStyle(&hlbox), m_hlbox(hlbox)
|
||||||
|
{ }
|
||||||
|
|
||||||
virtual wxColour GetSelectedTextColour(const wxColour& colFg) wxOVERRIDE
|
virtual wxColour GetSelectedTextColour(const wxColour& colFg) wxOVERRIDE
|
||||||
{
|
{
|
||||||
|
@@ -65,7 +65,12 @@ wxColour
|
|||||||
wxDefaultHtmlRenderingStyle::
|
wxDefaultHtmlRenderingStyle::
|
||||||
GetSelectedTextBgColour(const wxColour& WXUNUSED(clr))
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@@ -1138,7 +1138,7 @@ void wxHtmlWindow::OnPaint(wxPaintEvent& WXUNUSED(event))
|
|||||||
dc->SetLayoutDirection(GetLayoutDirection());
|
dc->SetLayoutDirection(GetLayoutDirection());
|
||||||
|
|
||||||
wxHtmlRenderingInfo rinfo;
|
wxHtmlRenderingInfo rinfo;
|
||||||
wxDefaultHtmlRenderingStyle rstyle;
|
wxDefaultHtmlRenderingStyle rstyle(this);
|
||||||
rinfo.SetSelection(m_selection);
|
rinfo.SetSelection(m_selection);
|
||||||
rinfo.SetStyle(&rstyle);
|
rinfo.SetStyle(&rstyle);
|
||||||
m_Cell->Draw(*dc, 0, 0,
|
m_Cell->Draw(*dc, 0, 0,
|
||||||
|
Reference in New Issue
Block a user