External/Aga.Controls/Tree/TreeModelBase.cs
author Stephane Lenclud
Sat, 30 Jan 2016 23:01:51 +0100
branchMiniDisplay
changeset 454 f84878f52cd9
permissions -rw-r--r--
Disabling Nuvoton NCT6791D because of fan full speed bug on Asus Z97 WS.
     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 }