* Source/NSMenuView.m (heightForItem:, yOriginForItem:):

Accept negative item indicies, which are passed in when
opening the preferences window in TextEdit. Need to investigate
further why that is happening.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37184 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2013-10-03 00:35:27 +00:00
parent dfab5c6196
commit d3be1c555f
2 changed files with 25 additions and 11 deletions

View file

@ -1,3 +1,10 @@
2013-10-02 Eric Wasylishen <ewasylishen@gmail.com>
* Source/NSMenuView.m (heightForItem:, yOriginForItem:):
Accept negative item indicies, which are passed in when
opening the preferences window in TextEdit. Need to investigate
further why that is happening.
2013-10-02 Eric Wasylishen <ewasylishen@gmail.com>
* Headers/Additions/GNUstepGUI/GSTheme.h:

View file

@ -701,26 +701,33 @@ static float menuBarHeight = 0.0;
return _needsSizing;
}
- (CGFloat) heightForItem: (NSUInteger)idx
- (CGFloat) heightForItem: (NSInteger)idx
{
NSMenuItemCell *cell = [_itemCells objectAtIndex: idx];
NSMenuItem *item = [cell menuItem];
if ([item isSeparatorItem])
if (idx >= 0)
{
return [[GSTheme theme] menuSeparatorHeight];
NSMenuItemCell *cell = [_itemCells objectAtIndex: idx];
NSMenuItem *item = [cell menuItem];
if ([item isSeparatorItem])
{
return [[GSTheme theme] menuSeparatorHeight];
}
}
return _cellSize.height;
}
- (CGFloat) yOriginForItem: (NSUInteger)item
{
- (CGFloat) yOriginForItem: (NSInteger)item
{
const NSInteger count = [_itemCells count];
CGFloat total = 0;
NSUInteger i = 0;
for (i = (count - 1); i > item ; i--)
if (item >= 0)
{
total += [self heightForItem: i];
NSInteger i = 0;
for (i = (count - 1); i > item ; i--)
{
total += [self heightForItem: i];
}
}
return total;
}