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))]
109extern_conformance!(
110 unsafe impl NSAccessibility for NSRuleEditor {}
111);
112
113#[cfg(all(
114 feature = "NSAccessibilityProtocols",
115 feature = "NSControl",
116 feature = "NSResponder",
117 feature = "NSView"
118))]
119extern_conformance!(
120 unsafe impl NSAccessibilityElementProtocol for NSRuleEditor {}
121);
122
123#[cfg(all(
124 feature = "NSAnimation",
125 feature = "NSControl",
126 feature = "NSResponder",
127 feature = "NSView"
128))]
129extern_conformance!(
130 unsafe impl NSAnimatablePropertyContainer for NSRuleEditor {}
131);
132
133#[cfg(all(
134 feature = "NSAppearance",
135 feature = "NSControl",
136 feature = "NSResponder",
137 feature = "NSView"
138))]
139extern_conformance!(
140 unsafe impl NSAppearanceCustomization for NSRuleEditor {}
141);
142
143#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
144extern_conformance!(
145 unsafe impl NSCoding for NSRuleEditor {}
146);
147
148#[cfg(all(
149 feature = "NSControl",
150 feature = "NSDragging",
151 feature = "NSResponder",
152 feature = "NSView"
153))]
154extern_conformance!(
155 unsafe impl NSDraggingDestination for NSRuleEditor {}
156);
157
158#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
159extern_conformance!(
160 unsafe impl NSObjectProtocol for NSRuleEditor {}
161);
162
163#[cfg(all(
164 feature = "NSControl",
165 feature = "NSResponder",
166 feature = "NSUserInterfaceItemIdentification",
167 feature = "NSView"
168))]
169extern_conformance!(
170 unsafe impl NSUserInterfaceItemIdentification for NSRuleEditor {}
171);
172
173#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
174impl NSRuleEditor {
175 extern_methods!(
176 #[unsafe(method(delegate))]
177 #[unsafe(method_family = none)]
178 pub unsafe fn delegate(&self)
179 -> Option<Retained<ProtocolObject<dyn NSRuleEditorDelegate>>>;
180
181 #[unsafe(method(setDelegate:))]
184 #[unsafe(method_family = none)]
185 pub unsafe fn setDelegate(
186 &self,
187 delegate: Option<&ProtocolObject<dyn NSRuleEditorDelegate>>,
188 );
189
190 #[unsafe(method(formattingStringsFilename))]
191 #[unsafe(method_family = none)]
192 pub unsafe fn formattingStringsFilename(&self) -> Option<Retained<NSString>>;
193
194 #[unsafe(method(setFormattingStringsFilename:))]
196 #[unsafe(method_family = none)]
197 pub unsafe fn setFormattingStringsFilename(
198 &self,
199 formatting_strings_filename: Option<&NSString>,
200 );
201
202 #[unsafe(method(formattingDictionary))]
203 #[unsafe(method_family = none)]
204 pub unsafe fn formattingDictionary(
205 &self,
206 ) -> Option<Retained<NSDictionary<NSString, NSString>>>;
207
208 #[unsafe(method(setFormattingDictionary:))]
210 #[unsafe(method_family = none)]
211 pub unsafe fn setFormattingDictionary(
212 &self,
213 formatting_dictionary: Option<&NSDictionary<NSString, NSString>>,
214 );
215
216 #[unsafe(method(reloadCriteria))]
217 #[unsafe(method_family = none)]
218 pub unsafe fn reloadCriteria(&self);
219
220 #[unsafe(method(nestingMode))]
221 #[unsafe(method_family = none)]
222 pub unsafe fn nestingMode(&self) -> NSRuleEditorNestingMode;
223
224 #[unsafe(method(setNestingMode:))]
226 #[unsafe(method_family = none)]
227 pub unsafe fn setNestingMode(&self, nesting_mode: NSRuleEditorNestingMode);
228
229 #[cfg(feature = "objc2-core-foundation")]
230 #[unsafe(method(rowHeight))]
231 #[unsafe(method_family = none)]
232 pub unsafe fn rowHeight(&self) -> CGFloat;
233
234 #[cfg(feature = "objc2-core-foundation")]
235 #[unsafe(method(setRowHeight:))]
237 #[unsafe(method_family = none)]
238 pub unsafe fn setRowHeight(&self, row_height: CGFloat);
239
240 #[unsafe(method(isEditable))]
241 #[unsafe(method_family = none)]
242 pub unsafe fn isEditable(&self) -> bool;
243
244 #[unsafe(method(setEditable:))]
246 #[unsafe(method_family = none)]
247 pub unsafe fn setEditable(&self, editable: bool);
248
249 #[unsafe(method(canRemoveAllRows))]
250 #[unsafe(method_family = none)]
251 pub unsafe fn canRemoveAllRows(&self) -> bool;
252
253 #[unsafe(method(setCanRemoveAllRows:))]
255 #[unsafe(method_family = none)]
256 pub unsafe fn setCanRemoveAllRows(&self, can_remove_all_rows: bool);
257
258 #[unsafe(method(predicate))]
259 #[unsafe(method_family = none)]
260 pub unsafe fn predicate(&self) -> Option<Retained<NSPredicate>>;
261
262 #[unsafe(method(reloadPredicate))]
263 #[unsafe(method_family = none)]
264 pub unsafe fn reloadPredicate(&self);
265
266 #[unsafe(method(predicateForRow:))]
267 #[unsafe(method_family = none)]
268 pub unsafe fn predicateForRow(&self, row: NSInteger) -> Option<Retained<NSPredicate>>;
269
270 #[unsafe(method(numberOfRows))]
271 #[unsafe(method_family = none)]
272 pub unsafe fn numberOfRows(&self) -> NSInteger;
273
274 #[unsafe(method(subrowIndexesForRow:))]
275 #[unsafe(method_family = none)]
276 pub unsafe fn subrowIndexesForRow(&self, row_index: NSInteger) -> Retained<NSIndexSet>;
277
278 #[unsafe(method(criteriaForRow:))]
279 #[unsafe(method_family = none)]
280 pub unsafe fn criteriaForRow(&self, row: NSInteger) -> Retained<NSArray>;
281
282 #[unsafe(method(displayValuesForRow:))]
283 #[unsafe(method_family = none)]
284 pub unsafe fn displayValuesForRow(&self, row: NSInteger) -> Retained<NSArray>;
285
286 #[unsafe(method(rowForDisplayValue:))]
287 #[unsafe(method_family = none)]
288 pub unsafe fn rowForDisplayValue(&self, display_value: &AnyObject) -> NSInteger;
289
290 #[unsafe(method(rowTypeForRow:))]
291 #[unsafe(method_family = none)]
292 pub unsafe fn rowTypeForRow(&self, row_index: NSInteger) -> NSRuleEditorRowType;
293
294 #[unsafe(method(parentRowForRow:))]
295 #[unsafe(method_family = none)]
296 pub unsafe fn parentRowForRow(&self, row_index: NSInteger) -> NSInteger;
297
298 #[unsafe(method(addRow:))]
299 #[unsafe(method_family = none)]
300 pub unsafe fn addRow(&self, sender: Option<&AnyObject>);
301
302 #[unsafe(method(insertRowAtIndex:withType:asSubrowOfRow:animate:))]
303 #[unsafe(method_family = none)]
304 pub unsafe fn insertRowAtIndex_withType_asSubrowOfRow_animate(
305 &self,
306 row_index: NSInteger,
307 row_type: NSRuleEditorRowType,
308 parent_row: NSInteger,
309 should_animate: bool,
310 );
311
312 #[unsafe(method(setCriteria:andDisplayValues:forRowAtIndex:))]
313 #[unsafe(method_family = none)]
314 pub unsafe fn setCriteria_andDisplayValues_forRowAtIndex(
315 &self,
316 criteria: &NSArray,
317 values: &NSArray,
318 row_index: NSInteger,
319 );
320
321 #[unsafe(method(removeRowAtIndex:))]
322 #[unsafe(method_family = none)]
323 pub unsafe fn removeRowAtIndex(&self, row_index: NSInteger);
324
325 #[unsafe(method(removeRowsAtIndexes:includeSubrows:))]
326 #[unsafe(method_family = none)]
327 pub unsafe fn removeRowsAtIndexes_includeSubrows(
328 &self,
329 row_indexes: &NSIndexSet,
330 include_subrows: bool,
331 );
332
333 #[unsafe(method(selectedRowIndexes))]
334 #[unsafe(method_family = none)]
335 pub unsafe fn selectedRowIndexes(&self) -> Retained<NSIndexSet>;
336
337 #[unsafe(method(selectRowIndexes:byExtendingSelection:))]
338 #[unsafe(method_family = none)]
339 pub unsafe fn selectRowIndexes_byExtendingSelection(
340 &self,
341 indexes: &NSIndexSet,
342 extend: bool,
343 );
344
345 #[unsafe(method(rowClass))]
346 #[unsafe(method_family = none)]
347 pub unsafe fn rowClass(&self) -> &'static AnyClass;
348
349 #[unsafe(method(setRowClass:))]
351 #[unsafe(method_family = none)]
352 pub unsafe fn setRowClass(&self, row_class: &AnyClass);
353
354 #[unsafe(method(rowTypeKeyPath))]
355 #[unsafe(method_family = none)]
356 pub unsafe fn rowTypeKeyPath(&self) -> Retained<NSString>;
357
358 #[unsafe(method(setRowTypeKeyPath:))]
360 #[unsafe(method_family = none)]
361 pub unsafe fn setRowTypeKeyPath(&self, row_type_key_path: &NSString);
362
363 #[unsafe(method(subrowsKeyPath))]
364 #[unsafe(method_family = none)]
365 pub unsafe fn subrowsKeyPath(&self) -> Retained<NSString>;
366
367 #[unsafe(method(setSubrowsKeyPath:))]
369 #[unsafe(method_family = none)]
370 pub unsafe fn setSubrowsKeyPath(&self, subrows_key_path: &NSString);
371
372 #[unsafe(method(criteriaKeyPath))]
373 #[unsafe(method_family = none)]
374 pub unsafe fn criteriaKeyPath(&self) -> Retained<NSString>;
375
376 #[unsafe(method(setCriteriaKeyPath:))]
378 #[unsafe(method_family = none)]
379 pub unsafe fn setCriteriaKeyPath(&self, criteria_key_path: &NSString);
380
381 #[unsafe(method(displayValuesKeyPath))]
382 #[unsafe(method_family = none)]
383 pub unsafe fn displayValuesKeyPath(&self) -> Retained<NSString>;
384
385 #[unsafe(method(setDisplayValuesKeyPath:))]
387 #[unsafe(method_family = none)]
388 pub unsafe fn setDisplayValuesKeyPath(&self, display_values_key_path: &NSString);
389 );
390}
391
392#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
394impl NSRuleEditor {
395 extern_methods!(
396 #[unsafe(method(initWithFrame:))]
397 #[unsafe(method_family = init)]
398 pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
399
400 #[unsafe(method(initWithCoder:))]
401 #[unsafe(method_family = init)]
402 pub unsafe fn initWithCoder(
403 this: Allocated<Self>,
404 coder: &NSCoder,
405 ) -> Option<Retained<Self>>;
406 );
407}
408
409#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
411impl NSRuleEditor {
412 extern_methods!(
413 #[unsafe(method(init))]
414 #[unsafe(method_family = init)]
415 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
416 );
417}
418
419#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
421impl NSRuleEditor {
422 extern_methods!(
423 #[unsafe(method(new))]
424 #[unsafe(method_family = new)]
425 pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
426 );
427}
428
429extern_protocol!(
430 pub unsafe trait NSRuleEditorDelegate: NSObjectProtocol + MainThreadOnly {
432 #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
433 #[unsafe(method(ruleEditor:numberOfChildrenForCriterion:withRowType:))]
434 #[unsafe(method_family = none)]
435 unsafe fn ruleEditor_numberOfChildrenForCriterion_withRowType(
436 &self,
437 editor: &NSRuleEditor,
438 criterion: Option<&AnyObject>,
439 row_type: NSRuleEditorRowType,
440 ) -> NSInteger;
441
442 #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
443 #[unsafe(method(ruleEditor:child:forCriterion:withRowType:))]
444 #[unsafe(method_family = none)]
445 unsafe fn ruleEditor_child_forCriterion_withRowType(
446 &self,
447 editor: &NSRuleEditor,
448 index: NSInteger,
449 criterion: Option<&AnyObject>,
450 row_type: NSRuleEditorRowType,
451 ) -> Retained<AnyObject>;
452
453 #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
454 #[unsafe(method(ruleEditor:displayValueForCriterion:inRow:))]
455 #[unsafe(method_family = none)]
456 unsafe fn ruleEditor_displayValueForCriterion_inRow(
457 &self,
458 editor: &NSRuleEditor,
459 criterion: &AnyObject,
460 row: NSInteger,
461 ) -> Retained<AnyObject>;
462
463 #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
464 #[optional]
465 #[unsafe(method(ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow:))]
466 #[unsafe(method_family = none)]
467 unsafe fn ruleEditor_predicatePartsForCriterion_withDisplayValue_inRow(
468 &self,
469 editor: &NSRuleEditor,
470 criterion: &AnyObject,
471 value: &AnyObject,
472 row: NSInteger,
473 ) -> Option<Retained<NSDictionary<NSRuleEditorPredicatePartKey, AnyObject>>>;
474
475 #[optional]
476 #[unsafe(method(ruleEditorRowsDidChange:))]
477 #[unsafe(method_family = none)]
478 unsafe fn ruleEditorRowsDidChange(&self, notification: &NSNotification);
479 }
480);
481
482extern "C" {
483 pub static NSRuleEditorRowsDidChangeNotification: &'static NSNotificationName;
485}