mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
Minor tidyups of horizontal menu integration.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@22429 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
02e87be139
commit
0b25a4ce8a
5 changed files with 29 additions and 31 deletions
|
@ -1,3 +1,11 @@
|
|||
2006-02-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSMenu.m:
|
||||
* Source/NSApplication.m:
|
||||
* Source/NSMenuItemCell.m:
|
||||
* Headers/AppKit/NSMenuItemCell.h:
|
||||
Tidyups suggested by Fred. More ideas welcome.
|
||||
|
||||
2006-02-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSMenu.m:
|
||||
|
|
|
@ -42,8 +42,7 @@ typedef void (*DrawingIMP)(id, SEL, NSRect, NSView*);
|
|||
|
||||
// Cache
|
||||
BOOL _needs_sizing;
|
||||
BOOL _horizontalMenu;
|
||||
char _pad1[2];
|
||||
char _pad1[3];
|
||||
|
||||
float _imageWidth;
|
||||
float _titleWidth;
|
||||
|
|
|
@ -2163,7 +2163,7 @@ image.</p><p>See Also: -applicationIconImage</p>
|
|||
[anImage setName: @"NSApplicationIcon"];
|
||||
ASSIGN(_app_icon, anImage);
|
||||
|
||||
[_main_menu _organizeMenu];
|
||||
[_main_menu _organizeMenu]; // Let horizontal menu change icon
|
||||
|
||||
if (_app_icon_window != nil)
|
||||
{
|
||||
|
@ -2644,23 +2644,6 @@ image.</p><p>See Also: -applicationIconImage</p>
|
|||
{
|
||||
[_main_menu setMain: YES];
|
||||
}
|
||||
|
||||
/*
|
||||
* If necessary,. rebuild menu for macintosh (horizontal) style
|
||||
*/
|
||||
if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil)
|
||||
== NSMacintoshInterfaceStyle)
|
||||
{
|
||||
NSMenuView *rep = [[NSMenuView alloc] initWithFrame: NSZeroRect];
|
||||
|
||||
[rep setHorizontal: YES];
|
||||
[_main_menu setMenuRepresentation: rep];
|
||||
RELEASE(rep);
|
||||
[_main_menu _organizeMenu];
|
||||
[[_main_menu window] setTitle: [[NSProcessInfo processInfo] processName]];
|
||||
[[_main_menu window] setLevel: NSMainMenuWindowLevel];
|
||||
[_main_menu setGeometry];
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -1575,8 +1575,18 @@ static NSNotificationCenter *nc;
|
|||
{
|
||||
if (isMain)
|
||||
{
|
||||
// Set the title of the window.
|
||||
// This wont be displayed, but the window manager may need it.
|
||||
/*
|
||||
* If necessary,. rebuild menu for macintosh (horizontal) style
|
||||
*/
|
||||
if (NSInterfaceStyleForKey(@"NSMenuInterfaceStyle", nil)
|
||||
== NSMacintoshInterfaceStyle)
|
||||
{
|
||||
NSMenuView *rep = [[NSMenuView alloc] initWithFrame: NSZeroRect];
|
||||
|
||||
[rep setHorizontal: YES];
|
||||
[self setMenuRepresentation: rep];
|
||||
RELEASE(rep);
|
||||
}
|
||||
[[self window] setTitle: [[NSProcessInfo processInfo] processName]];
|
||||
[[self window] setLevel: NSMainMenuWindowLevel];
|
||||
[self setGeometry];
|
||||
|
|
|
@ -107,14 +107,12 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
|||
/*
|
||||
* Determine whether we have horizontal or vertical layout and adjust.
|
||||
*/
|
||||
if ([_menuView isHorizontal])
|
||||
if ([_menuView isHorizontal] == YES)
|
||||
{
|
||||
_horizontalMenu = YES;
|
||||
[self setAlignment: NSCenterTextAlignment];
|
||||
}
|
||||
else
|
||||
{
|
||||
_horizontalMenu = NO;
|
||||
[self setAlignment: NSLeftTextAlignment];
|
||||
}
|
||||
}
|
||||
|
@ -263,7 +261,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
|||
//
|
||||
- (NSRect) imageRectForBounds:(NSRect)cellFrame
|
||||
{
|
||||
if (_horizontalMenu == YES)
|
||||
if ([_menuView isHorizontal] == YES)
|
||||
{
|
||||
switch (_cell.image_position)
|
||||
{
|
||||
|
@ -361,7 +359,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
|||
|
||||
- (NSRect) titleRectForBounds:(NSRect)cellFrame
|
||||
{
|
||||
if (_horizontalMenu == YES)
|
||||
if ([_menuView isHorizontal] == YES)
|
||||
{
|
||||
/* This adjust will center us within the menubar. */
|
||||
|
||||
|
@ -440,7 +438,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
|||
- (void) drawBorderAndBackgroundWithFrame: (NSRect)cellFrame
|
||||
inView: (NSView *)controlView
|
||||
{
|
||||
if (_horizontalMenu == YES)
|
||||
if ([_menuView isHorizontal] == YES)
|
||||
return;
|
||||
|
||||
if (!_cell.is_bordered)
|
||||
|
@ -573,7 +571,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
|||
- (void) drawTitleWithFrame:(NSRect)cellFrame
|
||||
inView:(NSView *)controlView
|
||||
{
|
||||
if (_horizontalMenu == YES)
|
||||
if ([_menuView isHorizontal] == YES)
|
||||
{
|
||||
id value = [NSMutableParagraphStyle defaultParagraphStyle];
|
||||
NSDictionary *attr;
|
||||
|
@ -632,7 +630,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
|||
if (_buttoncell_is_transparent)
|
||||
return;
|
||||
|
||||
if (_horizontalMenu == YES)
|
||||
if ([_menuView isHorizontal] == YES)
|
||||
{
|
||||
NSColor *backgroundColor = nil;
|
||||
|
||||
|
@ -781,7 +779,7 @@ static NSImage *arrowImage = nil; /* Cache arrow image. */
|
|||
|
||||
- (NSRect) drawingRectForBounds: (NSRect)theRect
|
||||
{
|
||||
if (_horizontalMenu == YES)
|
||||
if ([_menuView isHorizontal] == YES)
|
||||
{
|
||||
return NSMakeRect (theRect.origin.x, theRect.origin.y + 2,
|
||||
theRect.size.width, theRect.size.height - 2);
|
||||
|
|
Loading…
Reference in a new issue