@@ -20,7 +20,6 @@ public abstract class BaseNode
2020
2121 internal static readonly List < INodeInfoReader > NodeInfoReader = new List < INodeInfoReader > ( ) ;
2222
23- protected static readonly int TextPadding = Icons . Dimensions ;
2423 protected static readonly int HiddenHeight = 0 ;
2524
2625 private static int nodeIndex = 0 ;
@@ -383,6 +382,11 @@ protected void AddSelection(ViewInfo view, int x, int y, int height)
383382 AddHotSpot ( view , new Rectangle ( 0 , y , view . ClientArea . Right - ( IsSelected ? 16 : 0 ) , height ) , string . Empty , HotSpot . NoneId , HotSpotType . Select ) ;
384383 }
385384
385+ protected int AddIconPadding ( ViewInfo view , int x )
386+ {
387+ return x + view . IconProvider . Dimensions ;
388+ }
389+
386390 /// <summary>Draws an icon and adds a <see cref="HotSpot"/> if <paramref name="id"/> is not <see cref="HotSpot.NoneId"/>.</summary>
387391 /// <param name="view">The view information.</param>
388392 /// <param name="x">The x coordinate.</param>
@@ -397,19 +401,21 @@ protected int AddIcon(ViewInfo view, int x, int y, Image icon, int id, HotSpotTy
397401 Contract . Requires ( view . Context != null ) ;
398402 Contract . Requires ( icon != null ) ;
399403
400- if ( y > view . ClientArea . Bottom || y + Icons . Dimensions < 0 )
404+ var size = view . IconProvider . Dimensions ;
405+
406+ if ( y > view . ClientArea . Bottom || y + size < 0 )
401407 {
402- return x + Icons . Dimensions ;
408+ return x + size ;
403409 }
404410
405- view . Context . DrawImage ( icon , x + 2 , y , Icons . Dimensions , Icons . Dimensions ) ;
411+ view . Context . DrawImage ( icon , x + 2 , y , size , size ) ;
406412
407413 if ( id != HotSpot . NoneId )
408414 {
409- AddHotSpot ( view , new Rectangle ( x , y , Icons . Dimensions , Icons . Dimensions ) , string . Empty , id , type ) ;
415+ AddHotSpot ( view , new Rectangle ( x , y , size , size ) , string . Empty , id , type ) ;
410416 }
411417
412- return x + Icons . Dimensions ;
418+ return x + size ;
413419 }
414420
415421 /// <summary>Adds a togglable Open/Close icon.</summary>
@@ -422,12 +428,13 @@ protected int AddOpenCloseIcon(ViewInfo view, int x, int y)
422428 Contract . Requires ( view != null ) ;
423429 Contract . Requires ( view . Context != null ) ;
424430
425- if ( y > view . ClientArea . Bottom || y + Icons . Dimensions < 0 )
431+ if ( y > view . ClientArea . Bottom || y + view . IconProvider . Dimensions < 0 )
426432 {
427- return x + Icons . Dimensions ;
433+ return x + view . IconProvider . Dimensions ;
428434 }
429435
430- return AddIcon ( view , x , y , LevelsOpen [ view . Level ] ? Icons . OpenCloseOpen : Icons . OpenCloseClosed , 0 , HotSpotType . OpenClose ) ;
436+ var icon = LevelsOpen [ view . Level ] ? view . IconProvider . OpenCloseOpen : view . IconProvider . OpenCloseClosed ;
437+ return AddIcon ( view , x , y , icon , 0 , HotSpotType . OpenClose ) ;
431438 }
432439
433440 /// <summary>Draws a context drop icon if the node is selected.</summary>
@@ -438,14 +445,14 @@ protected void AddContextDropDownIcon(ViewInfo view, int y)
438445 Contract . Requires ( view != null ) ;
439446 Contract . Requires ( view . Context != null ) ;
440447
441- if ( view . MultipleNodesSelected || y > view . ClientArea . Bottom || y + Icons . Dimensions < 0 || IsWrapped )
448+ if ( view . MultipleNodesSelected || y > view . ClientArea . Bottom || y + view . IconProvider . Dimensions < 0 || IsWrapped )
442449 {
443450 return ;
444451 }
445452
446453 if ( IsSelected )
447454 {
448- AddIcon ( view , 0 , y , Icons . DropArrow , 0 , HotSpotType . Context ) ;
455+ AddIcon ( view , 0 , y , view . IconProvider . DropArrow , 0 , HotSpotType . Context ) ;
449456 }
450457 }
451458
@@ -457,14 +464,14 @@ protected void AddDeleteIcon(ViewInfo view, int y)
457464 Contract . Requires ( view != null ) ;
458465 Contract . Requires ( view . Context != null ) ;
459466
460- if ( y > view . ClientArea . Bottom || y + Icons . Dimensions < 0 || IsWrapped )
467+ if ( y > view . ClientArea . Bottom || y + view . IconProvider . Dimensions < 0 || IsWrapped )
461468 {
462469 return ;
463470 }
464471
465472 if ( IsSelected )
466473 {
467- AddIcon ( view , view . ClientArea . Right - Icons . Dimensions , y , Icons . Delete , 0 , HotSpotType . Delete ) ;
474+ AddIcon ( view , view . ClientArea . Right - view . IconProvider . Dimensions , y , view . IconProvider . Delete , 0 , HotSpotType . Delete ) ;
468475 }
469476 }
470477
0 commit comments