From 0229279b694dd8aff738642dd5ab8739577102b8 Mon Sep 17 00:00:00 2001 From: Jonathon Mah Date: Mon, 29 Sep 2008 22:06:54 +0930 Subject: [PATCH] Added tool tips for tabs when tab labels are truncated --- src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m index df4c6aed..f702ae73 100644 --- a/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m +++ b/src/MacVim/PSMTabBarControl/source/PSMTabBarControl.m @@ -644,7 +644,10 @@ [self removeTrackingRect:[cell cellTrackingTag]]; } } - + + // nuke old tool tips + [self removeAllToolTips]; + // calculate number of cells to fit in control and cell widths float availableWidth = [self availableCellWidth]; NSMutableArray *newWidths = [NSMutableArray arrayWithCapacity:cellCount]; @@ -757,7 +760,11 @@ tag = [self addTrackingRect:cellRect owner:cell userData:nil assumeInside:NO]; [cell setCellTrackingTag:tag]; [cell setEnabled:YES]; - + + // add tool tip if label will be truncated + if ([cell desiredWidthOfCell] > NSWidth([cell frame])) + [self addToolTipRect:cellRect owner:[cell stringValue] userData:NULL]; + // selected? set tab states... if([[cell representedObject] isEqualTo:[tabView selectedTabViewItem]]){ [cell setState:NSOnState]; -- 2.11.4.GIT