Add a few key value bindings.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@33277 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2011-06-11 12:01:59 +00:00
parent d25ee73927
commit c744492fee
8 changed files with 73 additions and 1 deletions

View file

@ -1,3 +1,13 @@
2011-06-11 Fred Kiefer <FredKiefer@gmx.de>
* Headers/AppKit/NSKeyValueBinding.h
* Source/NSPopUpButton.m
* Source/NSMatrix.m
* Source/NSLayoutManager.m
* Source/NSTextView.m
* Source/NSDocumentController.m
* Source/externs.m: Add a few key value bindings.
2011-06-10 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSBitmapImageRep+ICNS.m: Remove comment about libicns

View file

@ -111,6 +111,7 @@ APPKIT_EXPORT NSString *NSFontNameBinding;
APPKIT_EXPORT NSString *NSFontSizeBinding;
APPKIT_EXPORT NSString *NSHiddenBinding;
APPKIT_EXPORT NSString *NSSelectedIndexBinding;
APPKIT_EXPORT NSString *NSSelectedObjectBinding;
APPKIT_EXPORT NSString *NSSelectedTagBinding;
APPKIT_EXPORT NSString *NSTextColorBinding;
APPKIT_EXPORT NSString *NSTitleBinding;

View file

@ -41,6 +41,7 @@
#import "AppKit/NSDocumentController.h"
#import "AppKit/NSOpenPanel.h"
#import "AppKit/NSApplication.h"
#import "AppKit/NSKeyValueBinding.h"
#import "AppKit/NSMenu.h"
#import "AppKit/NSMenuItem.h"
#import "AppKit/NSWorkspace.h"
@ -246,6 +247,8 @@ TypeInfoForHumanReadableName (NSArray *types, NSString *typeName)
allTypes = [[NSArray alloc] initWithObjects: valid count: nValid];
}
}
[self exposeBinding: @"autosavingDelay"];
}
}

View file

@ -109,8 +109,10 @@ first. Remaining cases, highest priority first:
#import <Foundation/NSException.h>
#import <Foundation/NSValue.h>
#import "AppKit/NSAttributedString.h"
#import "AppKit/NSBezierPath.h"
#import "AppKit/NSColor.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSKeyValueBinding.h"
#import "AppKit/NSLayoutManager.h"
#import "AppKit/NSParagraphStyle.h"
#import "AppKit/NSRulerMarker.h"
@ -118,7 +120,6 @@ first. Remaining cases, highest priority first:
#import "AppKit/NSTextStorage.h"
#import "AppKit/NSWindow.h"
#import "AppKit/DPSOperators.h"
#import "AppKit/NSBezierPath.h"
#import "GNUstepGUI/GSLayoutManager_internal.h"
@ -2058,6 +2059,17 @@ static void GSDrawPatternLine(NSPoint start, NSPoint end, NSInteger pattern, CGF
@implementation NSLayoutManager
/*
* Class methods
*/
+ (void) initialize
{
if (self == [NSLayoutManager class])
{
[self exposeBinding: @"hyphenationFactor"];
}
}
-(void) insertTextContainer: (NSTextContainer *)aTextContainer
atIndex: (unsigned int)index
{

View file

@ -59,6 +59,8 @@
#import <Foundation/NSException.h>
#import <Foundation/NSDictionary.h>
#import <Foundation/NSKeyedArchiver.h>
#import <Foundation/NSKeyValueCoding.h>
#import <Foundation/NSKeyValueObserving.h>
#import <Foundation/NSNotification.h>
#import <Foundation/NSFormatter.h>
#import <Foundation/NSDebug.h>
@ -71,6 +73,7 @@
#import "AppKit/NSCursor.h"
#import "AppKit/NSEvent.h"
#import "AppKit/NSGraphics.h"
#import "AppKit/NSKeyValueBinding.h"
#import "AppKit/NSMatrix.h"
#import "AppKit/NSWindow.h"
@ -219,6 +222,8 @@ static SEL getSel;
defaultCellClass = [NSActionCell class];
//
nc = [NSNotificationCenter defaultCenter];
[self exposeBinding: NSSelectedTagBinding];
}
}
@ -1191,6 +1196,7 @@ static SEL getSel;
- (void) _selectCell: (NSCell *)aCell atRow: (int)row column: (int)column
{
[self willChangeValueForKey: NSSelectedTagBinding];
if (aCell)
{
NSRect cellFrame;
@ -1236,6 +1242,7 @@ static SEL getSel;
_selectedCell = nil;
_selectedRow = _selectedColumn = -1;
}
[self didChangeValueForKey: NSSelectedTagBinding];
}
- (void) selectCell: (NSCell *)aCell
@ -3885,6 +3892,30 @@ static SEL getSel;
}
}
- (void) setValue: (id)anObject forKey: (NSString*)aKey
{
if ([aKey isEqual: NSSelectedTagBinding])
{
[self selectCellWithTag: [anObject integerValue]];
}
else
{
[super setValue: anObject forKey: aKey];
}
}
- (id) valueForKey: (NSString*)aKey
{
if ([aKey isEqual: NSSelectedTagBinding])
{
return [NSNumber numberWithInteger: [self selectedTag]];
}
else
{
return [super valueForKey: aKey];
}
}
@end

View file

@ -65,6 +65,9 @@ Class _nspopupbuttonCellClass = 0;
[self setCellClass: [NSPopUpButtonCell class]];
[self exposeBinding: NSSelectedIndexBinding];
[self exposeBinding: NSSelectedObjectBinding];
[self setKeys: [NSArray arrayWithObject: NSSelectedIndexBinding]
triggerChangeNotificationsForDependentKey: NSSelectedObjectBinding];
[self exposeBinding: NSSelectedTagBinding];
[self setKeys: [NSArray arrayWithObject: NSSelectedIndexBinding]
triggerChangeNotificationsForDependentKey: NSSelectedTagBinding];
@ -575,6 +578,10 @@ this to return nil to indicate that we have no context menu.
{
[self selectItemWithTag: [anObject integerValue]];
}
else if ([aKey isEqual: NSSelectedObjectBinding])
{
[self selectItemWithTag: [anObject intValue]];
}
else
{
[super setValue: anObject forKey: aKey];
@ -591,6 +598,10 @@ this to return nil to indicate that we have no context menu.
{
return [NSNumber numberWithInteger: [self selectedTag]];
}
else if ([aKey isEqual: NSSelectedObjectBinding])
{
return [NSNumber numberWithInt: [self selectedTag]];
}
else
{
return [super valueForKey: aKey];

View file

@ -73,6 +73,7 @@
#import "AppKit/NSFileWrapper.h"
#import "AppKit/NSGraphics.h"
#import "AppKit/NSImage.h"
#import "AppKit/NSKeyValueBinding.h"
#import "AppKit/NSLayoutManager.h"
#import "AppKit/NSMenu.h"
#import "AppKit/NSMenuItem.h"
@ -599,6 +600,8 @@ static NSMenu *textViewMenu;
[NSCharacterSet punctuationCharacterSet]];
smartRightChars = [temp copy];
[temp release];
[self exposeBinding: NSEditableBinding];
}
}

View file

@ -668,6 +668,7 @@ NSString *NSFontNameBinding = @"fontName";
NSString *NSFontSizeBinding = @"fontSize";
NSString *NSHiddenBinding = @"hidden";
NSString *NSSelectedIndexBinding = @"selectedIndex";
NSString *NSSelectedObjectBinding = @"selectedObject";
NSString *NSSelectedTagBinding = @"selectedTag";
NSString *NSTextColorBinding = @"textColor";
NSString *NSTitleBinding = @"title";