Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

code supporting multiple frameworks



I've been thinking about how to write controller code that can be used
with multiple frameworks that provide GUI classes that are similar
except in name.  Say, for instance, that I've got a controller that
deals with an NSTableView, and now I'd like the same code to be used
for dealing with an XXTableView (where "XX" is the prefix used by the
other framework which I'm not mentioning specifically due to NDA, but
you can all surely guess :)

Anyway, It seems that I could do this sort of thing:

#ifdef APPKIT   // (or something)
#define TableView NSTableView
#else
#define TableView XXTableView
#end

And then everywhere my controller code references NSTableView, I
replace it with TableView.  I see a couple of problems with this:

- I'll end up with a big pile of ugly #define code just to wrap names
of any view classes I use.
- This seems likely to wreak havoc in IB, since it  knows about
classes like NSTableView and XXTableView, but not TableView (which is
what would appear for ivars in the header: "IBOutlet TableView
*myTable").

Has anyone played with this or other strategies for coding to both
AppKit and another similar GUI framework?

-- 
// jack
// http://www.nuthole.com
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/objc-language/email@hidden

This email sent to email@hidden



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.