AddLine function

void AddLine(wxLineShape* line, wxShape* other, int attachFrom = 0, int
attachTo = 0, int positionFrom = -1, int positionTo = -1)

Can anybody help me with a description of the attributes of this method?

Cheers,
Thomas

Thomas Aanensen wrote:

void AddLine(wxLineShape* line, wxShape* other, int attachFrom = 0, int
attachTo = 0, int positionFrom = -1, int positionTo = -1)

Can anybody help me with a description of the attributes of this method?

I know nothing beyond what is in the docs and sources.

void wxShape::AddLine(wxLineShape *line, wxShape *other,
                             int attachFrom, int attachTo,
                             // The line ordering
                             int positionFrom, int positionTo)
{
     if (positionFrom == -1)
     {
         if (!m_lines.Member(line))
             m_lines.Append(line);
     }
     else
     {
         // Don't preserve old ordering if we have new ordering instructions
         m_lines.DeleteObject(line);
         if (positionFrom < (int) m_lines.GetCount())
         {
             wxNode* node = m_lines.Item(positionFrom);
             m_lines.Insert(node, line);
         }
         else
             m_lines.Append(line);
     }

     if (positionTo == -1)
     {
         if (!other->m_lines.Member(line))
             other->m_lines.Append(line);
     }
     else
     {
         // Don't preserve old ordering if we have new ordering instructions
         other->m_lines.DeleteObject(line);
         if (positionTo < (int) other->m_lines.GetCount())
         {
             wxNode* node = other->m_lines.Item(positionTo);
             other->m_lines.Insert(node, line);
         }
         else
             other->m_lines.Append(line);
     }
#if 0
     // Wrong: doesn't preserve ordering of shape already linked
     m_lines.DeleteObject(line);
     other->m_lines.DeleteObject(line);

     if (positionFrom == -1)
         m_lines.Append(line);
     else
     {
         if (positionFrom < m_lines.GetCount())
         {
             wxNode* node = m_lines.Item(positionFrom);
             m_lines.Insert(node, line);
         }
         else
             m_lines.Append(line);
     }

     if (positionTo == -1)
         other->m_lines.Append(line);
     else
     {
         if (positionTo < other->m_lines.GetCount())
         {
             wxNode* node = other->m_lines.Item(positionTo);
             other->m_lines.Insert(node, line);
         }
         else
             other->m_lines.Append(line);
     }
#endif

     line->SetFrom(this);
     line->SetTo(other);
     line->SetAttachments(attachFrom, attachTo);
}

ยทยทยท

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!