I use the same NSTableCellView
for both top-level and other items.
I set the text color the same way for all items:
- (nullable NSView*) outlineView:(NSOutlineView *)outlineView viewForTableColumn:(nullable NSTableColumn *)tableColumn item:(id)item_;
{
NSTableCellView *cell = [outlineView makeViewWithIdentifier:@"DataCell" owner:self];
cell.textField.stringValue = @"hi";
cell.textField.textColor = NSColor.redColor;
return cell;
}
Which results in top-level items having some kinda system color - not red.
My remaining relevant code:
- (BOOL) outlineView:(NSOutlineView *)outlineView isGroupItem:(id)item_;
{
return YES // only for the first item;
}
I've tried to subclass NSTableHeaderCell
as advised in other topics but it's not working.
This is how I try to change the headerCells:
- (void) viewDidLoad;
{
for (NSTableColumn *col in self.ov_sidebar.tableColumns) {
col.headerCell = [NCTableHeaderCell_customizable new];
}
self.ov_sidebar.delegate = self;
self.ov_sidebar.dataSource = self;
}
But none of the NCTableHeaderCell_customizable
overiden methods are called. So I guess the custom headerCells must be set some other way.
Likely it's not even the proper way to change to text color.
Do you have any clue how to properly set text color of top-level NSOutlineView items?
One possible lead, when I change the "Highlight" from "Source List" to "None" then it shows the list like this:
It has proper font color but unwanted formatting with disclosure and background with border.
So, shall I continue this way and try to fix this formatting as needed or is there a solution with "Source List"?