Mercurial > projects > dwt-mac
diff dwt/internal/cocoa/NSRuleEditor.d @ 0:380af2bdd8e5
Upload of whole dwt tree
author | Jacob Carlborg <doob@me.com> <jacob.carlborg@gmail.com> |
---|---|
date | Sat, 09 Aug 2008 17:00:02 +0200 |
parents | |
children | 8b48be5454ce |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dwt/internal/cocoa/NSRuleEditor.d Sat Aug 09 17:00:02 2008 +0200 @@ -0,0 +1,287 @@ +/******************************************************************************* + * 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; + } + +}