Re: Regarding iTunes 7 sidebar
Re: Regarding iTunes 7 sidebar
- Subject: Re: Regarding iTunes 7 sidebar
- From: Fredrik Olsson <email@hidden>
- Date: Wed, 25 Oct 2006 08:45:30 +0200
Fredrik H. Larsen skrev:
I was wondering how I could make something that looks and works like
the new sidebar in iTunes 7. Something like NSOutlineView, I guess.
Any ideas? Thanks in advance!
Perhaps allot :).
First you have a larger gap before each "label row" except the first
one. So either the "label rows" needs to be of different height, or you
need some "separator rows", I would suggest separator rows. Either way
you need to use the NSOutlineView's delegate method
outlineView:heightOfRowByItem: to set different heights.
And when you are fiddling with the delegate also implement
outlineView:shouldSelectItem: to disallow selection of the "label rows".
Now the looks of the row cells are quite unusual so you will need to
subclass NSTextFieldCell. I would suggest two different subclasses, one
for the "label rows", and one for the "normal rows".
The "label row" subclass is quite simple, override
drawInteriorWithFrame:inView: and force uppercase, draw string twice to
get the nice emboss look.
For the "normal rows" check out
Examples/AppKit/DragNDropOutlineView/ImageAndTextCell.{h|m}, to get the
drawing with icons, do not forget to draw white text if the row is selected.
Now you also need to subclass NSOutlineView, and override its
highlightSelectionInClipRect: method in order to draw the selection bar,
use an image for starters.
If you now have two different subclasses for drawing "label rows" and
"normal rows" then you need to also subclass NSTableColumn and override
dataCellForRow: to return the data cell to use for each row.
That should be about it :).
// Fredrik Olsson
Fredrik Larsen.
_______________________________________________
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
outlineView:heightOfRowByItem:
_______________________________________________
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