Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSArrayController.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/NSArrayController.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,306 @@ +/******************************************************************************* + * 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.NSArrayController; + +import dwt.internal.cocoa.id; +import dwt.internal.cocoa.NSArray; +import dwt.internal.cocoa.NSIndexSet; +import dwt.internal.cocoa.NSInteger; +import dwt.internal.cocoa.NSObjectController; +import dwt.internal.cocoa.NSPredicate; +import dwt.internal.cocoa.OS; +import objc = dwt.internal.objc.runtime; + +public class NSArrayController : NSObjectController +{ + public this () + { + super(); + } + + public this (objc.id id) + { + super(id); + } + + public void add (id sender) + { + OS.objc_msgSend(this.id, OS.sel_add_1, sender !is null ? sender.id : null); + } + + public void addObject (id object) + { + OS.objc_msgSend(this.id, OS.sel_addObject_1, + object !is null ? object.id : null); + } + + public void addObjects (NSArray objects) + { + OS.objc_msgSend(this.id, OS.sel_addObjects_1, + objects !is null ? objects.id : null); + } + + public bool addSelectedObjects (NSArray objects) + { + return OS.objc_msgSend(this.id, OS.sel_addSelectedObjects_1, + objects !is null ? objects.id : null) !is null; + } + + public bool addSelectionIndexes (NSIndexSet indexes) + { + return OS.objc_msgSend(this.id, OS.sel_addSelectionIndexes_1, + indexes !is null ? indexes.id : null) !is null; + } + + public bool alwaysUsesMultipleValuesMarker () + { + return OS.objc_msgSend(this.id, OS.sel_alwaysUsesMultipleValuesMarker) !is null; + } + + public NSArray arrangeObjects (NSArray objects) + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_arrangeObjects_1, + objects !is null ? objects.id : null); + return result !is null ? new NSArray(result) : null; + } + + public id arrangedObjects () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_arrangedObjects); + return result !is null ? new id(result) : null; + } + + public NSArray automaticRearrangementKeyPaths () + { + objc.id result = OS.objc_msgSend(this.id, + OS.sel_automaticRearrangementKeyPaths); + return result !is null ? new NSArray(result) : null; + } + + public bool automaticallyRearrangesObjects () + { + return OS.objc_msgSend(this.id, OS.sel_automaticallyRearrangesObjects) !is null; + } + + public bool avoidsEmptySelection () + { + return OS.objc_msgSend(this.id, OS.sel_avoidsEmptySelection) !is null; + } + + public bool canInsert () + { + return OS.objc_msgSend(this.id, OS.sel_canInsert) !is null; + } + + public bool canSelectNext () + { + return OS.objc_msgSend(this.id, OS.sel_canSelectNext) !is null; + } + + public bool canSelectPrevious () + { + return OS.objc_msgSend(this.id, OS.sel_canSelectPrevious) !is null; + } + + public bool clearsFilterPredicateOnInsertion () + { + return OS.objc_msgSend(this.id, OS.sel_clearsFilterPredicateOnInsertion) !is null; + } + + public void didChangeArrangementCriteria () + { + OS.objc_msgSend(this.id, OS.sel_didChangeArrangementCriteria); + } + + public NSPredicate filterPredicate () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_filterPredicate); + return result !is null ? new NSPredicate(result) : null; + } + + public void insert (id sender) + { + OS.objc_msgSend(this.id, OS.sel_insert_1, + sender !is null ? sender.id : null); + } + + public void insertObject (id object, NSUInteger index) + { + OS.objc_msgSend(this.id, OS.sel_insertObject_1atArrangedObjectIndex_1, + object !is null ? object.id : null, index); + } + + public void insertObjects (NSArray objects, NSIndexSet indexes) + { + OS.objc_msgSend(this.id, + OS.sel_insertObjects_1atArrangedObjectIndexes_1, + objects !is null ? objects.id : null, + indexes !is null ? indexes.id : null); + } + + public bool preservesSelection () + { + return OS.objc_msgSend(this.id, OS.sel_preservesSelection) !is null; + } + + public void rearrangeObjects () + { + OS.objc_msgSend(this.id, OS.sel_rearrangeObjects); + } + + public void remove (id sender) + { + OS.objc_msgSend(this.id, OS.sel_remove_1, + sender !is null ? sender.id : null); + } + + public void removeObject (id object) + { + OS.objc_msgSend(this.id, OS.sel_removeObject_1, + object !is null ? object.id : null); + } + + public void removeObjectAtArrangedObjectIndex (NSUInteger index) + { + OS.objc_msgSend(this.id, OS.sel_removeObjectAtArrangedObjectIndex_1, + index); + } + + public void removeObjects (NSArray objects) + { + OS.objc_msgSend(this.id, OS.sel_removeObjects_1, + objects !is null ? objects.id : null); + } + + public void removeObjectsAtArrangedObjectIndexes (NSIndexSet indexes) + { + OS.objc_msgSend(this.id, OS.sel_removeObjectsAtArrangedObjectIndexes_1, + indexes !is null ? indexes.id : null); + } + + public bool removeSelectedObjects (NSArray objects) + { + return OS.objc_msgSend(this.id, OS.sel_removeSelectedObjects_1, + objects !is null ? objects.id : null) !is null; + } + + public bool removeSelectionIndexes (NSIndexSet indexes) + { + return OS.objc_msgSend(this.id, OS.sel_removeSelectionIndexes_1, + indexes !is null ? indexes.id : null) !is null; + } + + public void selectNext (id sender) + { + OS.objc_msgSend(this.id, OS.sel_selectNext_1, + sender !is null ? sender.id : null); + } + + public void selectPrevious (id sender) + { + OS.objc_msgSend(this.id, OS.sel_selectPrevious_1, + sender !is null ? sender.id : null); + } + + public NSArray selectedObjects () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_selectedObjects); + return result !is null ? new NSArray(result) : null; + } + + public NSUInteger selectionIndex () + { + return OS.objc_msgSend(this.id, OS.sel_selectionIndex); + } + + public NSIndexSet selectionIndexes () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_selectionIndexes); + return result !is null ? new NSIndexSet(result) : null; + } + + public bool selectsInsertedObjects () + { + return OS.objc_msgSend(this.id, OS.sel_selectsInsertedObjects) !is null; + } + + public void setAlwaysUsesMultipleValuesMarker (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setAlwaysUsesMultipleValuesMarker_1, + flag); + } + + public void setAutomaticallyRearrangesObjects (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setAutomaticallyRearrangesObjects_1, + flag); + } + + public void setAvoidsEmptySelection (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setAvoidsEmptySelection_1, flag); + } + + public void setClearsFilterPredicateOnInsertion (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setClearsFilterPredicateOnInsertion_1, + flag); + } + + public void setFilterPredicate (NSPredicate filterPredicate) + { + OS.objc_msgSend(this.id, OS.sel_setFilterPredicate_1, + filterPredicate !is null ? filterPredicate.id : null); + } + + public void setPreservesSelection (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setPreservesSelection_1, flag); + } + + public bool setSelectedObjects (NSArray objects) + { + return OS.objc_msgSend(this.id, OS.sel_setSelectedObjects_1, + objects !is null ? objects.id : null) !is null; + } + + public bool setSelectionIndex (NSUInteger index) + { + return OS.objc_msgSend(this.id, OS.sel_setSelectionIndex_1, index) !is null; + } + + public bool setSelectionIndexes (NSIndexSet indexes) + { + return OS.objc_msgSend(this.id, OS.sel_setSelectionIndexes_1, + indexes !is null ? indexes.id : null) !is null; + } + + public void setSelectsInsertedObjects (bool flag) + { + OS.objc_msgSend(this.id, OS.sel_setSelectsInsertedObjects_1, flag); + } + + public void setSortDescriptors (NSArray sortDescriptors) + { + OS.objc_msgSend(this.id, OS.sel_setSortDescriptors_1, + sortDescriptors !is null ? sortDescriptors.id : null); + } + + public NSArray sortDescriptors () + { + objc.id result = OS.objc_msgSend(this.id, OS.sel_sortDescriptors); + return result !is null ? new NSArray(result) : null; + } + +}