comparison dwt/internal/cocoa/NSPopUpButtonCell.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
11 * Port to the D Programming language: 11 * Port to the D Programming language:
12 * Jacob Carlborg <jacob.carlborg@gmail.com> 12 * Jacob Carlborg <jacob.carlborg@gmail.com>
13 *******************************************************************************/ 13 *******************************************************************************/
14 module dwt.internal.cocoa.NSPopUpButtonCell; 14 module dwt.internal.cocoa.NSPopUpButtonCell;
15 15
16 import dwt.internal.cocoa.id;
17 import dwt.internal.cocoa.NSArray;
16 import dwt.internal.cocoa.NSInteger; 18 import dwt.internal.cocoa.NSInteger;
19 import dwt.internal.cocoa.NSMenu;
20 import dwt.internal.cocoa.NSMenuItem;
17 import dwt.internal.cocoa.NSMenuItemCell; 21 import dwt.internal.cocoa.NSMenuItemCell;
22 import dwt.internal.cocoa.NSRect;
23 import dwt.internal.cocoa.NSString;
24 import dwt.internal.cocoa.NSView;
18 import dwt.internal.cocoa.OS; 25 import dwt.internal.cocoa.OS;
19 import objc = dwt.internal.objc.runtime; 26 import objc = dwt.internal.objc.runtime;
20 27
21 enum NSPopUpArrowPosition 28 enum NSPopUpArrowPosition
22 { 29 {
42 super(id); 49 super(id);
43 } 50 }
44 51
45 public void addItemWithTitle (NSString title) 52 public void addItemWithTitle (NSString title)
46 { 53 {
47 OS.objc_msgSend(this.id, OS.sel_addItemWithTitle_1, title !is null ? title.id : null); 54 OS.objc_msgSend(this.id_, OS.sel_addItemWithTitle_1, title !is null ? title.id_ : null);
48 } 55 }
49 56
50 public void addItemsWithTitles (NSArray itemTitles) 57 public void addItemsWithTitles (NSArray itemTitles)
51 { 58 {
52 OS.objc_msgSend(this.id, OS.sel_addItemsWithTitles_1, itemTitles !is null ? itemTitles.id : null); 59 OS.objc_msgSend(this.id_, OS.sel_addItemsWithTitles_1, itemTitles !is null ? itemTitles.id_ : null);
53 } 60 }
54 61
55 public bool altersStateOfSelectedItem () 62 public bool altersStateOfSelectedItem ()
56 { 63 {
57 return OS.objc_msgSend(this.id, OS.sel_altersStateOfSelectedItem) !is null; 64 return OS.objc_msgSend(this.id_, OS.sel_altersStateOfSelectedItem) !is null;
58 } 65 }
59 66
60 public NSPopUpArrowPosition arrowPosition () 67 public NSPopUpArrowPosition arrowPosition ()
61 { 68 {
62 return OS.objc_msgSend(this.id, OS.sel_arrowPosition); 69 return cast(NSPopUpArrowPosition) OS.objc_msgSend(this.id_, OS.sel_arrowPosition);
63 } 70 }
64 71
65 public void attachPopUpWithFrame (NSRect cellFrame, NSView controlView) 72 public void attachPopUpWithFrame (NSRect cellFrame, NSView controlView)
66 { 73 {
67 OS.objc_msgSend(this.id, OS.sel_attachPopUpWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id : null); 74 OS.objc_msgSend(this.id_, OS.sel_attachPopUpWithFrame_1inView_1, cellFrame, controlView !is null ? controlView.id_ : null);
68 } 75 }
69 76
70 public bool autoenablesItems () 77 public bool autoenablesItems ()
71 { 78 {
72 return OS.objc_msgSend(this.id, OS.sel_autoenablesItems) !is null; 79 return OS.objc_msgSend(this.id_, OS.sel_autoenablesItems) !is null;
73 } 80 }
74 81
75 public void dismissPopUp () 82 public void dismissPopUp ()
76 { 83 {
77 OS.objc_msgSend(this.id, OS.sel_dismissPopUp); 84 OS.objc_msgSend(this.id_, OS.sel_dismissPopUp);
78 } 85 }
79 86
80 public NSInteger indexOfItem (NSMenuItem item) 87 public NSInteger indexOfItem (NSMenuItem item)
81 { 88 {
82 return OS.objc_msgSend(this.id, OS.sel_indexOfItem_1, item !is null ? item.id : null); 89 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItem_1, item !is null ? item.id_ : null);
83 } 90 }
84 91
85 public NSInteger indexOfItemWithRepresentedObject (id obj) 92 public NSInteger indexOfItemWithRepresentedObject (id obj)
86 { 93 {
87 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithRepresentedObject_1, obj !is null ? obj.id : null); 94 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItemWithRepresentedObject_1, obj !is null ? obj.id_ : null);
88 } 95 }
89 96
90 public NSInteger indexOfItemWithTag (NSInteger tag) 97 public NSInteger indexOfItemWithTag (NSInteger tag)
91 { 98 {
92 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithTag_1, tag); 99 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItemWithTag_1, tag);
93 } 100 }
94 101
95 public NSInteger indexOfItemWithTarget (id target, objc.SEL actionSelector) 102 public NSInteger indexOfItemWithTarget (id target, objc.SEL actionSelector)
96 { 103 {
97 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithTarget_1andAction_1, target !is null ? target.id : null, actionSelector); 104 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItemWithTarget_1andAction_1, target !is null ? target.id_ : null, actionSelector);
98 } 105 }
99 106
100 public NSInteger indexOfItemWithTitle (NSString title) 107 public NSInteger indexOfItemWithTitle (NSString title)
101 { 108 {
102 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithTitle_1, title !is null ? title.id : null); 109 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItemWithTitle_1, title !is null ? title.id_ : null);
103 } 110 }
104 111
105 public NSInteger indexOfSelectedItem () 112 public NSInteger indexOfSelectedItem ()
106 { 113 {
107 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfSelectedItem); 114 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfSelectedItem);
108 } 115 }
109 116
110 public NSPopUpButtonCell initTextCell (NSString stringValue, bool pullDown) 117 public NSPopUpButtonCell initTextCell (NSString stringValue, bool pullDown)
111 { 118 {
112 objc.id result = OS.objc_msgSend(this.id, OS.sel_initTextCell_1pullsDown_1, stringValue !is null ? stringValue.id : null, pullDown); 119 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initTextCell_1pullsDown_1, stringValue !is null ? stringValue.id_ : null, pullDown);
113 return result !is null ? this : null; 120 return result !is null ? this : null;
114 } 121 }
115 122
116 public void insertItemWithTitle (NSString title, NSInteger index) 123 public void insertItemWithTitle (NSString title, NSInteger index)
117 { 124 {
118 OS.objc_msgSend(this.id, OS.sel_insertItemWithTitle_1atIndex_1, title !is null ? title.id : null, index); 125 OS.objc_msgSend(this.id_, OS.sel_insertItemWithTitle_1atIndex_1, title !is null ? title.id_ : null, index);
119 } 126 }
120 127
121 public NSArray itemArray () 128 public NSArray itemArray ()
122 { 129 {
123 objc.id result = OS.objc_msgSend(this.id, OS.sel_itemArray); 130 objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemArray);
124 return result !is null ? new NSArray(result) : null; 131 return result !is null ? new NSArray(result) : null;
125 } 132 }
126 133
127 public NSMenuItem itemAtIndex (NSInteger index) 134 public NSMenuItem itemAtIndex (NSInteger index)
128 { 135 {
129 objc.id result = OS.objc_msgSend(this.id, OS.sel_itemAtIndex_1, index); 136 objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemAtIndex_1, index);
130 return result !is null ? new NSMenuItem(result) : null; 137 return result !is null ? new NSMenuItem(result) : null;
131 } 138 }
132 139
133 public NSString itemTitleAtIndex (NSInteger index) 140 public NSString itemTitleAtIndex (NSInteger index)
134 { 141 {
135 objc.id result = OS.objc_msgSend(this.id, OS.sel_itemTitleAtIndex_1, index); 142 objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemTitleAtIndex_1, index);
136 return result !is null ? new NSString(result) : null; 143 return result !is null ? new NSString(result) : null;
137 } 144 }
138 145
139 public NSArray itemTitles () 146 public NSArray itemTitles ()
140 { 147 {
141 objc.id result = OS.objc_msgSend(this.id, OS.sel_itemTitles); 148 objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemTitles);
142 return result !is null ? new NSArray(result) : null; 149 return result !is null ? new NSArray(result) : null;
143 } 150 }
144 151
145 public NSMenuItem itemWithTitle (NSString title) 152 public NSMenuItem itemWithTitle (NSString title)
146 { 153 {
147 objc.id result = OS.objc_msgSend(this.id, OS.sel_itemWithTitle_1, title !is null ? title.id : null); 154 objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemWithTitle_1, title !is null ? title.id_ : null);
148 return result !is null ? new NSMenuItem(result) : null; 155 return result !is null ? new NSMenuItem(result) : null;
149 } 156 }
150 157
151 public NSMenuItem lastItem () 158 public NSMenuItem lastItem ()
152 { 159 {
153 objc.id result = OS.objc_msgSend(this.id, OS.sel_lastItem); 160 objc.id result = OS.objc_msgSend(this.id_, OS.sel_lastItem);
154 return result !is null ? new NSMenuItem(result) : null; 161 return result !is null ? new NSMenuItem(result) : null;
155 } 162 }
156 163
157 public NSMenu menu () 164 public NSMenu menu ()
158 { 165 {
159 objc.id result = OS.objc_msgSend(this.id, OS.sel_menu); 166 objc.id result = OS.objc_msgSend(this.id_, OS.sel_menu);
160 return result !is null ? new NSMenu(result) : null; 167 return result !is null ? new NSMenu(result) : null;
161 } 168 }
162 169
163 public NSInteger numberOfItems () 170 public NSInteger numberOfItems ()
164 { 171 {
165 return OS.objc_msgSend(this.id, OS.sel_numberOfItems); 172 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfItems);
166 } 173 }
167 174
168 public id objectValue () 175 public id objectValue ()
169 { 176 {
170 objc.id result = OS.objc_msgSend(this.id, OS.sel_objectValue); 177 objc.id result = OS.objc_msgSend(this.id_, OS.sel_objectValue);
171 return result !is null ? new id(result) : null; 178 return result !is null ? new id(result) : null;
172 } 179 }
173 180
174 public void performClickWithFrame (NSRect frame, NSView controlView) 181 public void performClickWithFrame (NSRect frame, NSView controlView)
175 { 182 {
176 OS.objc_msgSend(this.id, OS.sel_performClickWithFrame_1inView_1, frame, controlView !is null ? controlView.id : null); 183 OS.objc_msgSend(this.id_, OS.sel_performClickWithFrame_1inView_1, frame, controlView !is null ? controlView.id_ : null);
177 } 184 }
178 185
179 public NSRectEdge preferredEdge () 186 public NSRectEdge preferredEdge ()
180 { 187 {
181 return OS.objc_msgSend(this.id, OS.sel_preferredEdge); 188 return cast(NSRectEdge) OS.objc_msgSend(this.id_, OS.sel_preferredEdge);
182 } 189 }
183 190
184 public bool pullsDown () 191 public bool pullsDown ()
185 { 192 {
186 return OS.objc_msgSend(this.id, OS.sel_pullsDown) !is null; 193 return OS.objc_msgSend(this.id_, OS.sel_pullsDown) !is null;
187 } 194 }
188 195
189 public void removeAllItems () 196 public void removeAllItems ()
190 { 197 {
191 OS.objc_msgSend(this.id, OS.sel_removeAllItems); 198 OS.objc_msgSend(this.id_, OS.sel_removeAllItems);
192 } 199 }
193 200
194 public void removeItemAtIndex (NSInteger index) 201 public void removeItemAtIndex (NSInteger index)
195 { 202 {
196 OS.objc_msgSend(this.id, OS.sel_removeItemAtIndex_1, index); 203 OS.objc_msgSend(this.id_, OS.sel_removeItemAtIndex_1, index);
197 } 204 }
198 205
199 public void removeItemWithTitle (NSString title) 206 public void removeItemWithTitle (NSString title)
200 { 207 {
201 OS.objc_msgSend(this.id, OS.sel_removeItemWithTitle_1, title !is null ? title.id : null); 208 OS.objc_msgSend(this.id_, OS.sel_removeItemWithTitle_1, title !is null ? title.id_ : null);
202 } 209 }
203 210
204 public void selectItem (NSMenuItem item) 211 public void selectItem (NSMenuItem item)
205 { 212 {
206 OS.objc_msgSend(this.id, OS.sel_selectItem_1, item !is null ? item.id : null); 213 OS.objc_msgSend(this.id_, OS.sel_selectItem_1, item !is null ? item.id_ : null);
207 } 214 }
208 215
209 public void selectItemAtIndex (NSInteger index) 216 public void selectItemAtIndex (NSInteger index)
210 { 217 {
211 OS.objc_msgSend(this.id, OS.sel_selectItemAtIndex_1, index); 218 OS.objc_msgSend(this.id_, OS.sel_selectItemAtIndex_1, index);
212 } 219 }
213 220
214 public bool selectItemWithTag (NSInteger tag) 221 public bool selectItemWithTag (NSInteger tag)
215 { 222 {
216 return OS.objc_msgSend(this.id, OS.sel_selectItemWithTag_1, tag) !is null; 223 return OS.objc_msgSend(this.id_, OS.sel_selectItemWithTag_1, tag) !is null;
217 } 224 }
218 225
219 public void selectItemWithTitle (NSString title) 226 public void selectItemWithTitle (NSString title)
220 { 227 {
221 OS.objc_msgSend(this.id, OS.sel_selectItemWithTitle_1, title !is null ? title.id : null); 228 OS.objc_msgSend(this.id_, OS.sel_selectItemWithTitle_1, title !is null ? title.id_ : null);
222 } 229 }
223 230
224 public NSMenuItem selectedItem () 231 public NSMenuItem selectedItem ()
225 { 232 {
226 objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedItem); 233 objc.id result = OS.objc_msgSend(this.id_, OS.sel_selectedItem);
227 return result !is null ? new NSMenuItem(result) : null; 234 return result !is null ? new NSMenuItem(result) : null;
228 } 235 }
229 236
230 public void setAltersStateOfSelectedItem (bool flag) 237 public void setAltersStateOfSelectedItem (bool flag)
231 { 238 {
232 OS.objc_msgSend(this.id, OS.sel_setAltersStateOfSelectedItem_1, flag); 239 OS.objc_msgSend(this.id_, OS.sel_setAltersStateOfSelectedItem_1, flag);
233 } 240 }
234 241
235 public void setArrowPosition (NSPopUpArrowPosition position) 242 public void setArrowPosition (NSPopUpArrowPosition position)
236 { 243 {
237 OS.objc_msgSend(this.id, OS.sel_setArrowPosition_1, position); 244 OS.objc_msgSend(this.id_, OS.sel_setArrowPosition_1, position);
238 } 245 }
239 246
240 public void setAutoenablesItems (bool flag) 247 public void setAutoenablesItems (bool flag)
241 { 248 {
242 OS.objc_msgSend(this.id, OS.sel_setAutoenablesItems_1, flag); 249 OS.objc_msgSend(this.id_, OS.sel_setAutoenablesItems_1, flag);
243 } 250 }
244 251
245 public void setMenu (NSMenu menu) 252 public void setMenu (NSMenu menu)
246 { 253 {
247 OS.objc_msgSend(this.id, OS.sel_setMenu_1, menu !is null ? menu.id : null); 254 OS.objc_msgSend(this.id_, OS.sel_setMenu_1, menu !is null ? menu.id_ : null);
248 } 255 }
249 256
250 public void setObjectValue (id obj) 257 public void setObjectValue (id obj)
251 { 258 {
252 OS.objc_msgSend(this.id, OS.sel_setObjectValue_1, obj !is null ? obj.id : null); 259 OS.objc_msgSend(this.id_, OS.sel_setObjectValue_1, obj !is null ? obj.id_ : null);
253 } 260 }
254 261
255 public void setPreferredEdge (NSRectEdge edge) 262 public void setPreferredEdge (NSRectEdge edge)
256 { 263 {
257 OS.objc_msgSend(this.id, OS.sel_setPreferredEdge_1, edge); 264 OS.objc_msgSend(this.id_, OS.sel_setPreferredEdge_1, edge);
258 } 265 }
259 266
260 public void setPullsDown (bool flag) 267 public void setPullsDown (bool flag)
261 { 268 {
262 OS.objc_msgSend(this.id, OS.sel_setPullsDown_1, flag); 269 OS.objc_msgSend(this.id_, OS.sel_setPullsDown_1, flag);
263 } 270 }
264 271
265 public void setTitle (NSString aString) 272 public void setTitle (NSString aString)
266 { 273 {
267 OS.objc_msgSend(this.id, OS.sel_setTitle_1, aString !is null ? aString.id : null); 274 OS.objc_msgSend(this.id_, OS.sel_setTitle_1, aString !is null ? aString.id_ : null);
268 } 275 }
269 276
270 public void setUsesItemFromMenu (bool flag) 277 public void setUsesItemFromMenu (bool flag)
271 { 278 {
272 OS.objc_msgSend(this.id, OS.sel_setUsesItemFromMenu_1, flag); 279 OS.objc_msgSend(this.id_, OS.sel_setUsesItemFromMenu_1, flag);
273 } 280 }
274 281
275 public void synchronizeTitleAndSelectedItem () 282 public void synchronizeTitleAndSelectedItem ()
276 { 283 {
277 OS.objc_msgSend(this.id, OS.sel_synchronizeTitleAndSelectedItem); 284 OS.objc_msgSend(this.id_, OS.sel_synchronizeTitleAndSelectedItem);
278 } 285 }
279 286
280 public NSString titleOfSelectedItem () 287 public NSString titleOfSelectedItem ()
281 { 288 {
282 objc.id result = OS.objc_msgSend(this.id, OS.sel_titleOfSelectedItem); 289 objc.id result = OS.objc_msgSend(this.id_, OS.sel_titleOfSelectedItem);
283 return result !is null ? new NSString(result) : null; 290 return result !is null ? new NSString(result) : null;
284 } 291 }
285 292
286 public bool usesItemFromMenu () 293 public bool usesItemFromMenu ()
287 { 294 {
288 return OS.objc_msgSend(this.id, OS.sel_usesItemFromMenu) !is null; 295 return OS.objc_msgSend(this.id_, OS.sel_usesItemFromMenu) !is null;
289 } 296 }
290 297
291 } 298 }