Start cleanup after big base change. Remove the usage of extension

methods.
New 10.5 methods on NSCell.


git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@29656 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Fred Kiefer 2010-02-17 09:58:38 +00:00
parent c9d1292563
commit 43074e4a62
4 changed files with 66 additions and 7 deletions

View file

@ -1,3 +1,13 @@
2010-02-17 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSApplication.m (gnustep_backend_framework): Replace base
extension method with standard one.
* Source/NSCell.m (-setTitleWithMnemonic:): Replace base
extension method with standard one.
* Headers/AppKit/NSCell.h:
* Source/NSCell.m (-takeIntegerValueFrom:, -setIntegerValue:)
(-integerValue): Add OSX 10.5 methods.
2010-02-15 Fred Kiefer <FredKiefer@gmx.de>
* Source/NSTextView.m (-replaceTextContainer:): Implement this

View file

@ -205,7 +205,11 @@ enum {
- (void)setFloatValue:(float)aFloat;
- (void)setIntValue:(int)anInt;
- (void)setStringValue:(NSString *)aString;
#if OS_API_VERSION(MAC_OS_X_VERSION_10_5, GS_API_LATEST)
- (NSInteger) integerValue;
- (void) setIntegerValue: (NSInteger)anInt;
- (void) takeIntegerValueFrom: (id)sender;
#endif
//
// Setting Parameters
//

View file

@ -217,7 +217,7 @@ gnustep_backend_framework(NSString *bundleName)
{
if ([bundleName hasPrefix: @"libgnustep-"])
{
bundleName = [bundleName stringByDeletingPrefix: @"libgnustep-"];
bundleName = [bundleName substringFromIndex: [@"libgnustep-" length]];
}
bundleName = [NSString stringWithFormat: @"GNUstep-%@.framework",
bundleName];

View file

@ -293,6 +293,22 @@ static NSColor *dtxtCol;
}
}
/**<p>Returns the cell's value as an NSInteger. </p>
*<p>See Also: -setIntegerValue:</p>
*/
- (NSInteger) integerValue
{
if ((_cell.has_valid_object_value == YES) &&
([_object_value respondsToSelector: @selector(integerValue)]))
{
return [_object_value integerValue];
}
else
{
return [[self stringValue] integerValue];
}
}
/**<p>Returns the cell's value as a NSString.</p>
*<p>See Also: -setStringValue: </p>
*/
@ -412,6 +428,20 @@ static NSColor *dtxtCol;
[self setObjectValue: number];
}
/**
*<p>Sets the NSCell's value to anInt.</p>
*<p>See Also: -integerValue</p>
*/
- (void) setIntegerValue: (NSInteger)anInt
{
NSNumber *number;
// NB: GNUstep can set an int value for an image cell.
number = [NSNumber numberWithInteger: anInt];
[self setObjectValue: number];
}
/**<p>Sets the cell's value to a NSString.
The NSCell's type is set to NSTextCellType if needed</p>
<p>See Also: -stringValue</p>
@ -1335,12 +1365,19 @@ static NSColor *dtxtCol;
- (void) setTitleWithMnemonic: (NSString*)aString
{
unsigned int location = [aString rangeOfString: @"&"].location;
NSRange r = [aString rangeOfString: @"&"];
[self setTitle: [aString stringByReplacingString: @"&"
withString: @""]];
// TODO: We should underline this character
[self setMnemonicLocation: location];
if (r.length > 0)
{
unsigned int location = r.location;
[self setTitle: [[aString substringToIndex: location]
stringByAppendingString:
[aString substringFromIndex: NSMaxRange(r)]]];
// TODO: We should underline this character
[self setMnemonicLocation: location];
}
}
- (NSString*) mnemonic
@ -1479,6 +1516,14 @@ static NSColor *dtxtCol;
[self setIntValue: [sender intValue]];
}
/** <p>Sets the NSCell's NSInteger value to sender's NSInteger value</p>
<p>See Also: -setIntegerValue:</p>
*/
- (void) takeIntegerValueFrom: (id)sender
{
[self setIntegerValue: [sender integerValue]];
}
/** <p>Sets the NSCell's NSString value to sender's NSSting value</p>
<p>See Also: -setStringValue:</p>
*/