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;