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:
Richard Frith-MacDonald 2006-03-05 13:21:33 +00:00
parent 69672cbc88
commit c2d4e58fb5
4 changed files with 53 additions and 29 deletions

View file

@ -1,3 +1,8 @@
2006-03-05 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSScreen.m: ([-visibleFrame]) fix to work when using
mac style horizontal menu.
2006-03-01 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSMenuView.m: ([-rectOfItemAtIndex:]) Fix bug #15934 by

View file

@ -59,18 +59,18 @@
/*
Drawing related:
NSMenu superMenu (if not root menu, the parent meu)
^
|
| +------------------> NSMenuView view (content, draws the menu items)
| |
NSMenu +----------+-------> NSMenuPanel A (regular window, torn off window)
| | `-------> NSMenuPanel B (transient window)
| |
| +------------------> NSString title (title)
|
v
NSMenu attachedMenu (the menu that is attached to this one, during navigation)
NSMenu superMenu (if not root menu, the parent meu)
^
|
| +------------------> NSMenuView view (content, draws the menu items)
| |
NSMenu +----------+-------> NSMenuPanel A (regular window, torn off window)
| | `-------> NSMenuPanel B (transient window)
| |
| +------------------> NSString title (title)
|
v
NSMenu attachedMenu (the menu attached to this one, during navigation)

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 */

View file

@ -1519,8 +1519,8 @@ many times.
don't constrain if we are merely unhidding the window or if it's
already visible and is just being reordered. */
if ((_styleMask & NSTitledWindowMask)
&& [NSApp isHidden] == NO
&& _f.visible == NO)
&& [NSApp isHidden] == NO
&& _f.visible == NO)
{
NSRect nframe = [self constrainFrameRect: _frame
toScreen: [self screen]];
@ -1750,7 +1750,8 @@ many times.
if (resizeTime == 0)
{
NSNumber *num;
num = [[NSUserDefaults standardUserDefaults] objectForKey: @"NSWindowResizeTime"];
num = [[NSUserDefaults standardUserDefaults]
objectForKey: @"NSWindowResizeTime"];
if (num != nil)
{
resizeTime = [num floatValue];
@ -3895,7 +3896,7 @@ resetCursorRectsForView(NSView *theView)
}
- (BOOL) setFrameUsingName: (NSString *)name
force: (BOOL)force
force: (BOOL)force
{
// FIXME
return [self setFrameUsingName: name];
@ -3980,10 +3981,10 @@ resetCursorRectsForView(NSView *theView)
maxRect = [self constrainFrameRect: maxRect toScreen: [self screen]];
// Compare the new frame with the current one
if ((abs(NSMaxX(maxRect) - NSMaxX(_frame)) < DIST) &&
(abs(NSMaxY(maxRect) - NSMaxY(_frame)) < DIST) &&
(abs(NSMinX(maxRect) - NSMinX(_frame)) < DIST) &&
(abs(NSMinY(maxRect) - NSMinY(_frame)) < DIST))
if ((abs(NSMaxX(maxRect) - NSMaxX(_frame)) < DIST)
&& (abs(NSMaxY(maxRect) - NSMaxY(_frame)) < DIST)
&& (abs(NSMinX(maxRect) - NSMinX(_frame)) < DIST)
&& (abs(NSMinY(maxRect) - NSMinY(_frame)) < DIST))
{
// Already in zoomed mode, reset user frame, if stored
if (_autosaveName != nil)