| 405 |
405 |
| 406 UIWIDGET ui_sourcelist_create(UiObject *obj, UiSourceListArgs *args) { |
406 UIWIDGET ui_sourcelist_create(UiObject *obj, UiSourceListArgs *args) { |
| 407 // create views |
407 // create views |
| 408 NSScrollView *scrollview = [[NSScrollView alloc] init]; |
408 NSScrollView *scrollview = [[NSScrollView alloc] init]; |
| 409 scrollview.autoresizingMask = NSViewWidthSizable; |
409 scrollview.autoresizingMask = NSViewWidthSizable; |
| |
410 scrollview.hasVerticalScroller = YES; |
| |
411 scrollview.hasHorizontalScroller = NO; |
| |
412 scrollview.autohidesScrollers = YES; |
| 410 |
413 |
| 411 NSOutlineView *outline = [[NSOutlineView alloc]init]; |
414 NSOutlineView *outline = [[NSOutlineView alloc]init]; |
| 412 NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:@"label"]; |
415 NSTableColumn *column = [[NSTableColumn alloc] initWithIdentifier:@"label"]; |
| 413 [outline addTableColumn:column]; |
416 [outline addTableColumn:column]; |
| 414 outline.outlineTableColumn = column; |
417 outline.outlineTableColumn = column; |
| 416 outline.rowSizeStyle = NSTableViewRowSizeStyleDefault; |
419 outline.rowSizeStyle = NSTableViewRowSizeStyleDefault; |
| 417 outline.usesAutomaticRowHeights = YES; |
420 outline.usesAutomaticRowHeights = YES; |
| 418 outline.indentationPerLevel = 0; |
421 outline.indentationPerLevel = 0; |
| 419 |
422 |
| 420 outline.style = NSTableViewStyleSourceList; |
423 outline.style = NSTableViewStyleSourceList; |
| 421 outline.selectionHighlightStyle = NSTableViewSelectionHighlightStyleSourceList; |
|
| 422 |
424 |
| 423 // Make background transparent so vibrancy shows through |
425 // Make background transparent so vibrancy shows through |
| 424 //outline.backgroundColor = [NSColor clearColor]; |
426 //outline.backgroundColor = [NSColor clearColor]; |
| 425 scrollview.drawsBackground = NO; |
427 scrollview.drawsBackground = NO; |
| 426 |
428 |
| 515 UiSourceListItem *i = item; |
520 UiSourceListItem *i = item; |
| 516 if(i) { |
521 if(i) { |
| 517 return [i.items objectAtIndex:index]; |
522 return [i.items objectAtIndex:index]; |
| 518 } |
523 } |
| 519 return [_sections objectAtIndex:index]; |
524 return [_sections objectAtIndex:index]; |
| 520 } |
|
| 521 |
|
| 522 - (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { |
|
| 523 /* |
|
| 524 UiSourceListItem *i = item; |
|
| 525 if([[tableColumn identifier] isEqualToString:@"label"]) { |
|
| 526 return i.label; |
|
| 527 } |
|
| 528 */ |
|
| 529 return nil; |
|
| 530 } |
525 } |
| 531 |
526 |
| 532 - (void)outlineView:(NSOutlineView *)outlineView |
527 - (void)outlineView:(NSOutlineView *)outlineView |
| 533 setObjectValue:(id)object |
528 setObjectValue:(id)object |
| 534 forTableColumn:(NSTableColumn *)tableColumn |
529 forTableColumn:(NSTableColumn *)tableColumn |