Added NSWindow 'title' binding

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29113 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
qmathe 2009-12-10 12:43:35 +00:00
parent 30108b6069
commit 3e5a1cefaa
4 changed files with 35 additions and 0 deletions

View file

@ -1,3 +1,10 @@
2009-12-10 Quentin Mathe <quentin.mathe@gmail.com>
* Headers/AppKit/NSKKeyValueBinding.h:
* Source/externs.m:
* Source/NSWindow.m (+initialize, -bind:toObject:withKeyPath:options:):
Added NSWindow 'title' binding.
2009-12-08 Quentin Mathe <quentin.mathe@gmail.com> 2009-12-08 Quentin Mathe <quentin.mathe@gmail.com>
* Source/NSTableColumn.m (-dealloc): Fixed missing release for * Source/NSTableColumn.m (-dealloc): Fixed missing release for

View file

@ -110,6 +110,7 @@ APPKIT_EXPORT NSString *NSFontBinding;
APPKIT_EXPORT NSString *NSHiddenBinding; APPKIT_EXPORT NSString *NSHiddenBinding;
APPKIT_EXPORT NSString *NSSelectedIndexBinding; APPKIT_EXPORT NSString *NSSelectedIndexBinding;
APPKIT_EXPORT NSString *NSTextColorBinding; APPKIT_EXPORT NSString *NSTextColorBinding;
APPKIT_EXPORT NSString *NSTitleBinding;
APPKIT_EXPORT NSString *NSToolTipBinding; APPKIT_EXPORT NSString *NSToolTipBinding;
APPKIT_EXPORT NSString *NSValueBinding; APPKIT_EXPORT NSString *NSValueBinding;

View file

@ -66,6 +66,7 @@
#include "AppKit/NSFont.h" #include "AppKit/NSFont.h"
#include "AppKit/NSGraphics.h" #include "AppKit/NSGraphics.h"
#include "AppKit/NSHelpManager.h" #include "AppKit/NSHelpManager.h"
#include "AppKit/NSKeyValueBinding.h"
#include "AppKit/NSImage.h" #include "AppKit/NSImage.h"
#include "AppKit/NSMenu.h" #include "AppKit/NSMenu.h"
#include "AppKit/NSPasteboard.h" #include "AppKit/NSPasteboard.h"
@ -75,6 +76,7 @@
#include "AppKit/NSView.h" #include "AppKit/NSView.h"
#include "AppKit/NSWindow.h" #include "AppKit/NSWindow.h"
#include "AppKit/NSWindowController.h" #include "AppKit/NSWindowController.h"
#include "GSBindingHelpers.h"
#include "AppKit/PSOperators.h" #include "AppKit/PSOperators.h"
#include "GNUstepGUI/GSTrackingRect.h" #include "GNUstepGUI/GSTrackingRect.h"
#include "GNUstepGUI/GSDisplayServer.h" #include "GNUstepGUI/GSDisplayServer.h"
@ -620,6 +622,8 @@ static NSNotificationCenter *nc = nil;
windowmaps = NSCreateMapTable(NSIntMapKeyCallBacks, windowmaps = NSCreateMapTable(NSIntMapKeyCallBacks,
NSNonRetainedObjectMapValueCallBacks, 20); NSNonRetainedObjectMapValueCallBacks, 20);
nc = [NSNotificationCenter defaultCenter]; nc = [NSNotificationCenter defaultCenter];
[self exposeBinding: NSTitleBinding];
} }
} }
@ -5179,6 +5183,28 @@ current key view.<br />
return self; return self;
} }
- (void) bind: (NSString *)binding
toObject: (id)anObject
withKeyPath: (NSString *)keyPath
options: (NSDictionary *)options
{
if ([binding isEqual: NSTitleBinding])
{
[self unbind: binding];
[[GSKeyValueBinding alloc] initWithBinding: @"title"
withName: NSTitleBinding
toObject: anObject
withKeyPath: keyPath
options: options
fromObject: self];
}
else
{
[super bind: binding toObject: anObject withKeyPath: keyPath
options: options];
}
}
/** /**
Returns all drawers associated with this window. Returns all drawers associated with this window.
*/ */

View file

@ -649,6 +649,7 @@ NSString *NSFontBinding = @"font";
NSString *NSHiddenBinding = @"hidden"; NSString *NSHiddenBinding = @"hidden";
NSString *NSSelectedIndexBinding = @"selectedIndex"; NSString *NSSelectedIndexBinding = @"selectedIndex";
NSString *NSTextColorBinding = @"textColor"; NSString *NSTextColorBinding = @"textColor";
NSString *NSTitleBinding = @"title";
NSString *NSToolTipBinding = @"toolTip"; NSString *NSToolTipBinding = @"toolTip";
NSString *NSValueBinding = @"value"; NSString *NSValueBinding = @"value";