title: Customizing a NSButtonCell with images and highlighting
body: <p>I want to create a custom switch for my application, in which I supply three images for the possible states (on, off, mousedown). The whole appearance is contained in the images, so I do not want Cocoa to highlight (darken) the button by itself during mousedown.</p>
  
  <p>At the moment, I have created a NSButtonCell subclass, dragged a bevel button of NSButtonTypeMomentaryChange into my view and custom set the button cell class type to my subclass. The subclass just implements awakeFromNib to try and set some desired behavior:</p>
  
  <pre><code>- (void)awakeFromNib
  {
      [self setShowsStateBy:NSContentsCellMask];
      [self setHighlightsBy:NSContentsCellMask];
  }
  </code></pre>
  
  <p>which I thought (according to the documentation) would disable the mousedown-darkening of the button. It does not.</p>
  
  <p>This is where I stand and now I have two questions:</p>
  
  <ul>
  <li>How can I set the ButtonCell class to just show my prepared picture on mousedown and do not darken / draw borders around the button?</li>
  <li>What would be the cleanest/most proper way to implement the other behavior of a switch, i.e. showing the off/on position depending on the previous state and being able to communicate its state properly to other objects?</li>
  </ul>