view dwt/internal/cocoa/NSArrayController.d @ 13:f565d3a95c0a

Ported dwt.internal
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Fri, 22 Aug 2008 16:46:34 +0200
parents 8b48be5454ce
children
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.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 cast(NSUInteger) 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;
    }

}