External/Aga.Controls/Tree/TreeViewAdv.Properties.cs
changeset 345 0c551e8818e0
child 346 f652ab1e06e2
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/External/Aga.Controls/Tree/TreeViewAdv.Properties.cs	Sun May 27 15:16:19 2012 +0000
     1.3 @@ -0,0 +1,728 @@
     1.4 +using System;
     1.5 +using System.Collections.Generic;
     1.6 +using System.Collections.ObjectModel;
     1.7 +using System.ComponentModel;
     1.8 +using System.Drawing;
     1.9 +using System.Drawing.Design;
    1.10 +using System.Windows.Forms;
    1.11 +
    1.12 +using Aga.Controls.Tree.NodeControls;
    1.13 +
    1.14 +namespace Aga.Controls.Tree
    1.15 +{
    1.16 +	public partial class TreeViewAdv
    1.17 +	{
    1.18 +		private Cursor _innerCursor = null;
    1.19 +
    1.20 +		public override Cursor Cursor
    1.21 +		{
    1.22 +			get
    1.23 +			{
    1.24 +                if (_innerCursor != null)
    1.25 +                    return _innerCursor;
    1.26 +                else
    1.27 +					return base.Cursor;
    1.28 +			}
    1.29 +			set
    1.30 +			{
    1.31 +				base.Cursor = value;
    1.32 +			}
    1.33 +		}
    1.34 +
    1.35 +		#region Internal Properties
    1.36 +
    1.37 +		private IRowLayout _rowLayout;
    1.38 +
    1.39 +		private bool _dragMode;
    1.40 +		private bool DragMode
    1.41 +		{
    1.42 +			get { return _dragMode; }
    1.43 +			set
    1.44 +			{
    1.45 +				_dragMode = value;
    1.46 +				if (!value)
    1.47 +				{
    1.48 +					StopDragTimer();
    1.49 +					if (_dragBitmap != null)
    1.50 +						_dragBitmap.Dispose();
    1.51 +					_dragBitmap = null;
    1.52 +				}
    1.53 +				else
    1.54 +					StartDragTimer();
    1.55 +			}
    1.56 +		}
    1.57 +
    1.58 +		internal int ColumnHeaderHeight
    1.59 +		{
    1.60 +			get
    1.61 +			{
    1.62 +				if (UseColumns)
    1.63 +					return _columnHeaderHeight;
    1.64 +				else
    1.65 +					return 0;
    1.66 +			}
    1.67 +		}
    1.68 +
    1.69 +		/// <summary>
    1.70 +		/// returns all nodes, which parent is expanded
    1.71 +		/// </summary>
    1.72 +		private IEnumerable<TreeNodeAdv> VisibleNodes
    1.73 +		{
    1.74 +			get
    1.75 +			{
    1.76 +				TreeNodeAdv node = Root;
    1.77 +				while (node != null)
    1.78 +				{
    1.79 +					node = node.NextVisibleNode;
    1.80 +					if (node != null)
    1.81 +						yield return node;
    1.82 +				}
    1.83 +			}
    1.84 +		}
    1.85 +
    1.86 +		private bool _suspendSelectionEvent;
    1.87 +		internal bool SuspendSelectionEvent
    1.88 +		{
    1.89 +			get { return _suspendSelectionEvent; }
    1.90 +			set
    1.91 +			{
    1.92 +				if (value != _suspendSelectionEvent)
    1.93 +				{
    1.94 +					_suspendSelectionEvent = value;
    1.95 +					if (!_suspendSelectionEvent && _fireSelectionEvent)
    1.96 +						OnSelectionChanged();
    1.97 +				}
    1.98 +			}
    1.99 +		}
   1.100 +
   1.101 +		private List<TreeNodeAdv> _rowMap;
   1.102 +		internal List<TreeNodeAdv> RowMap
   1.103 +		{
   1.104 +			get { return _rowMap; }
   1.105 +		}
   1.106 +
   1.107 +		private TreeNodeAdv _selectionStart;
   1.108 +		internal TreeNodeAdv SelectionStart
   1.109 +		{
   1.110 +			get { return _selectionStart; }
   1.111 +			set { _selectionStart = value; }
   1.112 +		}
   1.113 +
   1.114 +		private InputState _input;
   1.115 +		internal InputState Input
   1.116 +		{
   1.117 +			get { return _input; }
   1.118 +			set
   1.119 +			{
   1.120 +				_input = value;
   1.121 +			}
   1.122 +		}
   1.123 +
   1.124 +		private bool _itemDragMode;
   1.125 +		internal bool ItemDragMode
   1.126 +		{
   1.127 +			get { return _itemDragMode; }
   1.128 +			set { _itemDragMode = value; }
   1.129 +		}
   1.130 +
   1.131 +		private Point _itemDragStart;
   1.132 +		internal Point ItemDragStart
   1.133 +		{
   1.134 +			get { return _itemDragStart; }
   1.135 +			set { _itemDragStart = value; }
   1.136 +		}
   1.137 +
   1.138 +
   1.139 +		/// <summary>
   1.140 +		/// Number of rows fits to the current page
   1.141 +		/// </summary>
   1.142 +		internal int CurrentPageSize
   1.143 +		{
   1.144 +			get
   1.145 +			{
   1.146 +				return _rowLayout.CurrentPageSize;
   1.147 +			}
   1.148 +		}
   1.149 +
   1.150 +		/// <summary>
   1.151 +		/// Number of all visible nodes (which parent is expanded)
   1.152 +		/// </summary>
   1.153 +		internal int RowCount
   1.154 +		{
   1.155 +			get
   1.156 +			{
   1.157 +				return RowMap.Count;
   1.158 +			}
   1.159 +		}
   1.160 +
   1.161 +		private int _contentWidth = 0;
   1.162 +		private int ContentWidth
   1.163 +		{
   1.164 +			get
   1.165 +			{
   1.166 +				return _contentWidth;
   1.167 +			}
   1.168 +		}
   1.169 +
   1.170 +		private int _firstVisibleRow;
   1.171 +		internal int FirstVisibleRow
   1.172 +		{
   1.173 +			get { return _firstVisibleRow; }
   1.174 +			set
   1.175 +			{
   1.176 +				HideEditor();
   1.177 +				_firstVisibleRow = value;
   1.178 +				UpdateView();
   1.179 +			}
   1.180 +		}
   1.181 +
   1.182 +		private int _offsetX;
   1.183 +		public int OffsetX
   1.184 +		{
   1.185 +			get { return _offsetX; }
   1.186 +			private set
   1.187 +			{
   1.188 +				HideEditor();
   1.189 +				_offsetX = value;
   1.190 +				UpdateView();
   1.191 +			}
   1.192 +		}
   1.193 +
   1.194 +		public override Rectangle DisplayRectangle
   1.195 +		{
   1.196 +			get
   1.197 +			{
   1.198 +				Rectangle r = ClientRectangle;
   1.199 +				//r.Y += ColumnHeaderHeight;
   1.200 +				//r.Height -= ColumnHeaderHeight;
   1.201 +				int w = _vScrollBar.Visible ? _vScrollBar.Width : 0;
   1.202 +				int h = _hScrollBar.Visible ? _hScrollBar.Height : 0;
   1.203 +				return new Rectangle(r.X, r.Y, r.Width - w, r.Height - h);
   1.204 +			}
   1.205 +		}
   1.206 +
   1.207 +		private List<TreeNodeAdv> _selection;
   1.208 +		internal List<TreeNodeAdv> Selection
   1.209 +		{
   1.210 +			get { return _selection; }
   1.211 +		}
   1.212 +
   1.213 +		#endregion
   1.214 +
   1.215 +		#region Public Properties
   1.216 +
   1.217 +		#region DesignTime
   1.218 +
   1.219 +		private bool _shiftFirstNode;
   1.220 +		[DefaultValue(false), Category("Behavior")]
   1.221 +		public bool ShiftFirstNode
   1.222 +		{
   1.223 +			get { return _shiftFirstNode; }
   1.224 +			set { _shiftFirstNode = value; }
   1.225 +		}
   1.226 +
   1.227 +		private bool _displayDraggingNodes;
   1.228 +		[DefaultValue(false), Category("Behavior")]
   1.229 +		public bool DisplayDraggingNodes
   1.230 +		{
   1.231 +			get { return _displayDraggingNodes; }
   1.232 +			set { _displayDraggingNodes = value; }
   1.233 +		}
   1.234 +
   1.235 +		private bool _fullRowSelect;
   1.236 +		[DefaultValue(false), Category("Behavior")]
   1.237 +		public bool FullRowSelect
   1.238 +		{
   1.239 +			get { return _fullRowSelect; }
   1.240 +			set
   1.241 +			{
   1.242 +				_fullRowSelect = value;
   1.243 +				UpdateView();
   1.244 +			}
   1.245 +		}
   1.246 +
   1.247 +		private bool _useColumns;
   1.248 +		[DefaultValue(false), Category("Behavior")]
   1.249 +		public bool UseColumns
   1.250 +		{
   1.251 +			get { return _useColumns; }
   1.252 +			set
   1.253 +			{
   1.254 +				_useColumns = value;
   1.255 +				FullUpdate();
   1.256 +			}
   1.257 +		}
   1.258 +
   1.259 +		private bool _allowColumnReorder;
   1.260 +		[DefaultValue(false), Category("Behavior")]
   1.261 +		public bool AllowColumnReorder
   1.262 +		{
   1.263 +			get { return _allowColumnReorder; }
   1.264 +			set { _allowColumnReorder = value; }
   1.265 +		}
   1.266 +
   1.267 +		private bool _showLines = true;
   1.268 +		[DefaultValue(true), Category("Behavior")]
   1.269 +		public bool ShowLines
   1.270 +		{
   1.271 +			get { return _showLines; }
   1.272 +			set
   1.273 +			{
   1.274 +				_showLines = value;
   1.275 +				UpdateView();
   1.276 +			}
   1.277 +		}
   1.278 +
   1.279 +		private bool _showPlusMinus = true;
   1.280 +		[DefaultValue(true), Category("Behavior")]
   1.281 +		public bool ShowPlusMinus
   1.282 +		{
   1.283 +			get { return _showPlusMinus; }
   1.284 +			set
   1.285 +			{
   1.286 +				_showPlusMinus = value;
   1.287 +				FullUpdate();
   1.288 +			}
   1.289 +		}
   1.290 +
   1.291 +		private bool _showNodeToolTips = false;
   1.292 +		[DefaultValue(false), Category("Behavior")]
   1.293 +		public bool ShowNodeToolTips
   1.294 +		{
   1.295 +			get { return _showNodeToolTips; }
   1.296 +			set { _showNodeToolTips = value; }
   1.297 +		}
   1.298 +
   1.299 +		[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA1801:ReviewUnusedParameters", MessageId = "value"), System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1822:MarkMembersAsStatic"), DefaultValue(true), Category("Behavior"), Obsolete("No longer used")]
   1.300 +		public bool KeepNodesExpanded
   1.301 +		{
   1.302 +			get { return true; }
   1.303 +			set {}
   1.304 +		}
   1.305 +
   1.306 +		private ITreeModel _model;
   1.307 +        /// <Summary>
   1.308 +        /// The model associated with this <see cref="TreeViewAdv"/>.
   1.309 +        /// </Summary>
   1.310 +        /// <seealso cref="ITreeModel"/>
   1.311 +        /// <seealso cref="TreeModel"/>
   1.312 +        [Browsable(false)]
   1.313 +		public ITreeModel Model
   1.314 +		{
   1.315 +			get { return _model; }
   1.316 +			set
   1.317 +			{
   1.318 +				if (_model != value)
   1.319 +				{
   1.320 +					AbortBackgroundExpandingThreads();
   1.321 +					if (_model != null)
   1.322 +						UnbindModelEvents();
   1.323 +					_model = value;
   1.324 +					CreateNodes();
   1.325 +					FullUpdate();
   1.326 +					if (_model != null)
   1.327 +						BindModelEvents();
   1.328 +				}
   1.329 +			}
   1.330 +		}
   1.331 +
   1.332 +        // Tahoma is the default font
   1.333 +        private static Font _font = new Font("Tahoma", 8.25F, FontStyle.Regular, GraphicsUnit.Point, ((byte)(0)), false);
   1.334 +        /// <summary>
   1.335 +        /// The font to render <see cref="TreeViewAdv"/> content in.
   1.336 +        /// </summary>
   1.337 +        [Category("Appearance"), Description("The font to render TreeViewAdv content in.")]
   1.338 +        public override Font Font
   1.339 +        {
   1.340 +            get
   1.341 +            {
   1.342 +                return (base.Font);
   1.343 +            }
   1.344 +            set
   1.345 +            {
   1.346 +                if (value == null)
   1.347 +                    base.Font = _font;
   1.348 +                else
   1.349 +                {
   1.350 +                    if (value == DefaultFont)
   1.351 +                        base.Font = _font;
   1.352 +                    else
   1.353 +                        base.Font = value;
   1.354 +                }
   1.355 +            }
   1.356 +        }
   1.357 +        public override void ResetFont()
   1.358 +        {
   1.359 +            Font = null;
   1.360 +        }
   1.361 +        private bool ShouldSerializeFont()
   1.362 +        {
   1.363 +            return (!Font.Equals(_font));
   1.364 +        }
   1.365 +        // End font property
   1.366 +
   1.367 +		private BorderStyle _borderStyle = BorderStyle.Fixed3D;
   1.368 +		[DefaultValue(BorderStyle.Fixed3D), Category("Appearance")]
   1.369 +		public BorderStyle BorderStyle
   1.370 +		{
   1.371 +			get
   1.372 +			{
   1.373 +				return this._borderStyle;
   1.374 +			}
   1.375 +			set
   1.376 +			{
   1.377 +				if (_borderStyle != value)
   1.378 +				{
   1.379 +					_borderStyle = value;
   1.380 +					base.UpdateStyles();
   1.381 +				}
   1.382 +			}
   1.383 +		}
   1.384 +
   1.385 +		private bool _autoRowHeight = false;
   1.386 +		/// <summary>
   1.387 +		/// Set to true to expand each row's height to fit the text of it's largest column.
   1.388 +		/// </summary>
   1.389 +		[DefaultValue(false), Category("Appearance"), Description("Expand each row's height to fit the text of it's largest column.")]
   1.390 +		public bool AutoRowHeight
   1.391 +		{
   1.392 +			get
   1.393 +			{
   1.394 +				return _autoRowHeight;
   1.395 +			}
   1.396 +			set
   1.397 +			{
   1.398 +				_autoRowHeight = value;
   1.399 +				if (value)
   1.400 +					_rowLayout = new AutoRowHeightLayout(this, RowHeight);
   1.401 +				else
   1.402 +					_rowLayout = new FixedRowHeightLayout(this, RowHeight);
   1.403 +				FullUpdate();
   1.404 +			}
   1.405 +		}
   1.406 +
   1.407 +        private GridLineStyle _gridLineStyle = GridLineStyle.None;
   1.408 +        [DefaultValue(GridLineStyle.None), Category("Appearance")]
   1.409 +        public GridLineStyle GridLineStyle
   1.410 +        {
   1.411 +            get
   1.412 +            {
   1.413 +                return _gridLineStyle;
   1.414 +            }
   1.415 +            set
   1.416 +            {
   1.417 +				if (value != _gridLineStyle)
   1.418 +				{
   1.419 +					_gridLineStyle = value;
   1.420 +					UpdateView();
   1.421 +					OnGridLineStyleChanged();
   1.422 +				}
   1.423 +            }
   1.424 +        }
   1.425 +
   1.426 +		private int _rowHeight = 16;
   1.427 +		[DefaultValue(16), Category("Appearance")]
   1.428 +		public int RowHeight
   1.429 +		{
   1.430 +			get
   1.431 +			{
   1.432 +				return _rowHeight;
   1.433 +			}
   1.434 +			set
   1.435 +			{
   1.436 +				if (value <= 0)
   1.437 +					throw new ArgumentOutOfRangeException("value");
   1.438 +
   1.439 +				_rowHeight = value;
   1.440 +				_rowLayout.PreferredRowHeight = value;
   1.441 +				FullUpdate();
   1.442 +			}
   1.443 +		}
   1.444 +
   1.445 +		private TreeSelectionMode _selectionMode = TreeSelectionMode.Single;
   1.446 +		[DefaultValue(TreeSelectionMode.Single), Category("Behavior")]
   1.447 +		public TreeSelectionMode SelectionMode
   1.448 +		{
   1.449 +			get { return _selectionMode; }
   1.450 +			set { _selectionMode = value; }
   1.451 +		}
   1.452 +
   1.453 +		private bool _hideSelection;
   1.454 +		[DefaultValue(false), Category("Behavior")]
   1.455 +		public bool HideSelection
   1.456 +		{
   1.457 +			get { return _hideSelection; }
   1.458 +			set
   1.459 +			{
   1.460 +				_hideSelection = value;
   1.461 +				UpdateView();
   1.462 +			}
   1.463 +		}
   1.464 +
   1.465 +		private float _topEdgeSensivity = 0.3f;
   1.466 +		[DefaultValue(0.3f), Category("Behavior")]
   1.467 +		public float TopEdgeSensivity
   1.468 +		{
   1.469 +			get { return _topEdgeSensivity; }
   1.470 +			set
   1.471 +			{
   1.472 +				if (value < 0 || value > 1)
   1.473 +					throw new ArgumentOutOfRangeException();
   1.474 +				_topEdgeSensivity = value;
   1.475 +			}
   1.476 +		}
   1.477 +
   1.478 +		private float _bottomEdgeSensivity = 0.3f;
   1.479 +		[DefaultValue(0.3f), Category("Behavior")]
   1.480 +		public float BottomEdgeSensivity
   1.481 +		{
   1.482 +			get { return _bottomEdgeSensivity; }
   1.483 +			set
   1.484 +			{
   1.485 +				if (value < 0 || value > 1)
   1.486 +					throw new ArgumentOutOfRangeException("value should be from 0 to 1");
   1.487 +				_bottomEdgeSensivity = value;
   1.488 +			}
   1.489 +		}
   1.490 +
   1.491 +		private bool _loadOnDemand;
   1.492 +		[DefaultValue(false), Category("Behavior")]
   1.493 +		public bool LoadOnDemand
   1.494 +		{
   1.495 +			get { return _loadOnDemand; }
   1.496 +			set { _loadOnDemand = value; }
   1.497 +		}
   1.498 +
   1.499 +		private bool _unloadCollapsedOnReload = false;
   1.500 +		[DefaultValue(false), Category("Behavior")]
   1.501 +		public bool UnloadCollapsedOnReload
   1.502 +		{
   1.503 +			get { return _unloadCollapsedOnReload; }
   1.504 +			set { _unloadCollapsedOnReload = value; }
   1.505 +		}
   1.506 +
   1.507 +		private int _indent = 19;
   1.508 +		[DefaultValue(19), Category("Behavior")]
   1.509 +		public int Indent
   1.510 +		{
   1.511 +			get { return _indent; }
   1.512 +			set
   1.513 +			{
   1.514 +				_indent = value;
   1.515 +				UpdateView();
   1.516 +			}
   1.517 +		}
   1.518 +
   1.519 +		private Color _lineColor = SystemColors.ControlDark;
   1.520 +		[Category("Behavior")]
   1.521 +		public Color LineColor
   1.522 +		{
   1.523 +			get { return _lineColor; }
   1.524 +			set
   1.525 +			{
   1.526 +				_lineColor = value;
   1.527 +				CreateLinePen();
   1.528 +				UpdateView();
   1.529 +			}
   1.530 +		}
   1.531 +
   1.532 +		private Color _dragDropMarkColor = Color.Black;
   1.533 +		[Category("Behavior")]
   1.534 +		public Color DragDropMarkColor
   1.535 +		{
   1.536 +			get { return _dragDropMarkColor; }
   1.537 +			set
   1.538 +			{
   1.539 +				_dragDropMarkColor = value;
   1.540 +				CreateMarkPen();
   1.541 +			}
   1.542 +		}
   1.543 +
   1.544 +		private float _dragDropMarkWidth = 3.0f;
   1.545 +		[DefaultValue(3.0f), Category("Behavior")]
   1.546 +		public float DragDropMarkWidth
   1.547 +		{
   1.548 +			get { return _dragDropMarkWidth; }
   1.549 +			set
   1.550 +			{
   1.551 +				_dragDropMarkWidth = value;
   1.552 +				CreateMarkPen();
   1.553 +			}
   1.554 +		}
   1.555 +
   1.556 +		private bool _highlightDropPosition = true;
   1.557 +		[DefaultValue(true), Category("Behavior")]
   1.558 +		public bool HighlightDropPosition
   1.559 +		{
   1.560 +			get { return _highlightDropPosition; }
   1.561 +			set { _highlightDropPosition = value; }
   1.562 +		}
   1.563 +
   1.564 +		private TreeColumnCollection _columns;
   1.565 +		[Category("Behavior"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
   1.566 +		public Collection<TreeColumn> Columns
   1.567 +		{
   1.568 +			get { return _columns; }
   1.569 +		}
   1.570 +
   1.571 +		private NodeControlsCollection _controls;
   1.572 +		[Category("Behavior"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
   1.573 +		[Editor(typeof(NodeControlCollectionEditor), typeof(UITypeEditor))]
   1.574 +		public Collection<NodeControl> NodeControls
   1.575 +		{
   1.576 +			get
   1.577 +			{
   1.578 +				return _controls;
   1.579 +			}
   1.580 +		}
   1.581 +
   1.582 +		private bool _asyncExpanding;
   1.583 +		/// <summary>
   1.584 +		/// When set to true, node contents will be read in background thread.
   1.585 +		/// </summary>
   1.586 +		[Category("Behavior"), DefaultValue(false), Description("Read children in a background thread when expanding.")]
   1.587 +		public bool AsyncExpanding
   1.588 +		{
   1.589 +			get { return _asyncExpanding; }
   1.590 +			set { _asyncExpanding = value; }
   1.591 +		}
   1.592 +
   1.593 +		#endregion
   1.594 +
   1.595 +		#region RunTime
   1.596 +
   1.597 +		private IToolTipProvider _defaultToolTipProvider = null;
   1.598 +		[Browsable(false)]
   1.599 +		public IToolTipProvider DefaultToolTipProvider
   1.600 +		{
   1.601 +			get { return _defaultToolTipProvider; }
   1.602 +			set { _defaultToolTipProvider = value; }
   1.603 +		}
   1.604 +
   1.605 +		[Browsable(false)]
   1.606 +		public IEnumerable<TreeNodeAdv> AllNodes
   1.607 +		{
   1.608 +			get
   1.609 +			{
   1.610 +				if (_root.Nodes.Count > 0)
   1.611 +				{
   1.612 +					TreeNodeAdv node = _root.Nodes[0];
   1.613 +					while (node != null)
   1.614 +					{
   1.615 +						yield return node;
   1.616 +						if (node.Nodes.Count > 0)
   1.617 +							node = node.Nodes[0];
   1.618 +						else if (node.NextNode != null)
   1.619 +							node = node.NextNode;
   1.620 +						else
   1.621 +							node = node.BottomNode;
   1.622 +					}
   1.623 +				}
   1.624 +			}
   1.625 +		}
   1.626 +
   1.627 +		private DropPosition _dropPosition;
   1.628 +		[Browsable(false)]
   1.629 +		public DropPosition DropPosition
   1.630 +		{
   1.631 +			get { return _dropPosition; }
   1.632 +			set { _dropPosition = value; }
   1.633 +		}
   1.634 +
   1.635 +		private TreeNodeAdv _root;
   1.636 +		[Browsable(false)]
   1.637 +		public TreeNodeAdv Root
   1.638 +		{
   1.639 +			get { return _root; }
   1.640 +		}
   1.641 +
   1.642 +		private ReadOnlyCollection<TreeNodeAdv> _readonlySelection;
   1.643 +		[Browsable(false)]
   1.644 +		public ReadOnlyCollection<TreeNodeAdv> SelectedNodes
   1.645 +		{
   1.646 +			get
   1.647 +			{
   1.648 +				return _readonlySelection;
   1.649 +			}
   1.650 +		}
   1.651 +
   1.652 +		[Browsable(false)]
   1.653 +		public TreeNodeAdv SelectedNode
   1.654 +		{
   1.655 +			get
   1.656 +			{
   1.657 +				if (Selection.Count > 0)
   1.658 +				{
   1.659 +					if (CurrentNode != null && CurrentNode.IsSelected)
   1.660 +						return CurrentNode;
   1.661 +					else
   1.662 +						return Selection[0];
   1.663 +				}
   1.664 +				else
   1.665 +					return null;
   1.666 +			}
   1.667 +			set
   1.668 +			{
   1.669 +				if (SelectedNode == value)
   1.670 +					return;
   1.671 +
   1.672 +				BeginUpdate();
   1.673 +				try
   1.674 +				{
   1.675 +					if (value == null)
   1.676 +					{
   1.677 +						ClearSelectionInternal();
   1.678 +					}
   1.679 +					else
   1.680 +					{
   1.681 +						if (!IsMyNode(value))
   1.682 +							throw new ArgumentException();
   1.683 +
   1.684 +						ClearSelectionInternal();
   1.685 +						value.IsSelected = true;
   1.686 +						CurrentNode = value;
   1.687 +						EnsureVisible(value);
   1.688 +					}
   1.689 +				}
   1.690 +				finally
   1.691 +				{
   1.692 +					EndUpdate();
   1.693 +				}
   1.694 +			}
   1.695 +		}
   1.696 +
   1.697 +		private TreeNodeAdv _currentNode;
   1.698 +		[Browsable(false)]
   1.699 +		public TreeNodeAdv CurrentNode
   1.700 +		{
   1.701 +			get { return _currentNode; }
   1.702 +			internal set { _currentNode = value; }
   1.703 +		}
   1.704 +
   1.705 +        [Browsable(false)]
   1.706 +        public int ItemCount
   1.707 +        {
   1.708 +            get { return RowMap.Count; }
   1.709 +        }
   1.710 +
   1.711 +		/// <summary>
   1.712 +		/// Indicates the distance the content is scrolled to the left
   1.713 +		/// </summary>
   1.714 +		[Browsable(false)]
   1.715 +		public int HorizontalScrollPosition
   1.716 +		{
   1.717 +			get
   1.718 +			{
   1.719 +				if (_hScrollBar.Visible)
   1.720 +					return _hScrollBar.Value;
   1.721 +				else
   1.722 +					return 0;
   1.723 +			}
   1.724 +		}
   1.725 +
   1.726 +		#endregion
   1.727 +
   1.728 +		#endregion
   1.729 +
   1.730 +	}
   1.731 +}