示例#1
0
 public void Insert(int index, Widget widget)
 {
     if (m_widgets.Contains(widget))
     {
         throw new InvalidOperationException("Child widget already present in container.");
     }
     if (index < 0 || index > m_widgets.Count)
     {
         throw new InvalidOperationException("Widget index out of range.");
     }
     widget.ChangeParent(m_containerWidget);
     m_widgets.Insert(index, widget);
     m_containerWidget.WidgetAdded(widget);
     m_version++;
 }