view dwt/internal/cocoa/NSTreeController.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.NSTreeController;

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSArray;
import dwt.internal.cocoa.NSIndexPath;
import dwt.internal.cocoa.NSObjectController;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.NSTreeNode;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSTreeController : 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 addChild (id sender)
    {
        OS.objc_msgSend(this.id_, OS.sel_addChild_1, sender !is null ? sender.id_ : null);
    }

    public bool addSelectionIndexPaths (NSArray indexPaths)
    {
        return OS.objc_msgSend(this.id_, OS.sel_addSelectionIndexPaths_1, indexPaths !is null ? indexPaths.id_ : null) !is null;
    }

    public bool alwaysUsesMultipleValuesMarker ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_alwaysUsesMultipleValuesMarker) !is null;
    }

    public id arrangedObjects ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_arrangedObjects);
        return result !is null ? new id(result) : null;
    }

    public bool avoidsEmptySelection ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_avoidsEmptySelection) !is null;
    }

    public bool canAddChild ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_canAddChild) !is null;
    }

    public bool canInsert ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_canInsert) !is null;
    }

    public bool canInsertChild ()
    {
        return OS.objc_msgSend(this.id_, OS.sel_canInsertChild) !is null;
    }

    public NSString childrenKeyPath ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_childrenKeyPath);
        return result !is null ? new NSString(result) : null;
    }

    public NSString childrenKeyPathForNode (NSTreeNode node)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_childrenKeyPathForNode_1, node !is null ? node.id_ : null);
        return result !is null ? new NSString(result) : null;
    }

    public id content ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_content);
        return result !is null ? new id(result) : null;
    }

    public NSString countKeyPath ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_countKeyPath);
        return result !is null ? new NSString(result) : null;
    }

    public NSString countKeyPathForNode (NSTreeNode node)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_countKeyPathForNode_1, node !is null ? node.id_ : null);
        return result !is null ? new NSString(result) : null;
    }

    public void insert (id sender)
    {
        OS.objc_msgSend(this.id_, OS.sel_insert_1, sender !is null ? sender.id_ : null);
    }

    public void insertChild (id sender)
    {
        OS.objc_msgSend(this.id_, OS.sel_insertChild_1, sender !is null ? sender.id_ : null);
    }

    public void insertObject (id object, NSIndexPath indexPath)
    {
        OS.objc_msgSend(this.id_, OS.sel_insertObject_1atArrangedObjectIndexPath_1, object !is null ? object.id_ : null,
                indexPath !is null ? indexPath.id_ : null);
    }

    public void insertObjects (NSArray objects, NSArray indexPaths)
    {
        OS.objc_msgSend(this.id_, OS.sel_insertObjects_1atArrangedObjectIndexPaths_1, objects !is null ? objects.id_ : null,
                indexPaths !is null ? indexPaths.id_ : null);
    }

    public NSString leafKeyPath ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_leafKeyPath);
        return result !is null ? new NSString(result) : null;
    }

    public NSString leafKeyPathForNode (NSTreeNode node)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_leafKeyPathForNode_1, node !is null ? node.id_ : null);
        return result !is null ? new NSString(result) : null;
    }

    public void moveNode (NSTreeNode node, NSIndexPath indexPath)
    {
        OS.objc_msgSend(this.id_, OS.sel_moveNode_1toIndexPath_1, node !is null ? node.id_ : null, indexPath !is null ? indexPath.id_ : null);
    }

    public void moveNodes (NSArray nodes, NSIndexPath startingIndexPath)
    {
        OS.objc_msgSend(this.id_, OS.sel_moveNodes_1toIndexPath_1, nodes !is null ? nodes.id_ : null,
                startingIndexPath !is null ? startingIndexPath.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 removeObjectAtArrangedObjectIndexPath (NSIndexPath indexPath)
    {
        OS.objc_msgSend(this.id_, OS.sel_removeObjectAtArrangedObjectIndexPath_1, indexPath !is null ? indexPath.id_ : null);
    }

    public void removeObjectsAtArrangedObjectIndexPaths (NSArray indexPaths)
    {
        OS.objc_msgSend(this.id_, OS.sel_removeObjectsAtArrangedObjectIndexPaths_1, indexPaths !is null ? indexPaths.id_ : null);
    }

    public bool removeSelectionIndexPaths (NSArray indexPaths)
    {
        return OS.objc_msgSend(this.id_, OS.sel_removeSelectionIndexPaths_1, indexPaths !is null ? indexPaths.id_ : null) !is null;
    }

    public NSArray selectedNodes ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_selectedNodes);
        return result !is null ? new NSArray(result) : null;
    }

    public NSArray selectedObjects ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_selectedObjects);
        return result !is null ? new NSArray(result) : null;
    }

    public NSIndexPath selectionIndexPath ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_selectionIndexPath);
        return result !is null ? new NSIndexPath(result) : null;
    }

    public NSArray selectionIndexPaths ()
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_selectionIndexPaths);
        return result !is null ? new NSArray(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 setAvoidsEmptySelection (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAvoidsEmptySelection_1, flag);
    }

    public void setChildrenKeyPath (NSString keyPath)
    {
        OS.objc_msgSend(this.id_, OS.sel_setChildrenKeyPath_1, keyPath !is null ? keyPath.id_ : null);
    }

    public void setContent (id content)
    {
        OS.objc_msgSend(this.id_, OS.sel_setContent_1, content !is null ? content.id_ : null);
    }

    public void setCountKeyPath (NSString keyPath)
    {
        OS.objc_msgSend(this.id_, OS.sel_setCountKeyPath_1, keyPath !is null ? keyPath.id_ : null);
    }

    public void setLeafKeyPath (NSString keyPath)
    {
        OS.objc_msgSend(this.id_, OS.sel_setLeafKeyPath_1, keyPath !is null ? keyPath.id_ : null);
    }

    public void setPreservesSelection (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setPreservesSelection_1, flag);
    }

    public bool setSelectionIndexPath (NSIndexPath indexPath)
    {
        return OS.objc_msgSend(this.id_, OS.sel_setSelectionIndexPath_1, indexPath !is null ? indexPath.id_ : null) !is null;
    }

    public bool setSelectionIndexPaths (NSArray indexPaths)
    {
        return OS.objc_msgSend(this.id_, OS.sel_setSelectionIndexPaths_1, indexPaths !is null ? indexPaths.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;
    }

}