mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-04-23 20:01:11 +00:00
New MacOSX methods [formatter], [setFormatter:],
[attributedStringValue], [setAttributedStringValue:]. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@17252 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
2707092701
commit
7b3541ec72
2 changed files with 58 additions and 5 deletions
|
@ -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
|
||||
//
|
||||
|
|
|
@ -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
|
||||
*/
|
||||
|
|
Loading…
Reference in a new issue