Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSWhoseSpecifier.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/NSWhoseSpecifier.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,117 @@ +/******************************************************************************* + * 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.NSWhoseSpecifier; + +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSScriptClassDescription; +import dwt.internal.cocoa.NSScriptObjectSpecifier; +import dwt.internal.cocoa.NSScriptWhoseTest; +import dwt.internal.cocoa.NSString; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + + + +enum NSWhoseSubelementIdentifier +{ + NSIndexSubelement = 0, + NSEverySubelement = 1, + NSMiddleSubelement = 2, + NSRandomSubelement = 3, + NSNoSubelement = 4 +} + +alias NSWhoseSubelementIdentifier.NSIndexSubelement NSIndexSubelement; +alias NSWhoseSubelementIdentifier.NSEverySubelement NSEverySubelement; +alias NSWhoseSubelementIdentifier.NSMiddleSubelement NSMiddleSubelement; +alias NSWhoseSubelementIdentifier.NSRandomSubelement NSRandomSubelement; +alias NSWhoseSubelementIdentifier.NSNoSubelement NSNoSubelement; + + + +public class NSWhoseSpecifier : NSScriptObjectSpecifier +{ + + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public NSWhoseSubelementIdentifier endSubelementIdentifier () + { + return cast(NSWhoseSubelementIdentifier) OS.objc_msgSend(this.id, OS.sel_endSubelementIdentifier); + } + + public NSInteger endSubelementIndex () + { + return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_endSubelementIndex); + } + + public id initWithContainerClassDescription (NSScriptClassDescription classDesc, NSScriptObjectSpecifier container, NSString property, + NSScriptWhoseTest test) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithContainerClassDescription_1containerSpecifier_1key_1test_1, + classDesc !is null ? classDesc.id : null, container !is null ? container.id : null, property !is null ? property.id : null, + test !is null ? test.id : null); + return result !is null ? new id(result) : null; + } + + public void setEndSubelementIdentifier (NSWhoseSubelementIdentifier subelement) + { + OS.objc_msgSend(this.id, OS.sel_setEndSubelementIdentifier_1, subelement); + } + + public void setEndSubelementIndex (NSInteger index) + { + OS.objc_msgSend(this.id, OS.sel_setEndSubelementIndex_1, index); + } + + public void setStartSubelementIdentifier (NSWhoseSubelementIdentifier subelement) + { + OS.objc_msgSend(this.id, OS.sel_setStartSubelementIdentifier_1, subelement); + } + + public void setStartSubelementIndex (NSInteger index) + { + OS.objc_msgSend(this.id, OS.sel_setStartSubelementIndex_1, index); + } + + public void setTest (NSScriptWhoseTest test) + { + OS.objc_msgSend(this.id, OS.sel_setTest_1, test !is null ? test.id : null); + } + + public NSWhoseSubelementIdentifier startSubelementIdentifier () + { + return cast(NSWhoseSubelementIdentifier) OS.objc_msgSend(this.id, OS.sel_startSubelementIdentifier); + } + + public NSInteger startSubelementIndex () + { + return cast(NSInteger) OS.objc_msgSend(this.id, OS.sel_startSubelementIndex); + } + + public NSScriptWhoseTest test () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_test); + return result !is null ? new NSScriptWhoseTest(result) : null; + } + +}