It turns out easier than I expected. Here is a draft of the solution. To indent a column other than a structure column in NSOutlineView, you can:
- Create a subclass of the NSCell class that you will use for this column, say MYIndentedCell
- Add
indentationan instance variable to MYIndentedCell and provide an access and mutator method for it - Override at least drawWithFrame: inView: in MYIndentedCell to:
- (void) drawWithFrame: (NSRect) frame inView: (NSView *) view
{
NSRect newFrame = frame;
newFrame.origin.x += indentation;
newFrame.size.width -= indentation;
[super drawWithFrame: newFrame inView: view];
}
editWithFrame:inView selectWithFrame:inView: , .- cellSize, :
- (NSSize) cellSize
{
NSSize cellSize = [super cellSize];
cellSize.width += indentation;
return cellSize;
}
- (void) outlineView: (NSOutlineView *) view
willDisplayCell: (id) cell
forTableColumn: (NSTableColumn *) column
item: (id) item
{
if (column == theColumnToBeIndented) {
[cell setIndentation:
[view indentationPerLevel] * [view levelForItem: item]];
}
}
, , , ImageAndTextCell.m Apple SourceView, , .