PDA

View Full Version : Title bar background in OmniFocus


titaniumdecoy
2007-12-13, 06:04 PM
How did you guys add a custom background to the title bar in OmniFocus? Please help me out here. I have searched and searched but cannot find any information on customizing the title bar of an NSWindow. Thanks!

Andrew
2007-12-13, 08:28 PM
Basically, we add a subview to the window's border view. The window's border view is not reachable via public API, so we use -valueForKey: to ask for it. Requires 10.4 or later. We don't like using non-public stuff, but we considered it ok for this situation as it is only to indicate the fact that the app is not a final build - the final release will not use the construction bar, andd if Apple ever removes the border view or breaks this we will come up with an alternate solution or will do without.

For the exact details, you can grab OmniAppKit here: <http://www.omnigroup.com/developer/

Look in NSWindow-OAExtensions.m for -addConstructionWarning.

-andrew

titaniumdecoy
2007-12-13, 10:13 PM
Thanks, Andrew. I find it strange that Apple makes it so difficult to work with the standard title bar, unless you are using a textured window, which comes with extra baggage (eg, rounded corners). After poking around, it seems to be that the ideal way to go about this would be to use a textured window and somehow straighten out the bottom corners--although I have no idea how to do that.

EDIT: If anyone's interested, I figured out prevent the corners from of a textured window from being rounded: NSWindow has a private method -setBottomCornerRounded:(BOOL)option which can be accessed in an NSWindow subclass.