• 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
Re: NSOutlineView variable width cell
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSOutlineView variable width cell


  • Subject: Re: NSOutlineView variable width cell
  • From: John Terranova <email@hidden>
  • Date: Thu, 14 Sep 2006 11:36:49 -0700

I do some kind of funky stuff with my table. I subclass NSTableView and override frameOfCellAtColumn:row:. This might give you some ideas of where to look in documentation as you figure out how and why this code works. In particular, look at the first case (colID == 0): this allows the text in that cell to spill past the column boundary, all the way to the right edge of the table.

- (NSRect)frameOfCellAtColumn:(int)column row:(int)row
{
NSRect rc = [super frameOfCellAtColumn:column row:row];

int colID = [[[[self tableColumns] objectAtIndex:column] identifier] intValue];


if (colID == 0) // the file name can stretch all the way across the table view
rc.size.width = [self bounds].size.width - rc.origin.x;
else if (colID == -1)
{ // disclosure triangle should always be at the top of the row
NSCell *cell = [[[self tableColumns] objectAtIndex:column] dataCellForRow:row];
NSSize size = [cell cellSizeForBounds:rc];
rc.size.height = size.height + 4.0;
}
else
{ // page thumbnails should be below the file name
float dy = [self rowHeight];
rc.size.height -= dy;
rc.origin.y += dy;
}

return rc;
}


	john

Fight war, not wars.


On Sep 14, 2006, at 10:45 AM, Ashley Clark wrote:

I'm not sure how to go about this in my project so I'm looking for some ideas and guidance.

I want to have an outline view where some rows are drawn similarly to the groups row in the Spotlight window ignoring the column layouts. Any ideas? I'm guessing that I'm going to have to subclass NSOutlineView and override whatever method is drawing the row but I'm not sure where to start on this. That is, unless an NSCell can overflow its' bounds?

Help me, please.

Ashley Clark


_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Follow-Ups:
    • Re: NSOutlineView variable width cell
      • From: Ashley Clark <email@hidden>
References: 
 >NSOutlineView variable width cell (From: Ashley Clark <email@hidden>)

  • Prev by Date: Re: NSOutlineView variable width cell
  • Next by Date: NSPopUpButton - addItemsWithTitles
  • Previous by thread: Re: NSOutlineView variable width cell
  • Next by thread: Re: NSOutlineView variable width cell
  • Index(es):
    • Date
    • Thread