External/Aga.Controls/Tree/NodeControls/InteractiveControl.cs
changeset 345 0c551e8818e0
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/External/Aga.Controls/Tree/NodeControls/InteractiveControl.cs	Sun May 27 15:16:19 2012 +0000
     1.3 @@ -0,0 +1,38 @@
     1.4 +using System;
     1.5 +using System.Collections.Generic;
     1.6 +using System.Text;
     1.7 +using System.ComponentModel;
     1.8 +
     1.9 +namespace Aga.Controls.Tree.NodeControls
    1.10 +{
    1.11 +	public abstract class InteractiveControl : BindableControl
    1.12 +	{
    1.13 +		private bool _editEnabled = false;
    1.14 +		[DefaultValue(false)]
    1.15 +		public bool EditEnabled
    1.16 +		{
    1.17 +			get { return _editEnabled; }
    1.18 +			set { _editEnabled = value; }
    1.19 +		}
    1.20 +
    1.21 +		protected bool IsEditEnabled(TreeNodeAdv node)
    1.22 +		{
    1.23 +			if (EditEnabled)
    1.24 +			{
    1.25 +				NodeControlValueEventArgs args = new NodeControlValueEventArgs(node);
    1.26 +				args.Value = true;
    1.27 +				OnIsEditEnabledValueNeeded(args);
    1.28 +				return Convert.ToBoolean(args.Value);
    1.29 +			}
    1.30 +			else
    1.31 +				return false;
    1.32 +		}
    1.33 +
    1.34 +		public event EventHandler<NodeControlValueEventArgs> IsEditEnabledValueNeeded;
    1.35 +		private void OnIsEditEnabledValueNeeded(NodeControlValueEventArgs args)
    1.36 +		{
    1.37 +			if (IsEditEnabledValueNeeded != null)
    1.38 +				IsEditEnabledValueNeeded(this, args);
    1.39 +		}
    1.40 +	}
    1.41 +}