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:
ericwa 2010-01-28 04:28:23 +00:00
parent 0614c779b0
commit 775d9caf51
4 changed files with 40 additions and 16 deletions

View file

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

View file

@ -832,6 +832,10 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
withFrame: (NSRect) aRect withFrame: (NSRect) aRect
position: (NSPoint) position; position: (NSPoint) position;
- (void) drawBackgroundForMenuView: (NSMenuView*)menuView
withFrame: (NSRect)bounds
dirtyRect: (NSRect)dirtyRect
horizontal: (BOOL)horizontal;
// menu item cell drawing method // menu item cell drawing method
- (void) drawBorderAndBackgroundForMenuItemCell: (NSMenuItemCell *)cell - (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 - (void) drawBorderAndBackgroundForMenuItemCell: (NSMenuItemCell *)cell
withFrame: (NSRect)cellFrame withFrame: (NSRect)cellFrame
inView: (NSView *)controlView inView: (NSView *)controlView

View file

@ -1223,23 +1223,12 @@ static NSMapTable *viewInfo = 0;
{ {
int i; int i;
int howMany = [_itemCells count]; int howMany = [_itemCells count];
NSRectEdge sides[2];
float grays[] = {NSDarkGray, NSDarkGray};
if (_horizontal == YES) [[GSTheme theme] drawBackgroundForMenuView: self
{ withFrame: _bounds
sides[0] = NSMinYEdge; dirtyRect: rect
sides[1] = NSMinYEdge; horizontal: _horizontal];
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);
}
// Draw the menu cells. // Draw the menu cells.
for (i = 0; i < howMany; i++) for (i = 0; i < howMany; i++)
{ {