Re: delegation strategy
Re: delegation strategy
- Subject: Re: delegation strategy
- From: "Michael Ash" <email@hidden>
- Date: Thu, 10 Jul 2008 23:32:30 -0400
On Wed, Jul 9, 2008 at 11:19 AM, Wesley Smith <email@hidden> wrote:
> Hi list,
> I'm trying to provide a particular windowing interface that combines
> NSWindow and NSPanel. For the most part I'm using a custom subclass
> of NSWindow that adds a decent amount of functionality. Occasionally,
> I want to make use of NSPanel (for the NSUtilityWindowMask style flag)
> and I'd like it to behave exactly as my custom NSWindow subclass does.
> I'm sure there's a way to make this work via some form of
> delegation/message passing so that I don't have to duplicate code and
> can just have messages passed from the NSWindow and NSPanel objects to
> my custom methods, but I'm not really sure how that kind of design
> pattern plays out in Cocoa. Any ideas? suggestions?
Are you sure you really need an NSWindow subclass? It's pretty
unusual, and when it is needed it's often for minor things like
getting nib-archived windows to use a style mask that IB doesn't let
you choose.
If you can move your behaviors into a controller class, then it will
be easy to make that controller class work with either an NSWindow or
an NSPanel. Whether this is possible or easy will depend on exactly
what you're doing, of course, but generally that's where this kind of
thing belongs anyway.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden