title: How to get title of NSButtonCell in delegate method of NSOutlineView
body: <p>I am using <code>NSButtonCell</code> subclass to display checkbox , image and label in same cell.  Now i want to edit label in outlineView on double click or on enter key.<br>
  <code>NSButtonCell</code> subclass:</p>
  
  <pre><code>- (void)dealloc {
      [image release];
      image = nil;
      [super dealloc];
  }
  
  -(id)copyWithZone:(NSZone *)zone {
      ImageAndTextAndCheckBox *cell = (ImageAndTextAndCheckBox *)[super copyWithZone:zone];
      cell-&gt;image = [image retain];
      return cell;
  }
  
  - (void)setImage:(NSImage *)anImage {
      if (anImage != image) {
          [image release];
          image = [anImage retain];
          [image setSize:NSMakeSize(kIconImageSize, kIconImageSize)];
      }
  }
  
  - (NSImage *)image {
      return image;
  }
  
  
  #define KNImageAndTextButtonCellPadding 5 // Distance between the end of the image and the start of the text.
  
  - (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
      // Draw the original button first, then the image.
      //shift check box to right
      NSRect newCellFrame = cellFrame;
      newCellFrame.origin.x =  newCellFrame.origin.x + 5;
      cellFrame = newCellFrame;
  
      [super drawWithFrame:cellFrame inView:controlView];
  
      if (image != nil) {
  
          NSRect imageFrame;
  
          NSSize imageSize = [image size];
          NSDivideRect(cellFrame, &amp;imageFrame, &amp;cellFrame, KNImageAndTextButtonCellPadding + imageSize.width, NSMinXEdge);
  
          imageFrame.origin.x += imageFrame.size.width;
          imageFrame.size = imageSize;
  
          if ([controlView isFlipped]) {
              imageFrame.origin.y += ceil((cellFrame.size.height + imageFrame.size.height) / 2);
          } else {
              imageFrame.origin.y += ceil((cellFrame.size.height - imageFrame.size.height) / 2);
          }
  
          BOOL oldFlipped = [image isFlipped];
          [image setFlipped:![controlView isFlipped]];
          [image compositeToPoint:imageFrame.origin operation:NSCompositeSourceOver];
          [image setFlipped:oldFlipped];
  
      }   
  }
  
  
  -(BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp {
  
      // Make sure that the mouse only gets tracked if it is clicked on the check box, otherwise 
      // the row will be checked/unchecked whenever the user clicks on any part of the cell (which is bad).
      if ([theEvent clickCount] &gt; 1)
      {
          NSLog(@"do double-click action" );
      }
      else
      {
           NSLog(@"do single-click action" );
      }
      NSPoint event_location = [theEvent locationInWindow];
      NSPoint localPoint = [controlView convertPoint:event_location fromView:nil];
      //shift check box mouse event to right
      NSRect newCellFrame = cellFrame;
      newCellFrame.origin.x =  newCellFrame.origin.x + 5;
      cellFrame = newCellFrame;
      if (localPoint.x &lt;= cellFrame.origin.x + 16) {
          return [super trackMouse:theEvent inRect:cellFrame ofView:controlView untilMouseUp:untilMouseUp];
      } else {
          return NO;
      }
  }
  
  -(NSRect)drawTitle:(NSAttributedString *)title withFrame:(NSRect)frame inView:(NSView *)controlView {
  
      // Adjust the rect so we don't interfere with the image's location
  
      if (image != nil) {
          //NSLog(@"orig %f %f %f %f", frame.size.width,frame.size.height,frame.origin.x,frame.origin.y);
          NSRect newFrame = NSOffsetRect(frame, [[self image] size].width + KNImageAndTextButtonCellPadding, 0);
          newFrame.size.width -= ([[self image] size].width + KNImageAndTextButtonCellPadding);
          //NSLog(@"drawTitle %f %f %f %f", newFrame.size.width,newFrame.size.height,newFrame.origin.x,newFrame.origin.y);
          return [super drawTitle:title withFrame:newFrame inView:controlView];
  
      } else {
          return [super drawTitle:title withFrame:frame inView:controlView];
      }
  
  }
  - (void)editWithFrame:(NSRect)aRect inView:(NSView *)controlView editor:(NSText *)textObj delegate:(id)anObject event:(NSEvent *)theEvent {
      NSLog(@"%@", anObject);
  
  
  //  id node = [anObject itemAtRow: [anObject selectedRow]];
  //  int length = [[node relativePath] length];
      NSRect newFrame = NSOffsetRect(aRect,  KNImageAndTextButtonCellPadding+kIconImageSize+ 16, 0);
      newFrame.size.width -= (KNImageAndTextButtonCellPadding+kIconImageSize+ 16);
      [super editWithFrame:newFrame inView:controlView editor:textObj delegate:anObject event:theEvent];
  }  
  </code></pre>
  
  <p>I am getting always 1 (boolean value) in </p>
  
  <pre><code>- (void)outlineView:(NSOutlineView *)ov     
       setObjectValue:(id)obj 
       forTableColumn:(NSTableColumn *)tableColumn 
               byItem:(id)item  
  </code></pre>
  
  <p><code>NSOutlineView</code> delegate method.(because of NSButtonCell) but i want to edit label.  </p>
  
  <ol>
  <li>How can i edit label?</li>
  <li>How to handle double click ?  </li>
  <li>Before pressing enter key:<br>
  <img src="https://i.stack.imgur.com/oFFxp.png" alt="enter image description here"> </li>
  </ol>
  
  <p>After<br>
  <img src="https://i.stack.imgur.com/ZK7ox.png" alt="enter image description here">
  How to change color text? its displaying white color.   </p>
  
  <p>it should be like  <img src="https://i.stack.imgur.com/juA2C.png" alt="enter image description here"> (with checkbox)  </p>
  
  <p>Can anyone please help me out?</p>