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:
@@ -103,7 +103,7 @@ void wxHtmlCell::GetHorizontalConstraints(int *left, int *right) const
|
|||||||
if (left)
|
if (left)
|
||||||
*left = m_PosX;
|
*left = m_PosX;
|
||||||
if (right)
|
if (right)
|
||||||
*right = m_PosX + m_Width - 1;
|
*right = m_PosX + m_Width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -232,10 +232,22 @@ bool wxHtmlContainerCell::AdjustPagebreak(int *pagebreak) const
|
|||||||
|
|
||||||
|
|
||||||
void wxHtmlContainerCell::Layout(int w)
|
void wxHtmlContainerCell::Layout(int w)
|
||||||
{
|
|
||||||
if (m_LastLayout == w)
|
|
||||||
{
|
{
|
||||||
wxHtmlCell::Layout(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)
|
||||||
|
{
|
||||||
|
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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -378,8 +390,6 @@ void wxHtmlContainerCell::Layout(int w)
|
|||||||
if (m_Width < MaxLineWidth) m_Width = MaxLineWidth;
|
if (m_Width < MaxLineWidth) m_Width = MaxLineWidth;
|
||||||
|
|
||||||
m_LastLayout = w;
|
m_LastLayout = w;
|
||||||
|
|
||||||
wxHtmlCell::Layout(w);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -576,6 +586,9 @@ void wxHtmlContainerCell::GetHorizontalConstraints(int *left, int *right) const
|
|||||||
cright = r;
|
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)
|
if (left)
|
||||||
*left = cleft;
|
*left = cleft;
|
||||||
if (right)
|
if (right)
|
||||||
|
@@ -343,8 +343,6 @@ void wxHtmlTableCell::ComputeMinMaxWidths()
|
|||||||
|
|
||||||
int left, right, width;
|
int left, right, width;
|
||||||
|
|
||||||
m_ColsInfo[0].minWidth = 0; // avoid recursion
|
|
||||||
Layout(1);
|
|
||||||
for (int c = 0; c < m_NumCols; c++)
|
for (int c = 0; c < m_NumCols; c++)
|
||||||
{
|
{
|
||||||
for (int r = 0; r < m_NumRows; r++)
|
for (int r = 0; r < m_NumRows; r++)
|
||||||
@@ -352,12 +350,13 @@ void wxHtmlTableCell::ComputeMinMaxWidths()
|
|||||||
cellStruct& cell = m_CellInfo[r][c];
|
cellStruct& cell = m_CellInfo[r][c];
|
||||||
if (cell.flag == cellUsed)
|
if (cell.flag == cellUsed)
|
||||||
{
|
{
|
||||||
|
cell.cont->Layout(2*m_Padding + 1);
|
||||||
cell.cont->GetHorizontalConstraints(&left, &right);
|
cell.cont->GetHorizontalConstraints(&left, &right);
|
||||||
width = right - left + 1;
|
width = right - left;
|
||||||
|
width -= (cell.colspan-1) * m_Spacing;
|
||||||
// HTML 4.0 says it is acceptable to distribute min/max
|
// HTML 4.0 says it is acceptable to distribute min/max
|
||||||
// width of spanning cells evently
|
// width of spanning cells evently
|
||||||
width /= cell.colspan;
|
width /= cell.colspan;
|
||||||
width += m_Spacing + 2*m_Padding;
|
|
||||||
for (int j = 0; j < cell.colspan; j++)
|
for (int j = 0; j < cell.colspan; j++)
|
||||||
if (width > m_ColsInfo[c+j].minWidth)
|
if (width > m_ColsInfo[c+j].minWidth)
|
||||||
m_ColsInfo[c+j].minWidth = width;
|
m_ColsInfo[c+j].minWidth = width;
|
||||||
@@ -374,6 +373,8 @@ void wxHtmlTableCell::Layout(int w)
|
|||||||
{
|
{
|
||||||
ComputeMinMaxWidths();
|
ComputeMinMaxWidths();
|
||||||
|
|
||||||
|
wxHtmlCell::Layout(w);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
WIDTH ADJUSTING :
|
WIDTH ADJUSTING :
|
||||||
|
Reference in New Issue
Block a user