itok's Lab

昔の開発ネタを記録として残してます

TableのcellにToolTipを指定する

table や outline の上にマウスカーソルを持っていったときに表示される ToolTip を指定します。これ、10.3以前では非常にややこしいことになっていたんですが、10.4になってようやくそれ用の delegate メソッドが登場しました。

// NSTableView
-(NSString*) tableView:(NSTableView*)aTableView 
    toolTipForCell:(NSCell*)aCell 
    rect:(NSRectPointer)rect
    tableColumn:(NSTableColumn*)aTableColumn
    row:(int)row
    mouseLocation:(NSPoint)mouseLocation

// NSOutlineView
-(NSString*) outlineView:(NSOutlineView*)ov
    toolTipForCell:(NSCell*)cell
    rect:(NSRectPointer)rect
    tableColumn:(NSTableColumn*)tc
    item:(id)item
    mouseLocation:(NSPoint)mouseLocation