| 1 |
footashida |
1.1 |
#import "DummyOutlineDataSource.h" |
| 2 |
|
|
#import "DummyOutlineItem.h" |
| 3 |
|
|
#import "IconedCell.h" |
| 4 |
|
|
#import <Cocoa/Cocoa.h> |
| 5 |
|
|
|
| 6 |
|
|
@implementation DummyOutlineDataSource |
| 7 |
|
|
- (id)init{ |
| 8 |
|
|
if(self = [super init]){ |
| 9 |
|
|
NSBundle *mainBundle; |
| 10 |
|
|
DummyOutlineItem *item; |
| 11 |
|
|
|
| 12 |
|
|
mainBundle = [NSBundle mainBundle]; |
| 13 |
|
|
rootItem = [[DummyOutlineItem alloc] initWithName:@"/"]; |
| 14 |
|
|
|
| 15 |
|
|
// óM ĚŠ{đěé |
| 16 |
|
|
item = [[DummyOutlineItem alloc] |
| 17 |
|
|
initWithName:[mainBundle localizedStringForKey:@"FolderLabel_Inbox" |
| 18 |
|
|
value:nil |
| 19 |
|
|
table:nil]]; |
| 20 |
|
|
[item addChild:[[DummyOutlineItem alloc] |
| 21 |
|
|
initWithName:[mainBundle localizedStringForKey:@"FolderLabel_Folder1" value:nil table:nil]]]; |
| 22 |
|
|
[item addChild:[[DummyOutlineItem alloc] |
| 23 |
|
|
initWithName:[mainBundle localizedStringForKey:@"FolderLabel_Folder2" value:nil table:nil]]]; |
| 24 |
|
|
[rootItem addChild:item]; |
| 25 |
|
|
|
| 26 |
|
|
[rootItem addChild:[[DummyOutlineItem alloc] |
| 27 |
|
|
initWithName:[mainBundle localizedStringForKey:@"FolderLabel_Outbox" value:nil table:nil]]]; |
| 28 |
|
|
[rootItem addChild:[[DummyOutlineItem alloc] |
| 29 |
|
|
initWithName:[mainBundle localizedStringForKey:@"FolderLabel_Sent" value:nil table:nil]]]; |
| 30 |
|
|
[rootItem addChild:[[DummyOutlineItem alloc] |
| 31 |
|
|
initWithName:[mainBundle localizedStringForKey:@"FolderLabel_Trash" value:nil table:nil]]]; |
| 32 |
|
|
|
| 33 |
|
|
// JX^r
[ĚŠ{đěéB |
| 34 |
|
|
item = [[DummyOutlineItem alloc] |
| 35 |
|
|
initWithName:[mainBundle localizedStringForKey:@"FolderLabel_CustomViewRoot" |
| 36 |
|
|
value:nil |
| 37 |
|
|
table:nil]]; |
| 38 |
|
|
[item addChild:[[DummyOutlineItem alloc] |
| 39 |
|
|
initWithName:[mainBundle localizedStringForKey:@"FolderLabel_CustomView1" |
| 40 |
|
|
value:nil |
| 41 |
|
|
table:nil]]]; |
| 42 |
|
|
[item addChild:[[DummyOutlineItem alloc] |
| 43 |
|
|
initWithName:[mainBundle localizedStringForKey:@"FolderLabel_CustomView2" |
| 44 |
|
|
value:nil |
| 45 |
|
|
table:nil]]]; |
| 46 |
|
|
|
| 47 |
|
|
[rootItem addChild:item]; |
| 48 |
|
|
|
| 49 |
|
|
|
| 50 |
|
|
} |
| 51 |
|
|
return self; |
| 52 |
|
|
} |
| 53 |
|
|
- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item { |
| 54 |
|
|
return (item == nil) ? [rootItem numberOfChildren] : [item numberOfChildren]; |
| 55 |
|
|
} |
| 56 |
|
|
- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item { |
| 57 |
|
|
return (item == nil) ? ([rootItem numberOfChildren] != -1) : ([item numberOfChildren] != -1); |
| 58 |
|
|
} |
| 59 |
|
|
- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item { |
| 60 |
|
|
return (item == nil) ? [rootItem childAtIndex:index] : [item childAtIndex:index]; |
| 61 |
|
|
} |
| 62 |
|
|
- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item { |
| 63 |
|
|
|
| 64 |
|
|
// NSFileWrapper *fileWrapper; |
| 65 |
|
|
// NSTextAttachment *textAttachment; |
| 66 |
|
|
// NSMutableAttributedString *ret; |
| 67 |
|
|
NSBundle *mainBundle; |
| 68 |
|
|
|
| 69 |
|
|
mainBundle = [NSBundle mainBundle]; |
| 70 |
|
|
|
| 71 |
|
|
[[tableColumn dataCell] setImage: |
| 72 |
|
|
[[NSImage alloc] initByReferencingFile:[mainBundle pathForImageResource:@"InMailbox.tiff"]]]; |
| 73 |
|
|
return (item == nil) ? [rootItem itemName] : [item itemName]; |
| 74 |
|
|
} |
| 75 |
|
|
|
| 76 |
|
|
@end |