improved HTML tables layout code (patch 911377)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@26246 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2004-03-17 20:47:31 +00:00
parent d43699ef11
commit ca16b7a98e
6 changed files with 285 additions and 41 deletions

View File

@@ -529,6 +529,7 @@ wxHtmlContainerCell::wxHtmlContainerCell(wxHtmlContainerCell *parent) : wxHtmlCe
{
m_Cells = m_LastCell = NULL;
m_Parent = parent;
m_MaxTotalWidth = 0;
if (m_Parent) m_Parent->InsertCell(this);
m_AlignHor = wxHTML_ALIGN_LEFT;
m_AlignVer = wxHTML_ALIGN_BOTTOM;
@@ -644,6 +645,8 @@ void wxHtmlContainerCell::Layout(int w)
int ysizeup = 0, ysizedown = 0;
int MaxLineWidth = 0;
int xcnt = 0;
int curLineWidth = 0;
m_MaxTotalWidth = 0;
/*
@@ -698,6 +701,20 @@ void wxHtmlContainerCell::Layout(int w)
// layout nonbreakable run of cells:
cell->SetPos(xpos, ybasicpos + cell->GetDescent());
xpos += cell->GetWidth();
if (!cell->IsTerminalCell())
{
// Container cell indicates new line
if (curLineWidth > m_MaxTotalWidth)
m_MaxTotalWidth = curLineWidth;
if (wxMax(cell->GetWidth(), cell->GetMaxTotalWidth()) > m_MaxTotalWidth)
m_MaxTotalWidth = cell->GetMaxTotalWidth();
curLineWidth = 0;
}
else
// Normal cell, add maximum cell width to line width
curLineWidth += cell->GetMaxTotalWidth();
cell = cell->GetNext();
xcnt++;
@@ -785,6 +802,10 @@ void wxHtmlContainerCell::Layout(int w)
m_Height = m_MinHeight;
}
if (curLineWidth > m_MaxTotalWidth)
m_MaxTotalWidth = curLineWidth;
m_MaxTotalWidth += s_indent + ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
MaxLineWidth += s_indent + ((m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight);
if (m_Width < MaxLineWidth) m_Width = MaxLineWidth;