Create a new GSTheme method for drawing the background of NSMenuView,

-drawBackgroundForMenuView:withFrame:dirtyRect:horizontal:


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29430 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2010-01-28 04:28:23 +00:00
parent b521058a3a
commit f03ffb9793
4 changed files with 40 additions and 16 deletions

View file

@ -1,5 +1,13 @@
2010-01-27 Eric Wasylishen <ewasylishen@gmail.com>
* 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 <ewasylishen@gmail.com>
* Source/GSThemeDrawing.m: Undo an accidental commit of some testing
code in r29416

View file

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

View file

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

View file

@ -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++)
{