mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-22 18:11:06 +00:00
Fixes for the menus.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@4661 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
9a2bf35f6c
commit
e384e9853a
2 changed files with 52 additions and 5 deletions
|
@ -15,7 +15,8 @@
|
|||
* Source/NSMenu.m: removed isTornOff: from frontend and it is in
|
||||
the backend where it should be.
|
||||
* Source/NSMenuView.m: added code that does quite a bit of the
|
||||
transient menu code.
|
||||
transient menu code. Added code to close transients when the mouse
|
||||
goes up.
|
||||
|
||||
The event code needs to be finessed so that the transient menu is
|
||||
not allowed to remain on screen unless the mouse button stays down.
|
||||
|
|
|
@ -412,7 +412,8 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
|||
{
|
||||
// The MacOSX API says that this method calls - rectOfItemAtIndex for
|
||||
// *every* cell to figure this out. Well, instead we will just do some
|
||||
// simple math.
|
||||
// simple math. (NOTE: if we get horizontal methods we will have to do
|
||||
// this. Very much like NSTabView.
|
||||
NSRect aRect = [self rectOfItemAtIndex: 0];
|
||||
|
||||
// this will need some finnessing but should be close.
|
||||
|
@ -525,6 +526,7 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
|||
{
|
||||
case NSRightMouseUp:
|
||||
case NSLeftMouseUp:
|
||||
// [self setHighlightedItemIndex:-1];
|
||||
/* right mouse up or left mouse up means we're done */
|
||||
done = YES;
|
||||
break;
|
||||
|
@ -629,11 +631,11 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
|||
[window flushWindow];
|
||||
}
|
||||
}
|
||||
/* FIXME this code is just plain nasty.
|
||||
else
|
||||
{
|
||||
// FIXME, Michael. This might be needed... or not?
|
||||
NSLog(@"This is the final else... its evil\n");
|
||||
/* FIXME this code is just plain nasty.
|
||||
if (lastIndex >= 0 && lastIndex < theCount)
|
||||
{
|
||||
[self setHighlightedItemIndex: -1];
|
||||
|
@ -641,8 +643,8 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
|||
weWereOut = YES;
|
||||
[window flushWindow];
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
[window flushWindow];
|
||||
default:
|
||||
break;
|
||||
|
@ -694,7 +696,6 @@ cell do the following */
|
|||
|
||||
while (!finished)
|
||||
{ // Recursive menu close & deselect.
|
||||
// if ([aMenu supermenu] && ![aMenu isTornOff])
|
||||
if ([aMenu supermenu])
|
||||
{
|
||||
[[[aMenu supermenu] menuView] setHighlightedItemIndex: -1];
|
||||
|
@ -715,6 +716,51 @@ cell do the following */
|
|||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOL finished = NO;
|
||||
NSMenu *aMenu = menuv_menu;
|
||||
|
||||
if (index >= 0 && index < theCount)
|
||||
selectedCell = [menuv_items_link objectAtIndex: index];
|
||||
else
|
||||
selectedCell = nil;
|
||||
|
||||
if (![[selectedCell target] isTornOff])
|
||||
return;
|
||||
|
||||
[self setHighlightedItemIndex: -1];
|
||||
|
||||
/* If we are a menu */
|
||||
|
||||
if (menuv_menu)
|
||||
{
|
||||
while (!finished)
|
||||
{ // "forward"cursive menu find.
|
||||
if ([aMenu attachedMenu])
|
||||
{
|
||||
aMenu = [aMenu attachedMenu];
|
||||
}
|
||||
else
|
||||
finished = YES;
|
||||
}
|
||||
|
||||
finished = NO;
|
||||
|
||||
while (!finished)
|
||||
{ // Recursive menu close & deselect.
|
||||
if ([aMenu supermenu])
|
||||
{
|
||||
[[[aMenu supermenu] menuView] setHighlightedItemIndex: -1];
|
||||
aMenu = [aMenu supermenu];
|
||||
}
|
||||
else
|
||||
finished = YES;
|
||||
|
||||
[window flushWindow];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* If the mouse is released and there is no highlighted cell */
|
||||
|
|
Loading…
Reference in a new issue