home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1995 August / NEBULA.bin / SourceCode / MiscKit1.2.6 / Examples / receiptfilter / PanelView.m < prev    next >
Encoding:
Text File  |  1994-03-03  |  952 b   |  59 lines

  1. #import "PanelView.h"
  2.  
  3. /*
  4.  * It seemed logical to put the controlling code for the panel inside a
  5.  * view subclass since a view is most often subclassed anyway.
  6.  */
  7.  
  8. @implementation PanelView
  9.  
  10. - initFrame:(const NXRect *) aRect memory:(BOOL) flag
  11. {
  12.     self = [super initFrame:aRect];
  13.     remember = flag;
  14.     return self;
  15. }
  16.  
  17. - rememberToggle
  18. /* Toggle status of check box on the panel */
  19. {
  20.     if (remember == YES) remember = NO;
  21.     if (remember == NO) remember = YES;
  22.     return self;
  23. }
  24.  
  25. - buttonPress:sender
  26. /* 
  27.  * Determine whether the user pressed the Yes or No button and
  28.  * terminate the modal loop.
  29.  */
  30. {
  31.     switch ([sender tag]) {
  32.         case 1 :
  33.             choice = NO;
  34.             break;
  35.         case 2 :
  36.         default:
  37.             choice = YES;
  38.             break;
  39.     }
  40.     [NXApp stopModal];
  41.     return self;
  42. }
  43.  
  44. /*
  45.  * The following two methods are used by the main program to find out 
  46.  * from the view what choice the user made.
  47.  */
  48.  
  49. - (BOOL) remember
  50. {
  51.     return remember;
  52. }
  53.  
  54. - (BOOL) choice
  55. {
  56.     return choice;
  57. }
  58.  
  59. @end