Re: CDEF's in Cocoa?
Re: CDEF's in Cocoa?
- Subject: Re: CDEF's in Cocoa?
- From: "Clark S. Cox III" <email@hidden>
- Date: Tue, 17 Jun 2003 14:50:28 -0400
On Tuesday, Jun 17, 2003, at 14:28 US/Eastern, Matthew Xavier Mora
wrote:
I good ol' Mac OS programming there were things call CDEF's that let
you make custom controls.
Is there such the thing for Cocoa? Any examples?
If you want to make a custom control you can go about it in one of
three ways (in increasing order of "correctness"):
1) Subclass NSView, and implement -drawRect: to do your drawing, and
mouseDown: to do your mouse tracking
2) Subclass NSControl, and, in addition to the NSView methods,
implement methods relating to actions and targets, etc.
3) Subclass NSCell and NSControl. Do all of the real work of drawing
and tracking in the NSCell subclass, and have the NSControl subclass
simply wrap the NSCell subclass.
Number 1 has the advantage of being easier to implement.
Number 3 has the advantage of being more "correct" (so you can do
things like put your custom control inside an NSMatrix or NSTableView).
Number 2 is halfway in between.
--
http://homepage.mac.com/clarkcox3/
email@hidden
Clark S. Cox, III
_______________________________________________
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.