make the arrow image in NSMenuItemCell themeable

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29001 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
hansfbaier 2009-11-14 02:56:29 +00:00
parent 81a8907f45
commit a6ac9e24c7
4 changed files with 17 additions and 8 deletions

View file

@ -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.
*