forked from Kentzo/F-Script
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSymbolTableView.m
More file actions
86 lines (73 loc) · 2.1 KB
/
SymbolTableView.m
File metadata and controls
86 lines (73 loc) · 2.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
/* SymbolTableView.m Copyright 1998,1999 Philippe Mougin. */
/* This software is Open Source. See the license. */
#import "SymbolTableView.h"
#import "Array.h"
#import <Foundation/Foundation.h>
@implementation SymbolTableView
- (BOOL)browser:(NSBrowser *)sender isColumnValid:(NSInteger)column
{
if (column == 0) return isValid;
else return YES;
}
- (void)browser:(NSBrowser *)sender createRowsForColumn:(NSInteger)column inMatrix:(NSMatrix *)matrix
{
NSEnumerator *enumerator = [[model allDefinedSymbols] objectEnumerator];
NSString *str;
NSInteger i = 0;
while (str = [enumerator nextObject])
{
NSBrowserCell *cell;
[matrix addRow];
cell = [matrix cellAtRow:i column:0];
[cell setStringValue:str];
[cell setLeaf:YES];
[cell setLoaded:YES];
i++;
}
isValid = YES;
}
- (void)dealloc
{
[model autorelease];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
- (id)initWithFrame:(NSRect)frameRect
{
if ([super initWithFrame:frameRect])
{
model = nil;
isValid = NO;
[self setHasHorizontalScroller:NO];
[self setTitled:NO];
[self setMinColumnWidth:1];
//^^^^^^^ the doc advice to do this before calling setMaxVisibleColumns:
[self setMaxVisibleColumns:1];
[self setAllowsEmptySelection:YES];
[self setTarget:self];
[self setAction:@selector(rowSelected:)];
return self;
}
return nil;
}
- (void)setModel:(SymbolTable *)theModel
{
[model autorelease];
model = [theModel retain];
[[NSNotificationCenter defaultCenter] removeObserver:self];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(update:) name:@"changed" object:model];
[self setDelegate:self];
}
- update:(NSNotification*)notification;
{
isValid = NO;
[self displayAllColumns];
return self;
}
// action message received as target of mySelf
- rowSelected:sender
{
[[[model valueWrapperForIndex:[model indexOfSymbol:[[self selectedCell] stringValue]]] value] inspect];
return self;
}
@end