Mercurial > projects > dstep
comparison dstep/appkit/NSPopUpButton.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.NSPopUpButton; | |
8 | |
9 import dstep.appkit.NSButton; | |
10 import dstep.appkit.NSMenu; | |
11 import dstep.appkit.NSMenuItem; | |
12 import dstep.appkit.NSMenuItemCell; | |
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.NSPopUpButton_bindings; | |
21 | |
22 private | |
23 { | |
24 NSString NSPopUpButtonWillPopUpNotification_; | |
25 } | |
26 | |
27 NSString NSPopUpButtonWillPopUpNotification () | |
28 { | |
29 if (NSPopUpButtonWillPopUpNotification_) | |
30 return NSPopUpButtonWillPopUpNotification_; | |
31 | |
32 return NSPopUpButtonWillPopUpNotification_ = new NSString(bindings.NSPopUpButtonWillPopUpNotification); | |
33 } | |
34 | |
35 class NSPopUpButton : NSButton | |
36 { | |
37 mixin (ObjcWrap); | |
38 | |
39 NSPopUpButton initWithFrame (NSRect buttonFrame, bool flag) | |
40 { | |
41 id result = invokeObjcSelf!(id, "initWithFrame:pullsDown:", NSRect, bool)(buttonFrame, flag); | |
42 return result is this.objcObject ? this : (result !is null ? new NSPopUpButton(result) : null); | |
43 } | |
44 | |
45 this (NSRect buttonFrame, bool flag) | |
46 { | |
47 super(NSPopUpButton.alloc.initWithFrame(buttonFrame, flag).objcObject); | |
48 } | |
49 | |
50 void setMenu (NSMenu menu) | |
51 { | |
52 return invokeObjcSelf!(void, "setMenu:", NSMenu)(menu); | |
53 } | |
54 | |
55 NSMenu menu () | |
56 { | |
57 return invokeObjcSelf!(NSMenu, "menu"); | |
58 } | |
59 | |
60 void setPullsDown (bool flag) | |
61 { | |
62 return invokeObjcSelf!(void, "setPullsDown:", bool)(flag); | |
63 } | |
64 | |
65 bool pullsDown () | |
66 { | |
67 return invokeObjcSelf!(bool, "pullsDown"); | |
68 } | |
69 | |
70 void setAutoenablesItems (bool flag) | |
71 { | |
72 return invokeObjcSelf!(void, "setAutoenablesItems:", bool)(flag); | |
73 } | |
74 | |
75 bool autoenablesItems () | |
76 { | |
77 return invokeObjcSelf!(bool, "autoenablesItems"); | |
78 } | |
79 | |
80 void setPreferredEdge (int edge) | |
81 { | |
82 return invokeObjcSelf!(void, "setPreferredEdge:", int)(edge); | |
83 } | |
84 | |
85 int preferredEdge () | |
86 { | |
87 return invokeObjcSelf!(int, "preferredEdge"); | |
88 } | |
89 | |
90 void addItemWithTitle (NSString title) | |
91 { | |
92 return invokeObjcSelf!(void, "addItemWithTitle:", NSString)(title); | |
93 } | |
94 | |
95 void addItemsWithTitles (NSArray itemTitles) | |
96 { | |
97 return invokeObjcSelf!(void, "addItemsWithTitles:", NSArray)(itemTitles); | |
98 } | |
99 | |
100 void insertItemWithTitle (NSString title, NSInteger index) | |
101 { | |
102 return invokeObjcSelf!(void, "insertItemWithTitle:atIndex:", NSString, NSInteger)(title, index); | |
103 } | |
104 | |
105 void removeItemWithTitle (NSString title) | |
106 { | |
107 return invokeObjcSelf!(void, "removeItemWithTitle:", NSString)(title); | |
108 } | |
109 | |
110 void removeItemAtIndex (NSInteger index) | |
111 { | |
112 return invokeObjcSelf!(void, "removeItemAtIndex:", NSInteger)(index); | |
113 } | |
114 | |
115 void removeAllItems () | |
116 { | |
117 return invokeObjcSelf!(void, "removeAllItems"); | |
118 } | |
119 | |
120 NSArray itemArray () | |
121 { | |
122 return invokeObjcSelf!(NSArray, "itemArray"); | |
123 } | |
124 | |
125 NSInteger numberOfItems () | |
126 { | |
127 return invokeObjcSelf!(NSInteger, "numberOfItems"); | |
128 } | |
129 | |
130 NSInteger indexOfItem (NSMenuItem item) | |
131 { | |
132 return invokeObjcSelf!(NSInteger, "indexOfItem:", NSMenuItem)(item); | |
133 } | |
134 | |
135 NSInteger indexOfItemWithTitle (NSString title) | |
136 { | |
137 return invokeObjcSelf!(NSInteger, "indexOfItemWithTitle:", NSString)(title); | |
138 } | |
139 | |
140 NSInteger indexOfItemWithTag (NSInteger tag) | |
141 { | |
142 return invokeObjcSelf!(NSInteger, "indexOfItemWithTag:", NSInteger)(tag); | |
143 } | |
144 | |
145 NSInteger indexOfItemWithRepresentedObject (Object obj) | |
146 { | |
147 return invokeObjcSelf!(NSInteger, "indexOfItemWithRepresentedObject:", Object)(obj); | |
148 } | |
149 | |
150 NSInteger indexOfItemWithTarget (Object target, SEL actionSelector) | |
151 { | |
152 return invokeObjcSelf!(NSInteger, "indexOfItemWithTarget:andAction:", Object, SEL)(target, actionSelector); | |
153 } | |
154 | |
155 NSMenuItem itemAtIndex (NSInteger index) | |
156 { | |
157 return invokeObjcSelf!(NSMenuItem, "itemAtIndex:", NSInteger)(index); | |
158 } | |
159 | |
160 NSMenuItem itemWithTitle (NSString title) | |
161 { | |
162 return invokeObjcSelf!(NSMenuItem, "itemWithTitle:", NSString)(title); | |
163 } | |
164 | |
165 NSMenuItem lastItem () | |
166 { | |
167 return invokeObjcSelf!(NSMenuItem, "lastItem"); | |
168 } | |
169 | |
170 void selectItem (NSMenuItem item) | |
171 { | |
172 return invokeObjcSelf!(void, "selectItem:", NSMenuItem)(item); | |
173 } | |
174 | |
175 void selectItemAtIndex (NSInteger index) | |
176 { | |
177 return invokeObjcSelf!(void, "selectItemAtIndex:", NSInteger)(index); | |
178 } | |
179 | |
180 void selectItemWithTitle (NSString title) | |
181 { | |
182 return invokeObjcSelf!(void, "selectItemWithTitle:", NSString)(title); | |
183 } | |
184 | |
185 bool selectItemWithTag (NSInteger tag) | |
186 { | |
187 return invokeObjcSelf!(bool, "selectItemWithTag:", NSInteger)(tag); | |
188 } | |
189 | |
190 void setTitle (NSString aString) | |
191 { | |
192 return invokeObjcSelf!(void, "setTitle:", NSString)(aString); | |
193 } | |
194 | |
195 NSMenuItem selectedItem () | |
196 { | |
197 return invokeObjcSelf!(NSMenuItem, "selectedItem"); | |
198 } | |
199 | |
200 NSInteger indexOfSelectedItem () | |
201 { | |
202 return invokeObjcSelf!(NSInteger, "indexOfSelectedItem"); | |
203 } | |
204 | |
205 void synchronizeTitleAndSelectedItem () | |
206 { | |
207 return invokeObjcSelf!(void, "synchronizeTitleAndSelectedItem"); | |
208 } | |
209 | |
210 NSString itemTitleAtIndex (NSInteger index) | |
211 { | |
212 return invokeObjcSelf!(NSString, "itemTitleAtIndex:", NSInteger)(index); | |
213 } | |
214 | |
215 NSArray itemTitles () | |
216 { | |
217 return invokeObjcSelf!(NSArray, "itemTitles"); | |
218 } | |
219 | |
220 NSString titleOfSelectedItem () | |
221 { | |
222 return invokeObjcSelf!(NSString, "titleOfSelectedItem"); | |
223 } | |
224 } | |
225 |