How should I go about "theming" my app?
-
Hello,
I want to skin/theme my app. I don't want a bunch of people asking why
I want this, that is not relevant. I have a couple choices:
1. Do it the same way that ShapeShifter's "previewing" does. (I don't
currently know how.)
2. "Fake" the HIToolbox.framework (http://will.thimbleby.net/themes.html)
3. Subclass all the AppKit classes and add custom drawing. (I can't
think of a worse way then this.)
I've listed my options in order of preferably, one being the most preferred.
It would be freakin awesome to actually be able to drop a .theme,
.dlta, or .guikit on my app and have it installed as the current
theme. In other words, I want direct support for the common theme
formats.
All help is greatly appreciated.
Peace, Alan
PS. I've CCed this to Unsanity hoping they can help.
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that religion really is unimportant, then it
shall evolve." -
On 26 Oct 2006, at 15:30, Alan Smith wrote:
> 3. Subclass all the AppKit classes and add custom drawing. (I can't
> think of a worse way then this.)
I can tell you that my Cocoa app has to use some HITheme calls to get
standard appearance -- if this is your own app, that might not be a
concern because you'd know if you use both families of drawing.
If you're a Cocoa app, this sounds like what you'd have to do. You
don't have to subclass all the classes, probably just the NSCells.
And you don't have to worry about compatibility issues.
------------
David Dunham <dunham...> http://www.pensee.com/dunham/
"No matter how far you have gone on a wrong road, turn back." -
Turkish proverb -
Yes, my program is a Cocoa app.
I don't see how subclassing just NSCell would do the trick for things
like NSButton, which inherits from NSControl, and others like
NSTableView, which inherits from NSView. Please explain.
Thanks, Alan
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that religion really is unimportant, then it
shall evolve." -
On 27 okt 2006, at 04.10, Alan Smith wrote:
> I don't see how subclassing just NSCell would do the trick for things
> like NSButton, which inherits from NSControl, and others like
> NSTableView, which inherits from NSView. Please explain.
Because many NSView and NSControl subclasses use NSCell subclasses
for their drawing. The description of the NSCell class states that:
"The NSCell class provides a mechanism for displaying text or images
in an NSView object without the overhead of a full NSView subclass.
It’s used heavily by most of the NSControl classes to implement their
internal workings."
Notice how a lot of controls have custom cells: NSButton
+NSButtonCell, NSTextField+NSTextFieldCell, etc.
That said, I'm fairly sure that you wouldn't get away with only
subclassing cells, and it would in any case be a whole lot of things
to subclass - IMO most likely too much work for a small developer
that would need to devote most of their time to the primary / core
project(s).
This sounds like an interesting "third party opportunity" though -
creating a "ThemeKit" framework that provides alternative versions of
all AppKit classes, that determine their appearance based on theme
resource files.
j o a r -
It is indeed too much for me to take on now.
For now I'll use the method that I posted a link to where you "fake"
the HIToolbox. There is only one problem, I can't get the Extras.rsrc
from guiKit files unless I install them with ShapeShifter and then
manually retrieve them from the framework. I would like to be able to
extract those from my program and not have to limit the user to having
to find those files themselves.
On the other hand, I would be willing to start a project on
SourceForge or something and we could all do this together. Contact me
off-list if you want to start a project and if I get enough people,
say 2 or 3 more, then we can do this.
Cheers, Alan
--
// Quotes from yours truly -------------------------
"You don't forget, you just don't remember."
"Maturity resides in the mind."
"Silence is the Universe's greatest gift."
"When the World realizes that religion really is unimportant, then it
shall evolve." -
Am 27.10.2006 um 00:30 schrieb Alan Smith:
> 2. "Fake" the HIToolbox.framework (http://will.thimbleby.net/
> themes.html)
One thing to watch out for with this approach is that if Apple ever
adds a file to HIToolbox Framework's Resources folder, it will break
(HIToolbox, not the file).
It might be a better idea to try and patch the resource manager so
requests for Extras.rsrc first return your resources, and only if you
have none it would just fall back on Apple's Extras.rsrc file. I
vaguely recall that the resource manager even had some way to
override a resource, so you may wanna look into that. I may just be
remembering OS 9's resource list, though...
Cheers,
-- M. Uli Kusterer
http://www.zathras.de


