Click here to Skip to main content
15,891,845 members
Articles / Multimedia / GDI+

Customizable Tree Control with Animation Support

Rate me:
Please Sign up or sign in to vote.
4.72/5 (17 votes)
8 Apr 2008CPOL4 min read 108K   23   115  
A tree control implementation, allowing complete customization and animation support
/////////////////////////////////////////////////////////////////////////////
//
// (c) 2007 BinaryComponents Ltd.  All Rights Reserved.
//
// http://www.binarycomponents.com/
//
/////////////////////////////////////////////////////////////////////////////

using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;
using System.Diagnostics;

namespace BinaryComponents.SuperTree.Internal
{
	internal abstract class VerticalPositioning : ITreeEvents
	{
		protected VerticalPositioning( TreeNodeCollection nodes, IRenderer renderer, ITreeInfo treeInfo, ITreeEvents treeEvents )
		{
			_nodes = nodes;
			_renderer = renderer;
			_treeInfo = treeInfo;
			_treeEvents = treeEvents;
		}

		internal abstract double ExpansionAnimationPosition( TreeNode treeNode );

		internal abstract bool IsAnimating();

		internal abstract Rectangle GetNodeBounds( TreeNode treeNode, Coordinates required );

		internal abstract bool IsVisible( TreeNode treeNode );

		internal abstract TreeNode[] GetNodesBetween( int top, int bottom );

		internal abstract TreeNode GetNodeBefore( TreeNode node );
		internal abstract TreeNode GetNodeAfter( TreeNode node );

		internal abstract int GetTotalHeight();
		internal abstract int GetMaxWidth();

		internal abstract void DirtyWidths();
		internal abstract void SetAnimationMark( DateTime dateTime );

		#region ITreeEvents Members

		public abstract void NodeUpdated( TreeNode treeNode );

		public abstract void NodeInserted( TreeNode treeNode );

		public abstract void NodeDeleted( TreeNode treeNode );

		public abstract void ToggleNodeExpansion( TreeNode treeNode );

		public abstract void SelectNode( TreeNode treeNode );

		public abstract void UpdateAnimations();

		#endregion

		protected TreeNodeCollection Nodes
		{
			[DebuggerStepThrough]
			get
			{
				return _nodes;
			}
		}

		protected IRenderer Renderer
		{
			[DebuggerStepThrough]
			get
			{
				return _renderer;
			}
		}

		protected ITreeInfo TreeInfo
		{
			[DebuggerStepThrough]
			get
			{
				return _treeInfo;
			}
		}

		protected ITreeEvents TreeEvents
		{
			[DebuggerStepThrough]
			get
			{
				return _treeEvents;
			}
		}

		private TreeNodeCollection _nodes;
		private IRenderer _renderer;
		private ITreeInfo _treeInfo;
		private ITreeEvents _treeEvents;
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Web Developer
United Kingdom United Kingdom
I'm currently working for a small start-up company, BinaryComponents Ltd, producing the FeedGhost RSS reader.

FeedGhost RSS Reader:
http://www.feedghost.com

Bespoke Software Development
http://www.binarycomponents.com

Comments and Discussions