Don't return zero size, when there are no items.

Based on patch by Andreas Höschler <ahoesch@smartsoft.de>. 


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@25511 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-10-02 21:10:40 +00:00
parent aab9028789
commit ac563421a4
2 changed files with 19 additions and 5 deletions

View file

@ -1,3 +1,9 @@
2007-10-02 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSPopUpButtonCell.m (-cellSize): Don't return zero size,
when there are no items. Based on patch by Andreas Höschler
<ahoesch@smartsoft.de>.
2007-10-01 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSDocument.m (-setFileName:, -fileURL:, -setUndoManager:

View file

@ -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;