mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 19:30:48 +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
cfc1fd0e1b
commit
0c9ce6b22e
2 changed files with 58 additions and 5 deletions
|
@ -33,6 +33,7 @@
|
||||||
|
|
||||||
@class NSString;
|
@class NSString;
|
||||||
@class NSNotification;
|
@class NSNotification;
|
||||||
|
@class NSFormatter;
|
||||||
|
|
||||||
@class NSCell;
|
@class NSCell;
|
||||||
@class NSFont;
|
@class NSFont;
|
||||||
|
@ -46,11 +47,6 @@
|
||||||
BOOL _ignoresMultiClick;
|
BOOL _ignoresMultiClick;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
|
||||||
// Initializing an NSControl Object
|
|
||||||
//
|
|
||||||
- (id)initWithFrame:(NSRect)frameRect;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Setting the Control's Cell
|
// Setting the Control's Cell
|
||||||
//
|
//
|
||||||
|
@ -110,6 +106,10 @@
|
||||||
- (void)setFloatingPointFormat:(BOOL)autoRange
|
- (void)setFloatingPointFormat:(BOOL)autoRange
|
||||||
left:(unsigned)leftDigits
|
left:(unsigned)leftDigits
|
||||||
right:(unsigned)rightDigits;
|
right:(unsigned)rightDigits;
|
||||||
|
#ifndef STRICT_OPENSTEP
|
||||||
|
- (void)setFormatter:(NSFormatter*)newFormatter;
|
||||||
|
- (id)formatter;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Managing the Field Editor
|
// Managing the Field Editor
|
||||||
|
@ -146,6 +146,14 @@
|
||||||
- (void)setTarget:(id)anObject;
|
- (void)setTarget:(id)anObject;
|
||||||
- (id)target;
|
- (id)target;
|
||||||
|
|
||||||
|
//
|
||||||
|
// Attributed string handling
|
||||||
|
//
|
||||||
|
#ifndef STRICT_OPENSTEP
|
||||||
|
- (NSAttributedString *)attributedStringValue;
|
||||||
|
- (void)setAttributedStringValue:(NSAttributedString *)attribStr;
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// Assigning a Tag
|
// Assigning a Tag
|
||||||
//
|
//
|
||||||
|
|
|
@ -324,6 +324,21 @@ static Class actionCellClass;
|
||||||
[self setNeedsDisplay: YES];
|
[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
|
* Managing the Field Editor
|
||||||
*/
|
*/
|
||||||
|
@ -448,6 +463,36 @@ static Class actionCellClass;
|
||||||
return [_cell target];
|
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
|
* Assigning a Tag
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue