Domanda

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?

È stato utile?

Soluzione

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.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top