Skip to content

Instantly share code, notes, and snippets.

@tbalthazar
Created March 27, 2009 08:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tbalthazar/86601 to your computer and use it in GitHub Desktop.
Save tbalthazar/86601 to your computer and use it in GitHub Desktop.
/*
* AppController.j
* ticket-10-0.7b
*
* Created by __Me__ on __Date__.
* Copyright 2008 __MyCompanyName__. All rights reserved.
*/
@import <Foundation/CPObject.j>
@implementation AppController : CPObject
{
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask],
contentView = [theWindow contentView];
var bounds = [contentView bounds];
var frame = CGRectMake(CGRectGetMinX(bounds)+75,
CGRectGetMinY(bounds)+100,
CGRectGetWidth(bounds)-150,
CGRectGetHeight(bounds)-200);
tabView = [[CPTabView alloc] initWithFrame:frame];
[tabView setTabViewType:CPTopTabsBezelBorder];
[tabView layoutSubviews];
[tabView setAutoresizingMask: CPViewHeightSizable | CPViewWidthSizable];
webSearchTabItem = [[CPTabViewItem alloc] initWithIdentifier:@"web"];
imageSearchTabItem = [[CPTabViewItem alloc] initWithIdentifier:@"image"];
newsSearchTabItem = [[CPTabViewItem alloc] initWithIdentifier:@"news"];
webView = [[CPView alloc] initWithFrame:CPRectMakeZero()];
imageView = [[CPView alloc] initWithFrame:CPRectMakeZero()];
newsView = [[CPView alloc] initWithFrame:CPRectMakeZero()];
[webSearchTabItem setLabel:@"Web"];
[imageSearchTabItem setLabel:@"Image"];
[newsSearchTabItem setLabel:@"News"];
[webSearchTabItem setView:webView];
[imageSearchTabItem setView:imageView];
[newsSearchTabItem setView:newsView];
// if the tabView is added here, it does work
[contentView addSubview:tabView];
[tabView addTabViewItem:webSearchTabItem];
[tabView addTabViewItem:imageSearchTabItem];
[tabView addTabViewItem:newsSearchTabItem];
// if the tabView is added here, it does not work
// [contentView addSubview:tabView];
[theWindow orderFront:self];
alert([tabView indexOfTabViewItemWithIdentifier:@"image"])
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment