NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing
NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing
- Subject: NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing
- From: Erg Consultant <email@hidden>
- Date: Sun, 31 May 2009 00:47:22 -0700 (PDT)
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@hidden)
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:
This email sent to email@hidden