* Source/GSTheme.m:

* Source/GSTitleView.m:
* Source/GSThemeDrawing.m:
* Headers/Additions/GNUstepGUI/GSTheme.h: Add GSMenuTitleBackground
theme tile for themeing the background of GSTitleView.

NOTE: I removed some code that was in -[GSTitleView drawRect:] for
drawing with a different style when the GSTitleView is NOT owned
by an NSMenu, but by an NSWindow/NSPanel (_ownedByMenu == NO).
If needed, this can be added back, but it doesn't appear to ever
be used in gnustep-gui - GSTitleView is only created in one place,
with NSMenu as the owner.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37165 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Eric Wasylishen 2013-09-29 00:30:59 +00:00
parent ef5f2cf19f
commit 2fe4c2e708
5 changed files with 80 additions and 59 deletions

View file

@ -1057,6 +1057,58 @@
return [GSTitleView class];
}
- (NSRect) drawMenuTitleBackground: (GSTitleView *)aTitleView
withBounds: (NSRect)bounds
withClip: (NSRect)clipRect
{
GSDrawTiles *tiles = [self tilesNamed: GSMenuTitleBackground state: GSThemeNormalState];
if (tiles == nil)
{
NSRect workRect = bounds;
NSRectEdge top_left[] = {NSMinXEdge, NSMaxYEdge};
CGFloat darkGrays[] = {NSDarkGray, NSDarkGray};
NSColor *titleColor;
titleColor = [self colorNamed: @"GSMenuBar" state: GSThemeNormalState];
if (titleColor == nil)
{
titleColor = [NSColor blackColor];
}
// Draw the dark gray upper left lines for menu and black for others.
// Rectangle 1
workRect = NSDrawTiledRects(workRect, workRect, top_left, darkGrays, 2);
// Rectangle 2
// Draw the title box's button.
[self drawButton: workRect withClip: workRect];
// Overdraw white top and left lines with light gray lines for window title
workRect.origin.y += 1;
workRect.size.height -= 1;
workRect.size.width -= 1;
// Rectangle 3
// Paint background
workRect.origin.x += 1;
workRect.origin.y += 1;
workRect.size.height -= 2;
workRect.size.width -= 2;
[titleColor set];
NSRectFill(workRect);
return workRect;
}
else
{
return [self fillRect: bounds
withTiles: tiles
background: [NSColor clearColor]];
}
}
// NSColorWell drawing method
- (NSRect) drawColorWellBorder: (NSColorWell*)well
withBounds: (NSRect)bounds