Mercurial > projects > dstep
comparison dstep/appkit/NSMenuView.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.NSMenuView; | |
8 | |
9 import dstep.appkit.AppKitDefines; | |
10 import dstep.appkit.NSEvent; | |
11 import dstep.appkit.NSFont; | |
12 import dstep.appkit.NSMenu; | |
13 import dstep.appkit.NSMenuItem; | |
14 import dstep.appkit.NSMenuItemCell; | |
15 import dstep.appkit.NSScreen; | |
16 import dstep.appkit.NSView; | |
17 import dstep.applicationservices.coregraphics.CGBase; | |
18 import dstep.foundation.NSGeometry; | |
19 import dstep.foundation.NSNotification; | |
20 import dstep.foundation.NSObjCRuntime; | |
21 import dstep.internal.Version; | |
22 import dstep.objc.bridge.Bridge; | |
23 import dstep.objc.objc; | |
24 | |
25 static if (!D_LP64): | |
26 | |
27 class NSMenuView : NSView | |
28 { | |
29 mixin (ObjcWrap); | |
30 | |
31 static CGFloat menuBarHeight () | |
32 { | |
33 return invokeObjcSelfClass!(CGFloat, "menuBarHeight"); | |
34 } | |
35 | |
36 NSMenuView initWithFrame (NSRect frame) | |
37 { | |
38 return invokeObjcSelf!(NSMenuView, "initWithFrame:", NSRect)(frame); | |
39 } | |
40 | |
41 NSMenuView initAsTearOff () | |
42 { | |
43 return invokeObjcSelf!(NSMenuView, "initAsTearOff"); | |
44 } | |
45 | |
46 void setMenu (NSMenu menu) | |
47 { | |
48 return invokeObjcSelf!(NSMenuView, "setMenu:", NSMenu)(menu); | |
49 } | |
50 | |
51 NSMenu menu () | |
52 { | |
53 return invokeObjcSelf!(NSMenu, "menu"); | |
54 } | |
55 | |
56 void itemChanged (NSNotification notification) | |
57 { | |
58 return invokeObjcSelf!(void, "itemChanged:", NSNotification)(notification); | |
59 } | |
60 | |
61 void itemAdded (NSNotification notification) | |
62 { | |
63 return invokeObjcSelf!(void, "itemAdded:", NSNotification)(notification); | |
64 } | |
65 | |
66 void itemRemoved (NSNotification notification) | |
67 { | |
68 return invokeObjcSelf!(void, "itemRemoved:", NSNotification)(notification); | |
69 } | |
70 | |
71 void update () | |
72 { | |
73 return invokeObjcSelf!(void, "update"); | |
74 } | |
75 | |
76 void setHorizontal (bool flag) | |
77 { | |
78 return invokeObjcSelf!(void, "setHorizontal:", bool)(flag); | |
79 } | |
80 | |
81 bool isHorizontal () | |
82 { | |
83 return invokeObjcSelf!(bool, "isHorizontal"); | |
84 } | |
85 | |
86 void setFont (NSFont font) | |
87 { | |
88 return invokeObjcSelf!(void, "setFont:", NSFont)(font); | |
89 } | |
90 | |
91 NSFont font () | |
92 { | |
93 return invokeObjcSelf!(NSFont, "font"); | |
94 } | |
95 | |
96 NSRect innerRect () | |
97 { | |
98 return invokeObjcSelf!(NSRect, "innerRect"); | |
99 } | |
100 | |
101 NSRect rectOfItemAtIndex (NSInteger index) | |
102 { | |
103 return invokeObjcSelf!(NSRect, "rectOfItemAtIndex:", NSInteger)(index); | |
104 } | |
105 | |
106 NSInteger indexOfItemAtPoint (NSPoint point) | |
107 { | |
108 return invokeObjcSelf!(NSInteger, "indexOfItemAtPoint:", NSPoint)(point); | |
109 } | |
110 | |
111 void setNeedsDisplayForItemAtIndex (NSInteger index) | |
112 { | |
113 return invokeObjcSelf!(void, "setNeedsDisplayForItemAtIndex:", NSInteger)(index); | |
114 } | |
115 | |
116 void setHighlightedItemIndex (NSInteger index) | |
117 { | |
118 return invokeObjcSelf!(void, "setHighlightedItemIndex:", NSInteger)(index); | |
119 } | |
120 | |
121 NSInteger highlightedItemIndex () | |
122 { | |
123 return invokeObjcSelf!(NSInteger, "highlightedItemIndex"); | |
124 } | |
125 | |
126 CGFloat stateImageOffset () | |
127 { | |
128 return invokeObjcSelf!(CGFloat, "stateImageOffset"); | |
129 } | |
130 | |
131 CGFloat stateImageWidth () | |
132 { | |
133 return invokeObjcSelf!(CGFloat, "stateImageWidth"); | |
134 } | |
135 | |
136 CGFloat imageAndTitleOffset () | |
137 { | |
138 return invokeObjcSelf!(CGFloat, "imageAndTitleOffset"); | |
139 } | |
140 | |
141 CGFloat imageAndTitleWidth () | |
142 { | |
143 return invokeObjcSelf!(CGFloat, "imageAndTitleWidth"); | |
144 } | |
145 | |
146 CGFloat keyEquivalentOffset () | |
147 { | |
148 return invokeObjcSelf!(CGFloat, "keyEquivalentOffset"); | |
149 } | |
150 | |
151 CGFloat keyEquivalentWidth () | |
152 { | |
153 return invokeObjcSelf!(CGFloat, "keyEquivalentWidth"); | |
154 } | |
155 | |
156 void setMenuItemCell (NSMenuItemCell cell, NSInteger index) | |
157 { | |
158 return invokeObjcSelf!(void, "setMenuItemCell:forItemAtIndex:", NSMenuItemCell, NSInteger)(cell, index); | |
159 } | |
160 | |
161 NSMenuItemCell menuItemCellForItemAtIndex (NSInteger index) | |
162 { | |
163 return invokeObjcSelf!(NSMenuItemCell, "menuItemCellForItemAtIndex:", NSInteger)(index); | |
164 } | |
165 | |
166 NSMenuView attachedMenuView () | |
167 { | |
168 return invokeObjcSelf!(NSMenuView, "attachedMenuView"); | |
169 } | |
170 | |
171 void setNeedsSizing (bool flag) | |
172 { | |
173 return invokeObjcSelf!(void, "setNeedsSizing:", bool)(flag); | |
174 } | |
175 | |
176 bool needsSizing () | |
177 { | |
178 return invokeObjcSelf!(bool, "needsSizing"); | |
179 } | |
180 | |
181 void sizeToFit () | |
182 { | |
183 return invokeObjcSelf!(void, "sizeToFit"); | |
184 } | |
185 | |
186 NSMenu attachedMenu () | |
187 { | |
188 return invokeObjcSelf!(NSMenu, "attachedMenu"); | |
189 } | |
190 | |
191 bool isAttached () | |
192 { | |
193 return invokeObjcSelf!(bool, "isAttached"); | |
194 } | |
195 | |
196 bool isTornOff () | |
197 { | |
198 return invokeObjcSelf!(bool, "isTornOff"); | |
199 } | |
200 | |
201 NSPoint locationForSubmenu (NSMenu aSubmenu) | |
202 { | |
203 return invokeObjcSelf!(NSPoint, "locationForSubmenu:", NSMenu)(aSubmenu); | |
204 } | |
205 | |
206 void setWindowFrameForAttachingToRect (NSRect screenRect, NSScreen screen, NSRectEdge edge, NSInteger selectedItemIndex) | |
207 { | |
208 return invokeObjcSelf!(void, "setWindowFrameForAttachingToRect:onScreen:preferredEdge:popUpSelectedItem:", NSRect, NSScreen, NSRectEdge, NSInteger)(screenRect, screen, edge, selectedItemIndex); | |
209 } | |
210 | |
211 void detachSubmenu () | |
212 { | |
213 return invokeObjcSelf!(void, "detachSubmenu"); | |
214 } | |
215 | |
216 void attachSubmenuForItemAtIndex (NSInteger index) | |
217 { | |
218 return invokeObjcSelf!(void, "attachSubmenuForItemAtIndex:", NSInteger)(index); | |
219 } | |
220 | |
221 void performActionWithHighlightingForItemAtIndex (NSInteger index) | |
222 { | |
223 return invokeObjcSelf!(void, "performActionWithHighlightingForItemAtIndex:", NSInteger)(index); | |
224 } | |
225 | |
226 bool trackWithEvent (NSEvent event) | |
227 { | |
228 return invokeObjcSelf!(bool, "trackWithEvent:", NSEvent)(event); | |
229 } | |
230 | |
231 CGFloat horizontalEdgePadding () | |
232 { | |
233 return invokeObjcSelf!(CGFloat, "horizontalEdgePadding"); | |
234 } | |
235 | |
236 void setHorizontalEdgePadding (CGFloat pad) | |
237 { | |
238 return invokeObjcSelf!(void, "setHorizontalEdgePadding:", CGFloat)(pad); | |
239 } | |
240 } |