diff --git a/ChangeLog b/ChangeLog index c487f321c..f496373d1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2009-11-14 Hans Baier + + * Headers/Additions/GNUstepGUI/GSTheme.h, + * Source/GSThemeDrawing.m, + * Source/NSMenuItemCell.m: Make the menu arrow image themeable + 2009-11-12 Fred Kiefer * Source/NSImage.m (-copyWithZone:): Set the name of the copy to diff --git a/Headers/Additions/GNUstepGUI/GSTheme.h b/Headers/Additions/GNUstepGUI/GSTheme.h index 1b1e529cc..659978a7e 100644 --- a/Headers/Additions/GNUstepGUI/GSTheme.h +++ b/Headers/Additions/GNUstepGUI/GSTheme.h @@ -702,6 +702,7 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification; // menu item cell drawing methods +- (NSImage *) arrowImageForMenuItemCell; - (NSColor *) backgroundColorForMenuItemCell: (NSMenuItemCell *)cell state: (GSThemeControlState)state; - (void) drawBorderAndBackgroundForMenuItemCell: (NSMenuItemCell *)cell @@ -710,6 +711,7 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification; state: (GSThemeControlState)state isHorizontal: (BOOL)isHorizontal; + // NSColorWell drawing method - (NSRect) drawColorWellBorder: (NSColorWell*)well withBounds: (NSRect)bounds diff --git a/Source/GSThemeDrawing.m b/Source/GSThemeDrawing.m index cb755b2a3..bcdcfe4fd 100644 --- a/Source/GSThemeDrawing.m +++ b/Source/GSThemeDrawing.m @@ -682,6 +682,11 @@ } } +- (NSImage *) arrowImageForMenuItemCell +{ + return [NSImage imageNamed: @"NSMenuArrow"]; +} + // menu item cell drawing methods - (NSColor *) backgroundColorForMenuItemCell: (NSMenuItemCell *)cell state: (GSThemeControlState)state diff --git a/Source/NSMenuItemCell.m b/Source/NSMenuItemCell.m index 111eb02ed..39b85d0d2 100644 --- a/Source/NSMenuItemCell.m +++ b/Source/NSMenuItemCell.m @@ -50,15 +50,11 @@ @implementation NSMenuItemCell -static NSImage *arrowImage = nil; /* Cache arrow image. */ - - + (void) initialize { if (self == [NSMenuItemCell class]) { [self setVersion: 2]; - arrowImage = [[NSImage imageNamed: @"NSMenuArrow"] copy]; } } @@ -298,7 +294,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */ // Submenu Arrow if ([_menuItem hasSubmenu]) { - componentSize = [arrowImage size]; + componentSize = [[[GSTheme theme] arrowImageForMenuItemCell] size]; _keyEquivalentWidth = componentSize.width; if (componentSize.height > neededMenuItemHeight) neededMenuItemHeight = componentSize.height; @@ -661,12 +657,12 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */ { cellFrame = [self keyEquivalentRectForBounds: cellFrame]; - if ([_menuItem hasSubmenu] && arrowImage != nil) + if ([_menuItem hasSubmenu] && [[GSTheme theme] arrowImageForMenuItemCell] != nil) { NSSize size; NSPoint position; - size = [arrowImage size]; + size = [[[GSTheme theme] arrowImageForMenuItemCell] size]; position.x = cellFrame.origin.x + cellFrame.size.width - size.width; position.y = MAX(NSMidY(cellFrame) - (size.height/2.), 0.); /* @@ -676,7 +672,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */ if ([controlView isFlipped]) position.y += size.height; - [arrowImage compositeToPoint: position operation: NSCompositeSourceOver]; + [[[GSTheme theme] arrowImageForMenuItemCell] compositeToPoint: position operation: NSCompositeSourceOver]; } /* FIXME/TODO here - decide a consistent policy for images. *