Mar
25
Day 27: toolbarHeight
The following snippet is taken from somewhere in Apple’s docs. It’s nice reminder for those who need to know the height of an NSToolbar:
- (float)toolbarHeight
{
NSToolbar *toolbar;
float toolbarHeight = 0.0;
NSRect windowFrame;
toolbar = [self toolbar];
if(toolbar && [toolbar isVisible]) {
windowFrame = [NSWindow contentRectForFrameRect:[self frame]
styleMask:[self styleMask]];
toolbarHeight = NSHeight(windowFrame) - NSHeight([[self contentView] frame]);
}
return toolbarHeight;
}