From e70f79fbf7766b91f434a6be83dea23f4adc233e Mon Sep 17 00:00:00 2001 From: gcasa Date: Sun, 23 Aug 2009 18:24:34 +0000 Subject: [PATCH] * Headers/Additions/GNUstepGUI/GSTheme.h: Add image parameter, * Source/GSThemeDrawing.m: Add image parameter. Correctly handle disabled buttons. * Source/NSButtonCell.m: Change to use new signature. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28523 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 7 +++++++ Headers/Additions/GNUstepGUI/GSTheme.h | 7 ++++--- Source/GSThemeDrawing.m | 16 ++++++++-------- Source/NSButtonCell.m | 3 ++- 4 files changed, 21 insertions(+), 12 deletions(-) diff --git a/ChangeLog b/ChangeLog index 086da9486..0d610d117 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2009-08-23 14:23-EDT Gregory John Casamento + + * Headers/Additions/GNUstepGUI/GSTheme.h: Add image parameter, + * Source/GSThemeDrawing.m: Add image parameter. Correctly + handle disabled buttons. + * Source/NSButtonCell.m: Change to use new signature. + 2009-08-23 14:05-EDT Gregory John Casamento * Headers/Additions/GNUstepGUI/GSTheme.h: Added new method declaration diff --git a/Headers/Additions/GNUstepGUI/GSTheme.h b/Headers/Additions/GNUstepGUI/GSTheme.h index 9b4f71a34..d01b12774 100644 --- a/Headers/Additions/GNUstepGUI/GSTheme.h +++ b/Headers/Additions/GNUstepGUI/GSTheme.h @@ -565,9 +565,10 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification; * of an image a button cell and replace it with a rendered * version (from the native theme). */ -- (void) drawButtonCellImage: (NSButtonCell *) cell - withFrame: (NSRect) aRect - position: (NSPoint) position; +- (void) drawImage: (NSImage *)image + inButtonCell: (NSButtonCell *) cell + withFrame: (NSRect) aRect + position: (NSPoint) position; @end /** diff --git a/Source/GSThemeDrawing.m b/Source/GSThemeDrawing.m index acab510dd..5ba2a5979 100644 --- a/Source/GSThemeDrawing.m +++ b/Source/GSThemeDrawing.m @@ -544,21 +544,21 @@ PSstroke(); } -- (void) drawButtonCellImage: (NSButtonCell *) cell - withFrame: (NSRect) aRect - position: (NSPoint) position +- (void) drawImage: (NSImage *)image + inButtonCell: (NSButtonCell *) cell + withFrame: (NSRect) aRect + position: (NSPoint) position { - NSImage *anImage = [cell image]; - BOOL disabled = [cell isEnabled]; + BOOL enabled = [cell isEnabled]; BOOL dims = [cell imageDimsWhenDisabled]; - if (disabled && dims) + if (!enabled && dims) { - [anImage dissolveToPoint: position fraction: 0.5]; + [image dissolveToPoint: position fraction: 0.5]; } else { - [anImage compositeToPoint: position + [image compositeToPoint: position operation: NSCompositeSourceOver]; } } diff --git a/Source/NSButtonCell.m b/Source/NSButtonCell.m index 62c5d7948..ad70ed50e 100644 --- a/Source/NSButtonCell.m +++ b/Source/NSButtonCell.m @@ -916,7 +916,8 @@ typedef struct _GSButtonCellFlags position.y += size.height; } - [[GSTheme theme] drawButtonCellImage: self + [[GSTheme theme] drawImage: anImage + inButtonCell: self withFrame: aRect position: position]; }