objc2_app_kit/generated/
NSRuleEditor.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use 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
12/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditorpredicatepartkey?language=objc)
13// NS_TYPED_ENUM
14pub type NSRuleEditorPredicatePartKey = NSString;
15
16extern "C" {
17    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditorpredicateleftexpression?language=objc)
18    pub static NSRuleEditorPredicateLeftExpression: &'static NSRuleEditorPredicatePartKey;
19}
20
21extern "C" {
22    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditorpredicaterightexpression?language=objc)
23    pub static NSRuleEditorPredicateRightExpression: &'static NSRuleEditorPredicatePartKey;
24}
25
26extern "C" {
27    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditorpredicatecomparisonmodifier?language=objc)
28    pub static NSRuleEditorPredicateComparisonModifier: &'static NSRuleEditorPredicatePartKey;
29}
30
31extern "C" {
32    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditorpredicateoptions?language=objc)
33    pub static NSRuleEditorPredicateOptions: &'static NSRuleEditorPredicatePartKey;
34}
35
36extern "C" {
37    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditorpredicateoperatortype?language=objc)
38    pub static NSRuleEditorPredicateOperatorType: &'static NSRuleEditorPredicatePartKey;
39}
40
41extern "C" {
42    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditorpredicatecustomselector?language=objc)
43    pub static NSRuleEditorPredicateCustomSelector: &'static NSRuleEditorPredicatePartKey;
44}
45
46extern "C" {
47    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditorpredicatecompoundtype?language=objc)
48    pub static NSRuleEditorPredicateCompoundType: &'static NSRuleEditorPredicatePartKey;
49}
50
51/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditornestingmode?language=objc)
52// NS_ENUM
53#[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/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditorrowtype?language=objc)
76// NS_ENUM
77#[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    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditor?language=objc)
97    #[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 fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSRuleEditorDelegate>>>;
179
180        /// Setter for [`delegate`][Self::delegate].
181        ///
182        /// This is a [weak property][objc2::topics::weak_property].
183        #[unsafe(method(setDelegate:))]
184        #[unsafe(method_family = none)]
185        pub fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSRuleEditorDelegate>>);
186
187        #[unsafe(method(formattingStringsFilename))]
188        #[unsafe(method_family = none)]
189        pub fn formattingStringsFilename(&self) -> Option<Retained<NSString>>;
190
191        /// Setter for [`formattingStringsFilename`][Self::formattingStringsFilename].
192        ///
193        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
194        #[unsafe(method(setFormattingStringsFilename:))]
195        #[unsafe(method_family = none)]
196        pub fn setFormattingStringsFilename(&self, formatting_strings_filename: Option<&NSString>);
197
198        #[unsafe(method(formattingDictionary))]
199        #[unsafe(method_family = none)]
200        pub fn formattingDictionary(&self) -> Option<Retained<NSDictionary<NSString, NSString>>>;
201
202        /// Setter for [`formattingDictionary`][Self::formattingDictionary].
203        ///
204        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
205        #[unsafe(method(setFormattingDictionary:))]
206        #[unsafe(method_family = none)]
207        pub fn setFormattingDictionary(
208            &self,
209            formatting_dictionary: Option<&NSDictionary<NSString, NSString>>,
210        );
211
212        #[unsafe(method(reloadCriteria))]
213        #[unsafe(method_family = none)]
214        pub fn reloadCriteria(&self);
215
216        #[unsafe(method(nestingMode))]
217        #[unsafe(method_family = none)]
218        pub fn nestingMode(&self) -> NSRuleEditorNestingMode;
219
220        /// Setter for [`nestingMode`][Self::nestingMode].
221        #[unsafe(method(setNestingMode:))]
222        #[unsafe(method_family = none)]
223        pub fn setNestingMode(&self, nesting_mode: NSRuleEditorNestingMode);
224
225        #[cfg(feature = "objc2-core-foundation")]
226        #[unsafe(method(rowHeight))]
227        #[unsafe(method_family = none)]
228        pub fn rowHeight(&self) -> CGFloat;
229
230        #[cfg(feature = "objc2-core-foundation")]
231        /// Setter for [`rowHeight`][Self::rowHeight].
232        #[unsafe(method(setRowHeight:))]
233        #[unsafe(method_family = none)]
234        pub fn setRowHeight(&self, row_height: CGFloat);
235
236        #[unsafe(method(isEditable))]
237        #[unsafe(method_family = none)]
238        pub fn isEditable(&self) -> bool;
239
240        /// Setter for [`isEditable`][Self::isEditable].
241        #[unsafe(method(setEditable:))]
242        #[unsafe(method_family = none)]
243        pub fn setEditable(&self, editable: bool);
244
245        #[unsafe(method(canRemoveAllRows))]
246        #[unsafe(method_family = none)]
247        pub fn canRemoveAllRows(&self) -> bool;
248
249        /// Setter for [`canRemoveAllRows`][Self::canRemoveAllRows].
250        #[unsafe(method(setCanRemoveAllRows:))]
251        #[unsafe(method_family = none)]
252        pub fn setCanRemoveAllRows(&self, can_remove_all_rows: bool);
253
254        #[unsafe(method(predicate))]
255        #[unsafe(method_family = none)]
256        pub fn predicate(&self) -> Option<Retained<NSPredicate>>;
257
258        #[unsafe(method(reloadPredicate))]
259        #[unsafe(method_family = none)]
260        pub fn reloadPredicate(&self);
261
262        #[unsafe(method(predicateForRow:))]
263        #[unsafe(method_family = none)]
264        pub fn predicateForRow(&self, row: NSInteger) -> Option<Retained<NSPredicate>>;
265
266        #[unsafe(method(numberOfRows))]
267        #[unsafe(method_family = none)]
268        pub fn numberOfRows(&self) -> NSInteger;
269
270        #[unsafe(method(subrowIndexesForRow:))]
271        #[unsafe(method_family = none)]
272        pub fn subrowIndexesForRow(&self, row_index: NSInteger) -> Retained<NSIndexSet>;
273
274        #[unsafe(method(criteriaForRow:))]
275        #[unsafe(method_family = none)]
276        pub fn criteriaForRow(&self, row: NSInteger) -> Retained<NSArray>;
277
278        #[unsafe(method(displayValuesForRow:))]
279        #[unsafe(method_family = none)]
280        pub fn displayValuesForRow(&self, row: NSInteger) -> Retained<NSArray>;
281
282        /// # Safety
283        ///
284        /// `display_value` should be of the correct type.
285        #[unsafe(method(rowForDisplayValue:))]
286        #[unsafe(method_family = none)]
287        pub unsafe fn rowForDisplayValue(&self, display_value: &AnyObject) -> NSInteger;
288
289        #[unsafe(method(rowTypeForRow:))]
290        #[unsafe(method_family = none)]
291        pub fn rowTypeForRow(&self, row_index: NSInteger) -> NSRuleEditorRowType;
292
293        #[unsafe(method(parentRowForRow:))]
294        #[unsafe(method_family = none)]
295        pub fn parentRowForRow(&self, row_index: NSInteger) -> NSInteger;
296
297        /// # Safety
298        ///
299        /// `sender` should be of the correct type.
300        #[unsafe(method(addRow:))]
301        #[unsafe(method_family = none)]
302        pub unsafe fn addRow(&self, sender: Option<&AnyObject>);
303
304        #[unsafe(method(insertRowAtIndex:withType:asSubrowOfRow:animate:))]
305        #[unsafe(method_family = none)]
306        pub fn insertRowAtIndex_withType_asSubrowOfRow_animate(
307            &self,
308            row_index: NSInteger,
309            row_type: NSRuleEditorRowType,
310            parent_row: NSInteger,
311            should_animate: bool,
312        );
313
314        /// # Safety
315        ///
316        /// - `criteria` generic should be of the correct type.
317        /// - `values` generic should be of the correct type.
318        #[unsafe(method(setCriteria:andDisplayValues:forRowAtIndex:))]
319        #[unsafe(method_family = none)]
320        pub unsafe fn setCriteria_andDisplayValues_forRowAtIndex(
321            &self,
322            criteria: &NSArray,
323            values: &NSArray,
324            row_index: NSInteger,
325        );
326
327        #[unsafe(method(removeRowAtIndex:))]
328        #[unsafe(method_family = none)]
329        pub fn removeRowAtIndex(&self, row_index: NSInteger);
330
331        #[unsafe(method(removeRowsAtIndexes:includeSubrows:))]
332        #[unsafe(method_family = none)]
333        pub fn removeRowsAtIndexes_includeSubrows(
334            &self,
335            row_indexes: &NSIndexSet,
336            include_subrows: bool,
337        );
338
339        #[unsafe(method(selectedRowIndexes))]
340        #[unsafe(method_family = none)]
341        pub fn selectedRowIndexes(&self) -> Retained<NSIndexSet>;
342
343        #[unsafe(method(selectRowIndexes:byExtendingSelection:))]
344        #[unsafe(method_family = none)]
345        pub fn selectRowIndexes_byExtendingSelection(&self, indexes: &NSIndexSet, extend: bool);
346
347        /// # Safety
348        ///
349        /// This is not retained internally, you must ensure the object is still alive.
350        #[unsafe(method(rowClass))]
351        #[unsafe(method_family = none)]
352        pub unsafe fn rowClass(&self) -> &'static AnyClass;
353
354        /// Setter for [`rowClass`][Self::rowClass].
355        ///
356        /// # Safety
357        ///
358        /// - `row_class` probably has further requirements.
359        /// - This is unretained, you must ensure the object is kept alive while in use.
360        #[unsafe(method(setRowClass:))]
361        #[unsafe(method_family = none)]
362        pub unsafe fn setRowClass(&self, row_class: &AnyClass);
363
364        #[unsafe(method(rowTypeKeyPath))]
365        #[unsafe(method_family = none)]
366        pub fn rowTypeKeyPath(&self) -> Retained<NSString>;
367
368        /// Setter for [`rowTypeKeyPath`][Self::rowTypeKeyPath].
369        ///
370        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
371        #[unsafe(method(setRowTypeKeyPath:))]
372        #[unsafe(method_family = none)]
373        pub fn setRowTypeKeyPath(&self, row_type_key_path: &NSString);
374
375        #[unsafe(method(subrowsKeyPath))]
376        #[unsafe(method_family = none)]
377        pub fn subrowsKeyPath(&self) -> Retained<NSString>;
378
379        /// Setter for [`subrowsKeyPath`][Self::subrowsKeyPath].
380        ///
381        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
382        #[unsafe(method(setSubrowsKeyPath:))]
383        #[unsafe(method_family = none)]
384        pub fn setSubrowsKeyPath(&self, subrows_key_path: &NSString);
385
386        #[unsafe(method(criteriaKeyPath))]
387        #[unsafe(method_family = none)]
388        pub fn criteriaKeyPath(&self) -> Retained<NSString>;
389
390        /// Setter for [`criteriaKeyPath`][Self::criteriaKeyPath].
391        ///
392        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
393        #[unsafe(method(setCriteriaKeyPath:))]
394        #[unsafe(method_family = none)]
395        pub fn setCriteriaKeyPath(&self, criteria_key_path: &NSString);
396
397        #[unsafe(method(displayValuesKeyPath))]
398        #[unsafe(method_family = none)]
399        pub fn displayValuesKeyPath(&self) -> Retained<NSString>;
400
401        /// Setter for [`displayValuesKeyPath`][Self::displayValuesKeyPath].
402        ///
403        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
404        #[unsafe(method(setDisplayValuesKeyPath:))]
405        #[unsafe(method_family = none)]
406        pub fn setDisplayValuesKeyPath(&self, display_values_key_path: &NSString);
407    );
408}
409
410/// Methods declared on superclass `NSControl`.
411#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
412impl NSRuleEditor {
413    extern_methods!(
414        #[unsafe(method(initWithFrame:))]
415        #[unsafe(method_family = init)]
416        pub fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
417
418        /// # Safety
419        ///
420        /// `coder` possibly has further requirements.
421        #[unsafe(method(initWithCoder:))]
422        #[unsafe(method_family = init)]
423        pub unsafe fn initWithCoder(
424            this: Allocated<Self>,
425            coder: &NSCoder,
426        ) -> Option<Retained<Self>>;
427    );
428}
429
430/// Methods declared on superclass `NSResponder`.
431#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
432impl NSRuleEditor {
433    extern_methods!(
434        #[unsafe(method(init))]
435        #[unsafe(method_family = init)]
436        pub fn init(this: Allocated<Self>) -> Retained<Self>;
437    );
438}
439
440/// Methods declared on superclass `NSObject`.
441#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
442impl NSRuleEditor {
443    extern_methods!(
444        #[unsafe(method(new))]
445        #[unsafe(method_family = new)]
446        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
447    );
448}
449
450extern_protocol!(
451    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditordelegate?language=objc)
452    pub unsafe trait NSRuleEditorDelegate: NSObjectProtocol + MainThreadOnly {
453        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
454        /// # Safety
455        ///
456        /// `criterion` should be of the correct type.
457        #[unsafe(method(ruleEditor:numberOfChildrenForCriterion:withRowType:))]
458        #[unsafe(method_family = none)]
459        unsafe fn ruleEditor_numberOfChildrenForCriterion_withRowType(
460            &self,
461            editor: &NSRuleEditor,
462            criterion: Option<&AnyObject>,
463            row_type: NSRuleEditorRowType,
464        ) -> NSInteger;
465
466        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
467        /// # Safety
468        ///
469        /// `criterion` should be of the correct type.
470        #[unsafe(method(ruleEditor:child:forCriterion:withRowType:))]
471        #[unsafe(method_family = none)]
472        unsafe fn ruleEditor_child_forCriterion_withRowType(
473            &self,
474            editor: &NSRuleEditor,
475            index: NSInteger,
476            criterion: Option<&AnyObject>,
477            row_type: NSRuleEditorRowType,
478        ) -> Retained<AnyObject>;
479
480        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
481        /// # Safety
482        ///
483        /// `criterion` should be of the correct type.
484        #[unsafe(method(ruleEditor:displayValueForCriterion:inRow:))]
485        #[unsafe(method_family = none)]
486        unsafe fn ruleEditor_displayValueForCriterion_inRow(
487            &self,
488            editor: &NSRuleEditor,
489            criterion: &AnyObject,
490            row: NSInteger,
491        ) -> Retained<AnyObject>;
492
493        #[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
494        /// # Safety
495        ///
496        /// - `criterion` should be of the correct type.
497        /// - `value` should be of the correct type.
498        #[optional]
499        #[unsafe(method(ruleEditor:predicatePartsForCriterion:withDisplayValue:inRow:))]
500        #[unsafe(method_family = none)]
501        unsafe fn ruleEditor_predicatePartsForCriterion_withDisplayValue_inRow(
502            &self,
503            editor: &NSRuleEditor,
504            criterion: &AnyObject,
505            value: &AnyObject,
506            row: NSInteger,
507        ) -> Option<Retained<NSDictionary<NSRuleEditorPredicatePartKey, AnyObject>>>;
508
509        #[optional]
510        #[unsafe(method(ruleEditorRowsDidChange:))]
511        #[unsafe(method_family = none)]
512        fn ruleEditorRowsDidChange(&self, notification: &NSNotification);
513    }
514);
515
516extern "C" {
517    /// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsruleeditorrowsdidchangenotification?language=objc)
518    pub static NSRuleEditorRowsDidChangeNotification: &'static NSNotificationName;
519}