@ -41,6 +41,14 @@ namespace Aga.Controls.Tree
private IncrementalSearch _ search ;
private IncrementalSearch _ search ;
private List < TreeNodeAdv > _ expandingNodes = new List < TreeNodeAdv > ( ) ;
private List < TreeNodeAdv > _ expandingNodes = new List < TreeNodeAdv > ( ) ;
private AbortableThreadPool _ threadPool = new AbortableThreadPool ( ) ;
private AbortableThreadPool _ threadPool = new AbortableThreadPool ( ) ;
private ContextMenuStrip _ cms ;
public new ContextMenuStrip ContextMenuStrip {
set {
base . ContextMenuStrip = value ;
_ cms = value ;
}
}
#region Public Events
#region Public Events
@ -182,11 +190,11 @@ namespace Aga.Controls.Tree
{
{
InitializeComponent ( ) ;
InitializeComponent ( ) ;
SetStyle ( ControlStyles . AllPaintingInWmPaint
SetStyle ( ControlStyles . AllPaintingInWmPaint
| ControlStyles . UserPaint
| ControlStyles . UserPaint
| ControlStyles . OptimizedDoubleBuffer
| ControlStyles . OptimizedDoubleBuffer
| ControlStyles . ResizeRedraw
| ControlStyles . ResizeRedraw
| ControlStyles . Selectable
| ControlStyles . Selectable
, true ) ;
, true ) ;
if ( Application . RenderWithVisualStyles )
if ( Application . RenderWithVisualStyles )
@ -308,7 +316,7 @@ namespace Aga.Controls.Tree
point . X + = OffsetX ;
point . X + = OffsetX ;
foreach ( NodeControlInfo info in GetNodeControls ( node ) )
foreach ( NodeControlInfo info in GetNodeControls ( node ) )
if ( info . Bounds . Contains ( point ) )
if ( info . Bounds . Contains ( point ) )
return info ;
return info ;
if ( FullRowSelect )
if ( FullRowSelect )
return new NodeControlInfo ( null , Rectangle . Empty , node ) ;
return new NodeControlInfo ( null , Rectangle . Empty , node ) ;
@ -433,10 +441,10 @@ namespace Aga.Controls.Tree
Rectangle clientRect = ClientRectangle ;
Rectangle clientRect = ClientRectangle ;
_ hScrollBar . SetBounds ( clientRect . X , clientRect . Bottom - hBarSize ,
_ hScrollBar . SetBounds ( clientRect . X , clientRect . Bottom - hBarSize ,
clientRect . Width - vBarSize , hBarSize ) ;
clientRect . Width - vBarSize , hBarSize ) ;
_ vScrollBar . SetBounds ( clientRect . Right - vBarSize , clientRect . Y ,
_ vScrollBar . SetBounds ( clientRect . Right - vBarSize , clientRect . Y ,
vBarSize , clientRect . Height - hBarSize ) ;
vBarSize , clientRect . Height - hBarSize ) ;
}
}
private void SafeUpdateScrollBars ( )
private void SafeUpdateScrollBars ( )
@ -483,10 +491,10 @@ namespace Aga.Controls.Tree
switch ( BorderStyle )
switch ( BorderStyle )
{
{
case BorderStyle . FixedSingle :
case BorderStyle . FixedSingle :
res . Style | = 0x800000 ;
res . Style | = 0x800000 ;
break ;
break ;
case BorderStyle . Fixed3D :
case BorderStyle . Fixed3D :
res . ExStyle | = 0x200 ;
res . ExStyle | = 0x200 ;
break ;
break ;
}
}
return res ;
return res ;
@ -580,10 +588,10 @@ namespace Aga.Controls.Tree
bool isLastControl = true ;
bool isLastControl = true ;
for ( int k = i + 1 ; k < NodeControls . Count ; k + + )
for ( int k = i + 1 ; k < NodeControls . Count ; k + + )
if ( NodeControls [ k ] . ParentColumn = = col )
if ( NodeControls [ k ] . ParentColumn = = col )
{
{
isLastControl = false ;
isLastControl = false ;
break ;
break ;
}
}
width = right - x ;
width = right - x ;
if ( ! isLastControl )
if ( ! isLastControl )
@ -669,26 +677,26 @@ namespace Aga.Controls.Tree
IEnumerable items = Model . GetChildren ( GetPath ( parentNode ) ) ;
IEnumerable items = Model . GetChildren ( GetPath ( parentNode ) ) ;
if ( items ! = null )
if ( items ! = null )
foreach ( object obj in items )
foreach ( object obj in items )
{
bool found = false ;
if ( obj ! = null )
{
{
bool found = false ;
for ( int i = 0 ; i < oldNodes . Count ; i + + )
if ( obj ! = null )
if ( object . Equals ( obj , oldNodes [ i ] . Tag ) )
{
{
for ( int i = 0 ; i < oldNodes . Count ; i + + )
oldNodes [ i ] . RightBounds = oldNodes [ i ] . Height = null ;
if ( object . Equals ( obj , oldNodes [ i ] . Tag ) )
AddNode ( parentNode , - 1 , oldNodes [ i ] ) ;
{
oldNodes . RemoveAt ( i ) ;
oldNodes [ i ] . RightBounds = oldNodes [ i ] . Height = null ;
found = true ;
AddNode ( parentNode , - 1 , oldNodes [ i ] ) ;
break ;
oldNodes . RemoveAt ( i ) ;
found = true ;
break ;
}
}
}
if ( ! found )
AddNewNode ( parentNode , obj , - 1 ) ;
if ( performFullUpdate )
FullUpdate ( ) ;
}
}
if ( ! found )
AddNewNode ( parentNode , obj , - 1 ) ;
if ( performFullUpdate )
FullUpdate ( ) ;
}
}
}
}
}
@ -860,7 +868,7 @@ namespace Aga.Controls.Tree
_ contentWidth = 0 ;
_ contentWidth = 0 ;
foreach ( TreeColumn col in _ columns )
foreach ( TreeColumn col in _ columns )
if ( col . IsVisible )
if ( col . IsVisible )
_ contentWidth + = col . Width ;
_ contentWidth + = col . Width ;
}
}
}
}
@ -945,10 +953,10 @@ namespace Aga.Controls.Tree
for ( int i = Selection . Count - 1 ; i > = 0 ; i - - )
for ( int i = Selection . Count - 1 ; i > = 0 ; i - - )
if ( ! IsMyNode ( Selection [ i ] ) )
if ( ! IsMyNode ( Selection [ i ] ) )
{
{
flag = true ;
flag = true ;
Selection . RemoveAt ( i ) ;
Selection . RemoveAt ( i ) ;
}
}
if ( flag )
if ( flag )
OnSelectionChanged ( ) ;
OnSelectionChanged ( ) ;
@ -1186,10 +1194,10 @@ namespace Aga.Controls.Tree
{
{
for ( int n = 0 ; n < e . Children . Length ; n + + )
for ( int n = 0 ; n < e . Children . Length ; n + + )
if ( parent . Nodes [ i ] . Tag = = e . Children [ n ] )
if ( parent . Nodes [ i ] . Tag = = e . Children [ n ] )
{
{
parent . Nodes . RemoveAt ( i ) ;
parent . Nodes . RemoveAt ( i ) ;
break ;
break ;
}
}
}
}
}
}
}
}
@ -1246,9 +1254,9 @@ namespace Aga.Controls.Tree
{
{
foreach ( object obj in e . Children )
foreach ( object obj in e . Children )
if ( node . Tag = = obj )
if ( node . Tag = = obj )
{
{
node . Height = node . RightBounds = null ;
node . Height = node . RightBounds = null ;
}
}
}
}
}
}
}
}