I have a custom window (NSBorderlessWindowMask) that requires using the 
standard close/minimize/zoom buttons.

NSWindow's standardWindowButton:forStyleMask: method works great for creating 
these buttons and adding to my custom (frame) view. However, the mouse over 
effect does not work without using undocumented methods. Mainly, overriding 
_mouseInGroup: in the button's superview (frame view) and returning YES when 
the mouse is over the buttons. This works, and I notice Google Chrome uses the 
same method, but I really dislike using undocumented APIs like this, especially 
for UI work. The other problem with using these widgets is their placement 
within my custom frame view requires custom positioning. I suppose I could get 
their position from an existing window (asking for their frame in their private 
superview) but that is also undocumented, although less guesswork.

The alternative is to use the Carbon HITheme API, which to my surprise works 
under 64-bit. The HIThemeDrawTitleBarWidget() and HIThemeGetWindowRegionHit() 
are the main functions, and they do the work of properly positioning the 
widgets. However, their Y position is still dependent on this imaginary content 
view so their position still has to be fudged, unless I can assume their height 
== the height of the title bar? I guess I can still play with that a little. 
However, they do require you to track the mouse down state, which isn't too 
much extra work, but the Cocoa widgets get this for free as buttons.

I suppose my question is, what is the best way to do this to support future 
versions of Mac OS X? Is there better support coming for using the Cocoa 
buttons, and is this undocumented API expected to change? Is the HITheme here 
to stay for 10.7 and beyond for all architectures and can it do everything I 
need?

Thanks,
Kevin_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to