I've been working on a window designed to look similar to Safari. This means a window with a "Unified" toolbar and tabs that blend into said toolbar.
The issue I have been having though is when sheets are involved. If you bring up the "Report Bug" sheet in Safari, you will notice that the window stays "active" - it's still drawn like it's in the foreground. So I used the code I posted earlier to determine if the window had a sheet attached, and drew the tabs active in that case.
But wait, it's not that simple. What if the window has a sheet attached, but the sheet is not the foreground window? This was becoming complicated.
That is, until I found the IsWindowHilited() Carbon function. This function, very simply, gives you a boolean stating wether or not to draw your controls in the foreground or background.
Function IsHighlighted(Extends w As Window) As Boolean
#If TargetMacOS
Soft Declare Function IsWindowHilited Lib "Carbon.framework" (window As WindowPtr) As Boolean
Return IsWindowHilited(w)
#Else
Return False
#EndIf
End Function
Enjoy.