mirror of
https://github.com/cappuccino/cappuccino.git
synced 2026-11-16 03:30:42 +00:00
Extend tab view test with different tab view types.
Resizing for all tab view types can now be tested by clicking "Cycle Tab View Type" up to 6 times and resizing the window for each mode. (Some modes are not implemented.)
This commit is contained in:
1 parent
27584544d9
commit
8a39561ddb
1 file changed
+22
-6
@@ -11,15 +11,18 @@
|
||||
|
||||
|
||||
@implementation AppController : CPObject
|
||||
{
|
||||
CPTabView tabView1;
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
|
||||
{
|
||||
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
|
||||
contentView = [theWindow contentView];
|
||||
|
||||
var tabView = [[CPTabView alloc] initWithFrame:CGRectMake(50,50,400,400)];
|
||||
[tabView setTabViewType:CPNoTabsBezelBorder];
|
||||
[tabView setTabViewType:CPTopTabsBezelBorder];
|
||||
tabView1 = [[CPTabView alloc] initWithFrame:CGRectMake(50,50,400,400)];
|
||||
[tabView1 setTabViewType:CPNoTabsBezelBorder];
|
||||
[tabView1 setTabViewType:CPTopTabsBezelBorder];
|
||||
|
||||
var tabs = [
|
||||
"First Tab", "a label",
|
||||
@@ -39,14 +42,27 @@
|
||||
var item = [[CPTabViewItem alloc] initWithIdentifier:tabs[i]];
|
||||
[item setView:view];
|
||||
[item setLabel:tabs[i]];
|
||||
[tabView addTabViewItem:item];
|
||||
[tabView1 addTabViewItem:item];
|
||||
}
|
||||
|
||||
[contentView addSubview:tabView];
|
||||
[contentView addSubview:tabView1];
|
||||
|
||||
[tabView setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
[tabView1 setAutoresizingMask:CPViewWidthSizable | CPViewHeightSizable];
|
||||
|
||||
var toggleButton = [CPButton buttonWithTitle:@"Cycle Tab View Type"];
|
||||
[toggleButton setAction:@selector(switchTabType:)];
|
||||
[toggleButton setTarget:self];
|
||||
[toggleButton sizeToFit];
|
||||
[toggleButton setFrameOrigin:CGPointMake(CGRectGetWidth([contentView frame]) - CGRectGetWidth([toggleButton frame]) - 15, 15)];
|
||||
[toggleButton setAutoresizingMask:CPViewMinXMargin | CPViewMaxYMargin];
|
||||
[contentView addSubview:toggleButton];
|
||||
|
||||
[theWindow orderFront:self];
|
||||
}
|
||||
|
||||
- (@action)switchTabType:(id)sender
|
||||
{
|
||||
[tabView1 setTabViewType:[tabView1 tabViewType] < CPNoTabsNoBorder ? [tabView1 tabViewType] + 1 : CPTopTabsBezelBorder];
|
||||
}
|
||||
|
||||
@end
|
||||
Reference in new issue
Block a user