comparison dstep/appkit/NSSplitView.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.NSSplitView;
8
9 import dstep.appkit.NSColor;
10 import dstep.appkit.NSView;
11 import dstep.applicationservices.coregraphics.CGBase;
12 import dstep.foundation.NSGeometry;
13 import dstep.foundation.NSNotification;
14 import dstep.foundation.NSObjCRuntime;
15 import dstep.foundation.NSString;
16 import dstep.objc.bridge.Bridge;
17 import dstep.objc.objc;
18
19 import bindings = dstep.appkit.NSSplitView_bindings;
20
21 alias NSInteger NSSplitViewDividerStyle;
22
23 private
24 {
25 NSString NSSplitViewWillResizeSubviewsNotification_;
26 NSString NSSplitViewDidResizeSubviewsNotification_;
27 }
28
29 NSString NSSplitViewWillResizeSubviewsNotification ()
30 {
31 if (NSSplitViewWillResizeSubviewsNotification_)
32 return NSSplitViewWillResizeSubviewsNotification_;
33
34 return NSSplitViewWillResizeSubviewsNotification_ = new NSString(bindings.NSSplitViewWillResizeSubviewsNotification);
35 }
36
37 NSString NSSplitViewDidResizeSubviewsNotification ()
38 {
39 if (NSSplitViewDidResizeSubviewsNotification_)
40 return NSSplitViewDidResizeSubviewsNotification_;
41
42 return NSSplitViewDidResizeSubviewsNotification_ = new NSString(bindings.NSSplitViewDidResizeSubviewsNotification);
43 }
44
45 enum
46 {
47 NSSplitViewDividerStyleThick = 1,
48 NSSplitViewDividerStyleThin
49 }
50
51 class NSSplitView : NSView
52 {
53 mixin (ObjcWrap);
54
55 void setVertical (bool flag)
56 {
57 return invokeObjcSelf!(void, "setVertical:", bool)(flag);
58 }
59
60 bool isVertical ()
61 {
62 return invokeObjcSelf!(bool, "isVertical");
63 }
64
65 void setDividerStyle (int dividerStyle)
66 {
67 return invokeObjcSelf!(void, "setDividerStyle:", int)(dividerStyle);
68 }
69
70 int dividerStyle ()
71 {
72 return invokeObjcSelf!(int, "dividerStyle");
73 }
74
75 void setAutosaveName (NSString autosaveName)
76 {
77 return invokeObjcSelf!(void, "setAutosaveName:", NSString)(autosaveName);
78 }
79
80 NSString autosaveName ()
81 {
82 return invokeObjcSelf!(NSString, "autosaveName");
83 }
84
85 void setDelegate (Object delegate_)
86 {
87 return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_);
88 }
89
90 Object delegate_ ()
91 {
92 return invokeObjcSelf!(Object, "delegate");
93 }
94
95 void drawDividerInRect (NSRect rect)
96 {
97 return invokeObjcSelf!(void, "drawDividerInRect:", NSRect)(rect);
98 }
99
100 NSColor dividerColor ()
101 {
102 return invokeObjcSelf!(NSColor, "dividerColor");
103 }
104
105 CGFloat dividerThickness ()
106 {
107 return invokeObjcSelf!(CGFloat, "dividerThickness");
108 }
109
110 void adjustSubviews ()
111 {
112 return invokeObjcSelf!(void, "adjustSubviews");
113 }
114
115 bool isSubviewCollapsed (NSView subview)
116 {
117 return invokeObjcSelf!(bool, "isSubviewCollapsed:", NSView)(subview);
118 }
119
120 CGFloat minPossiblePositionOfDividerAtIndex (NSInteger dividerIndex)
121 {
122 return invokeObjcSelf!(CGFloat, "minPossiblePositionOfDividerAtIndex:", NSInteger)(dividerIndex);
123 }
124
125 CGFloat maxPossiblePositionOfDividerAtIndex (NSInteger dividerIndex)
126 {
127 return invokeObjcSelf!(CGFloat, "maxPossiblePositionOfDividerAtIndex:", NSInteger)(dividerIndex);
128 }
129
130 void setPosition (CGFloat position, NSInteger dividerIndex)
131 {
132 return invokeObjcSelf!(void, "setPosition:ofDividerAtIndex:", CGFloat, NSInteger)(position, dividerIndex);
133 }
134
135 void setIsPaneSplitter (bool flag)
136 {
137 return invokeObjcSelf!(void, "setIsPaneSplitter:", bool)(flag);
138 }
139
140 bool isPaneSplitter ()
141 {
142 return invokeObjcSelf!(bool, "isPaneSplitter");
143 }
144 }
145
146 const TNSSplitViewDelegate = `
147
148 bool splitView (NSSplitView splitView, NSView subview)
149 {
150 return invokeObjcSelf!(bool, "splitView:canCollapseSubview:", NSSplitView, NSView)(splitView, subview);
151 }
152
153 bool splitView (NSSplitView splitView, NSView subview, NSInteger dividerIndex)
154 {
155 return invokeObjcSelf!(bool, "splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:", NSSplitView, NSView, NSInteger)(splitView, subview, dividerIndex);
156 }
157
158 CGFloat splitView (NSSplitView splitView, CGFloat proposedMinimumPosition, NSInteger dividerIndex)
159 {
160 return invokeObjcSelf!(CGFloat, "splitView:constrainMinCoordinate:ofSubviewAt:", NSSplitView, CGFloat, NSInteger)(splitView, proposedMinimumPosition, dividerIndex);
161 }
162
163 CGFloat splitView (NSSplitView splitView, CGFloat proposedMaximumPosition, NSInteger dividerIndex)
164 {
165 return invokeObjcSelf!(CGFloat, "splitView:constrainMaxCoordinate:ofSubviewAt:", NSSplitView, CGFloat, NSInteger)(splitView, proposedMaximumPosition, dividerIndex);
166 }
167
168 CGFloat splitView (NSSplitView splitView, CGFloat proposedPosition, NSInteger dividerIndex)
169 {
170 return invokeObjcSelf!(CGFloat, "splitView:constrainSplitPosition:ofSubviewAt:", NSSplitView, CGFloat, NSInteger)(splitView, proposedPosition, dividerIndex);
171 }
172
173 void splitView (NSSplitView splitView, NSSize oldSize)
174 {
175 return invokeObjcSelf!(void, "splitView:resizeSubviewsWithOldSize:", NSSplitView, NSSize)(splitView, oldSize);
176 }
177
178 bool splitView (NSSplitView splitView, NSInteger dividerIndex)
179 {
180 return invokeObjcSelf!(bool, "splitView:shouldHideDividerAtIndex:", NSSplitView, NSInteger)(splitView, dividerIndex);
181 }
182
183 NSRect splitView (NSSplitView splitView, NSRect proposedEffectiveRect, NSRect drawnRect, NSInteger dividerIndex)
184 {
185 return invokeObjcSelf!(NSRect, "splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:", NSSplitView, NSRect, NSRect, NSInteger)(splitView, proposedEffectiveRect, drawnRect, dividerIndex);
186 }
187
188 NSRect splitView (NSSplitView splitView, NSInteger dividerIndex)
189 {
190 return invokeObjcSelf!(NSRect, "splitView:additionalEffectiveRectOfDividerAtIndex:", NSSplitView, NSInteger)(splitView, dividerIndex);
191 }
192
193 void splitViewWillResizeSubviews (NSNotification notification)
194 {
195 return invokeObjcSelf!(void, "splitViewWillResizeSubviews:", NSNotification)(notification);
196 }
197
198 void splitViewDidResizeSubviews (NSNotification notification)
199 {
200 return invokeObjcSelf!(void, "splitViewDidResizeSubviews:", NSNotification)(notification);
201 }
202
203 //mixin ObjcBindMethod!(splitView, "splitView:canCollapseSubview:");
204 //mixin ObjcBindMethod!(splitView, "splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:");
205 //mixin ObjcBindMethod!(splitView, "splitView:constrainMinCoordinate:ofSubviewAt:");
206 //mixin ObjcBindMethod!(splitView, "splitView:constrainMaxCoordinate:ofSubviewAt:");
207 //mixin ObjcBindMethod!(splitView, "splitView:constrainSplitPosition:ofSubviewAt:");
208 //mixin ObjcBindMethod!(splitView, "splitView:resizeSubviewsWithOldSize:");
209 //mixin ObjcBindMethod!(splitView, "splitView:shouldHideDividerAtIndex:");
210 //mixin ObjcBindMethod!(splitView, "splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:");
211 //mixin ObjcBindMethod!(splitView, "splitView:additionalEffectiveRectOfDividerAtIndex:");
212 //mixin ObjcBindMethod!(splitViewWillResizeSubviews, "splitViewWillResizeSubviews:");
213 //mixin ObjcBindMethod!(splitViewDidResizeSubviews, "splitViewDidResizeSubviews:");
214
215 `;
216