mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 18:50:48 +00:00
Documentation tweaks
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@14760 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
39011c43ca
commit
ed00ac6d93
3 changed files with 31 additions and 21 deletions
|
@ -122,9 +122,13 @@
|
||||||
return _layoutManager;
|
return _layoutManager;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void) replaceLayoutManager: (NSLayoutManager *)newLayoutManager
|
/**
|
||||||
|
* Replaces the layout manager while maintaining the text object
|
||||||
|
* framework intact.
|
||||||
|
*/
|
||||||
|
- (void) replaceLayoutManager: (NSLayoutManager*)aLayoutManager
|
||||||
{
|
{
|
||||||
if (newLayoutManager != _layoutManager)
|
if (aLayoutManager != _layoutManager)
|
||||||
{
|
{
|
||||||
id textStorage = [_layoutManager textStorage];
|
id textStorage = [_layoutManager textStorage];
|
||||||
NSArray *textContainers = [_layoutManager textContainers];
|
NSArray *textContainers = [_layoutManager textContainers];
|
||||||
|
@ -133,7 +137,7 @@
|
||||||
|
|
||||||
RETAIN (oldLayoutManager);
|
RETAIN (oldLayoutManager);
|
||||||
[textStorage removeLayoutManager: _layoutManager];
|
[textStorage removeLayoutManager: _layoutManager];
|
||||||
[textStorage addLayoutManager: newLayoutManager];
|
[textStorage addLayoutManager: aLayoutManager];
|
||||||
|
|
||||||
for (i = 0; i < count; i++)
|
for (i = 0; i < count; i++)
|
||||||
{
|
{
|
||||||
|
@ -141,7 +145,7 @@
|
||||||
|
|
||||||
container = RETAIN ([textContainers objectAtIndex: i]);
|
container = RETAIN ([textContainers objectAtIndex: i]);
|
||||||
[_layoutManager removeTextContainerAtIndex: i];
|
[_layoutManager removeTextContainerAtIndex: i];
|
||||||
[newLayoutManager addTextContainer: container];
|
[aLayoutManager addTextContainer: container];
|
||||||
/* The textview is caching the layout manager; refresh the
|
/* The textview is caching the layout manager; refresh the
|
||||||
* cache with this do-nothing call. */
|
* cache with this do-nothing call. */
|
||||||
[[container textView] setTextContainer: container];
|
[[container textView] setTextContainer: container];
|
||||||
|
|
|
@ -551,9 +551,9 @@ static Class textFieldCellClass;
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) textShouldEndEditing: (NSText *)aTextObject
|
- (BOOL) textShouldEndEditing: (NSText*)textObject
|
||||||
{
|
{
|
||||||
if ([_cell isEntryAcceptable: [aTextObject text]] == NO)
|
if ([_cell isEntryAcceptable: [textObject text]] == NO)
|
||||||
{
|
{
|
||||||
[self sendAction: _error_action to: [self target]];
|
[self sendAction: _error_action to: [self target]];
|
||||||
return NO;
|
return NO;
|
||||||
|
@ -562,16 +562,14 @@ static Class textFieldCellClass;
|
||||||
if ([_delegate respondsToSelector:
|
if ([_delegate respondsToSelector:
|
||||||
@selector(control:textShouldEndEditing:)])
|
@selector(control:textShouldEndEditing:)])
|
||||||
{
|
{
|
||||||
if ([_delegate control: self
|
if ([_delegate control: self textShouldEndEditing: textObject] == NO)
|
||||||
textShouldEndEditing: aTextObject] == NO)
|
|
||||||
{
|
{
|
||||||
NSBeep ();
|
NSBeep ();
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ([_delegate respondsToSelector:
|
if ([_delegate respondsToSelector: @selector(control:isValidObject:)] == YES)
|
||||||
@selector(control:isValidObject:)] == YES)
|
|
||||||
{
|
{
|
||||||
NSFormatter *formatter;
|
NSFormatter *formatter;
|
||||||
id newObjectValue;
|
id newObjectValue;
|
||||||
|
@ -579,12 +577,13 @@ static Class textFieldCellClass;
|
||||||
formatter = [_cell formatter];
|
formatter = [_cell formatter];
|
||||||
|
|
||||||
if ([formatter getObjectValue: &newObjectValue
|
if ([formatter getObjectValue: &newObjectValue
|
||||||
forString: [_text_object text]
|
forString: [_text_object text]
|
||||||
errorDescription: NULL] == YES)
|
errorDescription: NULL] == YES)
|
||||||
{
|
{
|
||||||
if ([_delegate control: self
|
if ([_delegate control: self isValidObject: newObjectValue] == NO)
|
||||||
isValidObject: newObjectValue] == NO)
|
{
|
||||||
return NO;
|
return NO;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -262,14 +262,18 @@ static NSNotificationCenter *nc = nil;
|
||||||
return _editedDelta;
|
return _editedDelta;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Set/get the delegate
|
* Set the delegate (adds it as an observer for text storage notifications)
|
||||||
|
* and removes any old value (removes it as an observer).<br />
|
||||||
|
* The delegate is <em>not</em> retained.
|
||||||
*/
|
*/
|
||||||
- (void) setDelegate: (id)anObject
|
- (void) setDelegate: (id)delegate
|
||||||
{
|
{
|
||||||
if (_delegate)
|
if (_delegate != nil)
|
||||||
[nc removeObserver: _delegate name: nil object: self];
|
{
|
||||||
_delegate = anObject;
|
[nc removeObserver: _delegate name: nil object: self];
|
||||||
|
}
|
||||||
|
_delegate = delegate;
|
||||||
|
|
||||||
#define SET_DELEGATE_NOTIFICATION(notif_name) \
|
#define SET_DELEGATE_NOTIFICATION(notif_name) \
|
||||||
if ([_delegate respondsToSelector: @selector(textStorage##notif_name:)]) \
|
if ([_delegate respondsToSelector: @selector(textStorage##notif_name:)]) \
|
||||||
|
@ -281,6 +285,9 @@ static NSNotificationCenter *nc = nil;
|
||||||
SET_DELEGATE_NOTIFICATION(WillProcessEditing);
|
SET_DELEGATE_NOTIFICATION(WillProcessEditing);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the value most recently set usiong the -setDelegate: method.
|
||||||
|
*/
|
||||||
- (id) delegate
|
- (id) delegate
|
||||||
{
|
{
|
||||||
return _delegate;
|
return _delegate;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue