git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@16154 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2003-03-08 11:57:44 +00:00
parent 270921f22c
commit a3580a4caf
2 changed files with 6 additions and 4 deletions

View file

@ -2,6 +2,8 @@
* Source/NSMenu.m: ([-_updateUserDefaults:]) Do not store location * Source/NSMenu.m: ([-_updateUserDefaults:]) Do not store location
for attached menus. for attached menus.
* Source/NSMenuView.m ([NSMenuWindowTitleView -drawRect:]):
Centre drawing of title instead of using fixed offset.
2003-03-07 Richard Frith-Macdonald <rfm@gnu.org> 2003-03-07 Richard Frith-Macdonald <rfm@gnu.org>

View file

@ -1425,6 +1425,7 @@ _addLeftBorderOffsetToRect(NSRect aRect, BOOL isHorizontal)
- (void) drawRect: (NSRect)rect - (void) drawRect: (NSRect)rect
{ {
NSRect workRect = [self bounds]; NSRect workRect = [self bounds];
NSSize titleSize;
NSRectEdge sides[] = {NSMinXEdge, NSMaxYEdge}; NSRectEdge sides[] = {NSMinXEdge, NSMaxYEdge};
float grays[] = {NSDarkGray, NSDarkGray}; float grays[] = {NSDarkGray, NSDarkGray};
/* Cache the title attributes */ /* Cache the title attributes */
@ -1454,11 +1455,10 @@ _addLeftBorderOffsetToRect(NSRect aRect, BOOL isHorizontal)
nil]; nil];
} }
// This gives the correct position titleSize = [[menu title] sizeWithAttributes: attr];
// WO: No it doesn't!
workRect.origin.x += 5; workRect.origin.x += 5;
workRect.size.width -= 5; workRect.origin.y = NSMidY (workRect) - titleSize.height / 2;
workRect.size.height -= 2; workRect.size.height = titleSize.height;
[[menu title] drawInRect: workRect withAttributes: attr]; [[menu title] drawInRect: workRect withAttributes: attr];
} }