tables code fixes

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@11489 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík
2001-08-26 14:50:20 +00:00
parent af035b26c4
commit 026d1fac66
2 changed files with 24 additions and 10 deletions

View File

@@ -103,7 +103,7 @@ void wxHtmlCell::GetHorizontalConstraints(int *left, int *right) const
if (left)
*left = m_PosX;
if (right)
*right = m_PosX + m_Width - 1;
*right = m_PosX + m_Width;
}
@@ -233,10 +233,22 @@ bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) const
void wxHtmlContainerCell::Layout(int w)
{
if (m_LastLayout == w)
wxHtmlCell::Layout(w);
if (m_LastLayout == w) return;
// VS: Any attempt to layout with negative or zero width leads to hell,
// but we can't ignore such attempts completely, since it sometimes
// happen (e.g. when trying how small a table can be). The best thing we
// can do is to set the width of child cells to zero
if (w < 1)
{
wxHtmlCell::Layout(w);
return;
m_Width = 0;
for (wxHtmlCell *cell = m_Cells; cell; cell = cell->GetNext())
cell->Layout(0);
// this does two things: it recursively calls this code on all child
// contrainers and resets children's position to (0,0)
return;
}
wxHtmlCell *cell = m_Cells, *line = m_Cells;
@@ -378,8 +390,6 @@ void wxHtmlContainerCell::Layout(int w)
if (m_Width < MaxLineWidth) m_Width = MaxLineWidth;
m_LastLayout = w;
wxHtmlCell::Layout(w);
}
@@ -576,6 +586,9 @@ void wxHtmlContainerCell::GetHorizontalConstraints(int *left, int *right) const
cright = r;
}
cleft -= (m_IndentLeft < 0) ? (-m_IndentLeft * m_Width / 100) : m_IndentLeft;
cright += (m_IndentRight < 0) ? (-m_IndentRight * m_Width / 100) : m_IndentRight;
if (left)
*left = cleft;
if (right)