Changes to fix Report#9771.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/apps/gorm/trunk@19827 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Gregory John Casamento 2004-08-05 05:34:41 +00:00
parent 155b8df49a
commit eb74dd22f3
2 changed files with 42 additions and 37 deletions

View file

@ -1,3 +1,11 @@
2004-08-05 01:36 Gregory John Casamento <greg_casamento@yahoo.com>
* Palettes/GormNSMenu.m: Added code in the initWithCoder:
method to subscribe to the notification which indicates
a selection change. When the notification is recieved,
if the menu is owned by a popup the menu is closed. This
corrects Bug#9771.
2004-08-04 01:08 Gregory John Casamento <greg_casamento@yahoo.com>
* GormPalettesManager.m: -[GormPalettesManager loadPalette:]

View file

@ -25,22 +25,9 @@
#include "GormNSMenu.h"
#include <AppKit/NSPopUpButton.h>
#include <AppKit/NSPopUpButtonCell.h>
@interface NSMenu (GormNSMenuPrivate)
- (NSPopUpButtonCell *)popUpButtonCell;
@end
@implementation NSMenu (GormNSMenuPrivate)
- (NSPopUpButtonCell *)popUpButtonCell
{
return _popUpButtonCell;
}
@end
#include <InterfaceBuilder/InterfaceBuilder.h>
@interface GormNSMenuWindow : NSPanel
{
BOOL opened;
}
@end
@implementation GormNSMenuWindow
@ -67,26 +54,6 @@
NSModalPanelRunLoopMode,
NSEventTrackingRunLoopMode,
nil]];
opened = NO;
}
}
- (void)becomeMainWindow
{
[super becomeMainWindow];
if ( [[self menu] _ownedByPopUp] )
{
/*
if(opened == YES)
{
[[self menu] close];
opened = NO;
}
else
{
opened = YES;
}
*/
}
}
@ -113,6 +80,33 @@
@end
@implementation GormNSMenu
- (id) initWithCoder: (NSCoder *)coder
{
if((self = [super initWithCoder: coder]) != nil)
{
NSNotificationCenter *nc = [NSNotificationCenter defaultCenter];
[nc addObserver: self
selector: @selector(handleNotification:)
name: IBSelectionChangedNotification
object: nil];
}
return self;
}
- (void) handleNotification: (NSNotification *)notification
{
id<IBEditors> object = [notification object];
if(object != nil)
{
id edited = [object editedObject];
if(self != edited && [self _ownedByPopUp])
{
[self close];
}
}
}
- (BOOL) performKeyEquivalent: (NSEvent*)theEvent
{
return NO;
@ -159,14 +153,17 @@
NSLog(@"Being released... %d: %@", [self retainCount], self);
[super release];
}
*/
#endif
- (void) dealloc
{
NSLog(@"Deallocing %@",self);
[[NSNotificationCenter defaultCenter] removeObserver: self
name: IBSelectionChangedNotification
object: nil];
[super dealloc];
}
*/
#endif
@end
@implementation NSMenu (GormNSMenu)