Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSUserDefaultsController.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:380af2bdd8e5 |
---|---|
1 /******************************************************************************* | |
2 * Copyright (c) 2007 IBM Corporation and others. | |
3 * All rights reserved. This program and the accompanying materials | |
4 * are made available under the terms of the Eclipse Public License v1.0 | |
5 * which accompanies this distribution, and is available at | |
6 * http://www.eclipse.org/legal/epl-v10.html | |
7 * | |
8 * Contributors: | |
9 * IBM Corporation - initial API and implementation | |
10 * | |
11 * Port to the D Programming language: | |
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | |
13 *******************************************************************************/ | |
14 module dwt.internal.cocoa.NSUserDefaultsController; | |
15 | |
16 import dwt.internal.cocoa.id; | |
17 import dwt.internal.cocoa.NSController; | |
18 import dwt.internal.cocoa.NSDictionary; | |
19 import dwt.internal.cocoa.NSUserDefaults; | |
20 import dwt.internal.cocoa.OS; | |
21 import objc = dwt.internal.objc.runtime; | |
22 | |
23 public class NSUserDefaultsController : NSController | |
24 { | |
25 | |
26 public this () | |
27 { | |
28 super(); | |
29 } | |
30 | |
31 public this (objc.id id) | |
32 { | |
33 super(id); | |
34 } | |
35 | |
36 public bool appliesImmediately () | |
37 { | |
38 return OS.objc_msgSend(this.id, OS.sel_appliesImmediately) !is null; | |
39 } | |
40 | |
41 public NSUserDefaults defaults () | |
42 { | |
43 objc.id result = OS.objc_msgSend(this.id, OS.sel_defaults); | |
44 return result !is null ? new NSUserDefaults(result) : null; | |
45 } | |
46 | |
47 public bool hasUnappliedChanges () | |
48 { | |
49 return OS.objc_msgSend(this.id, OS.sel_hasUnappliedChanges) !is null; | |
50 } | |
51 | |
52 public id initWithDefaults (NSUserDefaults defaults, NSDictionary initialValues) | |
53 { | |
54 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithDefaults_1initialValues_1, defaults !is null ? defaults.id : null, | |
55 initialValues !is null ? initialValues.id : null); | |
56 return result !is null ? new id(result) : null; | |
57 } | |
58 | |
59 public NSDictionary initialValues () | |
60 { | |
61 objc.id result = OS.objc_msgSend(this.id, OS.sel_initialValues); | |
62 return result !is null ? new NSDictionary(result) : null; | |
63 } | |
64 | |
65 public void revert (id sender) | |
66 { | |
67 OS.objc_msgSend(this.id, OS.sel_revert_1, sender !is null ? sender.id : null); | |
68 } | |
69 | |
70 public void revertToInitialValues (id sender) | |
71 { | |
72 OS.objc_msgSend(this.id, OS.sel_revertToInitialValues_1, sender !is null ? sender.id : null); | |
73 } | |
74 | |
75 public void save (id sender) | |
76 { | |
77 OS.objc_msgSend(this.id, OS.sel_save_1, sender !is null ? sender.id : null); | |
78 } | |
79 | |
80 public void setAppliesImmediately (bool flag) | |
81 { | |
82 OS.objc_msgSend(this.id, OS.sel_setAppliesImmediately_1, flag); | |
83 } | |
84 | |
85 public void setInitialValues (NSDictionary initialValues) | |
86 { | |
87 OS.objc_msgSend(this.id, OS.sel_setInitialValues_1, initialValues !is null ? initialValues.id : null); | |
88 } | |
89 | |
90 public static id sharedUserDefaultsController () | |
91 { | |
92 objc.id result = OS.objc_msgSend(OS.class_NSUserDefaultsController, OS.sel_sharedUserDefaultsController); | |
93 return result !is null ? new id(result) : null; | |
94 } | |
95 | |
96 public id values () | |
97 { | |
98 objc.id result = OS.objc_msgSend(this.id, OS.sel_values); | |
99 return result !is null ? new id(result) : null; | |
100 } | |
101 | |
102 } |