home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / MiscKit1.7.1 / MiscKit / Examples / TreeView / TreeButtonCell.m < prev    next >
Encoding:
Text File  |  1995-04-12  |  1.1 KB  |  45 lines

  1. //        Written by Don Yacktman Copyright (c) 1994 by Don Yacktman.
  2. //                Version 1.0.  All rights reserved.
  3. //
  4. //        This notice may not be removed from this source code.
  5. //
  6. //    This program is included in the MiscKit by permission from the author
  7. //    and its use is governed by the MiscKit license, found in the file
  8. //    "LICENSE.rtf" in the MiscKit distribution.  Please refer to that file
  9. //    for a list of all applicable permissions and restrictions.
  10. //    
  11.  
  12.  
  13. #import "TreeButtonCell.h"
  14. #import "TreeButton.h"
  15.  
  16. @implementation TreeButtonCell
  17.  
  18. - parent { return parent; }
  19. - setParent:anObject
  20. {    // anObject should be the parent Control object subclass
  21.     parent = anObject;
  22.     return self;
  23. }
  24.  
  25. - (BOOL)trackMouse:(NXEvent *)theEvent
  26.         inRect:(const NXRect *)cellFrame ofView:aView
  27. {    // this traps the button being selected.
  28.     BOOL result = [super trackMouse:theEvent inRect:cellFrame ofView:aView];
  29.     if (result && [parent respondsTo:@selector(wasSelected:)]) {
  30.         [parent wasSelected:self];
  31.     }
  32.     return result;
  33. }
  34.  
  35. - performClick:sender
  36. {
  37.     [super performClick:sender];
  38.     if ([parent respondsTo:@selector(wasSelected:)]) {
  39.         [parent wasSelected:self];
  40.     }
  41.     return self;
  42. }
  43.  
  44. @end
  45.