1use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6#[cfg(feature = "objc2-core-foundation")]
7use objc2_core_foundation::*;
8use objc2_foundation::*;
9
10use crate::*;
11
12pub type NSRuleEditorPredicatePartKey = NSString;
15
16extern "C" {
17 pub static NSRuleEditorPredicateLeftExpression: &'static NSRuleEditorPredicatePartKey;
19}
20
21extern "C" {
22 pub static NSRuleEditorPredicateRightExpression: &'static NSRuleEditorPredicatePartKey;
24}
25
26extern "C" {
27 pub static NSRuleEditorPredicateComparisonModifier: &'static NSRuleEditorPredicatePartKey;
29}
30
31extern "C" {
32 pub static NSRuleEditorPredicateOptions: &'static NSRuleEditorPredicatePartKey;
34}
35
36extern "C" {
37 pub static NSRuleEditorPredicateOperatorType: &'static NSRuleEditorPredicatePartKey;
39}
40
41extern "C" {
42 pub static NSRuleEditorPredicateCustomSelector: &'static NSRuleEditorPredicatePartKey;
44}
45
46extern "C" {
47 pub static NSRuleEditorPredicateCompoundType: &'static NSRuleEditorPredicatePartKey;
49}
50
51#[repr(transparent)]
54#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
55pub struct NSRuleEditorNestingMode(pub NSUInteger);
56impl NSRuleEditorNestingMode {
57 #[doc(alias = "NSRuleEditorNestingModeSingle")]
58 pub const Single: Self = Self(0);
59 #[doc(alias = "NSRuleEditorNestingModeList")]
60 pub const List: Self = Self(1);
61 #[doc(alias = "NSRuleEditorNestingModeCompound")]
62 pub const Compound: Self = Self(2);
63 #[doc(alias = "NSRuleEditorNestingModeSimple")]
64 pub const Simple: Self = Self(3);
65}
66
67unsafe impl Encode for NSRuleEditorNestingMode {
68 const ENCODING: Encoding = NSUInteger::ENCODING;
69}
70
71unsafe impl RefEncode for NSRuleEditorNestingMode {
72 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
73}
74
75#[repr(transparent)]
78#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
79pub struct NSRuleEditorRowType(pub NSUInteger);
80impl NSRuleEditorRowType {
81 #[doc(alias = "NSRuleEditorRowTypeSimple")]
82 pub const Simple: Self = Self(0);
83 #[doc(alias = "NSRuleEditorRowTypeCompound")]
84 pub const Compound: Self = Self(1);
85}
86
87unsafe impl Encode for NSRuleEditorRowType {
88 const ENCODING: Encoding = NSUInteger::ENCODING;
89}
90
91unsafe impl RefEncode for NSRuleEditorRowType {
92 const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
93}
94
95extern_class!(
96 #[unsafe(super(NSControl, NSView, NSResponder, NSObject))]
98 #[derive(Debug, PartialEq, Eq, Hash)]
99 #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
100 pub struct NSRuleEditor;
101);
102
103#[cfg(all(
104 feature = "NSAccessibilityProtocols",
105 feature = "NSControl",
106 feature = "NSResponder",
107 feature = "NSView"
108))]
109unsafe impl NSAccessibility for NSRuleEditor {}
110
111#[cfg(all(
112 feature = "NSAccessibilityProtocols",
113 feature = "NSControl",
114 feature = "NSResponder",
115 feature = "NSView"
116))]
117unsafe impl NSAccessibilityElementProtocol for NSRuleEditor {}
118
119#[cfg(all(
120 feature = "NSAnimation",
121 feature = "NSControl",
122 feature = "NSResponder",
123 feature = "NSView"
124))]
125unsafe impl NSAnimatablePropertyContainer for NSRuleEditor {}
126
127#[cfg(all(
128 feature = "NSAppearance",
129 feature = "NSControl",
130 feature = "NSResponder",
131 feature = "NSView"
132))]
133unsafe impl NSAppearanceCustomization for NSRuleEditor {}
134
135#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
136unsafe impl NSCoding for NSRuleEditor {}
137
138#[cfg(all(
139 feature = "NSControl",
140 feature = "NSDragging",
141 feature = "NSResponder",
142 feature = "NSView"
143))]
144unsafe impl NSDraggingDestination for NSRuleEditor {}
145
146#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
147unsafe impl NSObjectProtocol for NSRuleEditor {}
148
149#[cfg(all(
150 feature = "NSControl",
151 feature = "NSResponder",
152 feature = "NSUserInterfaceItemIdentification",
153 feature = "NSView"
154))]
155unsafe impl NSUserInterfaceItemIdentification for NSRuleEditor {}
156
157#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
158impl NSRuleEditor {
159 extern_methods!(
160 #[unsafe(method(delegate))]
161 #[unsafe(method_family = none)]
162 pub unsafe fn delegate(&self)
163 -> Option<Retained<ProtocolObject<dyn NSRuleEditorDelegate>>>;
164
165 #[unsafe(method(setDelegate:))]
168 #[unsafe(method_family = none)]
169 pub unsafe fn setDelegate(
170 &self,
171 delegate: Option<&ProtocolObject<dyn NSRuleEditorDelegate>>,
172 );
173
174 #[unsafe(method(formattingStringsFilename))]
175 #[unsafe(method_family = none)]
176 pub unsafe fn formattingStringsFilename(&self) -> Option<Retained<NSString>>;
177
178 #[unsafe(method(setFormattingStringsFilename:))]
180 #[unsafe(method_family = none)]
181 pub unsafe fn setFormattingStringsFilename(
182 &self,
183 formatting_strings_filename: Option<&NSString>,
184 );
185
186 #[unsafe(method(formattingDictionary))]
187 #[unsafe(method_family = none)]
188 pub unsafe fn formattingDictionary(
189 &self,
190 ) -> Option<Retained<NSDictionary<NSString, NSString>>>;
191
192 #[unsafe(method(setFormattingDictionary:))]
194 #[unsafe(method_family = none)]
195 pub unsafe fn setFormattingDictionary(
196 &self,
197 formatting_dictionary: Option<&NSDictionary<NSString, NSString>>,
198 );
199
200 #[unsafe(method(reloadCriteria))]
201 #[unsafe(method_family = none)]
202 pub unsafe fn reloadCriteria(&self);
203
204 #[unsafe(method(nestingMode))]
205 #[unsafe(method_family = none)]
206 pub unsafe fn nestingMode(&self) -> NSRuleEditorNestingMode;
207
208 #[unsafe(method(setNestingMode:))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn setNestingMode(&self, nesting_mode: NSRuleEditorNestingMode);
212
213 #[cfg(feature = "objc2-core-foundation")]
214 #[unsafe(method(rowHeight))]
215 #[unsafe(method_family = none)]
216 pub unsafe fn rowHeight(&self) -> CGFloat;
217
218 #[cfg(feature = "objc2-core-foundation")]
219 #[unsafe(method(setRowHeight:))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn setRowHeight(&self, row_height: CGFloat);
223
224 #[unsafe(method(isEditable))]
225 #[unsafe(method_family = none)]
226 pub unsafe fn isEditable(&self) -> bool;
227
228 #[unsafe(method(setEditable:))]
230 #[unsafe(method_family = none)]
231 pub unsafe fn setEditable(&self, editable: bool);
232
233 #[unsafe(method(canRemoveAllRows))]
234 #[unsafe(method_family = none)]
235 pub unsafe fn canRemoveAllRows(&self) -> bool;
236
237 #[unsafe(method(setCanRemoveAllRows:))]
239 #[unsafe(method_family = none)]
240 pub unsafe fn setCanRemoveAllRows(&self, can_remove_all_rows: bool);
241
242 #[unsafe(method(predicate))]
243 #[unsafe(method_family = none)]
244 pub unsafe fn predicate(&self) -> Option<Retained<NSPredicate>>;
245
246 #[unsafe(method(reloadPredicate))]
247 #[unsafe(method_family = none)]
248 pub unsafe fn reloadPredicate(&self);
249
250 #[unsafe(method(predicateForRow:))]
251 #[unsafe(method_family = none)]
252 pub unsafe fn predicateForRow(&self, row: NSInteger) -> Option<Retained<NSPredicate>>;
253
254 #[unsafe(method(numberOfRows))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn numberOfRows(&self) -> NSInteger;
257
258 #[unsafe(method(subrowIndexesForRow:))]
259 #[unsafe(method_family = none)]
260 pub unsafe fn subrowIndexesForRow(&self, row_index: NSInteger) -> Retained<NSIndexSet>;
261
262 #[unsafe(method(criteriaForRow:))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn criteriaForRow(&self, row: NSInteger) -> Retained<NSArray>;
265
266 #[unsafe(method(displayValuesForRow:))]
267 #[unsafe(method_family = none)]
268 pub unsafe fn displayValuesForRow(&self, row: NSInteger) -> Retained<NSArray>;
269
270 #[unsafe(method(rowForDisplayValue:))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn rowForDisplayValue(&self, display_value: &AnyObject) -> NSInteger;
273
274 #[unsafe(method(rowTypeForRow:))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn rowTypeForRow(&self, row_index: NSInteger) -> NSRuleEditorRowType;
277
278 #[unsafe(method(parentRowForRow:))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn parentRowForRow(&self, row_index: NSInteger) -> NSInteger;
281
282 #[unsafe(method(addRow:))]
283 #[unsafe(method_family = none)]
284 pub unsafe fn addRow(&self, sender: Option<&AnyObject>);
285
286 #[unsafe(method(insertRowAtIndex:withType:asSubrowOfRow:animate:))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn insertRowAtIndex_withType_asSubrowOfRow_animate(
289 &self,
290 row_index: NSInteger,
291 row_type: NSRuleEditorRowType,
292 parent_row: NSInteger,
293 should_animate: bool,
294 );
295
296 #[unsafe(method(setCriteria:andDisplayValues:forRowAtIndex:))]
297 #[unsafe(method_family = none)]
298 pub unsafe fn setCriteria_andDisplayValues_forRowAtIndex(
299 &self,
300 criteria: &NSArray,
301 values: &NSArray,
302 row_index: NSInteger,
303 );
304
305 #[unsafe(method(removeRowAtIndex:))]
306 #[unsafe(method_family = none)]
307 pub unsafe fn removeRowAtIndex(&self, row_index: NSInteger);
308
309 #[unsafe(method(removeRowsAtIndexes:includeSubrows:))]
310 #[unsafe(method_family = none)]
311 pub unsafe fn removeRowsAtIndexes_includeSubrows(
312 &self,
313 row_indexes: &NSIndexSet,
314 include_subrows: bool,
315 );
316
317 #[unsafe(method(selectedRowIndexes))]
318 #[unsafe(method_family = none)]
319 pub unsafe fn selectedRowIndexes(&self) -> Retained<NSIndexSet>;
320
321 #[unsafe(method(selectRowIndexes:byExtendingSelection:))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn selectRowIndexes_byExtendingSelection(
324 &self,
325 indexes: &NSIndexSet,
326 extend: bool,
327 );
328
329 #[unsafe(method(rowClass))]
330 #[unsafe(method_family = none)]
331 pub unsafe fn rowClass(&self) -> &'static AnyClass;
332
333 #[unsafe(method(setRowClass:))]
335 #[unsafe(method_family = none)]
336 pub unsafe fn setRowClass(&self, row_class: &AnyClass);
337
338 #[unsafe(method(rowTypeKeyPath))]
339 #[unsafe(method_family = none)]
340 pub unsafe fn rowTypeKeyPath(&self) -> Retained<NSString>;
341
342 #[unsafe(method(setRowTypeKeyPath:))]
344 #[unsafe(method_family = none)]
345 pub unsafe fn setRowTypeKeyPath(&self, row_type_key_path: &NSString);
346
347 #[unsafe(method(subrowsKeyPath))]
348 #[unsafe(method_family = none)]
349 pub unsafe fn subrowsKeyPath(&self) -> Retained<NSString>;
350
351 #[unsafe(method(setSubrowsKeyPath:))]
353 #[unsafe(method_family = none)]
354 pub unsafe fn setSubrowsKeyPath(&self, subrows_key_path: &NSString);
355
356 #[unsafe(method(criteriaKeyPath))]
357 #[unsafe(method_family = none)]
358 pub unsafe fn criteriaKeyPath(&self) -> Retained<NSString>;
359
360 #[unsafe(method(setCriteriaKeyPath:))]
362 #[unsafe(method_family = none)]
363 pub unsafe fn setCriteriaKeyPath(&self, criteria_key_path: &NSString);
364
365 #[unsafe(method(displayValuesKeyPath))]
366 #[unsafe(method_family = none)]
367 pub unsafe fn displayValuesKeyPath(&self) -> Retained<NSString>;
368
369 #[unsafe(method(setDisplayValuesKeyPath:))]
371 #[unsafe(method_family = none)]
372 pub unsafe fn setDisplayValuesKeyPath(&self, display_values_key_path: &NSString);
373 );
374}
375
376#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
378impl NSRuleEditor {
379 extern_methods!(
380 #[unsafe(method(initWithFrame:))]
381 #[unsafe(method_family = init)]
382 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
383
384 #[unsafe(method(initWithCoder:))]
385 #[unsafe(method_family = init)]
386 pub unsafe fn initWithCoder(
387 this: Allocated<Self>,
388 coder: &NSCoder,
389 ) -> Option<Retained<Self>>;
390 );
391}
392
393#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
395impl NSRuleEditor {
396 extern_methods!(
397 #[unsafe(method(init))]
398 #[unsafe(method_family = init)]
399 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
400 );
401}
402
403#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
405impl NSRuleEditor {
406 extern_methods!(
407 #[unsafe(method(new))]
408 #[unsafe(method_family = new)]
409 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
410 );
411}
412
413extern_protocol!(
414 pub unsafe trait NSRuleEditorDelegate: NSObjectProtocol + MainThreadOnly {
416 #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
417 #[unsafe(method(ruleEditor:numberOfChildrenForCriterion:withRowType:))]
418 #[unsafe(method_family = none)]
419 unsafe fn ruleEditor_numberOfChildrenForCriterion_withRowType(
420 &self,
421 editor: &NSRuleEditor,
422 criterion: Option<&AnyObject>,
423 row_type: NSRuleEditorRowType,
424 ) -> NSInteger;
425
426 #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
427 #[unsafe(method(ruleEditor:child:forCriterion:withRowType:))]
428 #[unsafe(method_family = none)]
429 unsafe fn ruleEditor_child_forCriterion_withRowType(
430 &self,
431 editor: &NSRuleEditor,
432 index: NSInteger,
433 criterion: Option<&AnyObject>,
434 row_type: NSRuleEditorRowType,
435 ) -> Retained<AnyObject>;
436
437 #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
438 #[unsafe(method(ruleEditor:displayValueForCriterion:inRow:))]
439 #[unsafe(method_family = none)]
440 unsafe fn ruleEditor_displayValueForCriterion_inRow(
441 &self,
442 editor: &NSRuleEditor,
443 criterion: &AnyObject,
444 row: NSInteger,
445 ) -> Retained<AnyObject>;
446
447 #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
448 #[optional]
449 #[unsafe(method(ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow:))]
450 #[unsafe(method_family = none)]
451 unsafe fn ruleEditor_predicatePartsForCriterion_withDisplayValue_inRow(
452 &self,
453 editor: &NSRuleEditor,
454 criterion: &AnyObject,
455 value: &AnyObject,
456 row: NSInteger,
457 ) -> Option<Retained<NSDictionary<NSRuleEditorPredicatePartKey, AnyObject>>>;
458
459 #[optional]
460 #[unsafe(method(ruleEditorRowsDidChange:))]
461 #[unsafe(method_family = none)]
462 unsafe fn ruleEditorRowsDidChange(&self, notification: &NSNotification);
463 }
464);
465
466extern "C" {
467 pub static NSRuleEditorRowsDidChangeNotification: &'static NSNotificationName;
469}