Add MaxOS 10.4 methods and required ivars to NSButtonCell, implemented

then and use this methods. Also adjusted subclasses tothis changes.
Split off theming code for buttons into two methods.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@24400 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
fredkiefer 2007-01-23 14:17:02 +00:00
parent f498130747
commit 200770a3e5
8 changed files with 340 additions and 181 deletions

View file

@ -454,33 +454,10 @@ NSString *GSMovableToolbarItemPboardType = @"GSMovableToolbarItemPboardType";
}
// Overriden NSButtonCell method
- (void) _drawImage: (NSImage *)anImage inFrame: (NSRect)aRect isFlipped: (BOOL)flipped
- (void) drawImage: (NSImage *)anImage withFrame: (NSRect)aRect inView: (NSView*)controlView
{
NSSize size;
NSPoint position;
// We ignore aRect value
size = [anImage size];
position.x = MAX(NSMidX(imageRect) - (size.width / 2.), 0.);
position.y = MAX(NSMidY(imageRect) - (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;
}
if (_cell.is_disabled && _image_dims_when_disabled)
{
[anImage dissolveToPoint: position fraction: 0.5];
}
else
{
[anImage compositeToPoint: position
operation: NSCompositeSourceOver];
}
[super drawImage: anImage withFrame: imageRect inView: controlView];
}
@end