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
This commit is contained in:
Vadim Zeitlin
2013-06-29 12:50:37 +00:00
parent f03884e322
commit 88343ddae9
2 changed files with 4 additions and 8 deletions

View File

@@ -477,7 +477,7 @@ public:
// sets minimal height of this container. // 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 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 // returns background colour (of wxNullColour if none set), so that widgets can
// adapt to it: // adapt to it:
wxColour GetBackgroundColour(); wxColour GetBackgroundColour();
@@ -537,7 +537,6 @@ protected:
// alignment horizontal and vertical (left, center, right) // alignment horizontal and vertical (left, center, right)
int m_WidthFloat, m_WidthFloatUnits; int m_WidthFloat, m_WidthFloatUnits;
// width float is used in adjustWidth // width float is used in adjustWidth
bool m_UseBkColour;
wxColour m_BkColour; wxColour m_BkColour;
// background color of this container // background color of this container
int m_Border; int m_Border;

View File

@@ -716,7 +716,7 @@ wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell *parent) : wxHtmlCe
m_AlignVer = wxHTML_ALIGN_BOTTOM; m_AlignVer = wxHTML_ALIGN_BOTTOM;
m_IndentLeft = m_IndentRight = m_IndentTop = m_IndentBottom = 0; m_IndentLeft = m_IndentRight = m_IndentTop = m_IndentBottom = 0;
m_WidthFloat = 100; m_WidthFloatUnits = wxHTML_UNITS_PERCENT; m_WidthFloat = 100; m_WidthFloatUnits = wxHTML_UNITS_PERCENT;
m_UseBkColour = false; m_BkColour = wxNullColour;
m_Border = 0; m_Border = 0;
m_MinHeight = 0; m_MinHeight = 0;
m_MinHeightAlign = wxHTML_ALIGN_TOP; 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 xlocal = x + m_PosX;
int ylocal = y + m_PosY; int ylocal = y + m_PosY;
if (m_UseBkColour) if (m_BkColour.IsOk())
{ {
wxBrush myb = wxBrush(m_BkColour, wxBRUSHSTYLE_SOLID); wxBrush myb = wxBrush(m_BkColour, wxBRUSHSTYLE_SOLID);
@@ -1217,10 +1217,7 @@ void wxHtmlContainerCell::DrawInvisible(wxDC& dc, int x, int y,
wxColour wxHtmlContainerCell::GetBackgroundColour() wxColour wxHtmlContainerCell::GetBackgroundColour()
{ {
if (m_UseBkColour)
return m_BkColour; return m_BkColour;
else
return wxNullColour;
} }