For NSMenuWindowTitleView [drawRect:] use string

drawing method instead of PSshow().


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@9890 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2001-05-07 22:54:00 +00:00
parent 8650307f00
commit d76f980997

View file

@ -1363,23 +1363,16 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
- (void) drawRect: (NSRect)rect - (void) drawRect: (NSRect)rect
{ {
NSGraphicsContext *ctxt = GSCurrentContext(); NSRect workRect = [self bounds];
NSRect workRect = [self bounds]; NSRectEdge sides[] = {NSMinXEdge, NSMaxYEdge};
float grays[] = {NSDarkGray, NSDarkGray};
NSDictionary *attr;
// Draw the dark gray upper left lines. // Draw the dark gray upper left lines.
DPSgsave(ctxt); workRect = NSDrawTiledRects(workRect, workRect,
DPSsetlinewidth(ctxt, 1); sides, grays, 2);
DPSsetgray(ctxt, 0.333);
DPSmoveto(ctxt, workRect.origin.x, workRect.origin.y);
DPSrlineto(ctxt, 0, workRect.size.height);
DPSrlineto(ctxt, workRect.size.width, 0);
DPSstroke(ctxt);
DPSgrestore(ctxt);
// Draw the title box's button. // Draw the title box's button.
workRect.size.width -= 1;
workRect.size.height -= 1;
workRect.origin.x += 1;
NSDrawButton(workRect, workRect); NSDrawButton(workRect, workRect);
// Paint it Black! // Paint it Black!
@ -1391,12 +1384,17 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
NSRectFill(workRect); NSRectFill(workRect);
// Draw the title. // Draw the title.
[[NSColor windowFrameTextColor] set]; attr = [[NSDictionary alloc] initWithObjectsAndKeys:
[[NSFont boldSystemFontOfSize: 0] set]; [NSFont boldSystemFontOfSize: 0], NSFontAttributeName,
[NSColor windowFrameTextColor], NSForegroundColorAttributeName,
nil];
workRect = _bounds; // This gives the correct position, but I don't quite understand it.
PSmoveto(workRect.origin.x + 7, workRect.origin.y + 7); workRect.origin.x += 5;
PSshow([[menu title] cString]); workRect.size.width -= 5;
workRect.size.height -= 2;
[[menu title] drawInRect: workRect withAttributes: attr];
RELEASE(attr);
} }
- (void) mouseDown: (NSEvent*)theEvent - (void) mouseDown: (NSEvent*)theEvent