* Source/NSMenuView.m: In the method

- (void) setWindowFrameForAttachingToRect:... changed how
	popup/pulldown buttons handle the preferred edge.
	Per Cocoa documentation, the selected cell should always show up
	over the button for popups.   For pull down menus, the preferred 
	edge is relevant.   This is also apparent from testing under Cocoa.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@28189 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
gcasa 2009-04-10 04:54:24 +00:00
parent 6addac1c7c
commit 6573b6c50f
2 changed files with 39 additions and 21 deletions

View file

@ -1154,29 +1154,38 @@ static NSMapTable *viewInfo = 0;
}
// Update position, if needed, using the preferredEdge
if (edge == NSMinYEdge)
if([_attachedMenu _ownedByPopUp])
{
/*
if ([_attachedMenu _ownedByPopUp] &&
([[_attachedMenu _owningPopUp] pullsDown]))
{
screenFrame.origin.y -= screenRect.size.height;
}
*/
// Per Cocoa documentation, the selected cell should always show up
// over the button for popups. For pull down menus, the preferred
// edge is relevant. This is also apparent from testing under Cocoa.
if([[_attachedMenu _owningPopUp] pullsDown])
{
if (edge == NSMinYEdge)
{
/*
if ([_attachedMenu _ownedByPopUp] &&
([[_attachedMenu _owningPopUp] pullsDown]))
{
screenFrame.origin.y -= screenRect.size.height;
}
*/
}
else if (edge == NSMaxYEdge)
{
screenFrame.origin.y += screenRect.size.height;
}
else if (edge == NSMaxXEdge)
{
screenFrame.origin.x += screenRect.size.width;
}
else if (edge == NSMinXEdge)
{
screenFrame.origin.x -= screenRect.size.width;
}
}
}
else if (edge == NSMaxYEdge)
{
screenFrame.origin.y += screenRect.size.height;
}
else if (edge == NSMaxXEdge)
{
screenFrame.origin.x += screenRect.size.width;
}
else if (edge == NSMinXEdge)
{
screenFrame.origin.x -= screenRect.size.width;
}
// Get the frameRect
r = [NSWindow frameRectForContentRect: screenFrame
styleMask: [_window styleMask]];