Re: Copy constructing to a subclass
Re: Copy constructing to a subclass
- Subject: Re: Copy constructing to a subclass
- From: Nicholas Francis <email@hidden>
- Date: Wed, 7 Jan 2004 23:33:38 +0100
Basically, I'm making a framework that makes Aqua look like the apple
pro apps - hence, I want to replace all NSButtonCells with my own
derived OTEButtonCell (repeat ad nauseum for other cell classes)
I can use [NSButton setCellClass: OTEButtonClass] to do a replace, but
that only works for controls created from code (of which I have many
;-)
I would like to do the replacement of stuff I load from nibs...
1) use [OTEButtonCell poseAsClass: [NSButtonCell class]] - this works
across the app - However, I want to preserve some nibs as old-style
aqua apps (e.g. preference pane). This means doing:
2) replace the cell either when loading from the nib or immediately
afterwards (Im not sure about this ;-) - this is where I need to
construct the subclass from the superclass.
Nicholas Francis
On Jan 7, 2004, at 11:08 PM, Alexander Spohr wrote:
any tip on _why_ you try to do that?
atze
Am 07.01.2004 um 21:27 schrieb Nicholas Francis:
Hi guys...
I want to copy-construct an object to a subclass and am trying to
find a smarter way of doing it... Here's how I do at the moment:
@interface OTEButtonCell : NSButtonCell {
// no private variables
}
-(id)initWithNSButtonCell:(NSButtonCell *)src;
@end
@implementation OTEButtonCell
-(id)initWithNSButtonCell:(NSButtonCell *)src {
self = [super init]; // etc...
[self setControlSize: [src controlSize]];
[self setImagePosition: [src ImagePosition]];
// etc...
return self;
}
@end
My question is: is there a way to avoid having to type out all the
[self setProperty: [src proprty]]... It gets rather tedius and
error-prone...
TIA,
Nicholas
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.