home *** CD-ROM | disk | FTP | other *** search
/ OpenStep (Enterprise) / OpenStepENTCD.toast / OEDEV / DEV.Z / SelectionNotifMatrix.m < prev    next >
Encoding:
Text File  |  1996-07-30  |  754 b   |  30 lines

  1. /*
  2.   You may freely copy, distribute, and reuse the code in this example.
  3.   NeXT disclaims any warranty of any kind, expressed or implied, as to its
  4.   fitness for any particular use.
  5. */
  6.  
  7. #import "SelectionNotifMatrix.h"
  8.  
  9. NSString *SelectionInMatrixNotification = @"SelectionInMatrixNotification";
  10.    
  11. @implementation SelectionNotifMatrix
  12.  
  13. - (void)mouseDown:(NSEvent *)theEvent
  14. {
  15.     int row;
  16.     [super mouseDown:theEvent];
  17.     
  18.     row = [self selectedRow];
  19.     if (row != -1) {
  20.         [[NSNotificationCenter defaultCenter]
  21.  postNotificationName:SelectionInMatrixNotification
  22.                object:self
  23.              userInfo:[NSDictionary dictionaryWithObjectsAndKeys:
  24.                  [NSNumber numberWithInt:row], @"ItemIndex", nil]];
  25.     }
  26. }
  27.  
  28.  
  29. @end
  30.