mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 15:11:37 +00:00
* Source/NSMenuView.m: For horizontal menus, treat clicking in the
8 pixels of padding to the left of the first menu item as activating the first menu item. This lets you open the application menu with a Macintosh-syle menu bar when the mouse is on the top-left pixel of the screen. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29375 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
15de26b03c
commit
07f8682baf
2 changed files with 19 additions and 1 deletions
|
@ -1,3 +1,11 @@
|
|||
2010-01-23 Eric Wasylishen <ewasylishen@gmail.com>
|
||||
|
||||
* Source/NSMenuView.m: For horizontal menus, treat clicking in the
|
||||
8 pixels of padding to the left of the first menu item as activating
|
||||
the first menu item.
|
||||
This lets you open the application menu with a Macintosh-syle
|
||||
menu bar when the mouse is on the top-left pixel of the screen.
|
||||
|
||||
2010-01-23 18:41-EST Gregory John Casamento <greg.casamento@gmail.com>
|
||||
|
||||
* Headers/Additions/GNUstepGUI/GSTheme.h: Add updateMenu:forWindow:
|
||||
|
|
|
@ -65,6 +65,8 @@ static NSMapTable *viewInfo = 0;
|
|||
|
||||
#define cellRects ((GSIArray)NSMapGet(viewInfo, self))
|
||||
|
||||
#define HORIZONTAL_MENU_LEFT_PADDING 8
|
||||
|
||||
/*
|
||||
NSMenuView contains:
|
||||
|
||||
|
@ -641,7 +643,7 @@ static NSMapTable *viewInfo = 0;
|
|||
{
|
||||
unsigned i;
|
||||
unsigned howMany = [_itemCells count];
|
||||
float currentX = 8;
|
||||
float currentX = HORIZONTAL_MENU_LEFT_PADDING;
|
||||
// NSRect scRect = [[NSScreen mainScreen] frame];
|
||||
|
||||
GSIArrayRemoveAllItems(cellRects);
|
||||
|
@ -952,6 +954,14 @@ static NSMapTable *viewInfo = 0;
|
|||
aRect.origin.x -= _leftBorderOffset;
|
||||
aRect.size.width += _leftBorderOffset;
|
||||
|
||||
// For horizontal menus, clicking in the left padding should be treated
|
||||
// as hitting the first menu item.
|
||||
if (_horizontal == YES && i == 0)
|
||||
{
|
||||
aRect.origin.x -= HORIZONTAL_MENU_LEFT_PADDING;
|
||||
aRect.size.width += HORIZONTAL_MENU_LEFT_PADDING;
|
||||
}
|
||||
|
||||
if (NSMouseInRect(point, aRect, NO))
|
||||
return (int)i;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue