home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / SourceCode / MiniExamples / NormalBrowser / Controller.m < prev    next >
Text File  |  1993-01-19  |  1KB  |  48 lines

  1. /* Controller.m
  2. *  Purpose: How to implement a normal browser.
  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 fitness
  6. *  for any particular use.
  7. *
  8. */
  9.  
  10.  
  11. #import <appkit/Matrix.h>
  12. #import <appkit/NXBrowser.h>
  13. #import <appkit/NXBrowserCell.h>
  14. #import <appkit/ScrollView.h>
  15. #import "Controller.h"
  16.  
  17. @implementation Controller
  18.  
  19. - appDidInit:sender
  20. {
  21.     [myBrowser setDelegate:self];
  22.     [myBrowser loadColumnZero];
  23.     return self;
  24. }
  25.  
  26. - (int)browser:sender fillMatrix:matrix inColumn:(int)column
  27. {
  28.     char    buf[255];
  29.     int    row;
  30.     id    cell;
  31.     
  32.     for (row = 0; row < NUMROWS; row++)
  33.     {
  34.         sprintf(buf,"Column %d    Row %d", column, row);
  35.         [matrix addRow];
  36.         cell = [matrix cellAt: row  :0];    
  37.         /* Each column of the browser contains a separate */
  38.         /* matrix. So for each column in the browser we want */
  39.         /* to insert into column 0 for that matrix */  
  40.         [cell setStringValue:buf];
  41.         [cell setLoaded:YES];
  42.         [cell setLeaf:column < NUMCOLUMNS-1? NO : YES];
  43.     }
  44.     return NUMROWS;
  45. }
  46.  
  47. @end
  48.