Fixed the toolbar layout problem introduced by NSButtonCell changes

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@19941 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
qmathe 2004-08-30 21:33:17 +00:00
parent 0238dd7e11
commit 9c44969b67
5 changed files with 244 additions and 80 deletions

View file

@ -1664,34 +1664,21 @@ static NSColor *shadowCol;
switch (_cell.type)
{
case NSTextCellType:
{
[self _drawAttributedText: [self attributedStringValue]
inFrame: cellFrame];
}
[self _drawAttributedText: [self attributedStringValue]
inFrame: cellFrame];
break;
case NSImageCellType:
if (_cell_image)
{
NSSize size;
NSPoint position;
size = [_cell_image size];
position.x = MAX(NSMidX(cellFrame) - (size.width/2.),0.);
position.y = MAX(NSMidY(cellFrame) - (size.height/2.),0.);
/*
* Images are always drawn with their bottom-left corner
* at the origin so we must adjust the position to take
* account of a flipped view.
*/
if ([controlView isFlipped])
position.y += size.height;
[_cell_image compositeToPoint: position operation: NSCompositeSourceOver];
}
break;
[self _drawImage: _cell_image
inFrame: cellFrame
isFlipped: [controlView isFlipped]];
}
break;
case NSNullCellType:
break;
break;
}
if (_cell.shows_first_responder)
@ -2206,6 +2193,27 @@ static NSColor *shadowCol;
RELEASE (attributes);
}
- (void) _drawImage: (NSImage *)anImage inFrame: (NSRect)aRect
isFlipped: (BOOL)flipped
{
NSSize size;
NSPoint position;
size = [anImage size];
position.x = MAX(NSMidX(aRect) - (size.width/2.),0.);
position.y = MAX(NSMidY(aRect) - (size.height/2.),0.);
/*
* Images are always drawn with their bottom-left corner
* at the origin so we must adjust the position to take
* account of a flipped view.
*/
if (flipped)
position.y += size.height;
[anImage compositeToPoint: position operation: NSCompositeSourceOver];
}
@end
/*