I have a custom icon in a .tiff that I draw next to my cells in an 
NSOutlineView table.

Everything works fine until I turn on 
NSTableViewSelectionHighlightStyleSourceList:

[ registryOutlineView 
setSelectionHighlightStyle:NSTableViewSelectionHighlightStyleSourceList ];

When I do that the table draws the disclosure triangle area with the 
NSTableViewSelectionHighlightStyleSourceList but it draws the icon & text to 
the right of my icon without NSTableViewSelectionHighlightStyleSourceList (i.e. 
with normal selection highlighting).

In my header I have my cell & icon ivar:

IBOutlet NSOutlineView *registryOutlineView;
NSImage *hackOutlineViewFolderIconImage;
NSBrowserCell  *hackOutlineViewFolderCell;

When my app starts I load my icon from file, cache it, and then set my folder 
icon image onto my NSBrowserCell:

- (BOOL)loadCachedIconCell
{
    BOOL    gotEm = NO;
    
    if( hackOutlineViewFolderIconImage )
    {
        // Make a new folder icon cell and cache it...
        
        hackOutlineViewFolderCell = [ [ NSBrowserCell alloc ] init ];
        if( hackOutlineViewFolderCell )
        {
            // Turn off right-pointing arrow on right side of cell...
            
            [ hackOutlineViewFolderCell setLeaf:YES ];
        
            // Set our folder icon into the cell...
            
            [ hackOutlineViewFolderCell setImage:hackOutlineViewFolderIconImage 
];
        }
    }
    
    return gotEm;
}

In my - (void)outlineView:(NSOutlineView*)outlineView
willDisplayCell:(id)cell forTableColumn:(NSTableColumn*)tableColumn
item:(id)item method I set the cell to the cached cell I set up earlier:

- (void)outlineView:(NSOutlineView*)outlineView willDisplayCell:(id)cell 
forTableColumn:(NSTableColumn*)tableColumn item:(id)item
{
    if( outlineView && cell && tableColumn && item )
    {
        // Only handle outline view case...
        
        if( ( [ outlineView isEqualTo:registryOutlineView ] ) && ( [ 
tableColumn isEqualTo:registryTableColumn1 ] ) )
        {
            // Set the column's cell to our folder icon cell...
            
            if( hackOutlineViewFolderCell )
            {
                [ tableColumn setDataCell:hackOutlineViewFolderCell ];
            }
      }
  }
}


      
_______________________________________________

Cocoa-dev mailing list ([email protected])

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [email protected]

Reply via email to