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


import dwt.internal.cocoa.CGFloat;
import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSRect;
import dwt.internal.cocoa.NSTableColumn;
import dwt.internal.cocoa.NSTableView;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSOutlineView : NSTableView
{

    public this ()
    {
        super();
    }

    public this (objc.id id)
    {
        super(id);
    }

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

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

    public void collapseItem_ (id item)
    {
        OS.objc_msgSend(this.id_, OS.sel_collapseItem_1, item !is null ? item.id_ : null);
    }

    public void collapseItem_collapseChildren_ (id item, bool collapseChildren)
    {
        OS.objc_msgSend(this.id_, OS.sel_collapseItem_1collapseChildren_1, item !is null ? item.id_ : null, collapseChildren);
    }

    public void expandItem_ (id item)
    {
        OS.objc_msgSend(this.id_, OS.sel_expandItem_1, item !is null ? item.id_ : null);
    }

    public void expandItem_expandChildren_ (id item, bool expandChildren)
    {
        OS.objc_msgSend(this.id_, OS.sel_expandItem_1expandChildren_1, item !is null ? item.id_ : null, expandChildren);
    }

    public NSRect frameOfOutlineCellAtRow (NSInteger row)
    {
        NSRect result;
        OS.objc_msgSend_stret(&result, this.id_, OS.sel_frameOfOutlineCellAtRow_1, row);
        return result;
    }

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

    public CGFloat indentationPerLevel ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_indentationPerLevel);
    }

    public bool isExpandable (id item)
    {
        return OS.objc_msgSend(this.id_, OS.sel_isExpandable_1, item !is null ? item.id_ : null) !is null;
    }

    public bool isItemExpanded (id item)
    {
        return OS.objc_msgSend(this.id_, OS.sel_isItemExpanded_1, item !is null ? item.id_ : null) !is null;
    }

    public id itemAtRow (NSInteger row)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemAtRow_1, row);
        return result !is null ? new id(result) : null;
    }

    public NSInteger levelForItem (id item)
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_levelForItem_1, item !is null ? item.id_ : null);
    }

    public NSInteger levelForRow (NSInteger row)
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_levelForRow_1, row);
    }

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

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

    public void reloadItem_ (id item)
    {
        OS.objc_msgSend(this.id_, OS.sel_reloadItem_1, item !is null ? item.id_ : null);
    }

    public void reloadItem_reloadChildren_ (id item, bool reloadChildren)
    {
        OS.objc_msgSend(this.id_, OS.sel_reloadItem_1reloadChildren_1, item !is null ? item.id_ : null, reloadChildren);
    }

    public NSInteger rowForItem (id item)
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_rowForItem_1, item !is null ? item.id_ : null);
    }

    public void setAutoresizesOutlineColumn (bool resize)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAutoresizesOutlineColumn_1, resize);
    }

    public void setAutosaveExpandedItems (bool save)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAutosaveExpandedItems_1, save);
    }

    public void setDropItem (id item, NSInteger index)
    {
        OS.objc_msgSend(this.id_, OS.sel_setDropItem_1dropChildIndex_1, item !is null ? item.id_ : null, index);
    }

    public void setIndentationMarkerFollowsCell (bool drawInCell)
    {
        OS.objc_msgSend(this.id_, OS.sel_setIndentationMarkerFollowsCell_1, drawInCell);
    }

    public void setIndentationPerLevel (CGFloat indentationPerLevel)
    {
        OS.objc_msgSend(this.id_, OS.sel_setIndentationPerLevel_1, indentationPerLevel);
    }

    public void setOutlineTableColumn (NSTableColumn outlineTableColumn)
    {
        OS.objc_msgSend(this.id_, OS.sel_setOutlineTableColumn_1, outlineTableColumn !is null ? outlineTableColumn.id_ : null);
    }

    public bool shouldCollapseAutoExpandedItemsForDeposited (bool deposited)
    {
        return OS.objc_msgSend(this.id_, OS.sel_shouldCollapseAutoExpandedItemsForDeposited_1, deposited) !is null;
    }

}