mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-25 06:41:12 +00:00
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:
parent
8650307f00
commit
d76f980997
1 changed files with 17 additions and 19 deletions
|
@ -1363,23 +1363,16 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
|
||||
- (void) drawRect: (NSRect)rect
|
||||
{
|
||||
NSGraphicsContext *ctxt = GSCurrentContext();
|
||||
NSRect workRect = [self bounds];
|
||||
NSRectEdge sides[] = {NSMinXEdge, NSMaxYEdge};
|
||||
float grays[] = {NSDarkGray, NSDarkGray};
|
||||
NSDictionary *attr;
|
||||
|
||||
// Draw the dark gray upper left lines.
|
||||
DPSgsave(ctxt);
|
||||
DPSsetlinewidth(ctxt, 1);
|
||||
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);
|
||||
workRect = NSDrawTiledRects(workRect, workRect,
|
||||
sides, grays, 2);
|
||||
|
||||
// Draw the title box's button.
|
||||
workRect.size.width -= 1;
|
||||
workRect.size.height -= 1;
|
||||
workRect.origin.x += 1;
|
||||
NSDrawButton(workRect, workRect);
|
||||
|
||||
// Paint it Black!
|
||||
|
@ -1391,12 +1384,17 @@ static NSString *NSMenuLocationsKey = @"NSMenuLocations";
|
|||
NSRectFill(workRect);
|
||||
|
||||
// Draw the title.
|
||||
[[NSColor windowFrameTextColor] set];
|
||||
[[NSFont boldSystemFontOfSize: 0] set];
|
||||
attr = [[NSDictionary alloc] initWithObjectsAndKeys:
|
||||
[NSFont boldSystemFontOfSize: 0], NSFontAttributeName,
|
||||
[NSColor windowFrameTextColor], NSForegroundColorAttributeName,
|
||||
nil];
|
||||
|
||||
workRect = _bounds;
|
||||
PSmoveto(workRect.origin.x + 7, workRect.origin.y + 7);
|
||||
PSshow([[menu title] cString]);
|
||||
// This gives the correct position, but I don't quite understand it.
|
||||
workRect.origin.x += 5;
|
||||
workRect.size.width -= 5;
|
||||
workRect.size.height -= 2;
|
||||
[[menu title] drawInRect: workRect withAttributes: attr];
|
||||
RELEASE(attr);
|
||||
}
|
||||
|
||||
- (void) mouseDown: (NSEvent*)theEvent
|
||||
|
|
Loading…
Reference in a new issue