diff --git a/ChangeLog b/ChangeLog index d2ab48301..fbbaae445 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2003-11-05 Mike Kestner + + * gtk/ITreeNode.cs : make Parent readonly + * gtk/TreeNode.cs : use an internal method to set parent on the + child, and set child.Parent to null in RemoveChild. + 2003-11-05 Moritz Balz * gdk/Window.custom : System.Drawing.Rectangle/Point customizations diff --git a/gtk/ITreeNode.cs b/gtk/ITreeNode.cs index 41a4e7aee..a579ff7f1 100644 --- a/gtk/ITreeNode.cs +++ b/gtk/ITreeNode.cs @@ -16,7 +16,7 @@ namespace Gtk { int ID { get; } - ITreeNode Parent { get; set; } + ITreeNode Parent { get; } int ChildCount { get; } diff --git a/gtk/TreeNode.cs b/gtk/TreeNode.cs index dcc86666c..5c230e70f 100644 --- a/gtk/TreeNode.cs +++ b/gtk/TreeNode.cs @@ -32,9 +32,6 @@ namespace Gtk { get { return parent; } - set { - parent = value; - } } public int ChildCount { @@ -48,6 +45,11 @@ namespace Gtk { return children.IndexOf (o); } + internal void SetParent (ITreeNode parent) + { + this.parent = parent; + } + public ITreeNode this [int index] { get { if (index >= ChildCount) @@ -87,20 +89,21 @@ namespace Gtk { ChildRemoved (this, old_position); } - public void AddChild (ITreeNode child) + public void AddChild (TreeNode child) { children.Add (child); - child.Parent = this; + child.SetParent (this); OnChildAdded (child); } - public void RemoveChild (ITreeNode child) + public void RemoveChild (TreeNode child) { int idx = children.IndexOf (child); if (idx < 0) return; children.Remove (child); + child.SetParent (null); OnChildRemoved (idx); } }