문제

The standard source view-style side bar used in many Apps (Mail, for instance) has a blue-ish color when the window is active, and another when it is inactive - following the state change of the title bar.

For various reasons, I have developed a custom side bar, but still want the same effect for the background.

The idea is to make a custom NSView that fills the background, and use it as the background for the side bar. I have given it a property "active" that I want to set, and the draw method fills the rect with two different gradients accordingly.

Now, the question is: what is the best way to hook such a view up to the window state?

도움이 되었습니까?

해결책

This "side-bar" that apple uses in the mail application is a NSOutlineView. In the interface builder you can use this style as well by setting the property "Highlight" to "Source list".

If you want to make your own side bar you can listen to the window and application delegate. There are plenty of methods that report about their status.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top