* Source/NSMenuItemCell.m (-titleRectForBounds:): Keep title rect

inside cell bounds, to prevent drawing text outside of a
NSPopUpButtonCell which has a label that is too long to fit.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@34838 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2012-02-28 00:13:04 +00:00
parent 3d73efb55c
commit ac0663e17a
2 changed files with 12 additions and 3 deletions

View file

@ -565,7 +565,8 @@ static NSString *commandKeyString = @"#";
{
// Calculate the image part of cell frame from NSMenuView
cellFrame.origin.x += [_menuView imageAndTitleOffset];
cellFrame.size.width = [_menuView imageAndTitleWidth];
cellFrame.size.width = MIN(cellFrame.size.width - [_menuView imageAndTitleOffset],
[_menuView imageAndTitleWidth]);
switch (_cell.image_position)
{
@ -579,11 +580,13 @@ static NSString *commandKeyString = @"#";
case NSImageLeft:
cellFrame.origin.x += _imageWidth + GSCellTextImageXDist;
cellFrame.size.width = _titleWidth;
cellFrame.size.width = MIN(cellFrame.size.width - (_imageWidth + GSCellTextImageXDist),
_titleWidth);
break;
case NSImageRight:
cellFrame.size.width = _titleWidth;
cellFrame.size.width = MIN(cellFrame.size.width - (_imageWidth + GSCellTextImageXDist),
_titleWidth);
break;
case NSImageBelow: