mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 17:01:00 +00:00
* Source/GSThemeDrawing.m:
* Headers/Additions/GNUstepGUI/GSTheme.h: Add methods -menuSubmenuHorizontalOverlap and -menuSubmenuVerticalOverlap wrapping user defaults GSMenuSubmenuHorizontalOverlap and GSMenuSubmenuVerticalOverlap * Source/NSMenuView.m (-locationForSubmenu:): Offset calculations by -[GSTheme menuSubmenuHorizontalOverlap] and -[GSTheme menuSubmenuVerticalOverlap] git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@37243 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
3245adb05e
commit
6cb79db929
4 changed files with 46 additions and 5 deletions
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
||||||
|
2013-10-15 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
|
* Source/GSThemeDrawing.m:
|
||||||
|
* Headers/Additions/GNUstepGUI/GSTheme.h: Add methods
|
||||||
|
-menuSubmenuHorizontalOverlap and -menuSubmenuVerticalOverlap
|
||||||
|
wrapping user defaults GSMenuSubmenuHorizontalOverlap and
|
||||||
|
GSMenuSubmenuVerticalOverlap
|
||||||
|
* Source/NSMenuView.m (-locationForSubmenu:): Offset calculations
|
||||||
|
by -[GSTheme menuSubmenuHorizontalOverlap] and
|
||||||
|
-[GSTheme menuSubmenuVerticalOverlap]
|
||||||
|
|
||||||
2013-10-15 Eric Wasylishen <ewasylishen@gmail.com>
|
2013-10-15 Eric Wasylishen <ewasylishen@gmail.com>
|
||||||
|
|
||||||
* Source/GSThemePrivate.h:
|
* Source/GSThemePrivate.h:
|
||||||
|
|
|
@ -1084,6 +1084,22 @@ APPKIT_EXPORT NSString *GSThemeWillDeactivateNotification;
|
||||||
* <p>Can be overridden in subclasses to return a custom value.</p>
|
* <p>Can be overridden in subclasses to return a custom value.</p>
|
||||||
*/
|
*/
|
||||||
- (CGFloat) menuSeparatorInset;
|
- (CGFloat) menuSeparatorInset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Amount that submenus overlap their parent menu by, horizontally.
|
||||||
|
* (i.e. applies to vertical menus)
|
||||||
|
*
|
||||||
|
* Controlled by GSMenuSubmenuHorizontalOverlap default
|
||||||
|
*/
|
||||||
|
- (CGFloat) menuSubmenuHorizontalOverlap;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Amount that submenus overlap the horizontal menu bar by, vertically.
|
||||||
|
*
|
||||||
|
* Controlled by GSMenuSubmenuVerticalOverlap default
|
||||||
|
*/
|
||||||
|
- (CGFloat) menuSubmenuVerticalOverlap;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* <p>Draws a separator between normal menu items in a menu.</p>
|
* <p>Draws a separator between normal menu items in a menu.</p>
|
||||||
*
|
*
|
||||||
|
|
|
@ -1027,6 +1027,18 @@
|
||||||
return 3.0;
|
return 3.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (CGFloat) menuSubmenuHorizontalOverlap
|
||||||
|
{
|
||||||
|
return [[NSUserDefaults standardUserDefaults]
|
||||||
|
floatForKey: @"GSMenuSubmenuHorizontalOverlap"];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (CGFloat) menuSubmenuVerticalOverlap
|
||||||
|
{
|
||||||
|
return [[NSUserDefaults standardUserDefaults]
|
||||||
|
floatForKey: @"GSMenuSubmenuVerticalOverlap"];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) drawSeparatorItemForMenuItemCell: (NSMenuItemCell *)cell
|
- (void) drawSeparatorItemForMenuItemCell: (NSMenuItemCell *)cell
|
||||||
withFrame: (NSRect)cellFrame
|
withFrame: (NSRect)cellFrame
|
||||||
inView: (NSView *)controlView
|
inView: (NSView *)controlView
|
||||||
|
|
|
@ -1111,6 +1111,8 @@ static float menuBarHeight = 0.0;
|
||||||
{
|
{
|
||||||
NSRect frame = [_window frame];
|
NSRect frame = [_window frame];
|
||||||
NSRect submenuFrame;
|
NSRect submenuFrame;
|
||||||
|
const CGFloat submenuHorizOverlap = [[GSTheme theme] menuSubmenuHorizontalOverlap];
|
||||||
|
const CGFloat submenuVertOverlap = [[GSTheme theme] menuSubmenuVerticalOverlap];
|
||||||
|
|
||||||
if (_needsSizing)
|
if (_needsSizing)
|
||||||
[self sizeToFit];
|
[self sizeToFit];
|
||||||
|
@ -1130,7 +1132,7 @@ static float menuBarHeight = 0.0;
|
||||||
[_attachedMenu indexOfItemWithSubmenu: aSubmenu]] toView: nil];
|
[_attachedMenu indexOfItemWithSubmenu: aSubmenu]] toView: nil];
|
||||||
NSPoint subOrigin = [_window convertBaseToScreen: aRect.origin];
|
NSPoint subOrigin = [_window convertBaseToScreen: aRect.origin];
|
||||||
|
|
||||||
return NSMakePoint (NSMaxX(frame),
|
return NSMakePoint (NSMaxX(frame) - submenuHorizOverlap,
|
||||||
subOrigin.y - NSHeight(submenuFrame) - 2 +
|
subOrigin.y - NSHeight(submenuFrame) - 2 +
|
||||||
2*[NSMenuView menuBarHeight]);
|
2*[NSMenuView menuBarHeight]);
|
||||||
}
|
}
|
||||||
|
@ -1141,12 +1143,12 @@ static float menuBarHeight = 0.0;
|
||||||
NSPoint subOrigin = [_window convertBaseToScreen: aRect.origin];
|
NSPoint subOrigin = [_window convertBaseToScreen: aRect.origin];
|
||||||
|
|
||||||
// FIXME ... why is the offset +1 needed below?
|
// FIXME ... why is the offset +1 needed below?
|
||||||
return NSMakePoint (NSMaxX(frame),
|
return NSMakePoint (NSMaxX(frame) - submenuHorizOverlap,
|
||||||
subOrigin.y - NSHeight(submenuFrame) + aRect.size.height + 1);
|
subOrigin.y - NSHeight(submenuFrame) + aRect.size.height + 1);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return NSMakePoint(NSMaxX(frame),
|
return NSMakePoint(NSMaxX(frame) - submenuHorizOverlap,
|
||||||
NSMaxY(frame) - NSHeight(submenuFrame));
|
NSMaxY(frame) - NSHeight(submenuFrame));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1162,12 +1164,12 @@ static float menuBarHeight = 0.0;
|
||||||
NSWindows95InterfaceStyle)
|
NSWindows95InterfaceStyle)
|
||||||
{
|
{
|
||||||
return NSMakePoint(subOrigin.x,
|
return NSMakePoint(subOrigin.x,
|
||||||
subOrigin.y - NSHeight(submenuFrame) + 1);
|
subOrigin.y - NSHeight(submenuFrame) + 1 + submenuVertOverlap);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return NSMakePoint(subOrigin.x,
|
return NSMakePoint(subOrigin.x,
|
||||||
subOrigin.y - NSHeight(submenuFrame));
|
subOrigin.y - NSHeight(submenuFrame) + submenuVertOverlap);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue