Skip to content

Commit

Permalink
TabViewTest: add some subviews to test autosizing
Browse files Browse the repository at this point in the history
  • Loading branch information
trunkmaster committed Oct 31, 2024
1 parent ad83854 commit 38b5298
Showing 1 changed file with 25 additions and 7 deletions.
32 changes: 25 additions & 7 deletions Tests/DesktopKit/TabViewTest.m
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,33 @@ - (id)init
[tabView setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];

NXTTabViewItem *item;
NSView *subview;
item = [[NXTTabViewItem alloc] initWithIdentifier:@"0"];
item.label = @"Instances";
NSTextField *subview = [[NSTextField alloc] initWithFrame:NSMakeRect(20, 100, (359 - 40), 21)];
subview = [[NSTextField alloc] initWithFrame:NSMakeRect(20, 100, (359 - 40), 21)];
[item setView:subview];
[subview release];
[tabView addTabViewItem:item];

item = [[NXTTabViewItem alloc] initWithIdentifier:@"1"];
item.label = @"Classes";
NSBox *box = [[NSBox alloc] initWithFrame:NSMakeRect(0, 0, 359, 242 - 27)];
NSScrollView *sv = [[NSScrollView alloc] initWithFrame:NSMakeRect(0, 0, 359-1, 242 - 29)];

[box setBorderType:NSLineBorder];
[box setTitlePosition:NSNoTitle];
[box setContentViewMargins:NSMakeSize(0, 0)];
[box setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];

[sv setHasVerticalScroller:YES];
[sv setHasHorizontalScroller:NO];
[sv setBackgroundColor:[NSColor whiteColor]];
[sv setAutoresizingMask:NSViewHeightSizable | NSViewWidthSizable];
[box addSubview:sv];
[sv release];

[item setView:box];
[box release];
[tabView addTabViewItem:item];

item = [[NXTTabViewItem alloc] initWithIdentifier:@"2"];
Expand All @@ -66,13 +84,13 @@ - (id)init
item.label = @"Sounds";
[tabView addTabViewItem:item];

item = [[NXTTabViewItem alloc] initWithIdentifier:@"4"];
item.label = @"LogngTitle";
[tabView addTabViewItem:item];
// item = [[NXTTabViewItem alloc] initWithIdentifier:@"4"];
// item.label = @"LogngTitle";
// [tabView addTabViewItem:item];

item = [[NXTTabViewItem alloc] initWithIdentifier:@"5"];
item.label = @"VeryLogngTitle";
[tabView addTabViewItem:item];
// item = [[NXTTabViewItem alloc] initWithIdentifier:@"5"];
// item.label = @"VeryLogngTitle";
// [tabView addTabViewItem:item];

[[window contentView] addSubview:tabView];

Expand Down

0 comments on commit 38b5298

Please sign in to comment.