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

import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSArray;
import dwt.internal.cocoa.NSCollectionViewItem;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSIndexSet;
import dwt.internal.cocoa.NSSize;
import dwt.internal.cocoa.NSView;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSCollectionView : NSView
{

    public this ()
    {
        super();
    }

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

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

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

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

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

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

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

    public NSSize maxItemSize ()
    {
        NSSize result;
        OS.objc_msgSend_stret(&result, this.id_, OS.sel_maxItemSize);
        return result;
    }

    public NSUInteger maxNumberOfColumns ()
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_maxNumberOfColumns);
    }

    public NSUInteger maxNumberOfRows ()
    {
        return cast(NSUInteger) OS.objc_msgSend(this.id_, OS.sel_maxNumberOfRows);
    }

    public NSSize minItemSize ()
    {
        NSSize result;
        OS.objc_msgSend_stret(&result, this.id_, OS.sel_minItemSize);
        return result;
    }

    public NSCollectionViewItem newItemForRepresentedObject (id object)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_newItemForRepresentedObject_1, object !is null ? object.id_ : null);
        return result !is null ? new NSCollectionViewItem(result) : null;
    }

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

    public void setAllowsMultipleSelection (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setAllowsMultipleSelection_1, flag);
    }

    public void setBackgroundColors (NSArray colors)
    {
        OS.objc_msgSend(this.id_, OS.sel_setBackgroundColors_1, colors !is null ? colors.id_ : null);
    }

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

    public void setItemPrototype (NSCollectionViewItem prototype)
    {
        OS.objc_msgSend(this.id_, OS.sel_setItemPrototype_1, prototype !is null ? prototype.id_ : null);
    }

    public void setMaxItemSize (NSSize size)
    {
        OS.objc_msgSend(this.id_, OS.sel_setMaxItemSize_1, size);
    }

    public void setMaxNumberOfColumns (NSUInteger number)
    {
        OS.objc_msgSend(this.id_, OS.sel_setMaxNumberOfColumns_1, number);
    }

    public void setMaxNumberOfRows (NSUInteger number)
    {
        OS.objc_msgSend(this.id_, OS.sel_setMaxNumberOfRows_1, number);
    }

    public void setMinItemSize (NSSize size)
    {
        OS.objc_msgSend(this.id_, OS.sel_setMinItemSize_1, size);
    }

    public void setSelectable (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setSelectable_1, flag);
    }

    public void setSelectionIndexes (NSIndexSet indexes)
    {
        OS.objc_msgSend(this.id_, OS.sel_setSelectionIndexes_1, indexes !is null ? indexes.id_ : null);
    }

}