mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:40:47 +00:00
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:
parent
552a31196a
commit
f692658c91
4 changed files with 53 additions and 29 deletions
|
@ -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>
|
2006-03-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSMenuView.m: ([-rectOfItemAtIndex:]) Fix bug #15934 by
|
* Source/NSMenuView.m: ([-rectOfItemAtIndex:]) Fix bug #15934 by
|
||||||
|
|
|
@ -59,18 +59,18 @@
|
||||||
/*
|
/*
|
||||||
Drawing related:
|
Drawing related:
|
||||||
|
|
||||||
NSMenu superMenu (if not root menu, the parent meu)
|
NSMenu superMenu (if not root menu, the parent meu)
|
||||||
^
|
^
|
||||||
|
|
|
|
||||||
| +------------------> NSMenuView view (content, draws the menu items)
|
| +------------------> NSMenuView view (content, draws the menu items)
|
||||||
| |
|
| |
|
||||||
NSMenu +----------+-------> NSMenuPanel A (regular window, torn off window)
|
NSMenu +----------+-------> NSMenuPanel A (regular window, torn off window)
|
||||||
| | `-------> NSMenuPanel B (transient window)
|
| | `-------> NSMenuPanel B (transient window)
|
||||||
| |
|
| |
|
||||||
| +------------------> NSString title (title)
|
| +------------------> NSString title (title)
|
||||||
|
|
|
|
||||||
v
|
v
|
||||||
NSMenu attachedMenu (the menu that is attached to this one, during navigation)
|
NSMenu attachedMenu (the menu attached to this one, during navigation)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
#include "AppKit/NSScreen.h"
|
#include "AppKit/NSScreen.h"
|
||||||
#include "AppKit/NSInterfaceStyle.h"
|
#include "AppKit/NSInterfaceStyle.h"
|
||||||
#include "AppKit/NSGraphicsContext.h"
|
#include "AppKit/NSGraphicsContext.h"
|
||||||
|
#include "AppKit/NSWindow.h"
|
||||||
|
#include "AppKit/NSMenu.h"
|
||||||
#include "AppKit/AppKitExceptions.h"
|
#include "AppKit/AppKitExceptions.h"
|
||||||
#include "GNUstepGUI/GSDisplayServer.h"
|
#include "GNUstepGUI/GSDisplayServer.h"
|
||||||
|
|
||||||
|
@ -302,22 +304,38 @@ static NSMutableArray *screenArray = nil;
|
||||||
{
|
{
|
||||||
NSRect visFrame = _frame;
|
NSRect visFrame = _frame;
|
||||||
|
|
||||||
switch (NSInterfaceStyleForKey(@"NSInterfaceStyle", nil))
|
switch (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil))
|
||||||
{
|
{
|
||||||
case NSMacintoshInterfaceStyle:
|
case NSMacintoshInterfaceStyle:
|
||||||
// What is the size of the Mac menubar?
|
if ([NSApp mainMenu] != nil)
|
||||||
visFrame.size.height -= 25;
|
{
|
||||||
return visFrame;
|
float menuHeight = [[[NSApp mainMenu] window] frame].size.height;
|
||||||
|
|
||||||
|
visFrame.size.height -= menuHeight;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case GSWindowMakerInterfaceStyle:
|
case GSWindowMakerInterfaceStyle:
|
||||||
case NSNextStepInterfaceStyle:
|
case NSNextStepInterfaceStyle:
|
||||||
visFrame.size.width -= 64;
|
/* FIXME: Menu width will vary from app to app and there is no
|
||||||
return visFrame;
|
* 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:
|
default:
|
||||||
return _frame;
|
break;
|
||||||
}
|
}
|
||||||
|
return visFrame;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns the screen number */
|
/** Returns the screen number */
|
||||||
|
|
|
@ -1519,8 +1519,8 @@ many times.
|
||||||
don't constrain if we are merely unhidding the window or if it's
|
don't constrain if we are merely unhidding the window or if it's
|
||||||
already visible and is just being reordered. */
|
already visible and is just being reordered. */
|
||||||
if ((_styleMask & NSTitledWindowMask)
|
if ((_styleMask & NSTitledWindowMask)
|
||||||
&& [NSApp isHidden] == NO
|
&& [NSApp isHidden] == NO
|
||||||
&& _f.visible == NO)
|
&& _f.visible == NO)
|
||||||
{
|
{
|
||||||
NSRect nframe = [self constrainFrameRect: _frame
|
NSRect nframe = [self constrainFrameRect: _frame
|
||||||
toScreen: [self screen]];
|
toScreen: [self screen]];
|
||||||
|
@ -1750,7 +1750,8 @@ many times.
|
||||||
if (resizeTime == 0)
|
if (resizeTime == 0)
|
||||||
{
|
{
|
||||||
NSNumber *num;
|
NSNumber *num;
|
||||||
num = [[NSUserDefaults standardUserDefaults] objectForKey: @"NSWindowResizeTime"];
|
num = [[NSUserDefaults standardUserDefaults]
|
||||||
|
objectForKey: @"NSWindowResizeTime"];
|
||||||
if (num != nil)
|
if (num != nil)
|
||||||
{
|
{
|
||||||
resizeTime = [num floatValue];
|
resizeTime = [num floatValue];
|
||||||
|
@ -3895,7 +3896,7 @@ resetCursorRectsForView(NSView *theView)
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) setFrameUsingName: (NSString *)name
|
- (BOOL) setFrameUsingName: (NSString *)name
|
||||||
force: (BOOL)force
|
force: (BOOL)force
|
||||||
{
|
{
|
||||||
// FIXME
|
// FIXME
|
||||||
return [self setFrameUsingName: name];
|
return [self setFrameUsingName: name];
|
||||||
|
@ -3980,10 +3981,10 @@ resetCursorRectsForView(NSView *theView)
|
||||||
maxRect = [self constrainFrameRect: maxRect toScreen: [self screen]];
|
maxRect = [self constrainFrameRect: maxRect toScreen: [self screen]];
|
||||||
|
|
||||||
// Compare the new frame with the current one
|
// Compare the new frame with the current one
|
||||||
if ((abs(NSMaxX(maxRect) - NSMaxX(_frame)) < DIST) &&
|
if ((abs(NSMaxX(maxRect) - NSMaxX(_frame)) < DIST)
|
||||||
(abs(NSMaxY(maxRect) - NSMaxY(_frame)) < DIST) &&
|
&& (abs(NSMaxY(maxRect) - NSMaxY(_frame)) < DIST)
|
||||||
(abs(NSMinX(maxRect) - NSMinX(_frame)) < DIST) &&
|
&& (abs(NSMinX(maxRect) - NSMinX(_frame)) < DIST)
|
||||||
(abs(NSMinY(maxRect) - NSMinY(_frame)) < DIST))
|
&& (abs(NSMinY(maxRect) - NSMinY(_frame)) < DIST))
|
||||||
{
|
{
|
||||||
// Already in zoomed mode, reset user frame, if stored
|
// Already in zoomed mode, reset user frame, if stored
|
||||||
if (_autosaveName != nil)
|
if (_autosaveName != nil)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue