Click here to Skip to main content
15,895,656 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 108.1K   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.WinFormsGloss.Controls.Ribbon
{
	public abstract class Item
	{
		public const int StandardImportance = 10;
		public const int BestLevelOfDetail = -2;
		public const int WorstLevelOfDetail = 20;

		protected Item()
		{
		}

		public Section Section
		{
			[DebuggerStepThrough]
			get
			{
				return _section;
			}
			internal set
			{
				_section = value;
			}
		}

		public int Importance
		{
			[DebuggerStepThrough]
			get
			{
				return _importance;
			}
			set
			{
				_importance = value;
			}
		}

		public bool Visible
		{
			get
			{
				return _visible;
			}
			set
			{
				if( _visible == value )
				{
					return;
				}

				_visible = value;

				if( Section != null )
				{
					Section.NotifyItemChanged( this );
				}
			}
		}

		public virtual bool NeedsMouseOverUpdate
		{
			get
			{
				return false;
			}
		}

		public void PerformClick( Context context )
		{
			OnClick( context );
		}

		public abstract Size GetLogicalSize( RibbonControl ribbonControl, Graphics g, Size suggestedSize );

		public abstract void Paint( Context context, Rectangle clip, Rectangle logicalBounds );

		public virtual bool HasStyle( string style )
		{
			return false;
		}

		public virtual SuperToolTipInfo GetTooltipInfo()
		{
			return null;
		}

		public virtual System.Windows.Forms.ToolStripItem CreateEquivalentToolStripItem()
		{
			return null;
		}

		protected virtual bool OnClick( Context context )
		{
			return false;
		}

		private Section _section;
		private int _importance = Item.StandardImportance;
		private bool _visible = true;
	}
}

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