From ffcdd85e3bbc833ab4773a2187eb36cf4c4427bd Mon Sep 17 00:00:00 2001 From: Fred Kiefer Date: Tue, 2 Oct 2007 21:10:40 +0000 Subject: [PATCH] =?UTF-8?q?Don't=20return=20zero=20size,=20when=20there=20?= =?UTF-8?q?are=20no=20items.=20Based=20on=20patch=20by=20Andreas=20H=C3=B6?= =?UTF-8?q?schler=20.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25511 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++++ Source/NSPopUpButtonCell.m | 18 +++++++++++++----- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index cac19b018..07098b9aa 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-10-02 Fred Kiefer + + * Source/NSPopUpButtonCell.m (-cellSize): Don't return zero size, + when there are no items. Based on patch by Andreas Höschler + . + 2007-10-01 Fred Kiefer * Source/NSDocument.m (-setFileName:, -fileURL:, -setUndoManager: diff --git a/Source/NSPopUpButtonCell.m b/Source/NSPopUpButtonCell.m index 852de2ff8..c8f10e11a 100644 --- a/Source/NSPopUpButtonCell.m +++ b/Source/NSPopUpButtonCell.m @@ -921,21 +921,29 @@ static NSImage *_pbc_image[2]; count = [_menu numberOfItems]; - if (count == 0) - return NSZeroSize; - imageSize = [_pbc_image[_pbcFlags.pullsDown] size]; s = NSMakeSize(0, imageSize.height); + if (count == 0) + { + title = [self title]; + titleSize = [self _sizeText: title]; + + if (titleSize.width > s.width) + s.width = titleSize.width; + if (titleSize.height > s.height) + s.height = titleSize.height; + } + for (i = 0; i < count; i++) { title = [[_menu itemAtIndex: i] title]; titleSize = [self _sizeText: title]; if (titleSize.width > s.width) - s.width = titleSize.width; + s.width = titleSize.width; if (titleSize.height > s.height) - s.height = titleSize.height; + s.height = titleSize.height; } s.width += imageSize.width;