view dwt/internal/cocoa/NSComboBox.d @ 1:8b48be5454ce

The internal cocoa classes compile now
author Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com>
date Tue, 19 Aug 2008 17:35:17 +0200
parents 380af2bdd8e5
children f565d3a95c0a
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.NSComboBox;

import dwt.internal.cocoa.CGFloat;
import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSArray;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSSize;
import dwt.internal.cocoa.NSTextField;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

public class NSComboBox : NSTextField
{

    public this ()
    {
        super();
    }

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

    public void addItemWithObjectValue (id object)
    {
        OS.objc_msgSend(this.id_, OS.sel_addItemWithObjectValue_1, object !is null ? object.id_ : null);
    }

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

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

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

    public void deselectItemAtIndex (NSInteger index)
    {
        OS.objc_msgSend(this.id_, OS.sel_deselectItemAtIndex_1, index);
    }

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

    public NSInteger indexOfItemWithObjectValue (id object)
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfItemWithObjectValue_1, object !is null ? object.id_ : null);
    }

    public NSInteger indexOfSelectedItem ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_indexOfSelectedItem);
    }

    public void insertItemWithObjectValue (id object, NSInteger index)
    {
        OS.objc_msgSend(this.id_, OS.sel_insertItemWithObjectValue_1atIndex_1, object !is null ? object.id_ : null, index);
    }

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

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

    public CGFloat itemHeight ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_itemHeight);
    }

    public objc.id itemObjectValueAtIndex (NSInteger index)
    {
        objc.id result = OS.objc_msgSend(this.id_, OS.sel_itemObjectValueAtIndex_1, index);
        return result !is null ? result : null;
    }

    public void noteNumberOfItemsChanged ()
    {
        OS.objc_msgSend(this.id_, OS.sel_noteNumberOfItemsChanged);
    }

    public NSInteger numberOfItems ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfItems);
    }

    public NSInteger numberOfVisibleItems ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfVisibleItems);
    }

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

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

    public void reloadData ()
    {
        OS.objc_msgSend(this.id_, OS.sel_reloadData);
    }

    public void removeAllItems ()
    {
        OS.objc_msgSend(this.id_, OS.sel_removeAllItems);
    }

    public void removeItemAtIndex (NSInteger index)
    {
        OS.objc_msgSend(this.id_, OS.sel_removeItemAtIndex_1, index);
    }

    public void removeItemWithObjectValue (id object)
    {
        OS.objc_msgSend(this.id_, OS.sel_removeItemWithObjectValue_1, object !is null ? object.id_ : null);
    }

    public void scrollItemAtIndexToTop (NSInteger index)
    {
        OS.objc_msgSend(this.id_, OS.sel_scrollItemAtIndexToTop_1, index);
    }

    public void scrollItemAtIndexToVisible (NSInteger index)
    {
        OS.objc_msgSend(this.id_, OS.sel_scrollItemAtIndexToVisible_1, index);
    }

    public void selectItemAtIndex (NSInteger index)
    {
        OS.objc_msgSend(this.id_, OS.sel_selectItemAtIndex_1, index);
    }

    public void selectItemWithObjectValue (id object)
    {
        OS.objc_msgSend(this.id_, OS.sel_selectItemWithObjectValue_1, object !is null ? object.id_ : null);
    }

    public void setButtonBordered (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setButtonBordered_1, flag);
    }

    public void setCompletes (bool completes)
    {
        OS.objc_msgSend(this.id_, OS.sel_setCompletes_1, completes);
    }

    public void setDataSource (id aSource)
    {
        OS.objc_msgSend(this.id_, OS.sel_setDataSource_1, aSource !is null ? aSource.id_ : null);
    }

    public void setHasVerticalScroller (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setHasVerticalScroller_1, flag);
    }

    public void setIntercellSpacing (NSSize aSize)
    {
        OS.objc_msgSend(this.id_, OS.sel_setIntercellSpacing_1, aSize);
    }

    public void setItemHeight (CGFloat itemHeight)
    {
        OS.objc_msgSend(this.id_, OS.sel_setItemHeight_1, itemHeight);
    }

    public void setNumberOfVisibleItems (NSInteger visibleItems)
    {
        OS.objc_msgSend(this.id_, OS.sel_setNumberOfVisibleItems_1, visibleItems);
    }

    public void setUsesDataSource (bool flag)
    {
        OS.objc_msgSend(this.id_, OS.sel_setUsesDataSource_1, flag);
    }

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

}