mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-06-02 22:10:58 +00:00
First attempt at in window menus.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@27649 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
66a99f1cf7
commit
511b5be242
5 changed files with 165 additions and 90 deletions
|
@ -1,3 +1,12 @@
|
||||||
|
2009-01-22 Fred Kiefer <FredKiefer@gmx.de>
|
||||||
|
|
||||||
|
* Source/GSWindowDecorationView.m: Add handling of in-window
|
||||||
|
menu. Simplify code for toolbar handling.
|
||||||
|
* Source/NSToolbarFrameworkPrivate.h: Publish ne methods.
|
||||||
|
* Source/NSWindow.m (-setMenu:): Set the menu as in-window menu.
|
||||||
|
* Source/NSMenuView.m: Set the frame width to the screen width in
|
||||||
|
setHorizontal: and not in sizeToFit.
|
||||||
|
|
||||||
2009-01-21 Richard Frith-Macdonald <rfm@gnu.org>
|
2009-01-21 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSOutlineView.m: Don't ask if the topmost item is expandable.
|
* Source/NSOutlineView.m: Don't ask if the topmost item is expandable.
|
||||||
|
|
|
@ -29,6 +29,7 @@
|
||||||
#include <Foundation/NSException.h>
|
#include <Foundation/NSException.h>
|
||||||
|
|
||||||
#include "AppKit/NSColor.h"
|
#include "AppKit/NSColor.h"
|
||||||
|
#include "AppKit/NSMenuView.h"
|
||||||
#include "AppKit/NSWindow.h"
|
#include "AppKit/NSWindow.h"
|
||||||
#include "GNUstepGUI/GSDisplayServer.h"
|
#include "GNUstepGUI/GSDisplayServer.h"
|
||||||
#include "GNUstepGUI/GSTheme.h"
|
#include "GNUstepGUI/GSTheme.h"
|
||||||
|
@ -122,7 +123,11 @@
|
||||||
styleMask: aStyle];
|
styleMask: aStyle];
|
||||||
NSToolbar *tb = [_window toolbar];
|
NSToolbar *tb = [_window toolbar];
|
||||||
|
|
||||||
// TODO: Handle toolbar and others
|
if ([_window menu] != nil)
|
||||||
|
{
|
||||||
|
content.size.height -= [NSMenuView menuBarHeight];
|
||||||
|
}
|
||||||
|
|
||||||
if ([tb isVisible])
|
if ([tb isVisible])
|
||||||
{
|
{
|
||||||
GSToolbarView *tv = [tb _toolbarView];
|
GSToolbarView *tv = [tb _toolbarView];
|
||||||
|
@ -138,7 +143,11 @@
|
||||||
{
|
{
|
||||||
NSToolbar *tb = [_window toolbar];
|
NSToolbar *tb = [_window toolbar];
|
||||||
|
|
||||||
// TODO: Handle toolbar and others
|
if ([_window menu] != nil)
|
||||||
|
{
|
||||||
|
aRect.size.height += [NSMenuView menuBarHeight];
|
||||||
|
}
|
||||||
|
|
||||||
if ([tb isVisible])
|
if ([tb isVisible])
|
||||||
{
|
{
|
||||||
GSToolbarView *tv = [tb _toolbarView];
|
GSToolbarView *tv = [tb _toolbarView];
|
||||||
|
@ -193,31 +202,34 @@
|
||||||
[GSServerForWindow(window) docedited: documentEdited : windowNumber];
|
[GSServerForWindow(window) docedited: documentEdited : windowNumber];
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
- (void) layout
|
||||||
* Special setFrame: implementation - a minimal autoresize mechanism
|
|
||||||
*/
|
|
||||||
- (void) setFrame: (NSRect)frameRect
|
|
||||||
{
|
{
|
||||||
NSSize oldSize = _frame.size;
|
// Should resize all subviews
|
||||||
NSView *cv = [_window contentView];
|
NSRect contentViewFrame;
|
||||||
NSToolbar *tb = [_window toolbar];
|
NSToolbar *tb = [_window toolbar];
|
||||||
|
NSRect frame = [window frame];
|
||||||
|
|
||||||
// Wouldn't it be better to rely on the autoresize mechanism?
|
frame.origin = NSZeroPoint;
|
||||||
_autoresizes_subviews = NO;
|
contentViewFrame = [isa contentRectForFrameRect: frame
|
||||||
[super setFrame: frameRect];
|
|
||||||
|
|
||||||
contentRect = [isa contentRectForFrameRect: frameRect
|
|
||||||
styleMask: [window styleMask]];
|
styleMask: [window styleMask]];
|
||||||
|
|
||||||
// Safety Check.
|
if ([_window menu] != nil)
|
||||||
[cv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
{
|
||||||
[cv resizeWithOldSuperviewSize: oldSize];
|
NSMenuView *menuView;
|
||||||
|
float menuBarHeight = [NSMenuView menuBarHeight];
|
||||||
|
|
||||||
|
menuView = [[_window menu] menuRepresentation];
|
||||||
|
[menuView setFrame: NSMakeRect(
|
||||||
|
contentViewFrame.origin.x,
|
||||||
|
NSMaxY(contentViewFrame) - menuBarHeight,
|
||||||
|
contentViewFrame.size.width,
|
||||||
|
menuBarHeight)];
|
||||||
|
contentViewFrame.size.height -= menuBarHeight;
|
||||||
|
}
|
||||||
|
|
||||||
// FIXME: Should resize all subviews
|
|
||||||
if ([tb isVisible])
|
if ([tb isVisible])
|
||||||
{
|
{
|
||||||
GSToolbarView *tv = [tb _toolbarView];
|
GSToolbarView *tv = [tb _toolbarView];
|
||||||
NSRect contentViewFrame = [cv frame];
|
|
||||||
float newToolbarViewHeight;
|
float newToolbarViewHeight;
|
||||||
|
|
||||||
// If the width changed we may need to recalculate the height
|
// If the width changed we may need to recalculate the height
|
||||||
|
@ -230,12 +242,60 @@
|
||||||
newToolbarViewHeight = [tv _heightFromLayout];
|
newToolbarViewHeight = [tv _heightFromLayout];
|
||||||
[tv setFrame: NSMakeRect(
|
[tv setFrame: NSMakeRect(
|
||||||
contentViewFrame.origin.x,
|
contentViewFrame.origin.x,
|
||||||
NSMaxY(contentViewFrame),
|
NSMaxY(contentViewFrame) - newToolbarViewHeight,
|
||||||
contentViewFrame.size.width,
|
contentViewFrame.size.width,
|
||||||
newToolbarViewHeight)];
|
newToolbarViewHeight)];
|
||||||
|
contentViewFrame.size.height -= newToolbarViewHeight;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (void) changeWindowHeight: (float)difference
|
||||||
|
{
|
||||||
|
NSRect orgWindowFrame;
|
||||||
|
NSRect windowFrame;
|
||||||
|
NSRect windowContentFrame;
|
||||||
|
|
||||||
|
contentRect.size.height += difference;
|
||||||
|
windowFrame = [isa frameRectForContentRect: contentRect
|
||||||
|
styleMask: [window styleMask]];
|
||||||
|
|
||||||
|
// Set the local frame without changing the contents view
|
||||||
|
windowContentFrame = windowFrame;
|
||||||
|
windowContentFrame.origin = NSZeroPoint;
|
||||||
|
_autoresizes_subviews = NO;
|
||||||
|
[super setFrame: windowContentFrame];
|
||||||
|
|
||||||
|
// Keep the top of the window at the same place
|
||||||
|
orgWindowFrame = [window frame];
|
||||||
|
windowFrame.origin.y = orgWindowFrame.origin.y + orgWindowFrame.size.height - windowFrame.size.height;
|
||||||
|
windowFrame.origin.x = orgWindowFrame.origin.x;
|
||||||
|
|
||||||
|
// then resize the window
|
||||||
|
[window setFrame: windowFrame display: YES];
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Special setFrame: implementation - a minimal autoresize mechanism
|
||||||
|
*/
|
||||||
|
- (void) setFrame: (NSRect)frameRect
|
||||||
|
{
|
||||||
|
NSSize oldSize = _frame.size;
|
||||||
|
NSView *cv = [_window contentView];
|
||||||
|
|
||||||
|
// Wouldn't it be better to rely on the autoresize mechanism?
|
||||||
|
_autoresizes_subviews = NO;
|
||||||
|
[super setFrame: frameRect];
|
||||||
|
|
||||||
|
contentRect = [isa contentRectForFrameRect: frameRect
|
||||||
|
styleMask: [window styleMask]];
|
||||||
|
|
||||||
|
// Safety Check.
|
||||||
|
[cv setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
|
||||||
|
[cv resizeWithOldSuperviewSize: oldSize];
|
||||||
|
|
||||||
|
[self layout];
|
||||||
|
}
|
||||||
|
|
||||||
- (void) setInputState: (int)state
|
- (void) setInputState: (int)state
|
||||||
{
|
{
|
||||||
inputState = state;
|
inputState = state;
|
||||||
|
@ -291,74 +351,32 @@
|
||||||
|
|
||||||
- (void) addToolbarView: (GSToolbarView*)toolbarView
|
- (void) addToolbarView: (GSToolbarView*)toolbarView
|
||||||
{
|
{
|
||||||
NSView *contentView = [window contentView];
|
|
||||||
NSRect contentViewFrame = [contentView frame];
|
|
||||||
float newToolbarViewHeight;
|
float newToolbarViewHeight;
|
||||||
NSRect orgWindowFrame;
|
|
||||||
NSRect windowFrame;
|
|
||||||
NSRect windowContentFrame;
|
|
||||||
|
|
||||||
[toolbarView setFrameSize: NSMakeSize(contentViewFrame.size.width, 100)];
|
[toolbarView setFrameSize: NSMakeSize(contentRect.size.width, 100)];
|
||||||
// Will recalculate the layout
|
// Will recalculate the layout
|
||||||
[toolbarView _reload];
|
[toolbarView _reload];
|
||||||
newToolbarViewHeight = [toolbarView _heightFromLayout];
|
newToolbarViewHeight = [toolbarView _heightFromLayout];
|
||||||
|
|
||||||
// Plug the toolbar view
|
// Plug the toolbar view
|
||||||
[toolbarView setFrame: NSMakeRect(
|
[toolbarView setFrame: NSMakeRect(
|
||||||
contentViewFrame.origin.x,
|
contentRect.origin.x,
|
||||||
NSMaxY(contentViewFrame),
|
NSMaxY(contentRect),
|
||||||
contentViewFrame.size.width,
|
contentRect.size.width,
|
||||||
newToolbarViewHeight)];
|
newToolbarViewHeight)];
|
||||||
[self addSubview: toolbarView];
|
[self addSubview: toolbarView];
|
||||||
|
|
||||||
orgWindowFrame = [window frame];
|
[self changeWindowHeight: newToolbarViewHeight];
|
||||||
windowContentFrame = [isa contentRectForFrameRect: orgWindowFrame
|
|
||||||
styleMask: [window styleMask]];
|
|
||||||
windowContentFrame.size.height += newToolbarViewHeight;
|
|
||||||
windowFrame = [isa frameRectForContentRect: windowContentFrame
|
|
||||||
styleMask: [window styleMask]];
|
|
||||||
// Keep the top of the window at the same place
|
|
||||||
windowFrame.origin.y += orgWindowFrame.size.height - windowFrame.size.height;
|
|
||||||
|
|
||||||
// Set the local frames
|
|
||||||
contentRect = windowContentFrame;
|
|
||||||
windowContentFrame = windowFrame;
|
|
||||||
windowContentFrame.origin = NSZeroPoint;
|
|
||||||
_autoresizes_subviews = NO;
|
|
||||||
[super setFrame: windowContentFrame];
|
|
||||||
|
|
||||||
// then resize the window
|
|
||||||
[window setFrame: windowFrame display: YES];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) removeToolbarView: (GSToolbarView *)toolbarView
|
- (void) removeToolbarView: (GSToolbarView *)toolbarView
|
||||||
{
|
{
|
||||||
float toolbarViewHeight = [toolbarView frame].size.height;
|
float toolbarViewHeight = [toolbarView frame].size.height;
|
||||||
NSRect orgWindowFrame;
|
|
||||||
NSRect windowFrame;
|
|
||||||
NSRect windowContentFrame;
|
|
||||||
|
|
||||||
// Unplug the toolbar view
|
// Unplug the toolbar view
|
||||||
[toolbarView removeFromSuperviewWithoutNeedingDisplay];
|
[toolbarView removeFromSuperviewWithoutNeedingDisplay];
|
||||||
|
|
||||||
orgWindowFrame = [window frame];
|
[self changeWindowHeight: -toolbarViewHeight];
|
||||||
windowContentFrame = [isa contentRectForFrameRect: orgWindowFrame
|
|
||||||
styleMask: [window styleMask]];
|
|
||||||
windowContentFrame.size.height -= toolbarViewHeight;
|
|
||||||
windowFrame = [isa frameRectForContentRect: windowContentFrame
|
|
||||||
styleMask: [window styleMask]];
|
|
||||||
// Keep the top of the window at the same place
|
|
||||||
windowFrame.origin.y += orgWindowFrame.size.height - windowFrame.size.height;
|
|
||||||
|
|
||||||
// Set the local frames
|
|
||||||
contentRect = windowContentFrame;
|
|
||||||
windowContentFrame = windowFrame;
|
|
||||||
windowContentFrame.origin = NSZeroPoint;
|
|
||||||
_autoresizes_subviews = NO;
|
|
||||||
[super setFrame: windowContentFrame];
|
|
||||||
|
|
||||||
// then resize the window and display
|
|
||||||
[window setFrame: windowFrame display: YES];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) adjustToolbarView: (GSToolbarView *)toolbarView
|
- (void) adjustToolbarView: (GSToolbarView *)toolbarView
|
||||||
|
@ -370,36 +388,48 @@
|
||||||
|
|
||||||
if (toolbarViewHeight != newToolbarViewHeight)
|
if (toolbarViewHeight != newToolbarViewHeight)
|
||||||
{
|
{
|
||||||
NSRect orgWindowFrame;
|
|
||||||
NSRect windowFrame;
|
|
||||||
NSRect windowContentFrame;
|
|
||||||
|
|
||||||
[toolbarView setFrame: NSMakeRect(
|
[toolbarView setFrame: NSMakeRect(
|
||||||
toolbarViewFrame.origin.x,
|
toolbarViewFrame.origin.x,
|
||||||
toolbarViewFrame.origin.y + (toolbarViewHeight - newToolbarViewHeight),
|
toolbarViewFrame.origin.y + (toolbarViewHeight - newToolbarViewHeight),
|
||||||
toolbarViewFrame.size.width,
|
toolbarViewFrame.size.width,
|
||||||
newToolbarViewHeight)];
|
newToolbarViewHeight)];
|
||||||
|
|
||||||
orgWindowFrame = [window frame];
|
[self changeWindowHeight: newToolbarViewHeight - toolbarViewHeight];
|
||||||
windowContentFrame = [isa contentRectForFrameRect: orgWindowFrame
|
|
||||||
styleMask: [window styleMask]];
|
|
||||||
windowContentFrame.size.height -= toolbarViewHeight - newToolbarViewHeight;
|
|
||||||
windowFrame = [isa frameRectForContentRect: windowContentFrame
|
|
||||||
styleMask: [window styleMask]];
|
|
||||||
windowFrame.origin.y += orgWindowFrame.size.height - windowFrame.size.height;
|
|
||||||
// Set the local frames
|
|
||||||
contentRect = windowContentFrame;
|
|
||||||
windowContentFrame = windowFrame;
|
|
||||||
windowContentFrame.origin = NSZeroPoint;
|
|
||||||
_frame = windowContentFrame;
|
|
||||||
|
|
||||||
// then resize the window and display
|
|
||||||
[window setFrame: windowFrame display: YES];
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@implementation GSWindowDecorationView (Menu)
|
||||||
|
|
||||||
|
- (void) addMenuView: (NSMenuView*)menuView
|
||||||
|
{
|
||||||
|
float menubarHeight = [NSMenuView menuBarHeight];
|
||||||
|
|
||||||
|
// Plug the menu view
|
||||||
|
[menuView setFrame: NSMakeRect(
|
||||||
|
contentRect.origin.x,
|
||||||
|
NSMaxY(contentRect),
|
||||||
|
contentRect.size.width,
|
||||||
|
menubarHeight)];
|
||||||
|
[self addSubview: menuView];
|
||||||
|
|
||||||
|
[self changeWindowHeight: menubarHeight];
|
||||||
|
}
|
||||||
|
|
||||||
|
- (void) removeMenuView: (NSMenuView*)menuView
|
||||||
|
{
|
||||||
|
float menubarHeight = [NSMenuView menuBarHeight];
|
||||||
|
|
||||||
|
// Unplug the menu view
|
||||||
|
[menuView removeFromSuperviewWithoutNeedingDisplay];
|
||||||
|
|
||||||
|
[self changeWindowHeight: -menubarHeight];
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
|
|
||||||
@implementation GSBackendWindowDecorationView
|
@implementation GSBackendWindowDecorationView
|
||||||
|
|
||||||
+ (void) offsets: (float *)l : (float *)r : (float *)t : (float *)b
|
+ (void) offsets: (float *)l : (float *)r : (float *)t : (float *)b
|
||||||
|
|
|
@ -296,10 +296,14 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
{
|
{
|
||||||
if (flag == YES && _horizontal == NO)
|
if (flag == YES && _horizontal == NO)
|
||||||
{
|
{
|
||||||
|
NSRect scRect = [[NSScreen mainScreen] frame];
|
||||||
GSIArray a = NSZoneMalloc(NSDefaultMallocZone(), sizeof(GSIArray_t));
|
GSIArray a = NSZoneMalloc(NSDefaultMallocZone(), sizeof(GSIArray_t));
|
||||||
|
|
||||||
GSIArrayInitWithZoneAndCapacity(a, NSDefaultMallocZone(), 8);
|
GSIArrayInitWithZoneAndCapacity(a, NSDefaultMallocZone(), 8);
|
||||||
NSMapInsert(viewInfo, self, a);
|
NSMapInsert(viewInfo, self, a);
|
||||||
|
|
||||||
|
scRect.size.height = [NSMenuView menuBarHeight];
|
||||||
|
[self setFrameSize: scRect.size];
|
||||||
}
|
}
|
||||||
else if (flag == NO && _horizontal == YES)
|
else if (flag == NO && _horizontal == YES)
|
||||||
{
|
{
|
||||||
|
@ -644,13 +648,16 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
unsigned i;
|
unsigned i;
|
||||||
unsigned howMany = [_itemCells count];
|
unsigned howMany = [_itemCells count];
|
||||||
float currentX = 8;
|
float currentX = 8;
|
||||||
NSRect scRect = [[NSScreen mainScreen] frame];
|
// NSRect scRect = [[NSScreen mainScreen] frame];
|
||||||
|
|
||||||
GSIArrayRemoveAllItems(cellRects);
|
GSIArrayRemoveAllItems(cellRects);
|
||||||
|
|
||||||
|
/*
|
||||||
scRect.size.height = [NSMenuView menuBarHeight];
|
scRect.size.height = [NSMenuView menuBarHeight];
|
||||||
[self setFrameSize: scRect.size];
|
[self setFrameSize: scRect.size];
|
||||||
_cellSize.height = scRect.size.height;
|
_cellSize.height = scRect.size.height;
|
||||||
|
*/
|
||||||
|
_cellSize.height = [NSMenuView menuBarHeight];
|
||||||
|
|
||||||
for (i = 0; i < howMany; i++)
|
for (i = 0; i < howMany; i++)
|
||||||
{
|
{
|
||||||
|
@ -947,6 +954,7 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
{
|
{
|
||||||
NSRect aRect = [self rectOfItemAtIndex: i];
|
NSRect aRect = [self rectOfItemAtIndex: i];
|
||||||
|
|
||||||
|
//NSLog(@"indexOfItemAtPoint called for %@ %@ %d %@", self, NSStringFromPoint(point), i, NSStringFromRect(aRect));
|
||||||
aRect = _addLeftBorderOffsetToRect(aRect);
|
aRect = _addLeftBorderOffsetToRect(aRect);
|
||||||
|
|
||||||
if (NSMouseInRect(point, aRect, NO))
|
if (NSMouseInRect(point, aRect, NO))
|
||||||
|
@ -1347,6 +1355,7 @@ _addLeftBorderOffsetToRect(NSRect aRect)
|
||||||
int index;
|
int index;
|
||||||
|
|
||||||
location = [_window mouseLocationOutsideOfEventStream];
|
location = [_window mouseLocationOutsideOfEventStream];
|
||||||
|
|
||||||
index = [self indexOfItemAtPoint: location];
|
index = [self indexOfItemAtPoint: location];
|
||||||
|
|
||||||
if (event == original)
|
if (event == original)
|
||||||
|
|
|
@ -30,6 +30,7 @@
|
||||||
#ifndef _NSToolbarFrameworkPrivate_h_INCLUDE
|
#ifndef _NSToolbarFrameworkPrivate_h_INCLUDE
|
||||||
#define _NSToolbarFrameworkPrivate_h_INCLUDE
|
#define _NSToolbarFrameworkPrivate_h_INCLUDE
|
||||||
|
|
||||||
|
#include "AppKit/NSMenuView.h"
|
||||||
#include "AppKit/NSToolbar.h"
|
#include "AppKit/NSToolbar.h"
|
||||||
#include "AppKit/NSToolbarItem.h"
|
#include "AppKit/NSToolbarItem.h"
|
||||||
#include "GNUstepGUI/GSToolbarView.h"
|
#include "GNUstepGUI/GSToolbarView.h"
|
||||||
|
@ -113,5 +114,9 @@
|
||||||
- (void) removeToolbarView: (GSToolbarView *)toolbarView;
|
- (void) removeToolbarView: (GSToolbarView *)toolbarView;
|
||||||
- (void) adjustToolbarView: (GSToolbarView *)toolbarView;
|
- (void) adjustToolbarView: (GSToolbarView *)toolbarView;
|
||||||
@end
|
@end
|
||||||
|
@interface GSWindowDecorationView (Menu)
|
||||||
|
- (void) addMenuView: (NSMenuView*)menuView;
|
||||||
|
- (void) removeMenuView: (NSMenuView*)menuView;
|
||||||
|
@end
|
||||||
|
|
||||||
#endif // _NSToolbarFrameworkPrivate_h_INCLUDE
|
#endif // _NSToolbarFrameworkPrivate_h_INCLUDE
|
||||||
|
|
|
@ -5106,6 +5106,8 @@ current key view.<br />
|
||||||
if (!toolbar)
|
if (!toolbar)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
[toolbar setVisible: !isVisible];
|
||||||
|
|
||||||
if (isVisible)
|
if (isVisible)
|
||||||
{
|
{
|
||||||
[_wv removeToolbarView: [toolbar _toolbarView]];
|
[_wv removeToolbarView: [toolbar _toolbarView]];
|
||||||
|
@ -5115,8 +5117,6 @@ current key view.<br />
|
||||||
[_wv addToolbarView: [toolbar _toolbarView]];
|
[_wv addToolbarView: [toolbar _toolbarView]];
|
||||||
}
|
}
|
||||||
|
|
||||||
[toolbar setVisible: !isVisible];
|
|
||||||
|
|
||||||
[self display];
|
[self display];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5158,6 +5158,28 @@ current key view.<br />
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
|
@implementation NSWindow (Menu)
|
||||||
|
|
||||||
|
- (void) setMenu: (NSMenu *)menu
|
||||||
|
{
|
||||||
|
NSMenuView *menuView;
|
||||||
|
|
||||||
|
menuView = [[self menu] menuRepresentation];
|
||||||
|
if (menuView != nil)
|
||||||
|
[_wv removeMenuView: menuView];
|
||||||
|
[super setMenu: menu];
|
||||||
|
menuView = [menu menuRepresentation];
|
||||||
|
if (menuView != nil)
|
||||||
|
{
|
||||||
|
[menu close];
|
||||||
|
[menuView setHorizontal: YES];
|
||||||
|
[menuView sizeToFit];
|
||||||
|
[_wv addMenuView: menuView];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@end
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* GNUstep backend methods
|
* GNUstep backend methods
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue