Mercurial > projects > dstep
view dstep/appkit/NSRuleEditor.d @ 16:19885b43130e
Huge update, the bridge actually works now
author | Jacob Carlborg <doob@me.com> |
---|---|
date | Sun, 03 Jan 2010 22:06:11 +0100 |
parents | |
children | b9de51448c6b |
line wrap: on
line source
/** * Copyright: Copyright (c) 2009 Jacob Carlborg. * Authors: Jacob Carlborg * Version: Initial created: Sep 24, 2009 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost Software License 1.0) */ module dstep.appkit.NSRuleEditor; import dstep.appkit.AppKitDefines; import dstep.appkit.NSControl; import dstep.appkit.NSView; import dstep.applicationservices.coregraphics.CGBase; import dstep.foundation.NSArray; import dstep.foundation.NSDictionary; import dstep.foundation.NSIndexSet; import dstep.foundation.NSObjCRuntime; import dstep.foundation.NSPredicate; import dstep.foundation.NSString; import dstep.foundation.NSTimer; import dstep.objc.bridge.Bridge; import dstep.objc.objc; import bindings = dstep.appkit.NSRuleEditor_bindings; alias NSUInteger NSRuleEditorNestingMode; alias NSUInteger NSRuleEditorRowType; private { NSString NSRuleEditorPredicateLeftExpression_; NSString NSRuleEditorPredicateRightExpression_; NSString NSRuleEditorPredicateComparisonModifier_; NSString NSRuleEditorPredicateOptions_; NSString NSRuleEditorPredicateOperatorType_; NSString NSRuleEditorPredicateCustomSelector_; NSString NSRuleEditorPredicateCompoundType_; NSString NSRuleEditorRowsDidChangeNotification_; } NSString NSRuleEditorPredicateLeftExpression () { if (NSRuleEditorPredicateLeftExpression_) return NSRuleEditorPredicateLeftExpression_; return NSRuleEditorPredicateLeftExpression_ = new NSString(bindings.NSRuleEditorPredicateLeftExpression); } NSString NSRuleEditorPredicateRightExpression () { if (NSRuleEditorPredicateRightExpression_) return NSRuleEditorPredicateRightExpression_; return NSRuleEditorPredicateRightExpression_ = new NSString(bindings.NSRuleEditorPredicateRightExpression); } NSString NSRuleEditorPredicateComparisonModifier () { if (NSRuleEditorPredicateComparisonModifier_) return NSRuleEditorPredicateComparisonModifier_; return NSRuleEditorPredicateComparisonModifier_ = new NSString(bindings.NSRuleEditorPredicateComparisonModifier); } NSString NSRuleEditorPredicateOptions () { if (NSRuleEditorPredicateOptions_) return NSRuleEditorPredicateOptions_; return NSRuleEditorPredicateOptions_ = new NSString(bindings.NSRuleEditorPredicateOptions); } NSString NSRuleEditorPredicateOperatorType () { if (NSRuleEditorPredicateOperatorType_) return NSRuleEditorPredicateOperatorType_; return NSRuleEditorPredicateOperatorType_ = new NSString(bindings.NSRuleEditorPredicateOperatorType); } NSString NSRuleEditorPredicateCustomSelector () { if (NSRuleEditorPredicateCustomSelector_) return NSRuleEditorPredicateCustomSelector_; return NSRuleEditorPredicateCustomSelector_ = new NSString(bindings.NSRuleEditorPredicateCustomSelector); } NSString NSRuleEditorPredicateCompoundType () { if (NSRuleEditorPredicateCompoundType_) return NSRuleEditorPredicateCompoundType_; return NSRuleEditorPredicateCompoundType_ = new NSString(bindings.NSRuleEditorPredicateCompoundType); } NSString NSRuleEditorRowsDidChangeNotification () { if (NSRuleEditorRowsDidChangeNotification_) return NSRuleEditorRowsDidChangeNotification_; return NSRuleEditorRowsDidChangeNotification_ = new NSString(bindings.NSRuleEditorRowsDidChangeNotification); } enum { NSRuleEditorNestingModeSingle, NSRuleEditorNestingModeList, NSRuleEditorNestingModeCompound, NSRuleEditorNestingModeSimple } enum { NSRuleEditorRowTypeSimple, NSRuleEditorRowTypeCompound } class NSRuleEditor : NSControl { mixin (ObjcWrap); void setDelegate (Object arg0) { return invokeObjcSelf!(void, "setDelegate:", Object)(arg0); } Object delegate_ () { return invokeObjcSelf!(Object, "delegate"); } void setFormattingStringsFilename (NSString stringsFilename) { return invokeObjcSelf!(void, "setFormattingStringsFilename:", NSString)(stringsFilename); } NSString formattingStringsFilename () { return invokeObjcSelf!(NSString, "formattingStringsFilename"); } void setFormattingDictionary (NSDictionary dictionary) { return invokeObjcSelf!(void, "setFormattingDictionary:", NSDictionary)(dictionary); } NSDictionary formattingDictionary () { return invokeObjcSelf!(NSDictionary, "formattingDictionary"); } void reloadCriteria () { return invokeObjcSelf!(void, "reloadCriteria"); } void setNestingMode (uint mode) { return invokeObjcSelf!(void, "setNestingMode:", uint)(mode); } uint nestingMode () { return invokeObjcSelf!(uint, "nestingMode"); } void setRowHeight (CGFloat height) { return invokeObjcSelf!(void, "setRowHeight:", CGFloat)(height); } CGFloat rowHeight () { return invokeObjcSelf!(CGFloat, "rowHeight"); } void setEditable (bool editable) { return invokeObjcSelf!(void, "setEditable:", bool)(editable); } bool isEditable () { return invokeObjcSelf!(bool, "isEditable"); } void setCanRemoveAllRows (bool val) { return invokeObjcSelf!(void, "setCanRemoveAllRows:", bool)(val); } bool canRemoveAllRows () { return invokeObjcSelf!(bool, "canRemoveAllRows"); } NSPredicate predicate () { return invokeObjcSelf!(NSPredicate, "predicate"); } void reloadPredicate () { return invokeObjcSelf!(void, "reloadPredicate"); } NSPredicate predicateForRow (NSInteger row) { return invokeObjcSelf!(NSPredicate, "predicateForRow:", NSInteger)(row); } NSInteger numberOfRows () { return invokeObjcSelf!(NSInteger, "numberOfRows"); } NSIndexSet subrowIndexesForRow (NSInteger rowIndex) { return invokeObjcSelf!(NSIndexSet, "subrowIndexesForRow:", NSInteger)(rowIndex); } NSArray criteriaForRow (NSInteger row) { return invokeObjcSelf!(NSArray, "criteriaForRow:", NSInteger)(row); } NSArray displayValuesForRow (NSInteger row) { return invokeObjcSelf!(NSArray, "displayValuesForRow:", NSInteger)(row); } NSInteger rowForDisplayValue (Object displayValue) { return invokeObjcSelf!(NSInteger, "rowForDisplayValue:", Object)(displayValue); } uint rowTypeForRow (NSInteger rowIndex) { return invokeObjcSelf!(uint, "rowTypeForRow:", NSInteger)(rowIndex); } NSInteger parentRowForRow (NSInteger rowIndex) { return invokeObjcSelf!(NSInteger, "parentRowForRow:", NSInteger)(rowIndex); } void addRow (Object sender) { return invokeObjcSelf!(void, "addRow:", Object)(sender); } void insertRowAtIndex (NSInteger rowIndex, uint rowType, NSInteger parentRow, bool shouldAnimate) { return invokeObjcSelf!(void, "insertRowAtIndex:withType:asSubrowOfRow:animate:", NSInteger, uint, NSInteger, bool)(rowIndex, rowType, parentRow, shouldAnimate); } void setCriteria (NSArray criteria, NSArray values, NSInteger rowIndex) { return invokeObjcSelf!(void, "setCriteria:andDisplayValues:forRowAtIndex:", NSArray, NSArray, NSInteger)(criteria, values, rowIndex); } void removeRowAtIndex (NSInteger rowIndex) { return invokeObjcSelf!(void, "removeRowAtIndex:", NSInteger)(rowIndex); } void removeRowsAtIndexes (NSIndexSet rowIndexes, bool includeSubrows) { return invokeObjcSelf!(void, "removeRowsAtIndexes:includeSubrows:", NSIndexSet, bool)(rowIndexes, includeSubrows); } NSIndexSet selectedRowIndexes () { return invokeObjcSelf!(NSIndexSet, "selectedRowIndexes"); } void selectRowIndexes (NSIndexSet indexes, bool extend) { return invokeObjcSelf!(void, "selectRowIndexes:byExtendingSelection:", NSIndexSet, bool)(indexes, extend); } void setRowClass (Class rowClass) { return invokeObjcSelf!(void, "setRowClass:", Class)(rowClass); } Class rowClass () { return invokeObjcSelf!(Class, "rowClass"); } void setRowTypeKeyPath (NSString keyPath) { return invokeObjcSelf!(void, "setRowTypeKeyPath:", NSString)(keyPath); } NSString rowTypeKeyPath () { return invokeObjcSelf!(NSString, "rowTypeKeyPath"); } void setSubrowsKeyPath (NSString keyPath) { return invokeObjcSelf!(void, "setSubrowsKeyPath:", NSString)(keyPath); } NSString subrowsKeyPath () { return invokeObjcSelf!(NSString, "subrowsKeyPath"); } void setCriteriaKeyPath (NSString keyPath) { return invokeObjcSelf!(void, "setCriteriaKeyPath:", NSString)(keyPath); } NSString criteriaKeyPath () { return invokeObjcSelf!(NSString, "criteriaKeyPath"); } void setDisplayValuesKeyPath (NSString keyPath) { return invokeObjcSelf!(void, "setDisplayValuesKeyPath:", NSString)(keyPath); } NSString displayValuesKeyPath () { return invokeObjcSelf!(NSString, "displayValuesKeyPath"); } } const TNSRuleEditorDelegateMethods = ` NSInteger ruleEditor (NSRuleEditor editor, Object criterion, uint rowType) { return invokeObjcSelf!(NSInteger, "ruleEditor:numberOfChildrenForCriterion:withRowType:", NSRuleEditor, Object, uint)(editor, criterion, rowType); } Object ruleEditor (NSRuleEditor editor, NSInteger index, Object criterion, uint rowType) { return invokeObjcSelf!(Object, "ruleEditor:child:forCriterion:withRowType:", NSRuleEditor, NSInteger, Object, uint)(editor, index, criterion, rowType); } Object ruleEditor (NSRuleEditor editor, Object criterion, NSInteger row) { return invokeObjcSelf!(Object, "ruleEditor:displayValueForCriterion:inRow:", NSRuleEditor, Object, NSInteger)(editor, criterion, row); } NSDictionary ruleEditor (NSRuleEditor editor, Object criterion, Object value, NSInteger row) { return invokeObjcSelf!(NSDictionary, "ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow:", NSRuleEditor, Object, Object, NSInteger)(editor, criterion, value, row); } void ruleEditorRowsDidChange (NSNotification notification) { return invokeObjcSelf!(void, "ruleEditorRowsDidChange:", NSNotification)(notification); } //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:numberOfChildrenForCriterion:withRowType:"); //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:child:forCriterion:withRowType:"); //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:displayValueForCriterion:inRow:"); //mixin ObjcBindMethod!(ruleEditor, "ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow:"); //mixin ObjcBindMethod!(ruleEditorRowsDidChange, "ruleEditorRowsDidChange:"); `;