* Source/GSThemeDrawing.m:

* Headers/Additions/GNUstepGUI/GSTheme.h: Add methods
	-menuSubmenuHorizontalOverlap and -menuSubmenuVerticalOverlap
	wrapping user defaults GSMenuSubmenuHorizontalOverlap and
	GSMenuSubmenuVerticalOverlap
	* Source/NSMenuView.m (-locationForSubmenu:): Offset calculations
	by -[GSTheme menuSubmenuHorizontalOverlap] and
	-[GSTheme menuSubmenuVerticalOverlap]


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37243 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
ericwa 2013-10-16 07:08:15 +00:00
parent 3245adb05e
commit 6cb79db929
4 changed files with 46 additions and 5 deletions

View file

@ -1111,6 +1111,8 @@ static float menuBarHeight = 0.0;
{
NSRect frame = [_window frame];
NSRect submenuFrame;
const CGFloat submenuHorizOverlap = [[GSTheme theme] menuSubmenuHorizontalOverlap];
const CGFloat submenuVertOverlap = [[GSTheme theme] menuSubmenuVerticalOverlap];
if (_needsSizing)
[self sizeToFit];
@ -1130,7 +1132,7 @@ static float menuBarHeight = 0.0;
[_attachedMenu indexOfItemWithSubmenu: aSubmenu]] toView: nil];
NSPoint subOrigin = [_window convertBaseToScreen: aRect.origin];
return NSMakePoint (NSMaxX(frame),
return NSMakePoint (NSMaxX(frame) - submenuHorizOverlap,
subOrigin.y - NSHeight(submenuFrame) - 2 +
2*[NSMenuView menuBarHeight]);
}
@ -1141,12 +1143,12 @@ static float menuBarHeight = 0.0;
NSPoint subOrigin = [_window convertBaseToScreen: aRect.origin];
// FIXME ... why is the offset +1 needed below?
return NSMakePoint (NSMaxX(frame),
return NSMakePoint (NSMaxX(frame) - submenuHorizOverlap,
subOrigin.y - NSHeight(submenuFrame) + aRect.size.height + 1);
}
else
{
return NSMakePoint(NSMaxX(frame),
return NSMakePoint(NSMaxX(frame) - submenuHorizOverlap,
NSMaxY(frame) - NSHeight(submenuFrame));
}
}
@ -1162,12 +1164,12 @@ static float menuBarHeight = 0.0;
NSWindows95InterfaceStyle)
{
return NSMakePoint(subOrigin.x,
subOrigin.y - NSHeight(submenuFrame) + 1);
subOrigin.y - NSHeight(submenuFrame) + 1 + submenuVertOverlap);
}
else
{
return NSMakePoint(subOrigin.x,
subOrigin.y - NSHeight(submenuFrame));
subOrigin.y - NSHeight(submenuFrame) + submenuVertOverlap);
}
}
}