]> git.saurik.com Git - wxWidgets.git/blobdiff - src/html/m_list.cpp
forward ported patch to IsEditable()
[wxWidgets.git] / src / html / m_list.cpp
index cf6b010fae45ed0dcda8511cce1fd4de0d1992de..bb6b0299a46e5b729e1485761f2c9610c8b95361 100644 (file)
@@ -16,7 +16,7 @@
 #include "wx/defs.h"
 #if wxUSE_HTML && wxUSE_STREAMS
 
-#ifdef __BORDLANDC__
+#ifdef __BORLANDC__
 #pragma hdrstop
 #endif
 
@@ -43,23 +43,26 @@ class wxHtmlListmarkCell : public wxHtmlCell
         wxBrush m_Brush;
     public:
         wxHtmlListmarkCell(wxDC *dc, const wxColour& clr);
-        void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2);
+        void Draw(wxDC& dc, int x, int y, int view_y1, int view_y2,
+                  wxHtmlRenderingInfo& info);
 };
 
 wxHtmlListmarkCell::wxHtmlListmarkCell(wxDC* dc, const wxColour& clr) : wxHtmlCell(), m_Brush(clr, wxSOLID)
 {
-    m_Width = dc->GetCharWidth();
+    m_Width =  dc->GetCharHeight();
     m_Height = dc->GetCharHeight();
     m_Descent = 0;
 }
 
 
 
-void wxHtmlListmarkCell::Draw(wxDC& dc, int x, int y, int view_y1, int view_y2)
+void wxHtmlListmarkCell::Draw(wxDC& dc, int x, int y,
+                              int WXUNUSED(view_y1), int WXUNUSED(view_y2),
+                              wxHtmlRenderingInfo& WXUNUSED(info))
 {
     dc.SetBrush(m_Brush);
-    dc.DrawEllipse(x + m_PosX + m_Width / 4, y + m_PosY + m_Height / 4, m_Width / 2, m_Width / 2);
-    wxHtmlCell::Draw(dc, x, y, view_y1, view_y2);
+    dc.DrawEllipse(x + m_PosX + m_Width / 3, y + m_PosY + m_Height / 3, 
+                   (m_Width / 3), (m_Width / 3));
 }
 
 
@@ -88,34 +91,36 @@ TAG_HANDLER_BEGIN(OLULLI, "OL,UL,LI")
         // List Item:
         if (tag.GetName() == wxT("LI"))
         {
-            if (!tag.IsEnding())
-            {
-                m_WParser->GetContainer()->SetIndent(0, wxHTML_INDENT_TOP);
-                    // this is to prevent indetation in <li><p> case
-                m_WParser->CloseContainer();
-                m_WParser->CloseContainer();
+            m_WParser->GetContainer()->SetIndent(0, wxHTML_INDENT_TOP);
+                // this is to prevent indetation in <li><p> case
+            m_WParser->CloseContainer();
+            m_WParser->CloseContainer();
 
-                c = m_WParser->OpenContainer();
-                c->SetWidthFloat(2 * m_WParser->GetCharWidth(), wxHTML_UNITS_PIXELS);
+            c = m_WParser->OpenContainer();
+            c->SetWidthFloat(2 * m_WParser->GetCharWidth(), wxHTML_UNITS_PIXELS);
+            if (m_Numbering == 0)
+            {
+                // Centering gives more space after the bullet
+                c->SetAlignHor(wxHTML_ALIGN_CENTER);
+                c->InsertCell(new wxHtmlListmarkCell(m_WParser->GetDC(), m_WParser->GetActualColor()));
+            }
+            else
+            {
                 c->SetAlignHor(wxHTML_ALIGN_RIGHT);
-                if (m_Numbering == 0)
-                    c->InsertCell(new wxHtmlListmarkCell(m_WParser->GetDC(), m_WParser->GetActualColor()));
-                else
-                {
-                    wxString mark;
-                    mark.Printf(wxT("%i."), m_Numbering);
-                    c->InsertCell(new wxHtmlWordCell(mark, *(m_WParser->GetDC())));
-                }
-                m_WParser->CloseContainer();
+                wxString mark;
+                mark.Printf(wxT("%i."), m_Numbering);
+                c->InsertCell(new wxHtmlWordCell(mark, *(m_WParser->GetDC())));
+            }
+            m_WParser->CloseContainer();
 
-                c = m_WParser->OpenContainer();
-                c->SetIndent(m_WParser->GetCharWidth() / 4, wxHTML_INDENT_LEFT);
-                c->SetWidthFloat(-2 * m_WParser->GetCharWidth(), wxHTML_UNITS_PIXELS);
+            c = m_WParser->OpenContainer();
+            c->SetIndent(m_WParser->GetCharWidth() / 4, wxHTML_INDENT_LEFT);
+            c->SetWidthFloat(-2 * m_WParser->GetCharWidth(), wxHTML_UNITS_PIXELS);
 
-                m_WParser->OpenContainer();
+            m_WParser->OpenContainer();
+
+            if (m_Numbering != 0) m_Numbering++;
 
-                if (m_Numbering != 0) m_Numbering++;
-            }
             return FALSE;
         }
 
@@ -128,7 +133,7 @@ TAG_HANDLER_BEGIN(OLULLI, "OL,UL,LI")
             else m_Numbering = 1;
 
             c = m_WParser->GetContainer();
-            if (c->GetFirstCell() != NULL)
+            if (c->GetFirstChild() != NULL)
             {
                 m_WParser->CloseContainer();
                 m_WParser->OpenContainer();