From b57221cf44dab4f3afc453f59cfdb680dbb8b936 Mon Sep 17 00:00:00 2001 From: Mike Kestner Date: Wed, 5 Nov 2003 22:11:45 +0000 Subject: [PATCH] 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. svn path=/trunk/gtk-sharp/; revision=19651 --- ChangeLog | 6 ++++++ gtk/ITreeNode.cs | 2 +- gtk/TreeNode.cs | 15 +++++++++------ 3 files changed, 16 insertions(+), 7 deletions(-) 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); } }