-
-
Save abock/0493449d133be0caeb60 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// Using the generated constructors, lots of ugly: | |
// | |
FilterEditor.RowTemplates = new [] { | |
new NSPredicateEditorRowTemplate (new [] { | |
NSNumber.FromUInt32 ((uint)NSCompoundPredicateType.And), | |
NSNumber.FromUInt32 ((uint)NSCompoundPredicateType.Or), | |
NSNumber.FromUInt32 ((uint)NSCompoundPredicateType.Not), | |
}), | |
new NSPredicateEditorRowTemplate ( | |
new [] { NSExpression.FromKeyPath ("Platform") }, | |
new [] { | |
NSExpression.FromKeyPath ("Lion (10.7)"), | |
NSExpression.FromKeyPath ("Mountain Lion (10.8)") | |
}, | |
NSComparisonPredicateModifier.Direct, | |
new [] { | |
NSNumber.FromUInt32 ((uint)NSPredicateOperatorType.LessThan), | |
NSNumber.FromUInt32 ((uint)NSPredicateOperatorType.LessThanOrEqualTo), | |
NSNumber.FromUInt32 ((uint)NSPredicateOperatorType.GreaterThan), | |
NSNumber.FromUInt32 ((uint)NSPredicateOperatorType.GreaterThanOrEqualTo), | |
NSNumber.FromUInt32 ((uint)NSPredicateOperatorType.EqualTo), | |
NSNumber.FromUInt32 ((uint)NSPredicateOperatorType.NotEqualTo) | |
}, | |
NSComparisonPredicateOptions.None | |
), | |
new NSPredicateEditorRowTemplate ( | |
new [] { NSExpression.FromKeyPath ("C# Type") }, | |
NSAttributeType.String, | |
NSComparisonPredicateModifier.Direct, | |
new [] { | |
NSNumber.FromUInt32 ((uint)NSPredicateOperatorType.BeginsWith), | |
NSNumber.FromUInt32 ((uint)NSPredicateOperatorType.Contains), | |
NSNumber.FromUInt32 ((uint)NSPredicateOperatorType.EqualTo), | |
NSNumber.FromUInt32 ((uint)NSPredicateOperatorType.EndsWith), | |
NSNumber.FromUInt32 ((uint)NSPredicateOperatorType.NotEqualTo) | |
}, | |
NSComparisonPredicateOptions.None | |
) | |
}; | |
// | |
// Hot convenience constructors save your wrists and brain! | |
// | |
FilterEditor.RowTemplates = new [] { | |
new NSPredicateEditorRowTemplate ( | |
NSCompoundPredicateType.And, | |
NSCompoundPredicateType.Or, | |
NSCompoundPredicateType.Not | |
), | |
new NSPredicateEditorRowTemplate ( | |
"Platform", | |
new [] { | |
"Lion (10.7)", | |
"Mountain Lion (10.8)" | |
}, | |
new [] { | |
NSPredicateOperatorType.LessThan, | |
NSPredicateOperatorType.LessThanOrEqualTo, | |
NSPredicateOperatorType.GreaterThan, | |
NSPredicateOperatorType.GreaterThanOrEqualTo, | |
NSPredicateOperatorType.EqualTo, | |
NSPredicateOperatorType.NotEqualTo | |
} | |
), | |
new NSPredicateEditorRowTemplate ( | |
"C# Type", | |
NSAttributeType.String, | |
new [] { | |
NSPredicateOperatorType.BeginsWith, | |
NSPredicateOperatorType.Contains, | |
NSPredicateOperatorType.EqualTo, | |
NSPredicateOperatorType.EndsWith, | |
NSPredicateOperatorType.NotEqualTo | |
} | |
) | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment