Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSDrawer.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSDrawer.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,185 @@ +/******************************************************************************* + * Copyright (c) 2007 IBM Corporation and others. + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * IBM Corporation - initial API and implementation + * + * Port to the D Programming language: + * Jacob Carlborg <jacob.carlborg@gmail.com> + *******************************************************************************/ +module dwt.internal.cocoa.NSDrawer; + +import dwt.internal.cocoa.CGFloat; +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSResponder; +import dwt.internal.cocoa.NSSize; +import dwt.internal.cocoa.NSView; +import dwt.internal.cocoa.NSWindow; +import dwt.internal.cocoa.OS; +//import dwt.internal.objc.foundation.NSGeometry; +import objc = dwt.internal.objc.runtime; + +public class NSDrawer : NSResponder +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public void close () + { + OS.objc_msgSend(this.id, OS.sel_close); + } + + public void close_ (id sender) + { + OS.objc_msgSend(this.id, OS.sel_close_1, sender !is null ? sender.id : null); + } + + public NSSize contentSize () + { + NSSize result; + OS.objc_msgSend_stret(result, this.id, OS.sel_contentSize); + return result; + } + + public NSView contentView () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_contentView); + return result !is null ? new NSView(result) : null; + } + + public id delegatee () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_delegate); + return result !is null ? new id(result) : null; + } + + public NSRectEdge edge () + { + return OS.objc_msgSend(this.id, OS.sel_edge); + } + + public NSDrawer initWithContentSize (NSSize contentSize, NSRectEdge edge) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContentSize_1preferredEdge_1, contentSize, edge); + return result !is null ? this : null; + } + + public CGFloat leadingOffset () + { + return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_leadingOffset); + } + + public NSSize maxContentSize () + { + NSSize result; + OS.objc_msgSend_stret(result, this.id, OS.sel_maxContentSize); + return result; + } + + public NSSize minContentSize () + { + NSSize result; + OS.objc_msgSend_stret(result, this.id, OS.sel_minContentSize); + return result; + } + + public void open () + { + OS.objc_msgSend(this.id, OS.sel_open); + } + + public void open_ (id sender) + { + OS.objc_msgSend(this.id, OS.sel_open_1, sender !is null ? sender.id : null); + } + + public void openOnEdge (NSRectEdge edge) + { + OS.objc_msgSend(this.id, OS.sel_openOnEdge_1, edge); + } + + public NSWindow parentWindow () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_parentWindow); + return result !is null ? new NSWindow(result) : null; + } + + public NSRectEdge preferredEdge () + { + return OS.objc_msgSend(this.id, OS.sel_preferredEdge); + } + + public void setContentSize (NSSize size) + { + OS.objc_msgSend(this.id, OS.sel_setContentSize_1, size); + } + + public void setContentView (NSView aView) + { + OS.objc_msgSend(this.id, OS.sel_setContentView_1, aView !is null ? aView.id : null); + } + + public void setDelegate (id anObject) + { + OS.objc_msgSend(this.id, OS.sel_setDelegate_1, anObject !is null ? anObject.id : null); + } + + public void setLeadingOffset (CGFloat offset) + { + OS.objc_msgSend(this.id, OS.sel_setLeadingOffset_1, offset); + } + + public void setMaxContentSize (NSSize size) + { + OS.objc_msgSend(this.id, OS.sel_setMaxContentSize_1, size); + } + + public void setMinContentSize (NSSize size) + { + OS.objc_msgSend(this.id, OS.sel_setMinContentSize_1, size); + } + + public void setParentWindow (NSWindow parent) + { + OS.objc_msgSend(this.id, OS.sel_setParentWindow_1, parent !is null ? parent.id : null); + } + + public void setPreferredEdge (NSRectEdge edge) + { + OS.objc_msgSend(this.id, OS.sel_setPreferredEdge_1, edge); + } + + public void setTrailingOffset (CGFloat offset) + { + OS.objc_msgSend(this.id, OS.sel_setTrailingOffset_1, offset); + } + + public NSInteger state () + { + return OS.objc_msgSend(this.id, OS.sel_state); + } + + public void toggle (id sender) + { + OS.objc_msgSend(this.id, OS.sel_toggle_1, sender !is null ? sender.id : null); + } + + public CGFloat trailingOffset () + { + return cast(CGFloat) OS.objc_msgSend_fpret(this.id, OS.sel_trailingOffset); + } + +}