X-Git-Url: http://git.ithinksw.org/ITKit.git/blobdiff_plain/5e2815af6cd3f5dffaca2e8d1876c0a355209859..0aecaf45e8f7d5b1401b3872d06b07fea9497e7e:/Showcase/Controller.m diff --git a/Showcase/Controller.m b/Showcase/Controller.m old mode 100755 new mode 100644 index 49e9e35..9f9c1f6 --- a/Showcase/Controller.m +++ b/Showcase/Controller.m @@ -9,6 +9,8 @@ #import "ITSlideHorizontallyWindowEffect.h" #import "ITSlideVerticallyWindowEffect.h" #import "ITPivotWindowEffect.h" +#import "ITZoomWindowEffect.h" +#import "ITMultilineTextFieldCell.h" #define SW_PAD 24.0 @@ -30,7 +32,7 @@ { [self createStatusItem]; [button setBezelStyle:1001]; - [button setFont:[NSFont fontWithName:@"Lucida Grande Bold" size:14]]; + [button setFont:[NSFont fontWithName:@"LucidaGrande-Bold" size:14]]; [button setTitle:@"Launch Manually"]; [button sizeToFit]; [button setFrameSize:NSMakeSize([button frame].size.width + 8, 24)]; @@ -39,11 +41,16 @@ [bevelView setBevelDepth:10]; statusWindow = [ITIconAndTextStatusWindow sharedWindow]; [statusWindow setEntryEffect:[[ITCutWindowEffect alloc] initWithWindow:statusWindow]]; - [statusWindow setExitEffect:[[ITDissolveWindowEffect alloc] initWithWindow:statusWindow]]; + [statusWindow setExitEffect:[[ITCutWindowEffect alloc] initWithWindow:statusWindow]]; [[statusWindow entryEffect] setEffectTime:[swEntrySpeedSlider floatValue]]; [[statusWindow exitEffect] setEffectTime:[swExitSpeedSlider floatValue]]; + [self populateEffectPopups]; // [tabView setAllowsDragging:YES]; [[NSColorPanel sharedColorPanel] setShowsAlpha:YES]; + + [tableView setRowHeight:200]; + [[tableView tableColumnWithIdentifier:@"custom"] setDataCell:[[[ITMultilineTextFieldCell alloc] init] autorelease]]; + [[tableView tableColumnWithIdentifier:@"image"] setDataCell:[[[NSImageCell alloc] init] autorelease]]; } /*************************************************************************/ @@ -147,6 +154,21 @@ #pragma mark ITTransientStatusWindow SUPPORT /*************************************************************************/ +- (void)populateEffectPopups +{ + NSArray *effects = [ITWindowEffect effectClasses]; + int i; + [entryEffectPopup removeAllItems]; + [exitEffectPopup removeAllItems]; + for (i = 0; i < [effects count]; i++) { + id anItem = [effects objectAtIndex:i]; + [entryEffectPopup addItemWithTitle:[anItem effectName]]; + [exitEffectPopup addItemWithTitle:[anItem effectName]]; + [[entryEffectPopup lastItem] setRepresentedObject:anItem]; + [[exitEffectPopup lastItem] setRepresentedObject:anItem]; + } +} + - (IBAction)buildStatusWindow:(id)sender { NSImage *image = [NSImage imageNamed:SW_IMAGE]; @@ -189,39 +211,12 @@ } else if ( [sender tag] == 3061 ) { [[statusWindow exitEffect] setEffectTime:[sender floatValue]]; } else if ( [sender tag] == 3070 ) { - - if ( [sender indexOfSelectedItem] == 0 ) { - [statusWindow setEntryEffect:[[[ITCutWindowEffect alloc] initWithWindow:statusWindow] autorelease]]; - } else if ( [sender indexOfSelectedItem] == 1 ) { - [statusWindow setEntryEffect:[[[ITDissolveWindowEffect alloc] initWithWindow:statusWindow] autorelease]]; - } else if ( [sender indexOfSelectedItem] == 2 ) { - [statusWindow setEntryEffect:[[[ITSlideVerticallyWindowEffect alloc] initWithWindow:statusWindow] autorelease]]; - } else if ( [sender indexOfSelectedItem] == 3 ) { - [statusWindow setEntryEffect:[[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:statusWindow] autorelease]]; - } else if ( [sender indexOfSelectedItem] == 4 ) { - [statusWindow setEntryEffect:[[[ITPivotWindowEffect alloc] initWithWindow:statusWindow] autorelease]]; - } - + [statusWindow setEntryEffect:[[[[[sender selectedItem] representedObject] alloc] initWithWindow:statusWindow] autorelease]]; [[statusWindow entryEffect] setEffectTime:[swEntrySpeedSlider floatValue]]; - } else if ( [sender tag] == 3080 ) { - - if ( [sender indexOfSelectedItem] == 0 ) { - [statusWindow setExitEffect:[[ITCutWindowEffect alloc] initWithWindow:statusWindow]]; - } else if ( [sender indexOfSelectedItem] == 1 ) { - [statusWindow setExitEffect:[[ITDissolveWindowEffect alloc] initWithWindow:statusWindow]]; - } else if ( [sender indexOfSelectedItem] == 2 ) { - [statusWindow setExitEffect:[[ITSlideVerticallyWindowEffect alloc] initWithWindow:statusWindow]]; - } else if ( [sender indexOfSelectedItem] == 3 ) { - [statusWindow setExitEffect:[[ITSlideHorizontallyWindowEffect alloc] initWithWindow:statusWindow]]; - } else if ( [sender indexOfSelectedItem] == 4 ) { - [statusWindow setExitEffect:[[ITPivotWindowEffect alloc] initWithWindow:statusWindow]]; - } - + [statusWindow setExitEffect:[[[[[sender selectedItem] representedObject] alloc] initWithWindow:statusWindow] autorelease]]; [[statusWindow exitEffect] setEffectTime:[swExitSpeedSlider floatValue]]; - } else if ( [sender tag] == 3090 ) { - if ( [sender indexOfSelectedItem] == 0 ) { [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundMode:ITTSWBackgroundApple]; } else if ( [sender indexOfSelectedItem] == 1 ) { @@ -229,7 +224,6 @@ } else if ( [sender indexOfSelectedItem] == 2 ) { [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundMode:ITTSWBackgroundColored]; } - } else if ( [sender tag] == 3100 ) { [(ITTSWBackgroundView *)[statusWindow contentView] setBackgroundColor:[sender color]]; } @@ -299,5 +293,28 @@ [[note object] setMiniwindowImage:[NSImage imageNamed:@"ITStatusItem"]]; } +/*************************************************************************/ +#pragma mark - +#pragma mark ITMultilineTextFieldCell SUPPORT +/*************************************************************************/ + +- (int)numberOfRowsInTableView:(NSTableView *)aTableView { + return 50; +} + +- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex { + if ([[aTableColumn dataCell] isKindOfClass:[ITMultilineTextFieldCell class]]) { + if (rowIndex%2) { + return [NSArray arrayWithObjects:@"Foo", @"Bar", @"- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex", @"- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex", @"- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex", @"- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex", @"- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex", @"- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex", @"- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex", @"- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex", @"- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex", @"- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex", @"- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int)rowIndex", nil]; + } else { + return [NSArray arrayWithObjects:[[[NSAttributedString alloc] initWithString:@"This is a demo of ITMultilineTextFieldCell" attributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSFont fontWithName:@"Gill Sans" size:48], NSFontAttributeName, [NSColor purpleColor], NSForegroundColorAttributeName, nil]] autorelease], [[[NSAttributedString alloc] initWithString:@"Bar" attributes:[NSDictionary dictionaryWithObjectsAndKeys:[NSFont fontWithName:@"Gadget" size:20], NSFontAttributeName, nil]] autorelease], [[[NSObject alloc] init] autorelease], nil]; + } + } else if ([[aTableColumn dataCell] isKindOfClass:[NSImageCell class]]) { + return [NSImage imageNamed:@"NSApplicationIcon"]; + } else { + return @"I like cheese"; + } +} + @end