dev.stuconnolly.com / svn / safaritabs

  1. #import <Foundation/NSObject.h>
  2. #import <Foundation/NSGeometry.h>
  3. #import <AppKit/NSNibDeclarations.h>
  4.  
  5. // Private classes from the AppKit framework; used by Safari and Mail.NSPref
  6.  
  7. @class NSWindow;
  8. @class NSMatrix;
  9. @class NSBox;
  10. @class NSButtonCell;
  11. @class NSImage;
  12. @class NSView;
  13. @class NSMutableArray;
  14. @class NSMutableDictionary;
  15.  
  16. @protocol NSPreferencesModule
  17. #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
  18. - (BOOL) preferencesWindowShouldClose;
  19. - (BOOL) moduleCanBeRemoved;
  20. - (void) moduleWasInstalled;
  21. - (void) moduleWillBeRemoved;
  22. #endif
  23. - (void) didChange;
  24. - (void) initializeFromDefaults;
  25. - (void) willBeDisplayed;
  26. - (void) saveChanges;
  27. - (BOOL) hasChangesPending;
  28. - (NSImage *) imageForPreferenceNamed:(NSString *) name;
  29. - (NSView *) viewForPreferenceNamed:(NSString *) name;
  30. @end
  31.  
  32. @interface NSPreferences : NSObject {
  33. #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2
  34.     id preferencesPanel;
  35.     NSBox *preferenceBox;
  36.     id moduleMatrix;
  37.     id okButton;
  38.     id cancelButton;
  39.     id applyButton;
  40. #else
  41.     NSWindow *_preferencesPanel;
  42.     NSBox *_preferenceBox;
  43.     NSMatrix *_moduleMatrix;
  44.     NSButtonCell *_okButton;
  45.     NSButtonCell *_cancelButton;
  46.     NSButtonCell *_applyButton;
  47. #endif
  48.     NSMutableArray *_preferenceTitles;
  49.     NSMutableArray *_preferenceModules;
  50. #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2
  51.     NSMutableDictionary *_preferenceViews;
  52. #else
  53.     NSMutableDictionary *_masterPreferenceViews;
  54.     NSMutableDictionary *_currentSessionPreferenceViews;
  55. #endif
  56.     NSBox *_originalContentView;
  57.     BOOL _isModal;
  58. #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
  59.     float _constrainedWidth;
  60.     id _currentModule;
  61.     void *_reserved;
  62. #endif
  63. }
  64. + (id) sharedPreferences;
  65. + (void) setDefaultPreferencesClass:(Class) class;
  66. + (Class) defaultPreferencesClass;
  67.  
  68. - (id) init;
  69. - (void) dealloc;
  70. - (void) addPreferenceNamed:(NSString *) name owner:(id) owner;
  71.  
  72. - (NSSize) preferencesContentSize;
  73.  
  74. - (void) showPreferencesPanel;
  75. - (void) showPreferencesPanelForOwner:(id) owner;
  76. - (int) showModalPreferencesPanelForOwner:(id) owner;
  77. - (int) showModalPreferencesPanel;
  78.  
  79. - (void) ok:(id) sender;
  80. - (void) cancel:(id) sender;
  81. - (void) apply:(id) sender;
  82.  
  83. - (NSString *) windowTitle;
  84. - (BOOL) usesButtons;
  85.  
  86. #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2
  87. - (void) selectModule:(id) sender;
  88. #endif
  89. @end
  90.  
  91. @interface NSPreferencesModule : NSObject <NSPreferencesModule> {
  92. #if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_2
  93.     IBOutlet NSBox *preferencesView;
  94.     BOOL hasChanges;
  95. #else
  96.     IBOutlet NSBox *_preferencesView;
  97.     NSSize _minSize;
  98.     BOOL _hasChanges;
  99.     void *_reserved;
  100. #endif
  101. }
  102. + (id) sharedInstance;
  103. - (id) init;
  104. - (NSString *) preferencesNibName;
  105. #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
  106. - (void) setPreferencesView:(NSView *) view;
  107. #endif
  108. - (NSView *) viewForPreferenceNamed:(NSString *) name;
  109. - (NSImage *) imageForPreferenceNamed:(NSString *) name;
  110. #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
  111. - (NSString *) titleForIdentifier:(NSString *) identifier;
  112. #endif
  113. - (BOOL) hasChangesPending;
  114. - (void) saveChanges;
  115. - (void) willBeDisplayed;
  116. - (void) initializeFromDefaults;
  117. - (void) didChange;
  118. #if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_3
  119. - (NSSize) minSize;
  120. - (void) setMinSize:(NSSize) size;
  121. - (void) moduleWillBeRemoved;
  122. - (void) moduleWasInstalled;
  123. - (BOOL) moduleCanBeRemoved;
  124. - (BOOL) preferencesWindowShouldClose;
  125. - (BOOL) isResizable;
  126. #endif
  127. @end