Mercurial > projects > dstep
view dstep/appkit/NSNib.d @ 22:f8a3b67adfcb
Removed duplicated methods
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Tue, 09 Feb 2010 18:02:03 +0100 |
parents | 19885b43130e |
children | b9de51448c6b |
line wrap: on
line source
/** * 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.NSNib; import dstep.appkit.AppKitDefines; import dstep.foundation.NSArray; import dstep.foundation.NSBundle; import dstep.foundation.NSCoder; import dstep.foundation.NSData; import dstep.foundation.NSDictionary; import dstep.foundation.NSObject; import dstep.foundation.NSString; import dstep.foundation.NSURL; import dstep.objc.bridge.Bridge; import dstep.objc.objc; import bindings = dstep.appkit.NSNib_bindings; private { NSString NSNibOwner_; NSString NSNibTopLevelObjects_; } NSString NSNibOwner () { if (NSNibOwner_) return NSNibOwner_; return NSNibOwner_ = new NSString(bindings.NSNibOwner); } NSString NSNibTopLevelObjects () { if (NSNibTopLevelObjects_) return NSNibTopLevelObjects_; return NSNibTopLevelObjects_ = new NSString(bindings.NSNibTopLevelObjects); } class NSNib : NSObject, INSCoding { mixin (ObjcWrap); this (NSCoder aDecoder) { super(typeof(this).alloc.initWithCoder(aDecoder).objcObject); } void encodeWithCoder (NSCoder aCoder) { return invokeObjcSelf!(void, "encodeWithCoder:", NSCoder)(aCoder); } typeof(this) initWithCoder (NSCoder aDecoder) { return invokeObjcSelf!(typeof(this), "initWithCoder:", NSCoder)(aDecoder); } NSNib initWithContentsOfURL (NSURL nibFileURL) { id result = invokeObjcSelf!(id, "initWithContentsOfURL:", NSURL)(nibFileURL); return result is this.objcObject ? this : (result !is null ? new NSNib(result) : null); } this (NSURL nibFileURL) { super(NSNib.alloc.initWithContentsOfURL(nibFileURL).objcObject); } NSNib initWithNibNamed (NSString nibName, NSBundle bundle) { id result = invokeObjcSelf!(id, "initWithNibNamed:bundle:", NSString, NSBundle)(nibName, bundle); return result is this.objcObject ? this : (result !is null ? new NSNib(result) : null); } this (NSString nibName, NSBundle bundle) { super(NSNib.alloc.initWithNibNamed(nibName, bundle).objcObject); } bool instantiateNibWithExternalNameTable (NSDictionary externalNameTable) { return invokeObjcSelf!(bool, "instantiateNibWithExternalNameTable:", NSDictionary)(externalNameTable); } bool instantiateNibWithOwner (Object owner, ref NSArray topLevelObjects) { id objects; if (topLevelObjects) objects = topLevelObjects.objcObject; bool result = invokeObjcSelf!(bool, "instantiateNibWithOwner:topLevelObjects:", Object, id*)(owner, &objects); if (objects) topLevelObjects = new NSArray(objects); return result; } }