External/Aga.Controls/Tree/TreeModelBase.cs
author sl
Thu, 01 Jan 2015 23:35:49 +0100
changeset 405 5715aefd2bcc
permissions -rw-r--r--
SharpDisplay: Migrating to new robust client scheme.
     1 using System;
     2 using System.Collections.Generic;
     3 using System.Text;
     4 
     5 namespace Aga.Controls.Tree
     6 {
     7 	public abstract class TreeModelBase: ITreeModel
     8 	{
     9 		public abstract System.Collections.IEnumerable GetChildren(TreePath treePath);
    10 		public abstract bool IsLeaf(TreePath treePath);
    11 
    12 
    13 		public event EventHandler<TreeModelEventArgs> NodesChanged;
    14 		protected void OnNodesChanged(TreeModelEventArgs args)
    15 		{
    16 			if (NodesChanged != null)
    17 				NodesChanged(this, args);
    18 		}
    19 
    20 		public event EventHandler<TreePathEventArgs> StructureChanged;
    21 		protected void OnStructureChanged(TreePathEventArgs args)
    22 		{
    23 			if (StructureChanged != null)
    24 				StructureChanged(this, args);
    25 		}
    26 
    27 		public event EventHandler<TreeModelEventArgs> NodesInserted;
    28 		protected void OnNodesInserted(TreeModelEventArgs args)
    29 		{
    30 			if (NodesInserted != null)
    31 				NodesInserted(this, args);
    32 		}
    33 
    34 		public event EventHandler<TreeModelEventArgs> NodesRemoved;
    35 		protected void OnNodesRemoved(TreeModelEventArgs args)
    36 		{
    37 			if (NodesRemoved != null)
    38 				NodesRemoved(this, args);
    39 		}
    40 
    41 		public virtual void Refresh()
    42 		{
    43 			OnStructureChanged(new TreePathEventArgs(TreePath.Empty));
    44 		}
    45 	}
    46 }