diff -r 13896bdaa151 -r 32a4415dc69a ui/cocoa/list.m --- a/ui/cocoa/list.m Fri Oct 10 15:54:01 2025 +0200 +++ b/ui/cocoa/list.m Sat Oct 11 10:23:22 2025 +0200 @@ -416,20 +416,12 @@ outline.rowSizeStyle = NSTableViewRowSizeStyleDefault; outline.usesAutomaticRowHeights = YES; outline.indentationPerLevel = 0; - outline.indentationMarkerFollowsCell = NO; - - outline.floatsGroupRows = NO; - outline.indentationPerLevel = 0.0; - outline.indentationMarkerFollowsCell = NO; - outline.selectionHighlightStyle = NSTableViewSelectionHighlightStyleRegular; - - // Hide the disclosure triangle - //outline.disclosureButtonImage = nil; outline.style = NSTableViewStyleSourceList; - + outline.selectionHighlightStyle = NSTableViewSelectionHighlightStyleSourceList; + // Make background transparent so vibrancy shows through - outline.backgroundColor = [NSColor clearColor]; + //outline.backgroundColor = [NSColor clearColor]; scrollview.drawsBackground = NO; scrollview.documentView = outline; @@ -458,6 +450,8 @@ outline.dataSource = data; outline.delegate = data; + [data update:-1]; + objc_setAssociatedObject(outline, "ui_datasource", data, OBJC_ASSOCIATION_RETAIN); return (__bridge void*)scrollview; @@ -498,6 +492,7 @@ } [_outlineView reloadData]; + [_outlineView expandItem:nil expandChildren:YES]; } // NSOutlineViewDataSource implementation @@ -525,10 +520,12 @@ } - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { + /* UiSourceListItem *i = item; if([[tableColumn identifier] isEqualToString:@"label"]) { return i.label; } + */ return nil; } @@ -557,22 +554,50 @@ cell.imageView = iconView; // Label - NSTextField *textField = [NSTextField labelWithString:@""]; + //NSTextField *textField = [NSTextField labelWithString:@""]; + NSTextField *textField = [[NSTextField alloc] initWithFrame:NSZeroRect]; textField.translatesAutoresizingMaskIntoConstraints = NO; + textField.bezeled = NO; + textField.editable = NO; + textField.drawsBackground = NO; + textField.selectable = NO; + textField.lineBreakMode = NSLineBreakByTruncatingTail; + + [cell addSubview:textField]; cell.textField = textField; - - // Layout constraints - [NSLayoutConstraint activateConstraints:@[ - [iconView.leadingAnchor constraintEqualToAnchor:cell.leadingAnchor constant:0], - [iconView.centerYAnchor constraintEqualToAnchor:cell.centerYAnchor], + + if([i isSection]) { + NSFont *font = [NSFont boldSystemFontOfSize:[NSFont systemFontSize]*0.85]; + //NSFont *font = [NSFont preferredFontForTextStyle:NSFontTextStyleCaption1 options:@{}]; + NSDictionary *attrs = @{ + NSFontAttributeName: font, + NSForegroundColorAttributeName: [NSColor tertiaryLabelColor] + }; + textField.attributedStringValue = [[NSAttributedString alloc] initWithString:i.label attributes:attrs]; + + // Layout constraints + [NSLayoutConstraint activateConstraints:@[ + [iconView.leadingAnchor constraintEqualToAnchor:cell.leadingAnchor constant:0], + [iconView.bottomAnchor constraintEqualToAnchor:cell.bottomAnchor constant:-1], - [textField.leadingAnchor constraintEqualToAnchor:cell.leadingAnchor constant:0], - [textField.centerYAnchor constraintEqualToAnchor:cell.centerYAnchor], - [textField.trailingAnchor constraintEqualToAnchor:cell.trailingAnchor constant:0], - ]]; - - textField.stringValue = i.label; + [textField.leadingAnchor constraintEqualToAnchor:cell.leadingAnchor constant:0], + [textField.bottomAnchor constraintEqualToAnchor:cell.bottomAnchor constant:-1], + [textField.trailingAnchor constraintEqualToAnchor:cell.trailingAnchor constant:0], + ]]; + } else { + textField.stringValue = i.label; + + // Layout constraints + [NSLayoutConstraint activateConstraints:@[ + [iconView.leadingAnchor constraintEqualToAnchor:cell.leadingAnchor constant:0], + [iconView.centerYAnchor constraintEqualToAnchor:cell.centerYAnchor], + + [textField.leadingAnchor constraintEqualToAnchor:cell.leadingAnchor constant:0], + [textField.centerYAnchor constraintEqualToAnchor:cell.centerYAnchor], + [textField.trailingAnchor constraintEqualToAnchor:cell.trailingAnchor constant:0], + ]]; + } return cell; } @@ -590,6 +615,21 @@ return [i isSection] ? NO : YES; } +- (CGFloat) outlineView:(NSOutlineView *) outlineView + heightOfRowByItem:(id) item +{ + UiSourceListItem *i = item; + CGFloat rowHeight = outlineView.rowHeight; + if([i isSection]) { + if(i.index == 0) { + rowHeight -= 12; + } else { + rowHeight += 4; + } + } + return rowHeight; +} + - (void) outlineViewSelectionDidChange:(NSNotification *) notification { UiEvent event; event.obj = _obj; @@ -690,6 +730,21 @@ NSRect frame = subview.frame; frame.origin.x = self.bounds.size.width - frame.size.width - 16.0; subview.frame = frame; + + if(!_hover) { + subview.hidden = YES; + } + + if(subview != _disclosureButton) { + // init disclosure button + _disclosureButton = (NSButton*)subview; + if ([subview isKindOfClass:[NSButton class]]) { + NSButton *button = (NSButton*)subview; + button.contentTintColor = [NSColor tertiaryLabelColor]; + } + } + + } else if ([subview.identifier isEqualToString:@"cell"]) { NSRect frame = subview.frame; frame.origin.x = 16; @@ -698,4 +753,28 @@ } } +- (void)updateTrackingAreas { + [super updateTrackingAreas]; + if(_trackingArea != nil) { + [self removeTrackingArea:_trackingArea]; + } + _trackingArea = [[NSTrackingArea alloc] initWithRect:self.bounds + options:NSTrackingMouseEnteredAndExited | + NSTrackingActiveInActiveApp | + NSTrackingInVisibleRect + owner:self + userInfo:nil]; + [self addTrackingArea:_trackingArea]; +} + +- (void)mouseEntered:(NSEvent *)event { + _hover = YES; + _disclosureButton.hidden = NO; +} + +- (void)mouseExited:(NSEvent *)event { + _hover = NO; + _disclosureButton.hidden = YES; +} + @end