+wxHtmlListCell::~wxHtmlListCell()
+{
+ if (m_RowInfo) free(m_RowInfo);
+}
+
+void wxHtmlListCell::Layout(int w)
+{
+ wxHtmlCell::Layout(w);
+
+ ComputeMinMaxWidths();
+ m_Width = wxMax(m_Width, wxMin(w, GetMaxTotalWidth()));
+
+ int s_width = m_Width - m_IndentLeft;
+
+ int vpos = 0;
+ for (int r = 0; r < m_NumRows; r++)
+ {
+ m_RowInfo[r].mark->Layout(m_ListmarkWidth);
+ m_RowInfo[r].mark->SetPos(m_IndentLeft, vpos);
+ m_RowInfo[r].cont->Layout(s_width - m_ListmarkWidth);
+ m_RowInfo[r].cont->SetPos(m_IndentLeft + m_ListmarkWidth, vpos);
+ vpos += wxMax(m_RowInfo[r].cont->GetHeight(), m_RowInfo[r].mark->GetHeight());
+ }
+ m_Height = vpos;
+}
+
+void wxHtmlListCell::AddRow(wxHtmlContainerCell *mark, wxHtmlContainerCell *cont)
+{
+ ReallocRows(++m_NumRows);
+ m_RowInfo[m_NumRows - 1].mark = mark;
+ m_RowInfo[m_NumRows - 1].cont = cont;
+}
+
+void wxHtmlListCell::ReallocRows(int rows)
+{
+ m_RowInfo = (wxHtmlListItemStruct*) realloc(m_RowInfo, sizeof(wxHtmlListItemStruct) * rows);
+ m_RowInfo[rows - 1].mark = 0;
+ m_RowInfo[rows - 1].cont = 0;
+ m_RowInfo[rows - 1].minWidth = 0;
+ m_RowInfo[rows - 1].maxWidth = 0;
+
+ m_NumRows = rows;
+}
+
+void wxHtmlListCell::ComputeMinMaxWidths()
+{
+ if (m_NumRows == 0) return;
+
+ m_MaxTotalWidth = 0;
+ m_Width = 0;
+
+ for (int r = 0; r < m_NumRows; r++)
+ {
+ wxHtmlListItemStruct& row = m_RowInfo[r];
+ row.mark->Layout(1);
+ row.cont->Layout(1);
+ int maxWidth = row.cont->GetMaxTotalWidth();
+ int width = row.cont->GetWidth();
+ if (row.mark->GetWidth() > m_ListmarkWidth)
+ m_ListmarkWidth = row.mark->GetWidth();
+ if (maxWidth > m_MaxTotalWidth)
+ m_MaxTotalWidth = maxWidth;
+ if (width > m_Width)
+ m_Width = width;
+ }
+ m_Width += m_ListmarkWidth + m_IndentLeft;
+ m_MaxTotalWidth += m_ListmarkWidth + m_IndentLeft;
+}
+
+//-----------------------------------------------------------------------------
+// wxHtmlListcontentCell
+//-----------------------------------------------------------------------------
+
+class wxHtmlListcontentCell : public wxHtmlContainerCell
+{
+public:
+ wxHtmlListcontentCell(wxHtmlContainerCell *p) : wxHtmlContainerCell(p) {}
+ virtual void Layout(int w) {
+ // Reset top indentation, fixes <li><p>
+ SetIndent(0, wxHTML_INDENT_TOP);
+ wxHtmlContainerCell::Layout(w);
+ }
+};