Replacing cells in a window
Replacing cells in a window
- Subject: Replacing cells in a window
- From: Nicholas Francis <email@hidden>
- Date: Tue, 6 Jan 2004 22:27:31 +0100
Hi guys...
My quest for Pro-like controls continues ;-)
Now that the controls I use are mostly done, the question of how to
apply them to a nib rises its (ugly) head.
Basically, my approach has been as follows:
For each control I use, I derive a new class of cells, that overrides
the drawing behaviour. E.g:
NSButton --uses--> NSButtonCell
I've then derived an OTEButtonCell from NSButtonCell, that draws
buttons in a pro-like fashion (or optionally just falls through to the
underlying NSButtonCell.
Since changing all Controls of the app will take ages, I am planning to
do the following approach: I derive an OTEWindow from NSWindow, and
make a -(void)replaceControls, that works like this:
-(void)replaceControls {
foreach control in the window {
if the control is an NSButton {
create an OTEButtonCell from the button's NSButtonCell
replace the old cell with my newly created one
}
if the control is an NSPopUpButton {
create an OTEPopUpButtonCell from the pop up's NSPopUpButtonCell
replace the old cell with my newly created one
}
... etc...
}
}
I have a few questions regarding this:
* Can anyone see a problem with this approach?
* Is there a generic way to do a copy construction of objects from a
superclass to its derived class?
* Would anyone be interested in a framework of this stuff?
TIA,
Nicholas Francis
------------------------------------------------------------------------
-------
Scheduling fascist - Over The Edge Entertainments
_______________________________________________
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.