diff 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
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/dstep/appkit/NSSplitView.d	Sun Jan 03 22:06:11 2010 +0100
@@ -0,0 +1,216 @@
+/**
+ * Copyright: Copyright (c) 2009 Jacob Carlborg.
+ * Authors: Jacob Carlborg
+ * Version: Initial created: Sep 24, 2009 
+ * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0)
+ */
+module dstep.appkit.NSSplitView;
+
+import dstep.appkit.NSColor;
+import dstep.appkit.NSView;
+import dstep.applicationservices.coregraphics.CGBase;
+import dstep.foundation.NSGeometry;
+import dstep.foundation.NSNotification;
+import dstep.foundation.NSObjCRuntime;
+import dstep.foundation.NSString;
+import dstep.objc.bridge.Bridge;
+import dstep.objc.objc;
+
+import bindings = dstep.appkit.NSSplitView_bindings;
+
+alias NSInteger NSSplitViewDividerStyle;
+
+private
+{
+	NSString NSSplitViewWillResizeSubviewsNotification_;
+	NSString NSSplitViewDidResizeSubviewsNotification_;
+}
+
+NSString NSSplitViewWillResizeSubviewsNotification ()
+{
+	if (NSSplitViewWillResizeSubviewsNotification_)
+		return NSSplitViewWillResizeSubviewsNotification_;
+
+	return NSSplitViewWillResizeSubviewsNotification_ = new NSString(bindings.NSSplitViewWillResizeSubviewsNotification);
+}
+
+NSString NSSplitViewDidResizeSubviewsNotification ()
+{
+	if (NSSplitViewDidResizeSubviewsNotification_)
+		return NSSplitViewDidResizeSubviewsNotification_;
+
+	return NSSplitViewDidResizeSubviewsNotification_ = new NSString(bindings.NSSplitViewDidResizeSubviewsNotification);
+}
+
+enum
+{
+	NSSplitViewDividerStyleThick = 1,
+	NSSplitViewDividerStyleThin
+}
+
+class NSSplitView : NSView
+{
+	mixin (ObjcWrap);
+
+	void setVertical (bool flag)
+	{
+		return invokeObjcSelf!(void, "setVertical:", bool)(flag);
+	}
+
+	bool isVertical ()
+	{
+		return invokeObjcSelf!(bool, "isVertical");
+	}
+
+	void setDividerStyle (int dividerStyle)
+	{
+		return invokeObjcSelf!(void, "setDividerStyle:", int)(dividerStyle);
+	}
+
+	int dividerStyle ()
+	{
+		return invokeObjcSelf!(int, "dividerStyle");
+	}
+
+	void setAutosaveName (NSString autosaveName)
+	{
+		return invokeObjcSelf!(void, "setAutosaveName:", NSString)(autosaveName);
+	}
+
+	NSString autosaveName ()
+	{
+		return invokeObjcSelf!(NSString, "autosaveName");
+	}
+
+	void setDelegate (Object delegate_)
+	{
+		return invokeObjcSelf!(void, "setDelegate:", Object)(delegate_);
+	}
+
+	Object delegate_ ()
+	{
+		return invokeObjcSelf!(Object, "delegate");
+	}
+
+	void drawDividerInRect (NSRect rect)
+	{
+		return invokeObjcSelf!(void, "drawDividerInRect:", NSRect)(rect);
+	}
+
+	NSColor dividerColor ()
+	{
+		return invokeObjcSelf!(NSColor, "dividerColor");
+	}
+
+	CGFloat dividerThickness ()
+	{
+		return invokeObjcSelf!(CGFloat, "dividerThickness");
+	}
+
+	void adjustSubviews ()
+	{
+		return invokeObjcSelf!(void, "adjustSubviews");
+	}
+
+	bool isSubviewCollapsed (NSView subview)
+	{
+		return invokeObjcSelf!(bool, "isSubviewCollapsed:", NSView)(subview);
+	}
+
+	CGFloat minPossiblePositionOfDividerAtIndex (NSInteger dividerIndex)
+	{
+		return invokeObjcSelf!(CGFloat, "minPossiblePositionOfDividerAtIndex:", NSInteger)(dividerIndex);
+	}
+
+	CGFloat maxPossiblePositionOfDividerAtIndex (NSInteger dividerIndex)
+	{
+		return invokeObjcSelf!(CGFloat, "maxPossiblePositionOfDividerAtIndex:", NSInteger)(dividerIndex);
+	}
+
+	void setPosition (CGFloat position, NSInteger dividerIndex)
+	{
+		return invokeObjcSelf!(void, "setPosition:ofDividerAtIndex:", CGFloat, NSInteger)(position, dividerIndex);
+	}
+
+	void setIsPaneSplitter (bool flag)
+	{
+		return invokeObjcSelf!(void, "setIsPaneSplitter:", bool)(flag);
+	}
+
+	bool isPaneSplitter ()
+	{
+		return invokeObjcSelf!(bool, "isPaneSplitter");
+	}
+}
+
+const TNSSplitViewDelegate = `
+
+	bool splitView (NSSplitView splitView, NSView subview)
+	{
+		return invokeObjcSelf!(bool, "splitView:canCollapseSubview:", NSSplitView, NSView)(splitView, subview);
+	}
+
+	bool splitView (NSSplitView splitView, NSView subview, NSInteger dividerIndex)
+	{
+		return invokeObjcSelf!(bool, "splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:", NSSplitView, NSView, NSInteger)(splitView, subview, dividerIndex);
+	}
+
+	CGFloat splitView (NSSplitView splitView, CGFloat proposedMinimumPosition, NSInteger dividerIndex)
+	{
+		return invokeObjcSelf!(CGFloat, "splitView:constrainMinCoordinate:ofSubviewAt:", NSSplitView, CGFloat, NSInteger)(splitView, proposedMinimumPosition, dividerIndex);
+	}
+
+	CGFloat splitView (NSSplitView splitView, CGFloat proposedMaximumPosition, NSInteger dividerIndex)
+	{
+		return invokeObjcSelf!(CGFloat, "splitView:constrainMaxCoordinate:ofSubviewAt:", NSSplitView, CGFloat, NSInteger)(splitView, proposedMaximumPosition, dividerIndex);
+	}
+
+	CGFloat splitView (NSSplitView splitView, CGFloat proposedPosition, NSInteger dividerIndex)
+	{
+		return invokeObjcSelf!(CGFloat, "splitView:constrainSplitPosition:ofSubviewAt:", NSSplitView, CGFloat, NSInteger)(splitView, proposedPosition, dividerIndex);
+	}
+
+	void splitView (NSSplitView splitView, NSSize oldSize)
+	{
+		return invokeObjcSelf!(void, "splitView:resizeSubviewsWithOldSize:", NSSplitView, NSSize)(splitView, oldSize);
+	}
+
+	bool splitView (NSSplitView splitView, NSInteger dividerIndex)
+	{
+		return invokeObjcSelf!(bool, "splitView:shouldHideDividerAtIndex:", NSSplitView, NSInteger)(splitView, dividerIndex);
+	}
+
+	NSRect splitView (NSSplitView splitView, NSRect proposedEffectiveRect, NSRect drawnRect, NSInteger dividerIndex)
+	{
+		return invokeObjcSelf!(NSRect, "splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:", NSSplitView, NSRect, NSRect, NSInteger)(splitView, proposedEffectiveRect, drawnRect, dividerIndex);
+	}
+
+	NSRect splitView (NSSplitView splitView, NSInteger dividerIndex)
+	{
+		return invokeObjcSelf!(NSRect, "splitView:additionalEffectiveRectOfDividerAtIndex:", NSSplitView, NSInteger)(splitView, dividerIndex);
+	}
+
+	void splitViewWillResizeSubviews (NSNotification notification)
+	{
+		return invokeObjcSelf!(void, "splitViewWillResizeSubviews:", NSNotification)(notification);
+	}
+
+	void splitViewDidResizeSubviews (NSNotification notification)
+	{
+		return invokeObjcSelf!(void, "splitViewDidResizeSubviews:", NSNotification)(notification);
+	}
+
+	//mixin ObjcBindMethod!(splitView, "splitView:canCollapseSubview:");
+	//mixin ObjcBindMethod!(splitView, "splitView:shouldCollapseSubview:forDoubleClickOnDividerAtIndex:");
+	//mixin ObjcBindMethod!(splitView, "splitView:constrainMinCoordinate:ofSubviewAt:");
+	//mixin ObjcBindMethod!(splitView, "splitView:constrainMaxCoordinate:ofSubviewAt:");
+	//mixin ObjcBindMethod!(splitView, "splitView:constrainSplitPosition:ofSubviewAt:");
+	//mixin ObjcBindMethod!(splitView, "splitView:resizeSubviewsWithOldSize:");
+	//mixin ObjcBindMethod!(splitView, "splitView:shouldHideDividerAtIndex:");
+	//mixin ObjcBindMethod!(splitView, "splitView:effectiveRect:forDrawnRect:ofDividerAtIndex:");
+	//mixin ObjcBindMethod!(splitView, "splitView:additionalEffectiveRectOfDividerAtIndex:");
+	//mixin ObjcBindMethod!(splitViewWillResizeSubviews, "splitViewWillResizeSubviews:");
+	//mixin ObjcBindMethod!(splitViewDidResizeSubviews, "splitViewDidResizeSubviews:");
+
+`;
+