External/Aga.Controls/Tree/TreeViewAdv.Properties.cs
author moel.mich
Sun, 27 May 2012 16:50:01 +0000
changeset 347 d043dac9f34e
parent 345 0c551e8818e0
permissions -rw-r--r--
Added the source code of the WinRing0 device driver.
moel@345
     1
using System;
moel@345
     2
using System.Collections.Generic;
moel@345
     3
using System.Collections.ObjectModel;
moel@345
     4
using System.ComponentModel;
moel@345
     5
using System.Drawing;
moel@345
     6
using System.Drawing.Design;
moel@345
     7
using System.Windows.Forms;
moel@345
     8
moel@345
     9
using Aga.Controls.Tree.NodeControls;
moel@345
    10
moel@345
    11
namespace Aga.Controls.Tree
moel@345
    12
{
moel@345
    13
	public partial class TreeViewAdv
moel@345
    14
	{
moel@345
    15
		private Cursor _innerCursor = null;
moel@345
    16
moel@345
    17
		public override Cursor Cursor
moel@345
    18
		{
moel@345
    19
			get
moel@345
    20
			{
moel@345
    21
                if (_innerCursor != null)
moel@345
    22
                    return _innerCursor;
moel@345
    23
                else
moel@345
    24
					return base.Cursor;
moel@345
    25
			}
moel@345
    26
			set
moel@345
    27
			{
moel@345
    28
				base.Cursor = value;
moel@345
    29
			}
moel@345
    30
		}
moel@345
    31
moel@345
    32
		#region Internal Properties
moel@345
    33
moel@345
    34
		private IRowLayout _rowLayout;
moel@345
    35
moel@345
    36
		private bool _dragMode;
moel@345
    37
		private bool DragMode
moel@345
    38
		{
moel@345
    39
			get { return _dragMode; }
moel@345
    40
			set
moel@345
    41
			{
moel@345
    42
				_dragMode = value;
moel@345
    43
				if (!value)
moel@345
    44
				{
moel@345
    45
					StopDragTimer();
moel@345
    46
					if (_dragBitmap != null)
moel@345
    47
						_dragBitmap.Dispose();
moel@345
    48
					_dragBitmap = null;
moel@345
    49
				}
moel@345
    50
				else
moel@345
    51
					StartDragTimer();
moel@345
    52
			}
moel@345
    53
		}
moel@345
    54
moel@345
    55
		internal int ColumnHeaderHeight
moel@345
    56
		{
moel@345
    57
			get
moel@345
    58
			{
moel@345
    59
				if (UseColumns)
moel@345
    60
					return _columnHeaderHeight;
moel@345
    61
				else
moel@345
    62
					return 0;
moel@345
    63
			}
moel@345
    64
		}
moel@345
    65
moel@345
    66
		/// <summary>
moel@345
    67
		/// returns all nodes, which parent is expanded
moel@345
    68
		/// </summary>
moel@345
    69
		private IEnumerable<TreeNodeAdv> VisibleNodes
moel@345
    70
		{
moel@345
    71
			get
moel@345
    72
			{
moel@345
    73
				TreeNodeAdv node = Root;
moel@345
    74
				while (node != null)
moel@345
    75
				{
moel@345
    76
					node = node.NextVisibleNode;
moel@345
    77
					if (node != null)
moel@345
    78
						yield return node;
moel@345
    79
				}
moel@345
    80
			}
moel@345
    81
		}
moel@345
    82
moel@345
    83
		private bool _suspendSelectionEvent;
moel@345
    84
		internal bool SuspendSelectionEvent
moel@345
    85
		{
moel@345
    86
			get { return _suspendSelectionEvent; }
moel@345
    87
			set
moel@345
    88
			{
moel@345
    89
				if (value != _suspendSelectionEvent)
moel@345
    90
				{
moel@345
    91
					_suspendSelectionEvent = value;
moel@345
    92
					if (!_suspendSelectionEvent && _fireSelectionEvent)
moel@345
    93
						OnSelectionChanged();
moel@345
    94
				}
moel@345
    95
			}
moel@345
    96
		}
moel@345
    97
moel@345
    98
		private List<TreeNodeAdv> _rowMap;
moel@345
    99
		internal List<TreeNodeAdv> RowMap
moel@345
   100
		{
moel@345
   101
			get { return _rowMap; }
moel@345
   102
		}
moel@345
   103
moel@345
   104
		private TreeNodeAdv _selectionStart;
moel@345
   105
		internal TreeNodeAdv SelectionStart
moel@345
   106
		{
moel@345
   107
			get { return _selectionStart; }
moel@345
   108
			set { _selectionStart = value; }
moel@345
   109
		}
moel@345
   110
moel@345
   111
		private InputState _input;
moel@345
   112
		internal InputState Input
moel@345
   113
		{
moel@345
   114
			get { return _input; }
moel@345
   115
			set
moel@345
   116
			{
moel@345
   117
				_input = value;
moel@345
   118
			}
moel@345
   119
		}
moel@345
   120
moel@345
   121
		private bool _itemDragMode;
moel@345
   122
		internal bool ItemDragMode
moel@345
   123
		{
moel@345
   124
			get { return _itemDragMode; }
moel@345
   125
			set { _itemDragMode = value; }
moel@345
   126
		}
moel@345
   127
moel@345
   128
		private Point _itemDragStart;
moel@345
   129
		internal Point ItemDragStart
moel@345
   130
		{
moel@345
   131
			get { return _itemDragStart; }
moel@345
   132
			set { _itemDragStart = value; }
moel@345
   133
		}
moel@345
   134
moel@345
   135
moel@345
   136
		/// <summary>
moel@345
   137
		/// Number of rows fits to the current page
moel@345
   138
		/// </summary>
moel@345
   139
		internal int CurrentPageSize
moel@345
   140
		{
moel@345
   141
			get
moel@345
   142
			{
moel@345
   143
				return _rowLayout.CurrentPageSize;
moel@345
   144
			}
moel@345
   145
		}
moel@345
   146
moel@345
   147
		/// <summary>
moel@345
   148
		/// Number of all visible nodes (which parent is expanded)
moel@345
   149
		/// </summary>
moel@345
   150
		internal int RowCount
moel@345
   151
		{
moel@345
   152
			get
moel@345
   153
			{
moel@345
   154
				return RowMap.Count;
moel@345
   155
			}
moel@345
   156
		}
moel@345
   157
moel@345
   158
		private int _contentWidth = 0;
moel@345
   159
		private int ContentWidth
moel@345
   160
		{
moel@345
   161
			get
moel@345
   162
			{
moel@345
   163
				return _contentWidth;
moel@345
   164
			}
moel@345
   165
		}
moel@345
   166
moel@345
   167
		private int _firstVisibleRow;
moel@345
   168
		internal int FirstVisibleRow
moel@345
   169
		{
moel@345
   170
			get { return _firstVisibleRow; }
moel@345
   171
			set
moel@345
   172
			{
moel@345
   173
				HideEditor();
moel@345
   174
				_firstVisibleRow = value;
moel@345
   175
				UpdateView();
moel@345
   176
			}
moel@345
   177
		}
moel@345
   178
moel@345
   179
		private int _offsetX;
moel@345
   180
		public int OffsetX
moel@345
   181
		{
moel@345
   182
			get { return _offsetX; }
moel@345
   183
			private set
moel@345
   184
			{
moel@345
   185
				HideEditor();
moel@345
   186
				_offsetX = value;
moel@345
   187
				UpdateView();
moel@345
   188
			}
moel@345
   189
		}
moel@345
   190
moel@345
   191
		public override Rectangle DisplayRectangle
moel@345
   192
		{
moel@345
   193
			get
moel@345
   194
			{
moel@345
   195
				Rectangle r = ClientRectangle;
moel@345
   196
				//r.Y += ColumnHeaderHeight;
moel@345
   197
				//r.Height -= ColumnHeaderHeight;
moel@345
   198
				int w = _vScrollBar.Visible ? _vScrollBar.Width : 0;
moel@345
   199
				int h = _hScrollBar.Visible ? _hScrollBar.Height : 0;
moel@345
   200
				return new Rectangle(r.X, r.Y, r.Width - w, r.Height - h);
moel@345
   201
			}
moel@345
   202
		}
moel@345
   203
moel@345
   204
		private List<TreeNodeAdv> _selection;
moel@345
   205
		internal List<TreeNodeAdv> Selection
moel@345
   206
		{
moel@345
   207
			get { return _selection; }
moel@345
   208
		}
moel@345
   209
moel@345
   210
		#endregion
moel@345
   211
moel@345
   212
		#region Public Properties
moel@345
   213
moel@345
   214
		#region DesignTime
moel@345
   215
moel@345
   216
		private bool _shiftFirstNode;
moel@345
   217
		[DefaultValue(false), Category("Behavior")]
moel@345
   218
		public bool ShiftFirstNode
moel@345
   219
		{
moel@345
   220
			get { return _shiftFirstNode; }
moel@345
   221
			set { _shiftFirstNode = value; }
moel@345
   222
		}
moel@345
   223
moel@345
   224
		private bool _displayDraggingNodes;
moel@345
   225
		[DefaultValue(false), Category("Behavior")]
moel@345
   226
		public bool DisplayDraggingNodes
moel@345
   227
		{
moel@345
   228
			get { return _displayDraggingNodes; }
moel@345
   229
			set { _displayDraggingNodes = value; }
moel@345
   230
		}
moel@345
   231
moel@345
   232
		private bool _fullRowSelect;
moel@345
   233
		[DefaultValue(false), Category("Behavior")]
moel@345
   234
		public bool FullRowSelect
moel@345
   235
		{
moel@345
   236
			get { return _fullRowSelect; }
moel@345
   237
			set
moel@345
   238
			{
moel@345
   239
				_fullRowSelect = value;
moel@345
   240
				UpdateView();
moel@345
   241
			}
moel@345
   242
		}
moel@345
   243
moel@345
   244
		private bool _useColumns;
moel@345
   245
		[DefaultValue(false), Category("Behavior")]
moel@345
   246
		public bool UseColumns
moel@345
   247
		{
moel@345
   248
			get { return _useColumns; }
moel@345
   249
			set
moel@345
   250
			{
moel@345
   251
				_useColumns = value;
moel@345
   252
				FullUpdate();
moel@345
   253
			}
moel@345
   254
		}
moel@345
   255
moel@345
   256
		private bool _allowColumnReorder;
moel@345
   257
		[DefaultValue(false), Category("Behavior")]
moel@345
   258
		public bool AllowColumnReorder
moel@345
   259
		{
moel@345
   260
			get { return _allowColumnReorder; }
moel@345
   261
			set { _allowColumnReorder = value; }
moel@345
   262
		}
moel@345
   263
moel@345
   264
		private bool _showLines = true;
moel@345
   265
		[DefaultValue(true), Category("Behavior")]
moel@345
   266
		public bool ShowLines
moel@345
   267
		{
moel@345
   268
			get { return _showLines; }
moel@345
   269
			set
moel@345
   270
			{
moel@345
   271
				_showLines = value;
moel@345
   272
				UpdateView();
moel@345
   273
			}
moel@345
   274
		}
moel@345
   275
moel@345
   276
		private bool _showPlusMinus = true;
moel@345
   277
		[DefaultValue(true), Category("Behavior")]
moel@345
   278
		public bool ShowPlusMinus
moel@345
   279
		{
moel@345
   280
			get { return _showPlusMinus; }
moel@345
   281
			set
moel@345
   282
			{
moel@345
   283
				_showPlusMinus = value;
moel@345
   284
				FullUpdate();
moel@345
   285
			}
moel@345
   286
		}
moel@345
   287
moel@345
   288
		private bool _showNodeToolTips = false;
moel@345
   289
		[DefaultValue(false), Category("Behavior")]
moel@345
   290
		public bool ShowNodeToolTips
moel@345
   291
		{
moel@345
   292
			get { return _showNodeToolTips; }
moel@345
   293
			set { _showNodeToolTips = value; }
moel@345
   294
		}
moel@345
   295
moel@345
   296
		[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")]
moel@345
   297
		public bool KeepNodesExpanded
moel@345
   298
		{
moel@345
   299
			get { return true; }
moel@345
   300
			set {}
moel@345
   301
		}
moel@345
   302
moel@345
   303
		private ITreeModel _model;
moel@345
   304
        /// <Summary>
moel@345
   305
        /// The model associated with this <see cref="TreeViewAdv"/>.
moel@345
   306
        /// </Summary>
moel@345
   307
        /// <seealso cref="ITreeModel"/>
moel@345
   308
        /// <seealso cref="TreeModel"/>
moel@345
   309
        [Browsable(false)]
moel@345
   310
		public ITreeModel Model
moel@345
   311
		{
moel@345
   312
			get { return _model; }
moel@345
   313
			set
moel@345
   314
			{
moel@345
   315
				if (_model != value)
moel@345
   316
				{
moel@345
   317
					AbortBackgroundExpandingThreads();
moel@345
   318
					if (_model != null)
moel@345
   319
						UnbindModelEvents();
moel@345
   320
					_model = value;
moel@345
   321
					CreateNodes();
moel@345
   322
					FullUpdate();
moel@345
   323
					if (_model != null)
moel@345
   324
						BindModelEvents();
moel@345
   325
				}
moel@345
   326
			}
moel@345
   327
		}
moel@345
   328
moel@346
   329
        private static Font _font = SystemFonts.MessageBoxFont; 
moel@345
   330
        /// <summary>
moel@345
   331
        /// The font to render <see cref="TreeViewAdv"/> content in.
moel@345
   332
        /// </summary>
moel@345
   333
        [Category("Appearance"), Description("The font to render TreeViewAdv content in.")]
moel@345
   334
        public override Font Font
moel@345
   335
        {
moel@345
   336
            get
moel@345
   337
            {
moel@345
   338
                return (base.Font);
moel@345
   339
            }
moel@345
   340
            set
moel@345
   341
            {
moel@345
   342
                if (value == null)
moel@345
   343
                    base.Font = _font;
moel@345
   344
                else
moel@345
   345
                {
moel@345
   346
                    if (value == DefaultFont)
moel@345
   347
                        base.Font = _font;
moel@345
   348
                    else
moel@345
   349
                        base.Font = value;
moel@345
   350
                }
moel@345
   351
            }
moel@345
   352
        }
moel@345
   353
        public override void ResetFont()
moel@345
   354
        {
moel@345
   355
            Font = null;
moel@345
   356
        }
moel@345
   357
        private bool ShouldSerializeFont()
moel@345
   358
        {
moel@345
   359
            return (!Font.Equals(_font));
moel@345
   360
        }
moel@345
   361
        // End font property
moel@345
   362
moel@345
   363
		private BorderStyle _borderStyle = BorderStyle.Fixed3D;
moel@345
   364
		[DefaultValue(BorderStyle.Fixed3D), Category("Appearance")]
moel@345
   365
		public BorderStyle BorderStyle
moel@345
   366
		{
moel@345
   367
			get
moel@345
   368
			{
moel@345
   369
				return this._borderStyle;
moel@345
   370
			}
moel@345
   371
			set
moel@345
   372
			{
moel@345
   373
				if (_borderStyle != value)
moel@345
   374
				{
moel@345
   375
					_borderStyle = value;
moel@345
   376
					base.UpdateStyles();
moel@345
   377
				}
moel@345
   378
			}
moel@345
   379
		}
moel@345
   380
moel@345
   381
		private bool _autoRowHeight = false;
moel@345
   382
		/// <summary>
moel@345
   383
		/// Set to true to expand each row's height to fit the text of it's largest column.
moel@345
   384
		/// </summary>
moel@345
   385
		[DefaultValue(false), Category("Appearance"), Description("Expand each row's height to fit the text of it's largest column.")]
moel@345
   386
		public bool AutoRowHeight
moel@345
   387
		{
moel@345
   388
			get
moel@345
   389
			{
moel@345
   390
				return _autoRowHeight;
moel@345
   391
			}
moel@345
   392
			set
moel@345
   393
			{
moel@345
   394
				_autoRowHeight = value;
moel@345
   395
				if (value)
moel@345
   396
					_rowLayout = new AutoRowHeightLayout(this, RowHeight);
moel@345
   397
				else
moel@345
   398
					_rowLayout = new FixedRowHeightLayout(this, RowHeight);
moel@345
   399
				FullUpdate();
moel@345
   400
			}
moel@345
   401
		}
moel@345
   402
moel@345
   403
        private GridLineStyle _gridLineStyle = GridLineStyle.None;
moel@345
   404
        [DefaultValue(GridLineStyle.None), Category("Appearance")]
moel@345
   405
        public GridLineStyle GridLineStyle
moel@345
   406
        {
moel@345
   407
            get
moel@345
   408
            {
moel@345
   409
                return _gridLineStyle;
moel@345
   410
            }
moel@345
   411
            set
moel@345
   412
            {
moel@345
   413
				if (value != _gridLineStyle)
moel@345
   414
				{
moel@345
   415
					_gridLineStyle = value;
moel@345
   416
					UpdateView();
moel@345
   417
					OnGridLineStyleChanged();
moel@345
   418
				}
moel@345
   419
            }
moel@345
   420
        }
moel@345
   421
moel@345
   422
		private int _rowHeight = 16;
moel@345
   423
		[DefaultValue(16), Category("Appearance")]
moel@345
   424
		public int RowHeight
moel@345
   425
		{
moel@345
   426
			get
moel@345
   427
			{
moel@345
   428
				return _rowHeight;
moel@345
   429
			}
moel@345
   430
			set
moel@345
   431
			{
moel@345
   432
				if (value <= 0)
moel@345
   433
					throw new ArgumentOutOfRangeException("value");
moel@345
   434
moel@345
   435
				_rowHeight = value;
moel@345
   436
				_rowLayout.PreferredRowHeight = value;
moel@345
   437
				FullUpdate();
moel@345
   438
			}
moel@345
   439
		}
moel@345
   440
moel@345
   441
		private TreeSelectionMode _selectionMode = TreeSelectionMode.Single;
moel@345
   442
		[DefaultValue(TreeSelectionMode.Single), Category("Behavior")]
moel@345
   443
		public TreeSelectionMode SelectionMode
moel@345
   444
		{
moel@345
   445
			get { return _selectionMode; }
moel@345
   446
			set { _selectionMode = value; }
moel@345
   447
		}
moel@345
   448
moel@345
   449
		private bool _hideSelection;
moel@345
   450
		[DefaultValue(false), Category("Behavior")]
moel@345
   451
		public bool HideSelection
moel@345
   452
		{
moel@345
   453
			get { return _hideSelection; }
moel@345
   454
			set
moel@345
   455
			{
moel@345
   456
				_hideSelection = value;
moel@345
   457
				UpdateView();
moel@345
   458
			}
moel@345
   459
		}
moel@345
   460
moel@345
   461
		private float _topEdgeSensivity = 0.3f;
moel@345
   462
		[DefaultValue(0.3f), Category("Behavior")]
moel@345
   463
		public float TopEdgeSensivity
moel@345
   464
		{
moel@345
   465
			get { return _topEdgeSensivity; }
moel@345
   466
			set
moel@345
   467
			{
moel@345
   468
				if (value < 0 || value > 1)
moel@345
   469
					throw new ArgumentOutOfRangeException();
moel@345
   470
				_topEdgeSensivity = value;
moel@345
   471
			}
moel@345
   472
		}
moel@345
   473
moel@345
   474
		private float _bottomEdgeSensivity = 0.3f;
moel@345
   475
		[DefaultValue(0.3f), Category("Behavior")]
moel@345
   476
		public float BottomEdgeSensivity
moel@345
   477
		{
moel@345
   478
			get { return _bottomEdgeSensivity; }
moel@345
   479
			set
moel@345
   480
			{
moel@345
   481
				if (value < 0 || value > 1)
moel@345
   482
					throw new ArgumentOutOfRangeException("value should be from 0 to 1");
moel@345
   483
				_bottomEdgeSensivity = value;
moel@345
   484
			}
moel@345
   485
		}
moel@345
   486
moel@345
   487
		private bool _loadOnDemand;
moel@345
   488
		[DefaultValue(false), Category("Behavior")]
moel@345
   489
		public bool LoadOnDemand
moel@345
   490
		{
moel@345
   491
			get { return _loadOnDemand; }
moel@345
   492
			set { _loadOnDemand = value; }
moel@345
   493
		}
moel@345
   494
moel@345
   495
		private bool _unloadCollapsedOnReload = false;
moel@345
   496
		[DefaultValue(false), Category("Behavior")]
moel@345
   497
		public bool UnloadCollapsedOnReload
moel@345
   498
		{
moel@345
   499
			get { return _unloadCollapsedOnReload; }
moel@345
   500
			set { _unloadCollapsedOnReload = value; }
moel@345
   501
		}
moel@345
   502
moel@345
   503
		private int _indent = 19;
moel@345
   504
		[DefaultValue(19), Category("Behavior")]
moel@345
   505
		public int Indent
moel@345
   506
		{
moel@345
   507
			get { return _indent; }
moel@345
   508
			set
moel@345
   509
			{
moel@345
   510
				_indent = value;
moel@345
   511
				UpdateView();
moel@345
   512
			}
moel@345
   513
		}
moel@345
   514
moel@345
   515
		private Color _lineColor = SystemColors.ControlDark;
moel@345
   516
		[Category("Behavior")]
moel@345
   517
		public Color LineColor
moel@345
   518
		{
moel@345
   519
			get { return _lineColor; }
moel@345
   520
			set
moel@345
   521
			{
moel@345
   522
				_lineColor = value;
moel@345
   523
				CreateLinePen();
moel@345
   524
				UpdateView();
moel@345
   525
			}
moel@345
   526
		}
moel@345
   527
moel@345
   528
		private Color _dragDropMarkColor = Color.Black;
moel@345
   529
		[Category("Behavior")]
moel@345
   530
		public Color DragDropMarkColor
moel@345
   531
		{
moel@345
   532
			get { return _dragDropMarkColor; }
moel@345
   533
			set
moel@345
   534
			{
moel@345
   535
				_dragDropMarkColor = value;
moel@345
   536
				CreateMarkPen();
moel@345
   537
			}
moel@345
   538
		}
moel@345
   539
moel@345
   540
		private float _dragDropMarkWidth = 3.0f;
moel@345
   541
		[DefaultValue(3.0f), Category("Behavior")]
moel@345
   542
		public float DragDropMarkWidth
moel@345
   543
		{
moel@345
   544
			get { return _dragDropMarkWidth; }
moel@345
   545
			set
moel@345
   546
			{
moel@345
   547
				_dragDropMarkWidth = value;
moel@345
   548
				CreateMarkPen();
moel@345
   549
			}
moel@345
   550
		}
moel@345
   551
moel@345
   552
		private bool _highlightDropPosition = true;
moel@345
   553
		[DefaultValue(true), Category("Behavior")]
moel@345
   554
		public bool HighlightDropPosition
moel@345
   555
		{
moel@345
   556
			get { return _highlightDropPosition; }
moel@345
   557
			set { _highlightDropPosition = value; }
moel@345
   558
		}
moel@345
   559
moel@345
   560
		private TreeColumnCollection _columns;
moel@345
   561
		[Category("Behavior"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
moel@345
   562
		public Collection<TreeColumn> Columns
moel@345
   563
		{
moel@345
   564
			get { return _columns; }
moel@345
   565
		}
moel@345
   566
moel@345
   567
		private NodeControlsCollection _controls;
moel@345
   568
		[Category("Behavior"), DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
moel@345
   569
		[Editor(typeof(NodeControlCollectionEditor), typeof(UITypeEditor))]
moel@345
   570
		public Collection<NodeControl> NodeControls
moel@345
   571
		{
moel@345
   572
			get
moel@345
   573
			{
moel@345
   574
				return _controls;
moel@345
   575
			}
moel@345
   576
		}
moel@345
   577
moel@345
   578
		private bool _asyncExpanding;
moel@345
   579
		/// <summary>
moel@345
   580
		/// When set to true, node contents will be read in background thread.
moel@345
   581
		/// </summary>
moel@345
   582
		[Category("Behavior"), DefaultValue(false), Description("Read children in a background thread when expanding.")]
moel@345
   583
		public bool AsyncExpanding
moel@345
   584
		{
moel@345
   585
			get { return _asyncExpanding; }
moel@345
   586
			set { _asyncExpanding = value; }
moel@345
   587
		}
moel@345
   588
moel@345
   589
		#endregion
moel@345
   590
moel@345
   591
		#region RunTime
moel@345
   592
moel@345
   593
		private IToolTipProvider _defaultToolTipProvider = null;
moel@345
   594
		[Browsable(false)]
moel@345
   595
		public IToolTipProvider DefaultToolTipProvider
moel@345
   596
		{
moel@345
   597
			get { return _defaultToolTipProvider; }
moel@345
   598
			set { _defaultToolTipProvider = value; }
moel@345
   599
		}
moel@345
   600
moel@345
   601
		[Browsable(false)]
moel@345
   602
		public IEnumerable<TreeNodeAdv> AllNodes
moel@345
   603
		{
moel@345
   604
			get
moel@345
   605
			{
moel@345
   606
				if (_root.Nodes.Count > 0)
moel@345
   607
				{
moel@345
   608
					TreeNodeAdv node = _root.Nodes[0];
moel@345
   609
					while (node != null)
moel@345
   610
					{
moel@345
   611
						yield return node;
moel@345
   612
						if (node.Nodes.Count > 0)
moel@345
   613
							node = node.Nodes[0];
moel@345
   614
						else if (node.NextNode != null)
moel@345
   615
							node = node.NextNode;
moel@345
   616
						else
moel@345
   617
							node = node.BottomNode;
moel@345
   618
					}
moel@345
   619
				}
moel@345
   620
			}
moel@345
   621
		}
moel@345
   622
moel@345
   623
		private DropPosition _dropPosition;
moel@345
   624
		[Browsable(false)]
moel@345
   625
		public DropPosition DropPosition
moel@345
   626
		{
moel@345
   627
			get { return _dropPosition; }
moel@345
   628
			set { _dropPosition = value; }
moel@345
   629
		}
moel@345
   630
moel@345
   631
		private TreeNodeAdv _root;
moel@345
   632
		[Browsable(false)]
moel@345
   633
		public TreeNodeAdv Root
moel@345
   634
		{
moel@345
   635
			get { return _root; }
moel@345
   636
		}
moel@345
   637
moel@345
   638
		private ReadOnlyCollection<TreeNodeAdv> _readonlySelection;
moel@345
   639
		[Browsable(false)]
moel@345
   640
		public ReadOnlyCollection<TreeNodeAdv> SelectedNodes
moel@345
   641
		{
moel@345
   642
			get
moel@345
   643
			{
moel@345
   644
				return _readonlySelection;
moel@345
   645
			}
moel@345
   646
		}
moel@345
   647
moel@345
   648
		[Browsable(false)]
moel@345
   649
		public TreeNodeAdv SelectedNode
moel@345
   650
		{
moel@345
   651
			get
moel@345
   652
			{
moel@345
   653
				if (Selection.Count > 0)
moel@345
   654
				{
moel@345
   655
					if (CurrentNode != null && CurrentNode.IsSelected)
moel@345
   656
						return CurrentNode;
moel@345
   657
					else
moel@345
   658
						return Selection[0];
moel@345
   659
				}
moel@345
   660
				else
moel@345
   661
					return null;
moel@345
   662
			}
moel@345
   663
			set
moel@345
   664
			{
moel@345
   665
				if (SelectedNode == value)
moel@345
   666
					return;
moel@345
   667
moel@345
   668
				BeginUpdate();
moel@345
   669
				try
moel@345
   670
				{
moel@345
   671
					if (value == null)
moel@345
   672
					{
moel@345
   673
						ClearSelectionInternal();
moel@345
   674
					}
moel@345
   675
					else
moel@345
   676
					{
moel@345
   677
						if (!IsMyNode(value))
moel@345
   678
							throw new ArgumentException();
moel@345
   679
moel@345
   680
						ClearSelectionInternal();
moel@345
   681
						value.IsSelected = true;
moel@345
   682
						CurrentNode = value;
moel@345
   683
						EnsureVisible(value);
moel@345
   684
					}
moel@345
   685
				}
moel@345
   686
				finally
moel@345
   687
				{
moel@345
   688
					EndUpdate();
moel@345
   689
				}
moel@345
   690
			}
moel@345
   691
		}
moel@345
   692
moel@345
   693
		private TreeNodeAdv _currentNode;
moel@345
   694
		[Browsable(false)]
moel@345
   695
		public TreeNodeAdv CurrentNode
moel@345
   696
		{
moel@345
   697
			get { return _currentNode; }
moel@345
   698
			internal set { _currentNode = value; }
moel@345
   699
		}
moel@345
   700
moel@345
   701
        [Browsable(false)]
moel@345
   702
        public int ItemCount
moel@345
   703
        {
moel@345
   704
            get { return RowMap.Count; }
moel@345
   705
        }
moel@345
   706
moel@345
   707
		/// <summary>
moel@345
   708
		/// Indicates the distance the content is scrolled to the left
moel@345
   709
		/// </summary>
moel@345
   710
		[Browsable(false)]
moel@345
   711
		public int HorizontalScrollPosition
moel@345
   712
		{
moel@345
   713
			get
moel@345
   714
			{
moel@345
   715
				if (_hScrollBar.Visible)
moel@345
   716
					return _hScrollBar.Value;
moel@345
   717
				else
moel@345
   718
					return 0;
moel@345
   719
			}
moel@345
   720
		}
moel@345
   721
moel@345
   722
		#endregion
moel@345
   723
moel@345
   724
		#endregion
moel@345
   725
moel@345
   726
	}
moel@345
   727
}