diff --git a/Headers/gnustep/gui/NSControl.h b/Headers/gnustep/gui/NSControl.h index 660e5538d..32f8b7c7d 100644 --- a/Headers/gnustep/gui/NSControl.h +++ b/Headers/gnustep/gui/NSControl.h @@ -33,6 +33,7 @@ @class NSString; @class NSNotification; +@class NSFormatter; @class NSCell; @class NSFont; @@ -46,11 +47,6 @@ BOOL _ignoresMultiClick; } -// -// Initializing an NSControl Object -// -- (id)initWithFrame:(NSRect)frameRect; - // // Setting the Control's Cell // @@ -110,6 +106,10 @@ - (void)setFloatingPointFormat:(BOOL)autoRange left:(unsigned)leftDigits right:(unsigned)rightDigits; +#ifndef STRICT_OPENSTEP +- (void)setFormatter:(NSFormatter*)newFormatter; +- (id)formatter; +#endif // // Managing the Field Editor @@ -146,6 +146,14 @@ - (void)setTarget:(id)anObject; - (id)target; +// +// Attributed string handling +// +#ifndef STRICT_OPENSTEP +- (NSAttributedString *)attributedStringValue; +- (void)setAttributedStringValue:(NSAttributedString *)attribStr; +#endif + // // Assigning a Tag // diff --git a/Source/NSControl.m b/Source/NSControl.m index 233fd441e..47b7e2894 100644 --- a/Source/NSControl.m +++ b/Source/NSControl.m @@ -324,6 +324,21 @@ static Class actionCellClass; [self setNeedsDisplay: YES]; } +- (void) setFormatter: (NSFormatter*)newFormatter +{ + if (_cell) + { + [_cell setFormatter: newFormatter]; + if (![_cell isKindOfClass: actionCellClass]) + [self setNeedsDisplay: YES]; + } +} + +- (id) formatter +{ + return [_cell formatter]; +} + /* * Managing the Field Editor */ @@ -448,6 +463,36 @@ static Class actionCellClass; return [_cell target]; } +/* + * Attributed string handling + */ +- (void) setAttributedStringValue: (NSAttributedString*)attribStr +{ + NSCell *selected = [self selectedCell]; + + [self abortEditing]; + + [selected setAttributedStringValue: attribStr]; + if (![selected isKindOfClass: actionCellClass]) + [self setNeedsDisplay: YES]; +} + +- (NSAttributedString*) attributedStringValue +{ + NSCell *selected = [self selectedCell]; + + if (selected == nil) + { + return AUTORELEASE([NSAttributedString new]); + } + + // As this mehtod is not defined for NSActionCell, we have + // to do the validation here. + [self validateEditing]; + + return [selected attributedStringValue]; +} + /* * Assigning a Tag */