Mercurial > projects > dwt-mac
view dwt/internal/cocoa/NSIndexPath.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 source
/******************************************************************************* * 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.NSIndexPath; import dwt.internal.cocoa.id; import dwt.internal.cocoa.NSComparisonResult; import dwt.internal.cocoa.NSInteger; import dwt.internal.cocoa.NSObject; import dwt.internal.cocoa.OS; import objc = dwt.internal.objc.runtime; public class NSIndexPath : NSObject { public this () { super(); } public this (objc.id id) { super(id); } public NSComparisonResult compare (NSIndexPath otherObject) { return OS.objc_msgSend(this.id, OS.sel_compare_1, otherObject !is null ? otherObject.id : null); } public void getIndexes (NSUInteger* indexes) { OS.objc_msgSend(this.id, OS.sel_getIndexes_1, indexes); } public NSUInteger indexAtPosition (NSUInteger position) { return OS.objc_msgSend(this.id, OS.sel_indexAtPosition_1, position); } public NSIndexPath indexPathByAddingIndex (NSUInteger index) { objc.id result = OS.objc_msgSend(this.id, OS.sel_indexPathByAddingIndex_1, index); return result is this.id ? this : (result !is null ? new NSIndexPath(result) : null); } public NSIndexPath indexPathByRemovingLastIndex () { objc.id result = OS.objc_msgSend(this.id, OS.sel_indexPathByRemovingLastIndex); return result is this.id ? this : (result !is null ? new NSIndexPath(result) : null); } public static id indexPathWithIndex (NSUInteger index) { objc.id result = OS.objc_msgSend(OS.class_NSIndexPath, OS.sel_indexPathWithIndex_1, index); return result !is null ? new id(result) : null; } public static id indexPathWithIndexes (NSUInteger* indexes, NSUInteger length) { objc.id result = OS.objc_msgSend(OS.class_NSIndexPath, OS.sel_indexPathWithIndexes_1length_1, indexes, length); return result !is null ? new id(result) : null; } public id initWithIndex (NSUInteger index) { objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIndex_1, index); return result !is null ? new id(result) : null; } public id initWithIndexes (NSUInteger* indexes, NSUInteger length) { objc.id result = OS.objc_msgSend(this.id, OS.sel_initWithIndexes_1length_1, indexes, length); return result !is null ? new id(result) : null; } public NSUInteger length () { return OS.objc_msgSend(this.id, OS.sel_length); } }