Mercurial > projects > dstep
diff dstep/appkit/NSViewController.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/NSViewController.d Sun Jan 03 22:06:11 2010 +0100 @@ -0,0 +1,93 @@ +/** + * 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.NSViewController; + +import dstep.appkit.NSNibDeclarations; +import dstep.appkit.NSResponder; +import dstep.appkit.NSView; +import dstep.foundation.NSArray; +import dstep.foundation.NSBundle; +import dstep.foundation.NSString; +import dstep.objc.bridge.Bridge; +import dstep.objc.objc; + +class NSViewController : NSResponder +{ + mixin (ObjcWrap); + + NSViewController initWithNibName (NSString nibNameOrNil, NSBundle nibBundleOrNil) + { + id result = invokeObjcSelf!(id, "initWithNibName:bundle:", NSString, NSBundle)(nibNameOrNil, nibBundleOrNil); + return result is this.objcObject ? this : (result !is null ? new NSViewController(result) : null); + } + + this (NSString nibNameOrNil, NSBundle nibBundleOrNil) + { + super(NSViewController.alloc.initWithNibName(nibNameOrNil, nibBundleOrNil).objcObject); + } + + void setRepresentedObject (Object representedObject) + { + return invokeObjcSelf!(void, "setRepresentedObject:", Object)(representedObject); + } + + Object representedObject () + { + return invokeObjcSelf!(Object, "representedObject"); + } + + void setTitle (NSString title) + { + return invokeObjcSelf!(void, "setTitle:", NSString)(title); + } + + NSString title () + { + return invokeObjcSelf!(NSString, "title"); + } + + NSView view () + { + return invokeObjcSelf!(NSView, "view"); + } + + void loadView () + { + return invokeObjcSelf!(void, "loadView"); + } + + NSString nibName () + { + return invokeObjcSelf!(NSString, "nibName"); + } + + NSBundle nibBundle () + { + return invokeObjcSelf!(NSBundle, "nibBundle"); + } + + void setView (NSView view) + { + return invokeObjcSelf!(void, "setView:", NSView)(view); + } + + void commitEditingWithDelegate (Object delegate_, SEL didCommitSelector, void* contextInfo) + { + return invokeObjcSelf!(void, "commitEditingWithDelegate:didCommitSelector:contextInfo:", Object, SEL, void*)(delegate_, didCommitSelector, contextInfo); + } + + bool commitEditing () + { + return invokeObjcSelf!(bool, "commitEditing"); + } + + void discardEditing () + { + return invokeObjcSelf!(void, "discardEditing"); + } +} +