2003-11-05 Mike Kestner <mkestner@ximian.com>
* 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
This commit is contained in:
parent
7553348291
commit
b57221cf44
3 changed files with 16 additions and 7 deletions
|
@ -1,3 +1,9 @@
|
|||
2003-11-05 Mike Kestner <mkestner@ximian.com>
|
||||
|
||||
* 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 <verteiler@mbalz.de>
|
||||
|
||||
* gdk/Window.custom : System.Drawing.Rectangle/Point customizations
|
||||
|
|
|
@ -16,7 +16,7 @@ namespace Gtk {
|
|||
|
||||
int ID { get; }
|
||||
|
||||
ITreeNode Parent { get; set; }
|
||||
ITreeNode Parent { get; }
|
||||
|
||||
int ChildCount { get; }
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue