mirror of
https://github.com/gnustep/libs-gui.git
synced 2025-05-31 06:50:48 +00:00
NSNibOutletConnector and NSNibControlConnector classes added
This commit is contained in:
parent
f23058b172
commit
c31ec536a2
4 changed files with 8 additions and 62 deletions
|
@ -180,58 +180,3 @@
|
|||
return desc;
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSNibControlConnector
|
||||
- (void) establishConnection
|
||||
{
|
||||
SEL sel = NSSelectorFromString(_tag);
|
||||
|
||||
[_src setTarget: _dst];
|
||||
[_src setAction: sel];
|
||||
}
|
||||
@end
|
||||
|
||||
@implementation NSNibOutletConnector
|
||||
- (void) establishConnection
|
||||
{
|
||||
NS_DURING
|
||||
{
|
||||
if (_src != nil)
|
||||
{
|
||||
NSString *selName;
|
||||
SEL sel;
|
||||
|
||||
selName = [NSString stringWithFormat: @"set%@%@:",
|
||||
[[_tag substringToIndex: 1] uppercaseString],
|
||||
[_tag substringFromIndex: 1]];
|
||||
sel = NSSelectorFromString(selName);
|
||||
|
||||
if (sel && [_src respondsToSelector: sel])
|
||||
{
|
||||
[_src performSelector: sel withObject: _dst];
|
||||
}
|
||||
else
|
||||
{
|
||||
/*
|
||||
* We cannot use the KVC mechanism here, as this would always retain _dst
|
||||
* and it could also affect _setXXX methods and _XXX ivars that aren't
|
||||
* affected by the Cocoa code.
|
||||
*/
|
||||
const char *name = [_tag cString];
|
||||
Class class = object_getClass(_src);
|
||||
Ivar ivar = class_getInstanceVariable(class, name);
|
||||
|
||||
if (ivar != 0)
|
||||
{
|
||||
object_setIvar(_src, ivar, _dst);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
NS_HANDLER
|
||||
{
|
||||
NSLog(@"Error while establishing connection %@: %@", self, [localException reason]);
|
||||
}
|
||||
NS_ENDHANDLER;
|
||||
}
|
||||
@end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue