refType = 4;
sourceTree = "<group>";
};
+ 7C4BBADA05F98C9900734027 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.h;
+ path = ITMultilineTextFieldCell.h;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 7C4BBADB05F98C9900734027 = {
+ fileEncoding = 4;
+ isa = PBXFileReference;
+ lastKnownFileType = sourcecode.c.objc;
+ path = ITMultilineTextFieldCell.m;
+ refType = 4;
+ sourceTree = "<group>";
+ };
+ 7C4BBADC05F98C9900734027 = {
+ fileRef = 7C4BBADA05F98C9900734027;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
+ 7C4BBADD05F98C9900734027 = {
+ fileRef = 7C4BBADB05F98C9900734027;
+ isa = PBXBuildFile;
+ settings = {
+ };
+ };
7C5B7C93054F6EC9008379B6 = {
fileRef = 8DC2EF5B0486A6940098B216;
isa = PBXBuildFile;
7C992DF8054F5179000B93EA,
2AC8319B056D037700A7D7E2,
2AC8319C056D037700A7D7E2,
+ 7C4BBADA05F98C9900734027,
+ 7C4BBADB05F98C9900734027,
);
isa = PBXGroup;
name = Cells;
2AC83141056D00F700A7D7E2,
2AC8319D056D037700A7D7E2,
3710912805C0825900ED0F36,
+ 7C4BBADC05F98C9900734027,
);
isa = PBXHeadersBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
2AC83142056D00F700A7D7E2,
2AC8319E056D037700A7D7E2,
3710912305C0821000ED0F36,
+ 7C4BBADD05F98C9900734027,
);
isa = PBXSourcesBuildPhase;
runOnlyForDeploymentPostprocessing = 0;
--- /dev/null
+//
+// ITMultilineTextFieldCell.h
+// ITKit
+//
+// Created by Joseph Spiros on Fri Mar 05 2004.
+// Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+//
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface ITMultilineTextFieldCell : NSCell {
+}
+
+@end
--- /dev/null
+//
+// ITMultilineTextFieldCell.m
+// ITKit
+//
+// Created by Joseph Spiros on Fri Mar 05 2004.
+// Copyright (c) 2004 __MyCompanyName__. All rights reserved.
+//
+
+#import "ITMultilineTextFieldCell.h"
+
+
+@implementation ITMultilineTextFieldCell
+
+- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
+{
+ /*
+ Okay, here's the different possibilities for the objectValue of this cell, and how they're displayed:
+
+ NSArray of NSStrings - Draw first line with System Font, following lines with Small System Font
+ NSArray of NSAttributedStrings - Draw as given
+ NSArray of both - Draw each line as above!
+
+ The number of lines is determined by the contents of the array...
+ */
+
+ NSColor *defaultColor;
+ NSMutableParagraphStyle *paragraphStyle = [[[NSParagraphStyle defaultParagraphStyle] mutableCopy] autorelease];
+ [paragraphStyle setLineBreakMode:NSLineBreakByTruncatingTail];
+ NSPoint cellPoint = cellFrame.origin;
+ NSSize cellSize = cellFrame.size;
+
+ NSRect secondaryLineRect;
+
+ if ([self isHighlighted] && ([self highlightColorWithFrame:cellFrame inView:controlView]!=[NSColor secondarySelectedControlColor])) {
+ defaultColor = [NSColor whiteColor];
+ } else {
+ defaultColor = [NSColor blackColor];
+ }
+
+ // Process the first line...
+ {
+ NSDictionary *firstLineAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont boldSystemFontOfSize:[NSFont systemFontSize]], NSFontAttributeName, defaultColor, NSForegroundColorAttributeName, paragraphStyle, NSParagraphStyleAttributeName, nil];
+
+ NSRect firstLineRect = NSMakeRect(cellPoint.x+5, cellPoint.y+1, cellSize.width-5, cellSize.height);
+
+ id firstString = [[self objectValue] objectAtIndex:0];
+ NSMutableAttributedString *firstAttrString;
+
+ if ([firstString isKindOfClass:[NSAttributedString class]]) {
+ firstAttrString = [[[NSMutableAttributedString alloc] initWithAttributedString:firstString] autorelease];
+ [firstAttrString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0,[firstAttrString length])];
+ if ([defaultColor isEqual:[NSColor whiteColor]]) {
+ [firstAttrString addAttribute:NSForegroundColorAttributeName value:defaultColor range:NSMakeRange(0,[firstAttrString length])];
+ }
+ } else if ([firstString isKindOfClass:[NSString class]]) {
+ firstAttrString = [[[NSMutableAttributedString alloc] initWithString:firstString attributes:firstLineAttributes] autorelease];
+ } else {
+ firstAttrString = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"Object (%@) is not a string", firstString] attributes:firstLineAttributes] autorelease];
+ }
+
+ [controlView lockFocus];
+
+ [firstAttrString drawInRect:firstLineRect];
+
+ [controlView unlockFocus];
+
+ secondaryLineRect = NSMakeRect(cellPoint.x+5, (cellPoint.y+1+[firstAttrString size].height), cellSize.width-5, cellSize.height);
+ }
+
+ // Process the secondary lines
+ {
+ NSDictionary *secondaryLineAttributes = [NSDictionary dictionaryWithObjectsAndKeys:[NSFont systemFontOfSize:[NSFont smallSystemFontSize]], NSFontAttributeName, defaultColor, NSForegroundColorAttributeName, paragraphStyle, NSParagraphStyleAttributeName, nil];
+
+ NSMutableArray *tMArray = [NSMutableArray arrayWithArray:[self objectValue]];
+ [tMArray removeObjectAtIndex:0]; // Remove the first line string... already handled that above!
+
+ NSEnumerator *enumerator = [tMArray objectEnumerator];
+ id secondaryString;
+
+ while (secondaryString = [enumerator nextObject]) {
+
+ NSMutableAttributedString *secondaryAttrString;
+
+ if ([secondaryString isKindOfClass:[NSAttributedString class]]) {
+ secondaryAttrString = [[[NSMutableAttributedString alloc] initWithAttributedString:secondaryString] autorelease];
+ [secondaryAttrString addAttribute:NSParagraphStyleAttributeName value:paragraphStyle range:NSMakeRange(0,[secondaryAttrString length])];
+ if ([defaultColor isEqual:[NSColor whiteColor]]) {
+ [secondaryAttrString addAttribute:NSForegroundColorAttributeName value:defaultColor range:NSMakeRange(0,[secondaryAttrString length])];
+ }
+ } else if ([secondaryString isKindOfClass:[NSString class]]) {
+ secondaryAttrString = [[[NSMutableAttributedString alloc] initWithString:secondaryString attributes:secondaryLineAttributes] autorelease];
+ } else {
+ secondaryAttrString = [[[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"Object (%@) is not a string", secondaryString] attributes:secondaryLineAttributes] autorelease];
+ }
+
+ [controlView lockFocus];
+
+ [secondaryAttrString drawInRect:secondaryLineRect];
+
+ [controlView unlockFocus];
+
+ secondaryLineRect.origin.y = secondaryLineRect.origin.y+[secondaryAttrString size].height; // modify the rect for the next loop, based on the size and location of the most recently processed line.
+
+ }
+ }
+}
+
+@end
IBOutlet NSTextField *swShadowSaturation;
IBOutlet NSSlider *swEntrySpeedSlider;
IBOutlet NSSlider *swExitSpeedSlider;
+
+ // ITMultilineTextFieldCell Support
+ IBOutlet NSTableView *tableView;
}
// ITStatusItem Support
#import "ITSlideHorizontallyWindowEffect.h"
#import "ITSlideVerticallyWindowEffect.h"
#import "ITPivotWindowEffect.h"
+#import "ITMultilineTextFieldCell.h"
#define SW_PAD 24.0
[[statusWindow exitEffect] setEffectTime:[swExitSpeedSlider floatValue]];
// [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]];
}
/*************************************************************************/
[[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
swVanishDelay = NSTextField;
swVanishModePopup = NSPopUpButton;
tabView = ITTabView;
+ tableView = NSTableView;
testTextField = ITTextField;
useInvertedCheckBox = NSButton;
window = NSWindow;
<key>IBEditorPositions</key>
<dict>
<key>197</key>
- <string>564 424 153 118 0 0 1056 770 </string>
+ <string>624 471 153 118 0 0 1152 842 </string>
<key>29</key>
<string>1 271 349 44 0 0 1056 770 </string>
</dict>
<string>349.0</string>
<key>IBOpenObjects</key>
<array>
+ <integer>21</integer>
<integer>197</integer>
</array>
<key>IBSystem Version</key>
- <string>7C107</string>
+ <string>7D24</string>
</dict>
</plist>