From: Vadim Zeitlin Date: Sat, 29 Jun 2013 12:50:37 +0000 (+0000) Subject: Allow resetting background colour of wxHtmlContainerCell. X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/88343ddae94c7925a2ae884b76f6ac3246c23c48 Allow resetting background colour of wxHtmlContainerCell. Don't use m_UseBkColour flag which remained always set once SetBackgroundColour() had been called, but just rely on m_BkColour itself being valid to determine whether we should use it. This allows to reset the background colour after setting it. Closes #15287. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@74306 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/include/wx/html/htmlcell.h b/include/wx/html/htmlcell.h index 328aefce8a..c0d03c8a26 100644 --- a/include/wx/html/htmlcell.h +++ b/include/wx/html/htmlcell.h @@ -477,7 +477,7 @@ public: // sets minimal height of this container. void SetMinHeight(int h, int align = wxHTML_ALIGN_TOP) {m_MinHeight = h; m_MinHeightAlign = align; m_LastLayout = -1;} - void SetBackgroundColour(const wxColour& clr) {m_UseBkColour = true; m_BkColour = clr;} + void SetBackgroundColour(const wxColour& clr) {m_BkColour = clr;} // returns background colour (of wxNullColour if none set), so that widgets can // adapt to it: wxColour GetBackgroundColour(); @@ -537,7 +537,6 @@ protected: // alignment horizontal and vertical (left, center, right) int m_WidthFloat, m_WidthFloatUnits; // width float is used in adjustWidth - bool m_UseBkColour; wxColour m_BkColour; // background color of this container int m_Border; diff --git a/src/html/htmlcell.cpp b/src/html/htmlcell.cpp index 53699fc856..3d243b762f 100644 --- a/src/html/htmlcell.cpp +++ b/src/html/htmlcell.cpp @@ -716,7 +716,7 @@ wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell *parent) : wxHtmlCe m_AlignVer = wxHTML_ALIGN_BOTTOM; m_IndentLeft = m_IndentRight = m_IndentTop = m_IndentBottom = 0; m_WidthFloat = 100; m_WidthFloatUnits = wxHTML_UNITS_PERCENT; - m_UseBkColour = false; + m_BkColour = wxNullColour; m_Border = 0; m_MinHeight = 0; m_MinHeightAlign = wxHTML_ALIGN_TOP; @@ -1096,7 +1096,7 @@ void wxHtmlContainerCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2, int xlocal = x + m_PosX; int ylocal = y + m_PosY; - if (m_UseBkColour) + if (m_BkColour.IsOk()) { wxBrush myb = wxBrush(m_BkColour, wxBRUSHSTYLE_SOLID); @@ -1217,10 +1217,7 @@ void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y, wxColour wxHtmlContainerCell::GetBackgroundColour() { - if (m_UseBkColour) - return m_BkColour; - else - return wxNullColour; + return m_BkColour; }