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

import dwt.internal.cocoa.CGFloat;
import dwt.internal.cocoa.id;
import dwt.internal.cocoa.NSArray;
import dwt.internal.cocoa.NSControl;
import dwt.internal.cocoa.NSDictionary;
import dwt.internal.cocoa.NSIndexSet;
import dwt.internal.cocoa.NSInteger;
import dwt.internal.cocoa.NSPredicate;
import dwt.internal.cocoa.NSString;
import dwt.internal.cocoa.OS;
import objc = dwt.internal.objc.runtime;

enum NSRuleEditorRowType : NSUInteger
{
    NSRuleEditorRowTypeSimple,
    NSRuleEditorRowTypeCompound
}

alias NSRuleEditorRowType.NSRuleEditorRowTypeSimple NSRuleEditorRowTypeSimple;
alias NSRuleEditorRowType.NSRuleEditorRowTypeCompound NSRuleEditorRowTypeCompound;

enum NSRuleEditorNestingMode : NSUInteger
{
    NSRuleEditorNestingModeSingle,
    NSRuleEditorNestingModeList,
    NSRuleEditorNestingModeCompound,
    NSRuleEditorNestingModeSimple
}

alias NSRuleEditorNestingMode.NSRuleEditorNestingModeSingle NSRuleEditorNestingModeSingle;
alias NSRuleEditorNestingMode.NSRuleEditorNestingModeList NSRuleEditorNestingModeList;
alias NSRuleEditorNestingMode.NSRuleEditorNestingModeCompound NSRuleEditorNestingModeCompound;
alias NSRuleEditorNestingMode.NSRuleEditorNestingModeSimple NSRuleEditorNestingModeSimple;

public class NSRuleEditor : NSControl
{

    public this ()
    {
        super();
    }

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

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

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

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

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

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

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

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

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

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

    public void insertRowAtIndex (NSInteger rowIndex, NSRuleEditorRowType rowType, NSInteger parentRow, bool shouldAnimate)
    {
        OS.objc_msgSend(this.id_, OS.sel_insertRowAtIndex_1withType_1asSubrowOfRow_1animate_1, rowIndex, rowType, parentRow, shouldAnimate);
    }

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

    public NSRuleEditorNestingMode nestingMode ()
    {
        return cast(NSRuleEditorNestingMode) OS.objc_msgSend(this.id_, OS.sel_nestingMode);
    }

    public NSInteger numberOfRows ()
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_numberOfRows);
    }

    public NSInteger parentRowForRow (NSInteger rowIndex)
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_parentRowForRow_1, rowIndex);
    }

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

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

    public void reloadCriteria ()
    {
        OS.objc_msgSend(this.id_, OS.sel_reloadCriteria);
    }

    public void reloadPredicate ()
    {
        OS.objc_msgSend(this.id_, OS.sel_reloadPredicate);
    }

    public void removeRowAtIndex (NSInteger rowIndex)
    {
        OS.objc_msgSend(this.id_, OS.sel_removeRowAtIndex_1, rowIndex);
    }

    public void removeRowsAtIndexes (NSIndexSet rowIndexes, bool includeSubrows)
    {
        OS.objc_msgSend(this.id_, OS.sel_removeRowsAtIndexes_1includeSubrows_1, rowIndexes !is null ? rowIndexes.id_ : null, includeSubrows);
    }

    public objc.Class rowClass ()
    {
        return cast(objc.Class) OS.objc_msgSend(this.id_, OS.sel_rowClass);
    }

    public NSInteger rowForDisplayValue (id displayValue)
    {
        return cast(NSInteger) OS.objc_msgSend(this.id_, OS.sel_rowForDisplayValue_1, displayValue !is null ? displayValue.id_ : null);
    }

    public CGFloat rowHeight ()
    {
        return cast(CGFloat) OS.objc_msgSend_fpret(this.id_, OS.sel_rowHeight);
    }

    public NSRuleEditorRowType rowTypeForRow (NSInteger rowIndex)
    {
        return cast(NSRuleEditorRowType) OS.objc_msgSend(this.id_, OS.sel_rowTypeForRow_1, rowIndex);
    }

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

    public void selectRowIndexes (NSIndexSet indexes, bool extend)
    {
        OS.objc_msgSend(this.id_, OS.sel_selectRowIndexes_1byExtendingSelection_1, indexes !is null ? indexes.id_ : null, extend);
    }

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

    public void setCanRemoveAllRows (bool val)
    {
        OS.objc_msgSend(this.id_, OS.sel_setCanRemoveAllRows_1, val);
    }

    public void setCriteria (NSArray criteria, NSArray values, NSInteger rowIndex)
    {
        OS.objc_msgSend(this.id_, OS.sel_setCriteria_1andDisplayValues_1forRowAtIndex_1, criteria !is null ? criteria.id_ : null,
                values !is null ? values.id_ : null, rowIndex);
    }

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

    public void setDelegate (id delegatee)
    {
        OS.objc_msgSend(this.id_, OS.sel_setDelegate_1, delegatee !is null ? delegatee.id_ : null);
    }

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

    public void setEditable (bool editable)
    {
        OS.objc_msgSend(this.id_, OS.sel_setEditable_1, editable);
    }

    public void setFormattingDictionary (NSDictionary dictionary)
    {
        OS.objc_msgSend(this.id_, OS.sel_setFormattingDictionary_1, dictionary !is null ? dictionary.id_ : null);
    }

    public void setFormattingStringsFilename (NSString stringsFilename)
    {
        OS.objc_msgSend(this.id_, OS.sel_setFormattingStringsFilename_1, stringsFilename !is null ? stringsFilename.id_ : null);
    }

    public void setNestingMode (NSRuleEditorNestingMode mode)
    {
        OS.objc_msgSend(this.id_, OS.sel_setNestingMode_1, mode);
    }

    public void setRowClass (objc.Class rowClass)
    {
        OS.objc_msgSend(this.id_, OS.sel_setRowClass_1, rowClass);
    }

    public void setRowHeight (CGFloat height)
    {
        OS.objc_msgSend(this.id_, OS.sel_setRowHeight_1, height);
    }

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

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

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

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

}