Ignore:
Timestamp:
01/02/03 05:30:03 (22 years ago)
Author:
Nicholas Riley
Message:

Updated for Pester 1.1a5 (very limited release).

Pester 1.1a4 was never released.

Location:
trunk/Cocoa/Pester/Source
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Cocoa/Pester/Source

    • Property svn:ignore
      •  

        old new  
        11build
         2.gdb_history
  • trunk/Cocoa/Pester/Source/NJRTableView.m

    r51 r53  
    1717
    1818@implementation NJRTableView
     19
     20- (id)initWithCoder:(NSCoder *)aDecoder;
     21{
     22    if ( (self = [super initWithCoder: aDecoder]) != nil) {
     23        toolTipRegionList = [[NSMutableDictionary alloc] initWithCapacity: 20];
     24    }
     25    return self;
     26}
     27
     28- (void)dealloc;
     29{
     30    [toolTipRegionList release];
     31    [super dealloc];
     32}
     33
     34#pragma mark tool tips
     35
     36- (void)reloadData;
     37{
     38    [toolTipRegionList removeAllObjects];
     39    [self removeAllToolTips];
     40    [super reloadData];
     41}
     42
     43- (void)noteNumberOfRowsChanged;
     44{
     45    [toolTipRegionList removeAllObjects];
     46    [self removeAllToolTips];
     47    [super noteNumberOfRowsChanged];
     48}
     49
     50- (NSString *)_keyForColumn:(int)columnIndex row:(int)rowIndex;
     51{
     52    return [NSString stringWithFormat:@"%d,%d", rowIndex, columnIndex];
     53}
     54
     55- (NSString *)view:(NSView *)view stringForToolTip:(NSToolTipTag)tag point:(NSPoint)point userData:(void *)data;
     56{
     57    // ask our data source for the tool tip
     58    if ([[self dataSource] respondsToSelector: @selector(tableView:toolTipForTableColumn:row:)]) {
     59        if ([self rowAtPoint: point] >= 0) return [[self dataSource] tableView: self toolTipForTableColumn: [[self tableColumns] objectAtIndex: [self columnAtPoint: point]] row: [self rowAtPoint: point]];
     60    }
     61    return nil;
     62}
     63
     64- (NSRect)frameOfCellAtColumn:(int)columnIndex row:(int)rowIndex;
     65{
     66    // this cell is apparently displayed, so we need to add a region for it
     67    NSNumber *toolTipTag;
     68    NSRect result = [super frameOfCellAtColumn: columnIndex row: rowIndex];
     69    // check if cell is already in the list
     70    NSString *cellKey = [self _keyForColumn: columnIndex row: rowIndex];
     71    // remove old region
     72    if (toolTipTag = [toolTipRegionList objectForKey: cellKey])
     73        [self removeToolTip: [toolTipTag intValue]];
     74    // add new region
     75    [toolTipRegionList setObject: [NSNumber numberWithInt: [self addToolTipRect: result owner: self userData: cellKey]] forKey: cellKey];
     76    return [super frameOfCellAtColumn: columnIndex row: rowIndex];
     77}
     78
     79#pragma mark type selection
    1980
    2081- (id)typeSelectDisplay;
Note: See TracChangeset for help on using the changeset viewer.