Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSAlert.d @ 1:8b48be5454ce
The internal cocoa classes compile now
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Tue, 19 Aug 2008 17:35:17 +0200 |
parents | 380af2bdd8e5 |
children | f565d3a95c0a |
comparison
equal
deleted
inserted
replaced
0:380af2bdd8e5 | 1:8b48be5454ce |
---|---|
12 * Jacob Carlborg <jacob.carlborg@gmail.com> | 12 * Jacob Carlborg <jacob.carlborg@gmail.com> |
13 *******************************************************************************/ | 13 *******************************************************************************/ |
14 module dwt.internal.cocoa.NSAlert; | 14 module dwt.internal.cocoa.NSAlert; |
15 | 15 |
16 import dwt.internal.cocoa.id; | 16 import dwt.internal.cocoa.id; |
17 import dwt.internal.cocoa.NSArray; | |
17 import dwt.internal.cocoa.NSButton; | 18 import dwt.internal.cocoa.NSButton; |
18 import dwt.internal.cocoa.NSError; | 19 import dwt.internal.cocoa.NSError; |
20 import dwt.internal.cocoa.NSImage; | |
19 import dwt.internal.cocoa.NSInteger; | 21 import dwt.internal.cocoa.NSInteger; |
20 import dwt.internal.cocoa.NSObject; | 22 import dwt.internal.cocoa.NSObject; |
21 import dwt.internal.cocoa.NSString; | 23 import dwt.internal.cocoa.NSString; |
22 import dwt.internal.cocoa.NSView; | 24 import dwt.internal.cocoa.NSView; |
25 import dwt.internal.cocoa.NSWindow; | |
26 import dwt.internal.cocoa.OS; | |
23 import objc = dwt.internal.objc.runtime; | 27 import objc = dwt.internal.objc.runtime; |
24 | 28 |
25 alias NSUInteger NSAlertStyle; | 29 alias NSUInteger NSAlertStyle; |
26 | 30 |
27 public class NSAlert : NSObject | 31 public class NSAlert : NSObject |
37 super(id); | 41 super(id); |
38 } | 42 } |
39 | 43 |
40 public NSView accessoryView () | 44 public NSView accessoryView () |
41 { | 45 { |
42 objc.id result = OS.objc_msgSend(this.id, OS.sel_accessoryView); | 46 objc.id result = OS.objc_msgSend(this.id_, OS.sel_accessoryView); |
43 return result !is null ? new NSView(result) : null; | 47 return result !is null ? new NSView(result) : null; |
44 } | 48 } |
45 | 49 |
46 public NSButton addButtonWithTitle (NSString title) | 50 public NSButton addButtonWithTitle (NSString title) |
47 { | 51 { |
48 objc.id result = OS.objc_msgSend(this.id, OS.sel_addButtonWithTitle_1, title !is null ? title.id : null); | 52 objc.id result = OS.objc_msgSend(this.id_, OS.sel_addButtonWithTitle_1, title !is null ? title.id_ : null); |
49 return result !is null ? new NSButton(result) : null; | 53 return result !is null ? new NSButton(result) : null; |
50 } | 54 } |
51 | 55 |
52 public NSAlertStyle alertStyle () | 56 public NSAlertStyle alertStyle () |
53 { | 57 { |
54 return OS.objc_msgSend(this.id, OS.sel_alertStyle); | 58 return cast(NSAlertStyle) OS.objc_msgSend(this.id_, OS.sel_alertStyle); |
55 } | 59 } |
56 | 60 |
57 public static NSAlert alertWithError (NSError error) | 61 public static NSAlert alertWithError (NSError error) |
58 { | 62 { |
59 objc.id result = OS.objc_msgSend(OS.class_NSAlert, OS.sel_alertWithError_1, error !is null ? error.id : null); | 63 objc.id result = OS.objc_msgSend(OS.class_NSAlert, OS.sel_alertWithError_1, error !is null ? error.id_ : null); |
60 return result !is null ? new NSAlert(result) : null; | 64 return result !is null ? new NSAlert(result) : null; |
61 } | 65 } |
62 | 66 |
63 public static NSAlert alertWithMessageText (NSString message, NSString defaultButton, NSString alternateButton, NSString otherButton, | 67 public static NSAlert alertWithMessageText (NSString message, NSString defaultButton, NSString alternateButton, NSString otherButton, |
64 NSString informativeTextWithFormat) | 68 NSString informativeTextWithFormat) |
65 { | 69 { |
66 objc.id result = OS.objc_msgSend(OS.class_NSAlert, | 70 objc.id result = OS.objc_msgSend(OS.class_NSAlert, |
67 OS.sel_alertWithMessageText_1defaultButton_1alternateButton_1otherButton_1informativeTextWithFormat_1, | 71 OS.sel_alertWithMessageText_1defaultButton_1alternateButton_1otherButton_1informativeTextWithFormat_1, |
68 message !is null ? message.id : null, defaultButton !is null ? defaultButton.id : null, | 72 message !is null ? message.id_ : null, defaultButton !is null ? defaultButton.id_ : null, |
69 alternateButton !is null ? alternateButton.id : null, otherButton !is null ? otherButton.id : null, | 73 alternateButton !is null ? alternateButton.id_ : null, otherButton !is null ? otherButton.id_ : null, |
70 informativeTextWithFormat !is null ? informativeTextWithFormat.id : null); | 74 informativeTextWithFormat !is null ? informativeTextWithFormat.id_ : null); |
71 return result !is null ? new NSAlert(result) : null; | 75 return result !is null ? new NSAlert(result) : null; |
72 } | 76 } |
73 | 77 |
74 public void beginSheetModalForWindow (NSWindow window, id delegatee, objc.SEL didEndSelector, void* contextInfo) | 78 public void beginSheetModalForWindow (NSWindow window, id delegatee, objc.SEL didEndSelector, void* contextInfo) |
75 { | 79 { |
76 OS.objc_msgSend(this.id, OS.sel_beginSheetModalForWindow_1modalDelegate_1didEndSelector_1contextInfo_1, window !is null ? window.id : null, | 80 OS.objc_msgSend(this.id_, OS.sel_beginSheetModalForWindow_1modalDelegate_1didEndSelector_1contextInfo_1, window !is null ? window.id_ : null, |
77 delegatee !is null ? delegatee.id : null, didEndSelector, contextInfo); | 81 delegatee !is null ? delegatee.id_ : null, didEndSelector, contextInfo); |
78 } | 82 } |
79 | 83 |
80 public NSArray buttons () | 84 public NSArray buttons () |
81 { | 85 { |
82 objc.id result = OS.objc_msgSend(this.id, OS.sel_buttons); | 86 objc.id result = OS.objc_msgSend(this.id_, OS.sel_buttons); |
83 return result !is null ? new NSArray(result) : null; | 87 return result !is null ? new NSArray(result) : null; |
84 } | 88 } |
85 | 89 |
86 public id delegatee () | 90 public id delegatee () |
87 { | 91 { |
88 objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); | 92 objc.id result = OS.objc_msgSend(this.id_, OS.sel_delegate); |
89 return result !is null ? new id(result) : null; | 93 return result !is null ? new id(result) : null; |
90 } | 94 } |
91 | 95 |
92 public NSString helpAnchor () | 96 public NSString helpAnchor () |
93 { | 97 { |
94 objc.id result = OS.objc_msgSend(this.id, OS.sel_helpAnchor); | 98 objc.id result = OS.objc_msgSend(this.id_, OS.sel_helpAnchor); |
95 return result !is null ? new NSString(result) : null; | 99 return result !is null ? new NSString(result) : null; |
96 } | 100 } |
97 | 101 |
98 public NSImage icon () | 102 public NSImage icon () |
99 { | 103 { |
100 objc.id result = OS.objc_msgSend(this.id, OS.sel_icon); | 104 objc.id result = OS.objc_msgSend(this.id_, OS.sel_icon); |
101 return result !is null ? new NSImage(result) : null; | 105 return result !is null ? new NSImage(result) : null; |
102 } | 106 } |
103 | 107 |
104 public NSString informativeText () | 108 public NSString informativeText () |
105 { | 109 { |
106 objc.id result = OS.objc_msgSend(this.id, OS.sel_informativeText); | 110 objc.id result = OS.objc_msgSend(this.id_, OS.sel_informativeText); |
107 return result !is null ? new NSString(result) : null; | 111 return result !is null ? new NSString(result) : null; |
108 } | 112 } |
109 | 113 |
110 public void layout () | 114 public void layout () |
111 { | 115 { |
112 OS.objc_msgSend(this.id, OS.sel_layout); | 116 OS.objc_msgSend(this.id_, OS.sel_layout); |
113 } | 117 } |
114 | 118 |
115 public NSString messageText () | 119 public NSString messageText () |
116 { | 120 { |
117 objc.id result = OS.objc_msgSend(this.id, OS.sel_messageText); | 121 objc.id result = OS.objc_msgSend(this.id_, OS.sel_messageText); |
118 return result !is null ? new NSString(result) : null; | 122 return result !is null ? new NSString(result) : null; |
119 } | 123 } |
120 | 124 |
121 public NSInteger runModal () | 125 public NSInteger runModal () |
122 { | 126 { |
123 return OS.objc_msgSend(this.id, OS.sel_runModal); | 127 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_runModal); |
124 } | 128 } |
125 | 129 |
126 public void setAccessoryView (NSView view) | 130 public void setAccessoryView (NSView view) |
127 { | 131 { |
128 OS.objc_msgSend(this.id, OS.sel_setAccessoryView_1, view !is null ? view.id : null); | 132 OS.objc_msgSend(this.id_, OS.sel_setAccessoryView_1, view !is null ? view.id_ : null); |
129 } | 133 } |
130 | 134 |
131 public void setAlertStyle (NSAlertStyle style) | 135 public void setAlertStyle (NSAlertStyle style) |
132 { | 136 { |
133 OS.objc_msgSend(this.id, OS.sel_setAlertStyle_1, style); | 137 OS.objc_msgSend(this.id_, OS.sel_setAlertStyle_1, style); |
134 } | 138 } |
135 | 139 |
136 public void setDelegate (id delegatee) | 140 public void setDelegate (id delegatee) |
137 { | 141 { |
138 OS.objc_msgSend(this.id, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id : null); | 142 OS.objc_msgSend(this.id_, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id_ : null); |
139 } | 143 } |
140 | 144 |
141 public void setHelpAnchor (NSString anchor) | 145 public void setHelpAnchor (NSString anchor) |
142 { | 146 { |
143 OS.objc_msgSend(this.id, OS.sel_setHelpAnchor_1, anchor !is null ? anchor.id : nullnull); | 147 OS.objc_msgSend(this.id_, OS.sel_setHelpAnchor_1, anchor !is null ? anchor.id_ : null); |
144 } | 148 } |
145 | 149 |
146 public void setIcon (NSImage icon) | 150 public void setIcon (NSImage icon) |
147 { | 151 { |
148 OS.objc_msgSend(this.id, OS.sel_setIcon_1, icon !is null ? icon.id : null); | 152 OS.objc_msgSend(this.id_, OS.sel_setIcon_1, icon !is null ? icon.id_ : null); |
149 } | 153 } |
150 | 154 |
151 public void setInformativeText (NSString informativeText) | 155 public void setInformativeText (NSString informativeText) |
152 { | 156 { |
153 OS.objc_msgSend(this.id, OS.sel_setInformativeText_1, informativeText !is null ? informativeText.id : null); | 157 OS.objc_msgSend(this.id_, OS.sel_setInformativeText_1, informativeText !is null ? informativeText.id_ : null); |
154 } | 158 } |
155 | 159 |
156 public void setMessageText (NSString messageText) | 160 public void setMessageText (NSString messageText) |
157 { | 161 { |
158 OS.objc_msgSend(this.id, OS.sel_setMessageText_1, messageText !is null ? messageText.id : null); | 162 OS.objc_msgSend(this.id_, OS.sel_setMessageText_1, messageText !is null ? messageText.id_ : null); |
159 } | 163 } |
160 | 164 |
161 public void setShowsHelp (bool showsHelp) | 165 public void setShowsHelp (bool showsHelp) |
162 { | 166 { |
163 OS.objc_msgSend(this.id, OS.sel_setShowsHelp_1, showsHelp); | 167 OS.objc_msgSend(this.id_, OS.sel_setShowsHelp_1, showsHelp); |
164 } | 168 } |
165 | 169 |
166 public void setShowsSuppressionButton (bool flag) | 170 public void setShowsSuppressionButton (bool flag) |
167 { | 171 { |
168 OS.objc_msgSend(this.id, OS.sel_setShowsSuppressionButton_1, flag); | 172 OS.objc_msgSend(this.id_, OS.sel_setShowsSuppressionButton_1, flag); |
169 } | 173 } |
170 | 174 |
171 public bool showsHelp () | 175 public bool showsHelp () |
172 { | 176 { |
173 return OS.objc_msgSend(this.id, OS.sel_showsHelp) !is null; | 177 return OS.objc_msgSend(this.id_, OS.sel_showsHelp) !is null; |
174 } | 178 } |
175 | 179 |
176 public bool showsSuppressionButton () | 180 public bool showsSuppressionButton () |
177 { | 181 { |
178 return OS.objc_msgSend(this.id, OS.sel_showsSuppressionButton) !is null; | 182 return OS.objc_msgSend(this.id_, OS.sel_showsSuppressionButton) !is null; |
179 } | 183 } |
180 | 184 |
181 public NSButton suppressionButton () | 185 public NSButton suppressionButton () |
182 { | 186 { |
183 objc.id result = OS.objc_msgSend(this.id, OS.sel_suppressionButton); | 187 objc.id result = OS.objc_msgSend(this.id_, OS.sel_suppressionButton); |
184 return result !is null ? new NSButton(result) : null; | 188 return result !is null ? new NSButton(result) : null; |
185 } | 189 } |
186 | 190 |
187 public id window () | 191 public id window () |
188 { | 192 { |
189 objc.id result = OS.objc_msgSend(this.id, OS.sel_window); | 193 objc.id result = OS.objc_msgSend(this.id_, OS.sel_window); |
190 return result !is null ? new id(result) : null; | 194 return result !is null ? new id(result) : null; |
191 } | 195 } |
192 } | 196 } |