home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / Palettes / TTools / TToolsPalette / Utilities.subproj / ClassAgent.m < prev    next >
Encoding:
Text File  |  1993-11-09  |  1.2 KB  |  60 lines

  1. /* ClassAgent.m
  2.  * Written By:  Thomas Burkholder
  3.  *
  4.  * You may freely copy, distribute, and reuse the code in this example.
  5.  * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
  6.  * fitness for any particular use.
  7.  */
  8.  
  9. #import "ClassAgent.h"
  10. #import "ClassAdditions.h"
  11. #import <objc/objc-class.h>
  12.  
  13. @implementation ClassAgent
  14.  
  15. int descent(id son, id father)
  16. {
  17.     // Take care of private IB- and DB- kit classes
  18.     if (!strncmp([son name],"IB",2))
  19.         return 0;
  20.     if (!strncmp([son name],"DB",2))
  21.         return 0;
  22.     if (strstr([son name],"_nib"))
  23.         return 0;
  24.     return 1;
  25. }
  26.  
  27. - subdirectoryFor:anObject sender:sender
  28. {
  29.     static id list;
  30.  
  31.     if (!list) {
  32.         list = [[SortedList alloc] init];
  33.         [list setAgent:self];
  34.     } else
  35.         [list empty];
  36.     [anObject subclasses:list allowPosers:NO filterWith:descent];
  37.  
  38.     return list;
  39. }
  40.  
  41. - (BOOL)isLeaf:anObject sender:sender
  42. {
  43.     return (0==[anObject subclasses:nil allowPosers:NO filterWith:descent]);
  44. }
  45.  
  46. - (const char *)displayStringFor:anObject sender:sender
  47. {
  48.     return [anObject name];
  49. }
  50.  
  51. - (int)compare:first with:second sender:sender
  52. {
  53.     return strcmp([first name],[second name]);
  54. }
  55.  
  56. - (const char *)titleOfColumn:(int)col
  57. {
  58.     return NULL;
  59. }
  60. @end