Add semi-private wxHtmlCell::Dump()

This is useful to see the results of wxHTML layout algorithm.

Closes https://github.com/wxWidgets/wxWidgets/pull/1429
This commit is contained in:
Vadim Zeitlin
2019-07-18 17:02:18 +02:00
parent 8f386265dc
commit e2332f2703
3 changed files with 63 additions and 0 deletions

View File

@@ -284,6 +284,21 @@ bool wxHtmlCell::IsBefore(wxHtmlCell *cell) const
return false;
}
wxString wxHtmlCell::GetDescription() const
{
return GetClassInfo()->GetClassName();
}
wxString wxHtmlCell::Dump(int indent) const
{
wxString s(' ', indent);
s += wxString::Format("%s at (%d, %d) %dx%d",
GetDescription(), m_PosX, m_PosY, m_Width, m_Height);
if ( !m_id.empty() )
s += wxString::Format(" [id=%s]", m_id);
return s;
}
//-----------------------------------------------------------------------------
// wxHtmlWordCell
@@ -620,6 +635,15 @@ wxString wxHtmlWordWithTabsCell::GetPartAsText(int begin, int end) const
return sel;
}
wxString wxHtmlWordCell::GetDescription() const
{
wxString s;
s = wxString::Format("wxHtmlWordCell(%s)", m_Word);
if ( !m_allowLinebreak )
s += " no line break";
return s;
}
//-----------------------------------------------------------------------------
@@ -1437,6 +1461,15 @@ void wxHtmlContainerCell::RemoveExtraSpacing(bool top, bool bottom)
}
}
wxString wxHtmlContainerCell::Dump(int indent) const
{
wxString s = wxHtmlCell::Dump(indent);
for ( wxHtmlCell* c = m_Cells; c; c = c->GetNext() )
s << "\n" << c->Dump(indent + 4);
return s;
}
@@ -1491,6 +1524,10 @@ void wxHtmlColourCell::DrawInvisible(wxDC& dc,
}
}
wxString wxHtmlColourCell::GetDescription() const
{
return wxString::Format("wxHtmlColourCell(%s)", m_Colour.GetAsString());
}
@@ -1515,6 +1552,10 @@ void wxHtmlFontCell::DrawInvisible(wxDC& dc, int WXUNUSED(x), int WXUNUSED(y),
}
wxString wxHtmlFontCell::GetDescription() const
{
return wxString::Format("wxHtmlFontCell(%s)", m_Font.GetNativeFontInfoUserDesc());
}

View File

@@ -310,6 +310,12 @@ public:
virtual void Layout(int w) wxOVERRIDE;
virtual wxString GetDescription() const wxOVERRIDE
{
return wxString::Format("wxHtmlImageCell with bitmap of size %d*%d",
m_bmpW, m_bmpH);
}
private:
wxBitmap *m_bitmap;
int m_align;