- //dc.DrawEllipse(x + m_PosX + m_Width / 4, y + m_PosY + m_Height / 4, m_Width / 2, m_Width / 2);
- // This looks better IMHO (JACS) -- I tried to get ellipses/circles working but they can
- // just look terrible, at least on Windows. TODO: maybe have configurable bullets,
- // possibly with the app supplying bitmaps.
- int size = (int) ((m_Width / 2.0) + 0.5);
- dc.DrawRectangle(x + m_PosX + (m_Width - size)/2, y + m_PosY + (m_Height - size)/ 2, size, size);
+ dc.DrawEllipse(x + m_PosX + m_Width / 3, y + m_PosY + m_Height / 3,
+ (m_Width / 3), (m_Width / 3));
+}
+
+//-----------------------------------------------------------------------------
+// wxHtmlListCell
+//-----------------------------------------------------------------------------
+
+struct wxHtmlListItemStruct
+{
+ wxHtmlContainerCell *mark;
+ wxHtmlContainerCell *cont;
+ int minWidth;
+ int maxWidth;
+};
+
+class wxHtmlListCell : public wxHtmlContainerCell
+{
+ private:
+ wxBrush m_Brush;
+
+ int m_NumRows;
+ wxHtmlListItemStruct *m_RowInfo;
+ void ReallocRows(int rows);
+ void ComputeMinMaxWidths();
+ int ComputeMaxBase(wxHtmlCell *cell);
+ int m_ListmarkWidth;
+
+ public:
+ wxHtmlListCell(wxHtmlContainerCell *parent);
+ virtual ~wxHtmlListCell();
+ void AddRow(wxHtmlContainerCell *mark, wxHtmlContainerCell *cont);
+ virtual void Layout(int w);
+
+ wxDECLARE_NO_COPY_CLASS(wxHtmlListCell);
+};
+
+wxHtmlListCell::wxHtmlListCell(wxHtmlContainerCell *parent) : wxHtmlContainerCell(parent)
+{
+ m_NumRows = 0;
+ m_RowInfo = 0;
+ m_ListmarkWidth = 0;
+}
+
+wxHtmlListCell::~wxHtmlListCell()
+{
+ if (m_RowInfo) free(m_RowInfo);
+}
+
+int wxHtmlListCell::ComputeMaxBase(wxHtmlCell *cell)
+{
+ if(!cell)
+ return 0;
+
+ wxHtmlCell *child = cell->GetFirstChild();
+
+ while(child)
+ {
+ int base = ComputeMaxBase( child );
+ if ( base > 0 ) return base + child->GetPosY();
+ child = child->GetNext();
+ }
+
+ return cell->GetHeight() - cell->GetDescent();
+}
+
+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++)
+ {
+ // do layout first time to layout contents and adjust pos
+ m_RowInfo[r].mark->Layout(m_ListmarkWidth);
+ m_RowInfo[r].cont->Layout(s_width - m_ListmarkWidth);
+
+ const int base_mark = ComputeMaxBase( m_RowInfo[r].mark );
+ const int base_cont = ComputeMaxBase( m_RowInfo[r].cont );
+ const int adjust_mark = vpos + wxMax(base_cont-base_mark,0);
+ const int adjust_cont = vpos + wxMax(base_mark-base_cont,0);
+
+ m_RowInfo[r].mark->SetPos(m_IndentLeft, adjust_mark);
+ m_RowInfo[r].cont->SetPos(m_IndentLeft + m_ListmarkWidth, adjust_cont);
+
+ vpos = wxMax(adjust_mark + m_RowInfo[r].mark->GetHeight(),
+ adjust_cont + m_RowInfo[r].cont->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;