Allow for mac style horizontal menu. Also minor code style fixups.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22598 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2006-03-05 13:21:33 +00:00
parent 552a31196a
commit f692658c91
4 changed files with 53 additions and 29 deletions

View file

@ -31,6 +31,8 @@
#include "AppKit/NSScreen.h"
#include "AppKit/NSInterfaceStyle.h"
#include "AppKit/NSGraphicsContext.h"
#include "AppKit/NSWindow.h"
#include "AppKit/NSMenu.h"
#include "AppKit/AppKitExceptions.h"
#include "GNUstepGUI/GSDisplayServer.h"
@ -302,22 +304,38 @@ static NSMutableArray *screenArray = nil;
{
NSRect visFrame = _frame;
switch (NSInterfaceStyleForKey(@"NSInterfaceStyle", nil))
switch (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil))
{
case NSMacintoshInterfaceStyle:
// What is the size of the Mac menubar?
visFrame.size.height -= 25;
return visFrame;
if ([NSApp mainMenu] != nil)
{
float menuHeight = [[[NSApp mainMenu] window] frame].size.height;
visFrame.size.height -= menuHeight;
}
break;
case GSWindowMakerInterfaceStyle:
case NSNextStepInterfaceStyle:
visFrame.size.width -= 64;
return visFrame;
/* FIXME: Menu width will vary from app to app and there is no
* fixed position for the menu ... should we be making room for
* a menu top left, or something else?
*/
#if 0
if ([NSApp mainMenu] != nil)
{
float menuWidth = [[[NSApp mainMenu] window] frame].size.width;
visFrame.size.width -= menuWidth;
visFrame.origin.x += menuWidth;
}
#endif
break;
case NSWindows95InterfaceStyle:
case NSNoInterfaceStyle:
default:
return _frame;
break;
}
return visFrame;
}
/** Returns the screen number */