Skip to content

Commit

Permalink
Display data from outline view
Browse files Browse the repository at this point in the history
  • Loading branch information
gcasa committed Dec 28, 2024
1 parent 226d5d3 commit db124f0
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 15 deletions.
52 changes: 37 additions & 15 deletions GormCore/GormDocument.m
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,17 @@ - (void) awakeFromNib
object: window];

// objects...
NSTableColumn *tb = [[NSTableColumn alloc] initWithIdentifier: @"object"];
NSScrollView *outlineScrollView = [[NSScrollView alloc] initWithFrame: scrollRect];

[tb setTitle: @"Object"];
[outlineView addTableColumn: tb];
[outlineScrollView setHasVerticalScroller: YES];
[outlineScrollView setHasHorizontalScroller: YES];
[outlineScrollView setAutoresizingMask:
NSViewHeightSizable|NSViewWidthSizable];
[outlineScrollView setBorderType: NSBezelBorder];

mainRect.origin = NSMakePoint(0,0);
scrollView = [[NSScrollView alloc] initWithFrame: scrollRect];
[scrollView setHasVerticalScroller: YES];
Expand All @@ -386,8 +397,9 @@ - (void) awakeFromNib

[objectViewController setIconView: scrollView];
RELEASE(scrollView);

[objectViewController setOutlineView: outlineView];

[outlineScrollView setDocumentView: outlineView];
[objectViewController setOutlineView: outlineScrollView];
[outlineView setDataSource: self];
[outlineView reloadData];
RELEASE(outlineView);
Expand Down Expand Up @@ -3936,58 +3948,68 @@ - (id) outlineView: (NSOutlineView *)ov
child: (NSInteger)index
ofItem: (id)item
{
id result = nil;

NSLog(@"index = %ld, item = %@", index, item);
if (item == nil)
{
return [[topLevelObjects allObjects] objectAtIndex: index];
result = [[topLevelObjects allObjects] objectAtIndex: index];
}
else if ([item isKindOfClass: [NSWindow class]])
{
return [item contentView];
result = [item contentView];
}
else if ([item isKindOfClass: [NSView class]])
{
return [[item subviews] objectAtIndex: index];
result = [[item subviews] objectAtIndex: index];
}

return nil;
NSLog(@"result = %@", result);

return result;
}

- (BOOL) outlineView: (NSOutlineView *)ov
isItemExpandable: (id)item
{
BOOL f = NO;

if (item == nil)
{
return [topLevelObjects count] > 0;
f = [topLevelObjects count] > 0;
}
else if ([item isKindOfClass: [NSWindow class]])
{
return [item contentView] != nil;
f = [item contentView] != nil;
}
else if ([item isKindOfClass: [NSView class]])
{
return [[item subviews] count] > 0;
f = [[item subviews] count] > 0;
}

return NO;
NSLog(@"f = %d",f);
return f;
}

- (NSInteger) outlineView: (NSOutlineView *)ov
numberOfChildrenOfItem: (id)item
{
NSInteger c = 0;

if (item == nil)
{
return [topLevelObjects count];
c = [topLevelObjects count];
}
else if ([item isKindOfClass: [NSWindow class]])
{
return 1; // We are only counting the contentView...
c = 1; // We are only counting the contentView...
}
else if ([item isKindOfClass: [NSView class]])
{
return [[item subviews] count];
c = [[item subviews] count];
}

return 0;
NSLog(@"c = %ld", c);
return c;
}

- (id) outlineView: (NSOutlineView *)ov
Expand Down
1 change: 1 addition & 0 deletions GormCore/GormObjectViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ - (IBAction) iconView: (id)sender
- (IBAction) outlineView: (id)sender
{
NSLog(@"Called %@", NSStringFromSelector(_cmd));
[[_outlineView documentView] reloadData];
[self resetDisplayView: _outlineView];
}

Expand Down

0 comments on commit db124f0

Please sign in to comment.