Sat, 11 Oct 2025 10:37:00 +0200
enable vertical scrollbar in the sourcelist (Cocoa)
| ui/cocoa/list.m | file | annotate | diff | comparison | revisions | |
| ui/cocoa/window.m | file | annotate | diff | comparison | revisions |
--- a/ui/cocoa/list.m Sat Oct 11 10:23:22 2025 +0200 +++ b/ui/cocoa/list.m Sat Oct 11 10:37:00 2025 +0200 @@ -407,6 +407,9 @@ // create views NSScrollView *scrollview = [[NSScrollView alloc] init]; scrollview.autoresizingMask = NSViewWidthSizable; + scrollview.hasVerticalScroller = YES; + scrollview.hasHorizontalScroller = NO; + scrollview.autohidesScrollers = YES; NSOutlineView *outline = [[NSOutlineView alloc]init]; NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:@"label"]; @@ -418,7 +421,6 @@ outline.indentationPerLevel = 0; outline.style = NSTableViewStyleSourceList; - outline.selectionHighlightStyle = NSTableViewSelectionHighlightStyleSourceList; // Make background transparent so vibrancy shows through //outline.backgroundColor = [NSColor clearColor]; @@ -463,6 +465,9 @@ } +/* + * Data Source and Delegate for the sourcelist NSOutlineView + */ @implementation UiSourceList - (id)init:(UiObject*)obj outline:(NSOutlineView*)view { @@ -519,16 +524,6 @@ return [_sections objectAtIndex:index]; } -- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { - /* - UiSourceListItem *i = item; - if([[tableColumn identifier] isEqualToString:@"label"]) { - return i.label; - } - */ - return nil; -} - - (void)outlineView:(NSOutlineView *)outlineView setObjectValue:(id)object forTableColumn:(NSTableColumn *)tableColumn @@ -663,6 +658,10 @@ @end +/* + * Outline datasource item + * Is used for sections (sublists) and individual items + */ @implementation UiSourceListItem - (id)init:(UiSourceList*)sourcelist sublist:(UiSubList*)sublist { @@ -694,6 +693,8 @@ } - (void)update:(int)row { + // TODO: check row + [_items removeAllObjects]; if(_var == NULL) { return; @@ -718,6 +719,11 @@ @end +/* + * Custom NSTableRowView implementation + * Moves the disclosure button to the right side + * Handles mouse hover events (for hiding the disclosure button) + */ @implementation UiSourceListRow - (void)layout {
--- a/ui/cocoa/window.m Sat Oct 11 10:23:22 2025 +0200 +++ b/ui/cocoa/window.m Sat Oct 11 10:37:00 2025 +0200 @@ -51,7 +51,7 @@ MainWindow *window = [[MainWindow alloc] init:obj withSidebar:sidebar withSplitview:splitview]; [[WindowManager sharedWindowManager] addWindow:window]; - window.releasedWhenClosed = false; + window.releasedWhenClosed = false; // TODO: we still need a cleanup strategy obj->wobj = (__bridge void*)window;