mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 00:41:05 +00:00
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:
parent
f498130747
commit
200770a3e5
8 changed files with 340 additions and 181 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue