This is Superimposer.m in view mode; [Download] [Up]
// Superimposer.m // Project: Rulers // // Stephan Wacker // 93-02-13 #if 0 // Purpose A Superimposer object can be used in the NeXT InterfaceBuilder to modify some of the objects installed from the palettes. You connect the `template' outlet to an object of your own design which should be a subclass of one of the palette objects, e.g. a subclass of Button. The outlets `object0', `object1', etc., are connected to regular objects of that class (e.g. some Buttons). The Superimposer receives a message set...: for every outlet when it is installed from the nib file. These methods change the object's classes to that of the template. For details see SuperimposedObject.m NB: Another implementation of this class provided an awakeFromNib: method instead of the outlet installing methods. This approach didn't work properly if other objects in the interface also implemented an awakeFromNib: method and they received that message earlier than the Superimposer. If these methods referenced an object whose class should be superimposed, it would still be the original object and the behaviour was not as expected. #endif // Purpose #import "Superimposer.h" #import "SuperimposedObject.h" @implementation Superimposer - setObject0: anObject // Install the outlet object0; change its class to [template class]. { object0 = anObject; if( template ) [anObject superimposeClass: [template class]]; return self; } - setObject1: anObject { object1 = anObject; if( template ) [anObject superimposeClass: [template class]]; return self; } - setObject2: anObject { object2 = anObject; if( template ) [anObject superimposeClass: [template class]]; return self; } - setObject3: anObject { object3 = anObject; if( template ) [anObject superimposeClass: [template class]]; return self; } - setObject4: anObject { object4 = anObject; if( template ) [anObject superimposeClass: [template class]]; return self; } - setObject5: anObject { object5 = anObject; if( template ) [anObject superimposeClass: [template class]]; return self; } - setObject6: anObject { object6 = anObject; if( template ) [anObject superimposeClass: [template class]]; return self; } - setObject7: anObject { object7 = anObject; if( template ) [anObject superimposeClass: [template class]]; return self; } - setObject8: anObject { object8 = anObject; if( template ) [anObject superimposeClass: [template class]]; return self; } - setObject9: anObject { object9 = anObject; if( template ) [anObject superimposeClass: [template class]]; return self; } - setTemplate: anObject // Install the outlet template; change all objects' classes. { id templateClass = [anObject class]; template = anObject; if( object0 ) [object0 superimposeClass: templateClass]; if( object1 ) [object1 superimposeClass: templateClass]; if( object2 ) [object2 superimposeClass: templateClass]; if( object3 ) [object3 superimposeClass: templateClass]; if( object4 ) [object4 superimposeClass: templateClass]; if( object5 ) [object5 superimposeClass: templateClass]; if( object6 ) [object6 superimposeClass: templateClass]; if( object7 ) [object7 superimposeClass: templateClass]; if( object8 ) [object8 superimposeClass: templateClass]; if( object9 ) [object9 superimposeClass: templateClass]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.