From e23d0015192afac2b47ea6bd938619f9ee51f7eb Mon Sep 17 00:00:00 2001 From: nico Date: Sat, 11 Dec 1999 03:04:22 +0000 Subject: [PATCH] Implemented method which prepares the window for pop-up buttons. Tiny changing to make popup buttons selections work. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5441 72102866-910b-0410-8b05-ffd578937521 --- Source/NSMenuView.m | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/Source/NSMenuView.m b/Source/NSMenuView.m index f0b7c8c5f..6d206edd3 100644 --- a/Source/NSMenuView.m +++ b/Source/NSMenuView.m @@ -607,7 +607,31 @@ static float GSMenuBarHeight = 25.0; // A wild guess. preferredEdge: (NSRectEdge)edge popUpSelectedItem: (int)selectedItemIndex { - // Huh!? + NSRect r; + + // Move the menu window to screen? + // TODO + + // Compute position for popups, if needed + if (selectedItemIndex > -1) + { + screenRect.origin.y += ([self convertSize: cellSize + toView: nil].height + * selectedItemIndex); + } + + // Get the frameRect + r = [NSMenuWindow frameRectForContentRect: screenRect + styleMask: [window styleMask]]; + + // Update position,if needed, using the preferredEdge; + // It seems we should be calling [self resizeWindowWithMaxHeight: ]; + // see the (quite obscure) doc. + // TODO + + // Set the window frame + [window setFrame: r + display: YES]; } // @@ -790,7 +814,7 @@ static float GSMenuBarHeight = 25.0; // A wild guess. [NSEvent stopPeriodicEvents]; [menuv_menu performActionForItemAtIndex: index]; - if (![menuv_menu isFollowTransient]) + if (![menuv_menu isFollowTransient] && ![menuv_menu _ownedByPopUp]) [self setHighlightedItemIndex: -1]; }