home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / SourceCode / AtYourService / ServicesHandler.m < prev    next >
Text File  |  1991-03-27  |  1KB  |  54 lines

  1.  
  2. /* The serviceHandler object controls the enabling and disabling of services
  3.  * from the Preferences panel.  It is hooked up to a matrix of checkboxes each
  4.  * of which has a title corresponding to a service that can be controlled. When
  5.  * any of the checkboxes are selected,  the corresponding service is enabled or 
  6.  * disabled, depending on the state of the checkbox.
  7.  */
  8.  
  9. #import "ServicesHandler.h"
  10. #import <appkit/Matrix.h>
  11. #import <appkit/Listener.h>
  12.  
  13. @implementation ServicesHandler
  14.  
  15.  
  16. /* Enable/Disable Services from a matrix of buttonCells which have
  17.  * titles corresponding to the Service menu entries
  18.  */
  19.  
  20. - servicesEnable:sender
  21. {
  22.     NXSetServicesMenuItemEnabled([[sender selectedCell] title], 
  23.         [[sender selectedCell] intValue]);
  24.     return self;
  25. }
  26.  
  27.  
  28. /* On initialisation, the following methods insure that the checkboxes
  29.  * show the state of their corresponding service
  30.  *
  31.  * Set the state of the sender (a checkbox) based on whether the
  32.  * corresponding service is enabled
  33.  */
  34.  
  35. - servicesSetState:sender
  36. {
  37.     [sender setIntValue:
  38.         NXIsServicesMenuItemEnabled([sender title]) ? 1 : 0];
  39.     return (id) YES;
  40. }
  41.  
  42. /* The application's delegate calls this method on initialisation. It simply
  43.  * calls the above method for each cell in the matrix
  44.  */
  45.  
  46. - prefSetup:sender
  47. {
  48.     [prefMatrix sendAction:(SEL) @selector(servicesSetState:) 
  49.         to:self forAllCells:YES];
  50.     return self;
  51. }
  52.  
  53. @end
  54.