More changes to support not highlighting cells when traversing to a submenu.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@5242 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
David Lazaro Saz 1999-11-19 18:18:58 +00:00
parent 0f73d1d9ea
commit 05ba07e9e8
2 changed files with 25 additions and 10 deletions

View file

@ -1,3 +1,9 @@
1999-11-19 David Lazaro Saz <khelekir@encomix.es>
* Source/NSMenuView.m ([NSMenuView -trackWithEvent:]): Added two
defines (MOVE_THRESHOLD_DELTA and DELAY_MULTIPLIER) to make nicer the
menu traversing.
1999-11-18 David Lazaro Saz <khelekir@encomix.es>
* Source/NSPopUpButton.m ([NSPopUpButton +initialize]): Fixed core

View file

@ -674,7 +674,8 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
[targetMenuView setHighlightedItemIndex: -1];
}
#define MOVE_THRESHOLD_DELTA 1
#define MOVE_THRESHOLD_DELTA 1.0
#define DELAY_MULTIPLIER 12
- (BOOL)trackWithEvent: (NSEvent *)event
{
@ -689,6 +690,7 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
NSPoint lastLocation = {0,0};
NSMenu *alreadyAttachedMenu = NO;
BOOL delayedSelect = NO;
int delayCount = DELAY_MULTIPLIER;
do
{
@ -708,6 +710,17 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
- 1)
[menuv_menu shiftOnScreen];
}
if ([event type] == NSPeriodic && delayedSelect && !delayCount)
{
if (location.x - lastLocation.x < MOVE_THRESHOLD_DELTA ||
abs(location.y - lastLocation.y) < MOVE_THRESHOLD_DELTA)
delayedSelect = NO;
lastLocation = location;
}
delayCount = delayCount ? --delayCount : DELAY_MULTIPLIER;
}
if (index == -1)
@ -731,15 +744,6 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
{
if (index != menuv_highlightedItemIndex)
{
if ([event type] == NSPeriodic && delayedSelect)
{
if (location.x - lastLocation.x < MOVE_THRESHOLD_DELTA ||
abs(location.y - lastLocation.y) < MOVE_THRESHOLD_DELTA)
delayedSelect = NO;
lastLocation = location;
}
if (![menuv_menu attachedMenu] || !delayedSelect)
{
[self setHighlightedItemIndex: index];
@ -752,6 +756,11 @@ static float GSMenuBarHeight = 25.0; // A wild guess.
{
[self attachSubmenuForItemAtIndex: index];
delayedSelect = YES;
delayCount = DELAY_MULTIPLIER;
}
else
{
delayedSelect = NO;
}
}
}