Recognize class that responds to menuRepresetation as NSMenu derived class. Fix for Gorm.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@18383 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
stoyan 2004-01-12 06:59:32 +00:00
parent 4d2177ce6d
commit 77d082747a

View file

@ -25,6 +25,7 @@
#include <AppKit/NSView.h> #include <AppKit/NSView.h>
#include <AppKit/NSWindow.h> #include <AppKit/NSWindow.h>
#include <AppKit/NSPanel.h>
#include <AppKit/NSButton.h> #include <AppKit/NSButton.h>
#include <AppKit/NSImage.h> #include <AppKit/NSImage.h>
#include <AppKit/NSMenu.h> #include <AppKit/NSMenu.h>
@ -363,18 +364,10 @@
{ {
NSNotificationCenter *theCenter = [NSNotificationCenter defaultCenter]; NSNotificationCenter *theCenter = [NSNotificationCenter defaultCenter];
if ([owner class] == [NSMenu class]) if ([owner class] == [NSWindow class]
{ || [owner class] == [NSPanel class])
_owner = owner;
_ownedByMenu = YES;
RELEASE (titleColor);
titleColor = RETAIN ([NSColor blackColor]);
[textAttributes setObject: [NSColor whiteColor]
forKey: NSForegroundColorAttributeName];
}
else if ([owner class] == [NSWindow class])
{ {
NSDebugLLog(@"GSTitleView: owner is NSWindow or NSPanel");
_owner = owner; _owner = owner;
_ownedByMenu = NO; _ownedByMenu = NO;
@ -396,8 +389,21 @@
name: NSWindowDidResignKeyNotification name: NSWindowDidResignKeyNotification
object: _owner]; object: _owner];
} }
else if ([owner respondsToSelector:@selector(menuRepresentation)])
{
NSDebugLLog(@"GSTitleView: owner is NSMenu");
_owner = owner;
_ownedByMenu = YES;
RELEASE (titleColor);
titleColor = RETAIN ([NSColor blackColor]);
[textAttributes setObject: [NSColor whiteColor]
forKey: NSForegroundColorAttributeName];
}
else else
{ {
NSDebugLLog(@"GSTitleView: %@ owner is not NSMenu or NSWindow or NSPanel",
[owner className]);
return; return;
} }
} }