1 /* xscreensaver, Copyright (c) 2006-2013 Jamie Zawinski <jwz@jwz.org>
3 * Permission to use, copy, modify, distribute, and sell this software and its
4 * documentation for any purpose is hereby granted without fee, provided that
5 * the above copyright notice appear in all copies and that both that
6 * copyright notice and this permission notice appear in supporting
7 * documentation. No representations are made about the suitability of this
8 * software for any purpose. It is provided "as is" without express or
12 /* This implements the substrate of the xscreensaver preferences code:
13 It does this by writing defaults to, and reading values from, the
14 NSUserDefaultsController (and ScreenSaverDefaults/NSUserDefaults)
15 and thereby reading the preferences that may have been edited by
16 the UI (XScreenSaverConfigSheet).
20 # import <Foundation/Foundation.h>
21 # import <UIKit/UIKit.h>
22 # define NSUserDefaultsController NSUserDefaults
24 # import <Cocoa/Cocoa.h>
30 @interface PrefsReader : NSObject
34 NSUserDefaults *userDefaults; // this is actually a 'ScreenSaverDefaults'
35 NSUserDefaultsController *userDefaultsController;
37 NSUserDefaults *globalDefaults; // for prefs shared by all xscreensavers.
38 NSUserDefaultsController *globalDefaultsController;
40 NSDictionary *defaultOptions; // Hardcoded defaults before any changes.
43 - (id) initWithName: (NSString *) name
44 xrmKeys: (const XrmOptionDescRec *) opts
45 defaults: (const char * const *) defs;
47 - (NSUserDefaultsController *) userDefaultsController;
48 - (NSUserDefaultsController *) globalDefaultsController;
49 - (NSDictionary *) defaultOptions;
51 - (char *) getStringResource: (const char *) name;
52 - (double) getFloatResource: (const char *) name;
53 - (int) getIntegerResource: (const char *) name;
54 - (BOOL) getBooleanResource: (const char *) name;