• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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

  • Follow-Ups:
    • Re: NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing
      • From: Kyle Sluder <email@hidden>
  • Prev by Date: Re: Subject: [ NSSplitview ] -setAutosaveName
  • Next by Date: Re: NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing
  • Previous by thread: Re: Subject: [ NSSplitview ] -setAutosaveName
  • Next by thread: Re: NSTableViewSelectionHighlightStyleSourceList interferes with custom NSBrowserCell drawing
  • Index(es):
    • Date
    • Thread