home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / Examples / AppKit / Yap / Preferences.h < prev    next >
Text File  |  1996-01-19  |  2KB  |  51 lines

  1. #import <Foundation/NSObject.h>
  2. #import <Foundation/NSDictionary.h>
  3.  
  4. /* Keys in the dictionary... */   
  5. #define DeleteBackup @"DeleteBackup"
  6. #define ViewWidth @"ViewWidth"
  7. #define ViewHeight @"ViewHeight"
  8. #define ShowCache @"ShowCache"
  9. #define ShowGridLines @"ShowGridLines"
  10. #define ClearCache @"ClearCache"
  11.  
  12. /* Notification sent when any default changes */
  13. #define PreferencesChangedNotification @"PreferencesChangedNotification"
  14.  
  15. @interface Preferences : NSObject {
  16.     id dontDeleteBackupButton;
  17.     id showCacheButton;
  18.     id dontClearCacheButton;
  19.     id showGridLinesButton;
  20.     id viewWidthField;
  21.     id viewHeightField;
  22.     id tabWidthField;
  23.  
  24.     NSDictionary *curValues;
  25.     NSMutableDictionary *displayedValues;
  26. }
  27.  
  28. + (id)objectForKey:(id)key;    /* Convenience for getting global preferences */
  29. + (void)saveDefaults;        /* Convenience for saving global preferences */
  30.  
  31. + (Preferences *)sharedInstance;
  32.  
  33. - (NSDictionary *)preferences;    /* The current preferences; contains values for the documented keys */
  34.  
  35. - (void)showPanel:(id)sender;    /* Shows the panel */
  36.  
  37. - (void)updateUI;        /* Updates the displayed values in the UI */
  38. - (void)commitDisplayedValues;    /* The displayed values are made current */
  39. - (void)discardDisplayedValues;    /* The displayed values are replaced with current prefs and updateUI is called */
  40.  
  41. - (void)revert:(id)sender;    /* Reverts the displayed values to the current preferences */
  42. - (void)ok:(id)sender;        /* Calls commitUI to commit the displayed values as current */
  43. - (void)revertToDefault:(id)sender;    
  44.  
  45. - (void)miscChanged:(id)sender;        /* Action message for most of the misc items in the UI to get displayedValues */
  46.  
  47. + (NSDictionary *)preferencesFromDefaults;
  48. + (void)savePreferencesToDefaults:(NSDictionary *)dict;
  49.  
  50. @end
  51.