diff --git a/ChangeLog b/ChangeLog index 7f5984073..4069ffb04 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,13 @@ 2010-01-27 Eric Wasylishen + * Headers/Additions/GNUstepGUI/GSTheme.h: + * Source/NSMenuView.m: + * Source/GSThemeDrawing.m: + Create a new GSTheme method for drawing the background of NSMenuView, + -drawBackgroundForMenuView:withFrame:dirtyRect:horizontal: + +10-01-27 Eric Wasylishen + * Source/GSThemeDrawing.m: Undo an accidental commit of some testing code in r29416 diff --git a/Headers/Additions/GNUstepGUI/GSTheme.h b/Headers/Additions/GNUstepGUI/GSTheme.h index 02718d4ca..5bc098b07 100644 --- a/Headers/Additions/GNUstepGUI/GSTheme.h +++ b/Headers/Additions/GNUstepGUI/GSTheme.h @@ -832,6 +832,10 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification; withFrame: (NSRect) aRect position: (NSPoint) position; +- (void) drawBackgroundForMenuView: (NSMenuView*)menuView + withFrame: (NSRect)bounds + dirtyRect: (NSRect)dirtyRect + horizontal: (BOOL)horizontal; // menu item cell drawing method - (void) drawBorderAndBackgroundForMenuItemCell: (NSMenuItemCell *)cell diff --git a/Source/GSThemeDrawing.m b/Source/GSThemeDrawing.m index 0ee521309..61e1886c8 100644 --- a/Source/GSThemeDrawing.m +++ b/Source/GSThemeDrawing.m @@ -679,6 +679,29 @@ } } +- (void) drawBackgroundForMenuView: (NSMenuView*)menuView + withFrame: (NSRect)bounds + dirtyRect: (NSRect)dirtyRect + horizontal: (BOOL)horizontal +{ + NSRectEdge sides[2]; + float grays[] = {NSDarkGray, NSDarkGray}; + + if (horizontal == YES) + { + sides[0] = NSMinYEdge; + sides[1] = NSMinYEdge; + NSDrawTiledRects(bounds, dirtyRect, sides, grays, 2); + } + else + { + sides[0] = NSMinXEdge; + sides[1] = NSMaxYEdge; + // Draw the dark gray upper left lines. + NSDrawTiledRects(bounds, dirtyRect, sides, grays, 2); + } +} + - (void) drawBorderAndBackgroundForMenuItemCell: (NSMenuItemCell *)cell withFrame: (NSRect)cellFrame inView: (NSView *)controlView diff --git a/Source/NSMenuView.m b/Source/NSMenuView.m index b57250c20..c1cea99cf 100644 --- a/Source/NSMenuView.m +++ b/Source/NSMenuView.m @@ -1223,23 +1223,12 @@ static NSMapTable *viewInfo = 0; { int i; int howMany = [_itemCells count]; - NSRectEdge sides[2]; - float grays[] = {NSDarkGray, NSDarkGray}; - if (_horizontal == YES) - { - sides[0] = NSMinYEdge; - sides[1] = NSMinYEdge; - NSDrawTiledRects(_bounds, rect, sides, grays, 2); - } - else - { - sides[0] = NSMinXEdge; - sides[1] = NSMaxYEdge; - // Draw the dark gray upper left lines. - NSDrawTiledRects(_bounds, rect, sides, grays, 2); - } - + [[GSTheme theme] drawBackgroundForMenuView: self + withFrame: _bounds + dirtyRect: rect + horizontal: _horizontal]; + // Draw the menu cells. for (i = 0; i < howMany; i++) {