Skip to content

Instantly share code, notes, and snippets.

@jlebrech
Created January 10, 2011 16:36
Show Gist options
  • Save jlebrech/773008 to your computer and use it in GitHub Desktop.
Save jlebrech/773008 to your computer and use it in GitHub Desktop.
@import <Foundation/CPObject.j>
@import "ProjectsView.j"
@import "TasksView.j"
@implementation AppController : CPObject
{
ProjectsView projectsView;
TasksView tasksView;
CPTabView tabsView;
}
- (void)applicationDidFinishLaunching:(CPNotification)aNotification
{
var theWindow = [[CPWindow alloc] initWithContentRect:CGRectMakeZero() styleMask:CPBorderlessBridgeWindowMask];
var contentView = [theWindow contentView];
// projects list
projectsView = [[ProjectsView alloc] initWithFrame:CGRectMake(5,5,300,400)];//CGRectGetWidth([finderPanel bounds])-5,CGRectGetHeight([finderPanel bounds])-5)];
[projectsView setAutoresizingMask:CPViewHeightSizable|CPViewWidthSizable];
[projectsView setDelegate:self];
//[projectsContent addSubview:projectsView];
// tasks list
tasksView = [[TasksView alloc] initWithFrame:CGRectMake(5,5,300,400)];//CGRectGetWidth([finderPanel bounds])-5,CGRectGetHeight([finderPanel bounds])-5)];
[tasksView setAutoresizingMask:CPViewHeightSizable|CPViewWidthSizable];
[tasksView setDelegate:self];
//[tasksContent addSubview:tasksView];
// panel for tabs
var tabsPanel = [[CPPanel alloc] initWithContentRect:CGRectMake(50, 50, 800, 600) styleMask:CPClosableWindowMask];
[tabsPanel setFloatingPanel:YES];
[tabsPanel orderFront:self];
[tabsPanel setTitle:"Tabs"];
var tabsContent = [tabsPanel contentView];
// the tabs view
tabsView = [[CPTabView alloc] initWithFrame:CGRectMake(5,5,790,590)];
[tabsView setAutoresizingMask:CPViewHeightSizable|CPViewWidthSizable];
[tabsView layoutSubviews];
[tabsContent addSubview:tabsView];
// the projects tab
//
//
projectsTab = [[CPTabViewItem alloc] initWithIdentifier:@"projects"];
[projectsTab setLabel:@"Projects"];
[projectsTab setView:projectsView];
[tabsView addTabViewItem:projectsTab];
// the tasks tab
//
//
tasksTab = [[CPTabViewItem alloc] initWithIdentifier:@"tasks"];
[tasksTab setLabel:@"Tasks"];
[tasksTab setView:tasksView];
[tabsView addTabViewItem:tasksTab];
/*
var timerPanel = [[CPPanel alloc] initWithContentRect:CGRectMake(500, 600, 100, 100) styleMask:CPHUDBackgroundWindowMask | CPClosableWindowMask];
[timerPanel setFloatingPanel:YES];
[timerPanel orderFront:self];
[timerPanel setTitle:"Timer"];
var timerContent = [timerPanel contentView];
*/
[theWindow orderFront:self];
}
- (void)projectIdSelected:(int)projectId
{
//CPLog.trace(projectId);
[tasksView getProjectTasks:projectId];
}
- (void)didFinishLoadingTasks
{
[tabsView selectTabViewItemAtIndex:1];
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment