Mercurial > projects > dstep
comparison dstep/appkit/NSPopUpButtonCell.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children | b9de51448c6b |
comparison
equal
deleted
inserted
replaced
15:7ff919f595d5 | 16:19885b43130e |
---|---|
1 /** | |
2 * Copyright: Copyright (c) 2009 Jacob Carlborg. | |
3 * Authors: Jacob Carlborg | |
4 * Version: Initial created: Sep 24, 2009 | |
5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) | |
6 */ | |
7 module dstep.appkit.NSPopUpButtonCell; | |
8 | |
9 import dstep.appkit.NSMenu; | |
10 import dstep.appkit.NSMenuItem; | |
11 import dstep.appkit.NSMenuItemCell; | |
12 import dstep.appkit.NSView; | |
13 import dstep.foundation.NSArray; | |
14 import dstep.foundation.NSGeometry; | |
15 import dstep.foundation.NSObjCRuntime; | |
16 import dstep.foundation.NSString; | |
17 import dstep.objc.bridge.Bridge; | |
18 import dstep.objc.objc; | |
19 | |
20 import bindings = dstep.appkit.NSPopUpButtonCell_bindings; | |
21 | |
22 typedef NSUInteger NSPopUpArrowPosition; | |
23 | |
24 private | |
25 { | |
26 NSString NSPopUpButtonCellWillPopUpNotification_; | |
27 } | |
28 | |
29 NSString NSPopUpButtonCellWillPopUpNotification () | |
30 { | |
31 if (NSPopUpButtonCellWillPopUpNotification_) | |
32 return NSPopUpButtonCellWillPopUpNotification_; | |
33 | |
34 return NSPopUpButtonCellWillPopUpNotification_ = new NSString(bindings.NSPopUpButtonCellWillPopUpNotification); | |
35 } | |
36 | |
37 enum | |
38 { | |
39 NSPopUpNoArrow = 0, | |
40 NSPopUpArrowAtCenter = 1, | |
41 NSPopUpArrowAtBottom = 2 | |
42 } | |
43 | |
44 class NSPopUpButtonCell : NSMenuItemCell | |
45 { | |
46 mixin (ObjcWrap); | |
47 | |
48 NSPopUpButtonCell initTextCell (NSString stringValue, bool pullDown) | |
49 { | |
50 id result = invokeObjcSelf!(id, "initTextCell:pullsDown:", NSString, bool)(stringValue, pullDown); | |
51 return result is this.objcObject ? this : (result !is null ? new NSPopUpButtonCell(result) : null); | |
52 } | |
53 | |
54 this (NSString stringValue, bool pullDown) | |
55 { | |
56 super(NSPopUpButtonCell.alloc.initTextCell(stringValue, pullDown).objcObject); | |
57 } | |
58 | |
59 void setMenu (NSMenu menu) | |
60 { | |
61 return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu); | |
62 } | |
63 | |
64 NSMenu menu () | |
65 { | |
66 return invokeObjcSelf!(NSMenu, "menu"); | |
67 } | |
68 | |
69 void setPullsDown (bool flag) | |
70 { | |
71 return invokeObjcSelf!(void, "setPullsDown:", bool)(flag); | |
72 } | |
73 | |
74 bool pullsDown () | |
75 { | |
76 return invokeObjcSelf!(bool, "pullsDown"); | |
77 } | |
78 | |
79 void setAutoenablesItems (bool flag) | |
80 { | |
81 return invokeObjcSelf!(void, "setAutoenablesItems:", bool)(flag); | |
82 } | |
83 | |
84 bool autoenablesItems () | |
85 { | |
86 return invokeObjcSelf!(bool, "autoenablesItems"); | |
87 } | |
88 | |
89 void setPreferredEdge (int edge) | |
90 { | |
91 return invokeObjcSelf!(void, "setPreferredEdge:", int)(edge); | |
92 } | |
93 | |
94 int preferredEdge () | |
95 { | |
96 return invokeObjcSelf!(int, "preferredEdge"); | |
97 } | |
98 | |
99 void setUsesItemFromMenu (bool flag) | |
100 { | |
101 return invokeObjcSelf!(void, "setUsesItemFromMenu:", bool)(flag); | |
102 } | |
103 | |
104 bool usesItemFromMenu () | |
105 { | |
106 return invokeObjcSelf!(bool, "usesItemFromMenu"); | |
107 } | |
108 | |
109 void setAltersStateOfSelectedItem (bool flag) | |
110 { | |
111 return invokeObjcSelf!(void, "setAltersStateOfSelectedItem:", bool)(flag); | |
112 } | |
113 | |
114 bool altersStateOfSelectedItem () | |
115 { | |
116 return invokeObjcSelf!(bool, "altersStateOfSelectedItem"); | |
117 } | |
118 | |
119 void addItemWithTitle (NSString title) | |
120 { | |
121 return invokeObjcSelf!(void, "addItemWithTitle:", NSString)(title); | |
122 } | |
123 | |
124 void addItemsWithTitles (NSArray itemTitles) | |
125 { | |
126 return invokeObjcSelf!(void, "addItemsWithTitles:", NSArray)(itemTitles); | |
127 } | |
128 | |
129 void insertItemWithTitle (NSString title, NSInteger index) | |
130 { | |
131 return invokeObjcSelf!(void, "insertItemWithTitle:atIndex:", NSString, NSInteger)(title, index); | |
132 } | |
133 | |
134 void removeItemWithTitle (NSString title) | |
135 { | |
136 return invokeObjcSelf!(void, "removeItemWithTitle:", NSString)(title); | |
137 } | |
138 | |
139 void removeItemAtIndex (NSInteger index) | |
140 { | |
141 return invokeObjcSelf!(void, "removeItemAtIndex:", NSInteger)(index); | |
142 } | |
143 | |
144 void removeAllItems () | |
145 { | |
146 return invokeObjcSelf!(void, "removeAllItems"); | |
147 } | |
148 | |
149 NSArray itemArray () | |
150 { | |
151 return invokeObjcSelf!(NSArray, "itemArray"); | |
152 } | |
153 | |
154 NSInteger numberOfItems () | |
155 { | |
156 return invokeObjcSelf!(NSInteger, "numberOfItems"); | |
157 } | |
158 | |
159 NSInteger indexOfItem (NSMenuItem item) | |
160 { | |
161 return invokeObjcSelf!(NSInteger, "indexOfItem:", NSMenuItem)(item); | |
162 } | |
163 | |
164 NSInteger indexOfItemWithTitle (NSString title) | |
165 { | |
166 return invokeObjcSelf!(NSInteger, "indexOfItemWithTitle:", NSString)(title); | |
167 } | |
168 | |
169 NSInteger indexOfItemWithTag (NSInteger tag) | |
170 { | |
171 return invokeObjcSelf!(NSInteger, "indexOfItemWithTag:", NSInteger)(tag); | |
172 } | |
173 | |
174 NSInteger indexOfItemWithRepresentedObject (Object obj) | |
175 { | |
176 return invokeObjcSelf!(NSInteger, "indexOfItemWithRepresentedObject:", Object)(obj); | |
177 } | |
178 | |
179 NSInteger indexOfItemWithTarget (Object target, SEL actionSelector) | |
180 { | |
181 return invokeObjcSelf!(NSInteger, "indexOfItemWithTarget:andAction:", Object, SEL)(target, actionSelector); | |
182 } | |
183 | |
184 NSMenuItem itemAtIndex (NSInteger index) | |
185 { | |
186 return invokeObjcSelf!(NSMenuItem, "itemAtIndex:", NSInteger)(index); | |
187 } | |
188 | |
189 NSMenuItem itemWithTitle (NSString title) | |
190 { | |
191 return invokeObjcSelf!(NSMenuItem, "itemWithTitle:", NSString)(title); | |
192 } | |
193 | |
194 NSMenuItem lastItem () | |
195 { | |
196 return invokeObjcSelf!(NSMenuItem, "lastItem"); | |
197 } | |
198 | |
199 void selectItem (NSMenuItem item) | |
200 { | |
201 return invokeObjcSelf!(void, "selectItem:", NSMenuItem)(item); | |
202 } | |
203 | |
204 void selectItemAtIndex (NSInteger index) | |
205 { | |
206 return invokeObjcSelf!(void, "selectItemAtIndex:", NSInteger)(index); | |
207 } | |
208 | |
209 void selectItemWithTitle (NSString title) | |
210 { | |
211 return invokeObjcSelf!(void, "selectItemWithTitle:", NSString)(title); | |
212 } | |
213 | |
214 bool selectItemWithTag (NSInteger tag) | |
215 { | |
216 return invokeObjcSelf!(bool, "selectItemWithTag:", NSInteger)(tag); | |
217 } | |
218 | |
219 void setTitle (NSString aString) | |
220 { | |
221 return invokeObjcSelf!(void, "setTitle:", NSString)(aString); | |
222 } | |
223 | |
224 NSMenuItem selectedItem () | |
225 { | |
226 return invokeObjcSelf!(NSMenuItem, "selectedItem"); | |
227 } | |
228 | |
229 NSInteger indexOfSelectedItem () | |
230 { | |
231 return invokeObjcSelf!(NSInteger, "indexOfSelectedItem"); | |
232 } | |
233 | |
234 void synchronizeTitleAndSelectedItem () | |
235 { | |
236 return invokeObjcSelf!(void, "synchronizeTitleAndSelectedItem"); | |
237 } | |
238 | |
239 NSString itemTitleAtIndex (NSInteger index) | |
240 { | |
241 return invokeObjcSelf!(NSString, "itemTitleAtIndex:", NSInteger)(index); | |
242 } | |
243 | |
244 NSArray itemTitles () | |
245 { | |
246 return invokeObjcSelf!(NSArray, "itemTitles"); | |
247 } | |
248 | |
249 NSString titleOfSelectedItem () | |
250 { | |
251 return invokeObjcSelf!(NSString, "titleOfSelectedItem"); | |
252 } | |
253 | |
254 void attachPopUpWithFrame (NSRect cellFrame, NSView controlView) | |
255 { | |
256 return invokeObjcSelf!(void, "attachPopUpWithFrame:inView:", NSRect, NSView)(cellFrame, controlView); | |
257 } | |
258 | |
259 void dismissPopUp () | |
260 { | |
261 return invokeObjcSelf!(void, "dismissPopUp"); | |
262 } | |
263 | |
264 void performClickWithFrame (NSRect frame, NSView controlView) | |
265 { | |
266 return invokeObjcSelf!(void, "performClickWithFrame:inView:", NSRect, NSView)(frame, controlView); | |
267 } | |
268 | |
269 uint arrowPosition () | |
270 { | |
271 return invokeObjcSelf!(uint, "arrowPosition"); | |
272 } | |
273 | |
274 void setArrowPosition (uint position) | |
275 { | |
276 return invokeObjcSelf!(void, "setArrowPosition:", uint)(position); | |
277 } | |
278 | |
279 Object objectValue () | |
280 { | |
281 return invokeObjcSelf!(Object, "objectValue"); | |
282 } | |
283 | |
284 void setObjectValue (Object obj) | |
285 { | |
286 return invokeObjcSelf!(void, "setObjectValue:", Object)(obj); | |
287 } | |
288 } | |
289 |