void wxHtmlTableCell::AddCell(wxHtmlContainerCell *cell, const wxHtmlTag& tag) { // Is this cell in new row? // VS: we can't do it in AddRow, see my comment there if (m_ActualCol == -1) { if (m_ActualRow + 1 > m_NumRows - 1) ReallocRows(m_ActualRow + 2); m_ActualRow++; } // cells & columns: do { m_ActualCol++; } while ((m_ActualCol < m_NumCols) && (m_CellInfo[m_ActualRow][m_ActualCol].flag != cellFree)); if (m_ActualCol > m_NumCols - 1) ReallocCols(m_ActualCol + 1); int r = m_ActualRow, c = m_ActualCol; m_CellInfo[r][c].cont = cell; m_CellInfo[r][c].colspan = 1; m_CellInfo[r][c].rowspan = 1; m_CellInfo[r][c].flag = cellUsed; m_CellInfo[r][c].minheight = 0; m_CellInfo[r][c].valign = wxHTML_ALIGN_TOP; /* scan for parameters: */ // id: wxString idvalue; if (tag.GetParamAsString(wxT("ID"), &idvalue)) { cell->SetId(idvalue); } // width: { int width = 0; bool wpercent = false; if (tag.GetParamAsIntOrPercent(wxT("WIDTH"), &width, wpercent)) { if (wpercent) { m_ColsInfo[c].width = width; m_ColsInfo[c].units = wxHTML_UNITS_PERCENT; } else { m_ColsInfo[c].width = (int)(m_PixelScale * (double)width); m_ColsInfo[c].units = wxHTML_UNITS_PIXELS; } } } // spanning: { tag.GetParamAsInt(wxT("COLSPAN"), &m_CellInfo[r][c].colspan); tag.GetParamAsInt(wxT("ROWSPAN"), &m_CellInfo[r][c].rowspan); // VS: the standard says this about col/rowspan: // "This attribute specifies the number of rows spanned by the // current cell. The default value of this attribute is one ("1"). // The value zero ("0") means that the cell spans all rows from the // current row to the last row of the table." All mainstream // browsers act as if 0==1, though, and so does wxHTML. if (m_CellInfo[r][c].colspan < 1) m_CellInfo[r][c].colspan = 1; if (m_CellInfo[r][c].rowspan < 1) m_CellInfo[r][c].rowspan = 1; if ((m_CellInfo[r][c].colspan > 1) || (m_CellInfo[r][c].rowspan > 1)) { int i, j; if (r + m_CellInfo[r][c].rowspan > m_NumRows) ReallocRows(r + m_CellInfo[r][c].rowspan); if (c + m_CellInfo[r][c].colspan > m_NumCols) ReallocCols(c + m_CellInfo[r][c].colspan); for (i = r; i < r + m_CellInfo[r][c].rowspan; i++) for (j = c; j < c + m_CellInfo[r][c].colspan; j++) m_CellInfo[i][j].flag = cellSpan; m_CellInfo[r][c].flag = cellUsed; } } //background color: { wxColour bk = m_rBkg; tag.GetParamAsColour(wxT("BGCOLOR"), &bk); if (bk.IsOk()) cell->SetBackgroundColour(bk); } if (m_Border > 0) cell->SetBorder(TABLE_BORDER_CLR_2, TABLE_BORDER_CLR_1); // vertical alignment: { wxString valign; if (!tag.GetParamAsString(wxT("VALIGN"), &valign)) valign = m_tValign; valign.MakeUpper(); if (valign == wxT("TOP")) m_CellInfo[r][c].valign = wxHTML_ALIGN_TOP; else if (valign == wxT("BOTTOM")) m_CellInfo[r][c].valign = wxHTML_ALIGN_BOTTOM; else m_CellInfo[r][c].valign = wxHTML_ALIGN_CENTER; } // nowrap m_CellInfo[r][c].nowrap = tag.HasParam(wxT("NOWRAP")); cell->SetIndent(m_Padding, wxHTML_INDENT_ALL, wxHTML_UNITS_PIXELS); }
void wxHtmlListCell::AddRow(wxHtmlContainerCell *mark, wxHtmlContainerCell *cont) { ReallocRows(++m_NumRows); m_RowInfo[m_NumRows - 1].mark = mark; m_RowInfo[m_NumRows - 1].cont = cont; }