From 02259cada8c44a6e86cca1d1e3be75d3bae3d257 Mon Sep 17 00:00:00 2001 From: rmottola Date: Sun, 9 Dec 2012 23:13:49 +0000 Subject: [PATCH] Add a special case for popup buttons, akin imageRectForBounds git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@35868 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 5 +++++ Source/NSMenuItemCell.m | 8 ++++++++ 2 files changed, 13 insertions(+) diff --git a/ChangeLog b/ChangeLog index f10e450ec..a2e731a5b 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2012-12-10 Riccardo Mottola + + * Source/NSMenuItemCell.m (titleRectForBounds) + Add a special case for popup buttons, akin imageRectForBounds + 2012-12-08 Fred Kiefer * Source/NSViewController.m: Add missing #import for NSArray. diff --git a/Source/NSMenuItemCell.m b/Source/NSMenuItemCell.m index 26c340451..1a13b936a 100644 --- a/Source/NSMenuItemCell.m +++ b/Source/NSMenuItemCell.m @@ -526,6 +526,14 @@ static NSString *commandKeyString = @"#"; if (_needs_sizing) [self calcSize]; + if (_mcell_belongs_to_popupbutton && _cell.image_position) + { + // Special case: draw image on the extreme right + cellFrame.origin.x += [_menuView imageAndTitleOffset]; + cellFrame.size.width = _titleWidth; + return cellFrame; + } + if ([_menuView isHorizontal] == YES) { /* This adjust will center us within the menubar. */