Mercurial > projects > dwt-mac
comparison dwt/internal/cocoa/NSPopUpButton.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.NSPopUpButton; | 14 module dwt.internal.cocoa.NSPopUpButton; |
15 | 15 |
16 import dwt.internal.cocoa.id; | |
16 import dwt.internal.cocoa.NSArray; | 17 import dwt.internal.cocoa.NSArray; |
17 import dwt.internal.cocoa.NSButton; | 18 import dwt.internal.cocoa.NSButton; |
18 import dwt.internal.cocoa.NSInteger; | 19 import dwt.internal.cocoa.NSInteger; |
19 import dwt.internal.cocoa.NSMenu; | 20 import dwt.internal.cocoa.NSMenu; |
20 import dwt.internal.cocoa.NSMenuItem; | 21 import dwt.internal.cocoa.NSMenuItem; |
36 super(id); | 37 super(id); |
37 } | 38 } |
38 | 39 |
39 public void addItemWithTitle (NSString title) | 40 public void addItemWithTitle (NSString title) |
40 { | 41 { |
41 OS.objc_msgSend(this.id, OS.sel_addItemWithTitle_1, title !is null ? title.id : null); | 42 OS.objc_msgSend(this.id_, OS.sel_addItemWithTitle_1, title !is null ? title.id_ : null); |
42 } | 43 } |
43 | 44 |
44 public void addItemsWithTitles (NSArray itemTitles) | 45 public void addItemsWithTitles (NSArray itemTitles) |
45 { | 46 { |
46 OS.objc_msgSend(this.id, OS.sel_addItemsWithTitles_1, itemTitles !is null ? itemTitles.id : null); | 47 OS.objc_msgSend(this.id_, OS.sel_addItemsWithTitles_1, itemTitles !is null ? itemTitles.id_ : null); |
47 } | 48 } |
48 | 49 |
49 public bool autoenablesItems () | 50 public bool autoenablesItems () |
50 { | 51 { |
51 return OS.objc_msgSend(this.id, OS.sel_autoenablesItems) !is null; | 52 return OS.objc_msgSend(this.id_, OS.sel_autoenablesItems) !is null; |
52 } | 53 } |
53 | 54 |
54 public NSInteger indexOfItem (NSMenuItem item) | 55 public NSInteger indexOfItem (NSMenuItem item) |
55 { | 56 { |
56 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItem_1, item !is null ? item.id : null); | 57 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItem_1, item !is null ? item.id_ : null); |
57 } | 58 } |
58 | 59 |
59 public NSInteger indexOfItemWithRepresentedObject (id obj) | 60 public NSInteger indexOfItemWithRepresentedObject (id obj) |
60 { | 61 { |
61 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithRepresentedObject_1, obj !is null ? obj.id : null); | 62 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItemWithRepresentedObject_1, obj !is null ? obj.id_ : null); |
62 } | 63 } |
63 | 64 |
64 public NSInteger indexOfItemWithTag (NSInteger tag) | 65 public NSInteger indexOfItemWithTag (NSInteger tag) |
65 { | 66 { |
66 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithTag_1, tag); | 67 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItemWithTag_1, tag); |
67 } | 68 } |
68 | 69 |
69 public NSInteger indexOfItemWithTarget (id target, objc.SEL actionSelector) | 70 public NSInteger indexOfItemWithTarget (id target, objc.SEL actionSelector) |
70 { | 71 { |
71 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithTarget_1andAction_1, target !is null ? target.id : null, actionSelector); | 72 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItemWithTarget_1andAction_1, target !is null ? target.id_ : null, actionSelector); |
72 } | 73 } |
73 | 74 |
74 public NSInteger indexOfItemWithTitle (NSString title) | 75 public NSInteger indexOfItemWithTitle (NSString title) |
75 { | 76 { |
76 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfItemWithTitle_1, title !is null ? title.id : null); | 77 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItemWithTitle_1, title !is null ? title.id_ : null); |
77 } | 78 } |
78 | 79 |
79 public NSInteger indexOfSelectedItem () | 80 public NSInteger indexOfSelectedItem () |
80 { | 81 { |
81 return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_indexOfSelectedItem); | 82 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfSelectedItem); |
82 } | 83 } |
83 | 84 |
84 public NSPopUpButton initWithFrame (NSRect buttonFrame, bool flag) | 85 public NSPopUpButton initWithFrame (NSRect buttonFrame, bool flag) |
85 { | 86 { |
86 objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithFrame_1pullsDown_1, buttonFrame, flag); | 87 objc.id result = OS.objc_msgSend(this.id_, OS.sel_initWithFrame_1pullsDown_1, buttonFrame, flag); |
87 return result !is null ? this : null; | 88 return result !is null ? this : null; |
88 } | 89 } |
89 | 90 |
90 public void insertItemWithTitle (NSString title, NSInteger index) | 91 public void insertItemWithTitle (NSString title, NSInteger index) |
91 { | 92 { |
92 OS.objc_msgSend(this.id, OS.sel_insertItemWithTitle_1atIndex_1, title !is null ? title.id : null, index); | 93 OS.objc_msgSend(this.id_, OS.sel_insertItemWithTitle_1atIndex_1, title !is null ? title.id_ : null, index); |
93 } | 94 } |
94 | 95 |
95 public NSArray itemArray () | 96 public NSArray itemArray () |
96 { | 97 { |
97 objc.id result = OS.objc_msgSend(this.id, OS.sel_itemArray); | 98 objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemArray); |
98 return result !is null ? new NSArray(result) : null; | 99 return result !is null ? new NSArray(result) : null; |
99 } | 100 } |
100 | 101 |
101 public NSMenuItem itemAtIndex (NSInteger index) | 102 public NSMenuItem itemAtIndex (NSInteger index) |
102 { | 103 { |
103 objc.id result = OS.objc_msgSend(this.id, OS.sel_itemAtIndex_1, index); | 104 objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemAtIndex_1, index); |
104 return result !is null ? new NSMenuItem(result) : null; | 105 return result !is null ? new NSMenuItem(result) : null; |
105 } | 106 } |
106 | 107 |
107 public NSString itemTitleAtIndex (NSInteger index) | 108 public NSString itemTitleAtIndex (NSInteger index) |
108 { | 109 { |
109 objc.id result = OS.objc_msgSend(this.id, OS.sel_itemTitleAtIndex_1, index); | 110 objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemTitleAtIndex_1, index); |
110 return result !is null ? new NSString(result) : null; | 111 return result !is null ? new NSString(result) : null; |
111 } | 112 } |
112 | 113 |
113 public NSArray itemTitles () | 114 public NSArray itemTitles () |
114 { | 115 { |
115 objc.id result = OS.objc_msgSend(this.id, OS.sel_itemTitles); | 116 objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemTitles); |
116 return result !is null ? new NSArray(result) : null; | 117 return result !is null ? new NSArray(result) : null; |
117 } | 118 } |
118 | 119 |
119 public NSMenuItem itemWithTitle (NSString title) | 120 public NSMenuItem itemWithTitle (NSString title) |
120 { | 121 { |
121 objc.id result = OS.objc_msgSend(this.id, OS.sel_itemWithTitle_1, title !is null ? title.id : null); | 122 objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemWithTitle_1, title !is null ? title.id_ : null); |
122 return result !is null ? new NSMenuItem(result) : null; | 123 return result !is null ? new NSMenuItem(result) : null; |
123 } | 124 } |
124 | 125 |
125 public NSMenuItem lastItem () | 126 public NSMenuItem lastItem () |
126 { | 127 { |
127 objc.id result = OS.objc_msgSend(this.id, OS.sel_lastItem); | 128 objc.id result = OS.objc_msgSend(this.id_, OS.sel_lastItem); |
128 return result !is null ? new NSMenuItem(result) : null; | 129 return result !is null ? new NSMenuItem(result) : null; |
129 } | 130 } |
130 | 131 |
131 public NSMenu menu () | 132 public NSMenu menu () |
132 { | 133 { |
133 objc.id result = OS.objc_msgSend(this.id, OS.sel_menu); | 134 objc.id result = OS.objc_msgSend(this.id_, OS.sel_menu); |
134 return result !is null ? new NSMenu(result) : null; | 135 return result !is null ? new NSMenu(result) : null; |
135 } | 136 } |
136 | 137 |
137 public NSInteger numberOfItems () | 138 public NSInteger numberOfItems () |
138 { | 139 { |
139 return OS.objc_msgSend(this.id, OS.sel_numberOfItems); | 140 return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfItems); |
140 } | 141 } |
141 | 142 |
142 public NSRectEdge preferredEdge () | 143 public NSRectEdge preferredEdge () |
143 { | 144 { |
144 return OS.objc_msgSend(this.id, OS.sel_preferredEdge); | 145 return cast(NSRectEdge) OS.objc_msgSend(this.id_, OS.sel_preferredEdge); |
145 } | 146 } |
146 | 147 |
147 public bool pullsDown () | 148 public bool pullsDown () |
148 { | 149 { |
149 return OS.objc_msgSend(this.id, OS.sel_pullsDown) !is null; | 150 return OS.objc_msgSend(this.id_, OS.sel_pullsDown) !is null; |
150 } | 151 } |
151 | 152 |
152 public void removeAllItems () | 153 public void removeAllItems () |
153 { | 154 { |
154 OS.objc_msgSend(this.id, OS.sel_removeAllItems); | 155 OS.objc_msgSend(this.id_, OS.sel_removeAllItems); |
155 } | 156 } |
156 | 157 |
157 public void removeItemAtIndex (NSInteger index) | 158 public void removeItemAtIndex (NSInteger index) |
158 { | 159 { |
159 OS.objc_msgSend(this.id, OS.sel_removeItemAtIndex_1, index); | 160 OS.objc_msgSend(this.id_, OS.sel_removeItemAtIndex_1, index); |
160 } | 161 } |
161 | 162 |
162 public void removeItemWithTitle (NSString title) | 163 public void removeItemWithTitle (NSString title) |
163 { | 164 { |
164 OS.objc_msgSend(this.id, OS.sel_removeItemWithTitle_1, title !is null ? title.id : null); | 165 OS.objc_msgSend(this.id_, OS.sel_removeItemWithTitle_1, title !is null ? title.id_ : null); |
165 } | 166 } |
166 | 167 |
167 public void selectItem (NSMenuItem item) | 168 public void selectItem (NSMenuItem item) |
168 { | 169 { |
169 OS.objc_msgSend(this.id, OS.sel_selectItem_1, item !is null ? item.id : null); | 170 OS.objc_msgSend(this.id_, OS.sel_selectItem_1, item !is null ? item.id_ : null); |
170 } | 171 } |
171 | 172 |
172 public void selectItemAtIndex (NSInteger index) | 173 public void selectItemAtIndex (NSInteger index) |
173 { | 174 { |
174 OS.objc_msgSend(this.id, OS.sel_selectItemAtIndex_1, index); | 175 OS.objc_msgSend(this.id_, OS.sel_selectItemAtIndex_1, index); |
175 } | 176 } |
176 | 177 |
177 public bool selectItemWithTag (NSInteger tag) | 178 public bool selectItemWithTag (NSInteger tag) |
178 { | 179 { |
179 return OS.objc_msgSend(this.id, OS.sel_selectItemWithTag_1, tag) !is null; | 180 return OS.objc_msgSend(this.id_, OS.sel_selectItemWithTag_1, tag) !is null; |
180 } | 181 } |
181 | 182 |
182 public void selectItemWithTitle (NSString title) | 183 public void selectItemWithTitle (NSString title) |
183 { | 184 { |
184 OS.objc_msgSend(this.id, OS.sel_selectItemWithTitle_1, title !is null ? title.id : null); | 185 OS.objc_msgSend(this.id_, OS.sel_selectItemWithTitle_1, title !is null ? title.id_ : null); |
185 } | 186 } |
186 | 187 |
187 public NSMenuItem selectedItem () | 188 public NSMenuItem selectedItem () |
188 { | 189 { |
189 objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedItem); | 190 objc.id result = OS.objc_msgSend(this.id_, OS.sel_selectedItem); |
190 return result !is null ? new NSMenuItem(result) : null; | 191 return result !is null ? new NSMenuItem(result) : null; |
191 } | 192 } |
192 | 193 |
193 public void setAutoenablesItems (bool flag) | 194 public void setAutoenablesItems (bool flag) |
194 { | 195 { |
195 OS.objc_msgSend(this.id, OS.sel_setAutoenablesItems_1, flag); | 196 OS.objc_msgSend(this.id_, OS.sel_setAutoenablesItems_1, flag); |
196 } | 197 } |
197 | 198 |
198 public void setMenu (NSMenu menu) | 199 public void setMenu (NSMenu menu) |
199 { | 200 { |
200 OS.objc_msgSend(this.id, OS.sel_setMenu_1, menu !is null ? menu.id : null); | 201 OS.objc_msgSend(this.id_, OS.sel_setMenu_1, menu !is null ? menu.id_ : null); |
201 } | 202 } |
202 | 203 |
203 public void setPreferredEdge (NSRectEdge edge) | 204 public void setPreferredEdge (NSRectEdge edge) |
204 { | 205 { |
205 OS.objc_msgSend(this.id, OS.sel_setPreferredEdge_1, edge); | 206 OS.objc_msgSend(this.id_, OS.sel_setPreferredEdge_1, edge); |
206 } | 207 } |
207 | 208 |
208 public void setPullsDown (bool flag) | 209 public void setPullsDown (bool flag) |
209 { | 210 { |
210 OS.objc_msgSend(this.id, OS.sel_setPullsDown_1, flag); | 211 OS.objc_msgSend(this.id_, OS.sel_setPullsDown_1, flag); |
211 } | 212 } |
212 | 213 |
213 public void setTitle (NSString aString) | 214 public void setTitle (NSString aString) |
214 { | 215 { |
215 OS.objc_msgSend(this.id, OS.sel_setTitle_1, aString !is null ? aString.id : null); | 216 OS.objc_msgSend(this.id_, OS.sel_setTitle_1, aString !is null ? aString.id_ : null); |
216 } | 217 } |
217 | 218 |
218 public void synchronizeTitleAndSelectedItem () | 219 public void synchronizeTitleAndSelectedItem () |
219 { | 220 { |
220 OS.objc_msgSend(this.id, OS.sel_synchronizeTitleAndSelectedItem); | 221 OS.objc_msgSend(this.id_, OS.sel_synchronizeTitleAndSelectedItem); |
221 } | 222 } |
222 | 223 |
223 public NSString titleOfSelectedItem () | 224 public NSString titleOfSelectedItem () |
224 { | 225 { |
225 objc.id result = OS.objc_msgSend(this.id, OS.sel_titleOfSelectedItem); | 226 objc.id result = OS.objc_msgSend(this.id_, OS.sel_titleOfSelectedItem); |
226 return result !is null ? new NSString(result) : null; | 227 return result !is null ? new NSString(result) : null; |
227 } | 228 } |
228 | 229 |
229 } | 230 } |