mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-01 08:31:55 +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
d86555ef4c
commit
9454db0cf5
2 changed files with 52 additions and 5 deletions
|
@ -15,7 +15,8 @@
|
||||||
* Source/NSMenu.m: removed isTornOff: from frontend and it is in
|
* Source/NSMenu.m: removed isTornOff: from frontend and it is in
|
||||||
the backend where it should be.
|
the backend where it should be.
|
||||||
* Source/NSMenuView.m: added code that does quite a bit of the
|
* 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
|
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.
|
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
|
// The MacOSX API says that this method calls - rectOfItemAtIndex for
|
||||||
// *every* cell to figure this out. Well, instead we will just do some
|
// *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];
|
NSRect aRect = [self rectOfItemAtIndex: 0];
|
||||||
|
|
||||||
// this will need some finnessing but should be close.
|
// this will need some finnessing but should be close.
|
||||||
|
@ -525,6 +526,7 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
||||||
{
|
{
|
||||||
case NSRightMouseUp:
|
case NSRightMouseUp:
|
||||||
case NSLeftMouseUp:
|
case NSLeftMouseUp:
|
||||||
|
// [self setHighlightedItemIndex:-1];
|
||||||
/* right mouse up or left mouse up means we're done */
|
/* right mouse up or left mouse up means we're done */
|
||||||
done = YES;
|
done = YES;
|
||||||
break;
|
break;
|
||||||
|
@ -629,11 +631,11 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
||||||
[window flushWindow];
|
[window flushWindow];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/* FIXME this code is just plain nasty.
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// FIXME, Michael. This might be needed... or not?
|
// FIXME, Michael. This might be needed... or not?
|
||||||
NSLog(@"This is the final else... its evil\n");
|
NSLog(@"This is the final else... its evil\n");
|
||||||
|
/* FIXME this code is just plain nasty.
|
||||||
if (lastIndex >= 0 && lastIndex < theCount)
|
if (lastIndex >= 0 && lastIndex < theCount)
|
||||||
{
|
{
|
||||||
[self setHighlightedItemIndex: -1];
|
[self setHighlightedItemIndex: -1];
|
||||||
|
@ -641,8 +643,8 @@ static float GSMenuBarHeight = 25.0; // a guess.
|
||||||
weWereOut = YES;
|
weWereOut = YES;
|
||||||
[window flushWindow];
|
[window flushWindow];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
*/
|
*/
|
||||||
|
}
|
||||||
[window flushWindow];
|
[window flushWindow];
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
|
@ -694,7 +696,6 @@ cell do the following */
|
||||||
|
|
||||||
while (!finished)
|
while (!finished)
|
||||||
{ // Recursive menu close & deselect.
|
{ // Recursive menu close & deselect.
|
||||||
// if ([aMenu supermenu] && ![aMenu isTornOff])
|
|
||||||
if ([aMenu supermenu])
|
if ([aMenu supermenu])
|
||||||
{
|
{
|
||||||
[[[aMenu supermenu] menuView] setHighlightedItemIndex: -1];
|
[[[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 */
|
/* If the mouse is released and there is no highlighted cell */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue