objc2_notification_center/generated/
NCWidgetListViewController.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-app-kit")]
7#[cfg(target_os = "macos")]
8use objc2_app_kit::*;
9use objc2_foundation::*;
10
11use crate::*;
12
13extern_class!(
14    /// [Apple's documentation](https://developer.apple.com/documentation/notificationcenter/ncwidgetlistviewcontroller?language=objc)
15    #[unsafe(super(NSViewController, NSResponder, NSObject))]
16    #[derive(Debug, PartialEq, Eq, Hash)]
17    #[cfg(feature = "objc2-app-kit")]
18    #[cfg(target_os = "macos")]
19    #[deprecated = "Use WidgetKit instead. Today View extensions have been deprecated."]
20    pub struct NCWidgetListViewController;
21);
22
23#[cfg(feature = "objc2-app-kit")]
24#[cfg(target_os = "macos")]
25extern_conformance!(
26    unsafe impl NSCoding for NCWidgetListViewController {}
27);
28
29#[cfg(feature = "objc2-app-kit")]
30#[cfg(target_os = "macos")]
31extern_conformance!(
32    unsafe impl NSEditor for NCWidgetListViewController {}
33);
34
35#[cfg(feature = "objc2-app-kit")]
36#[cfg(target_os = "macos")]
37extern_conformance!(
38    unsafe impl NSObjectProtocol for NCWidgetListViewController {}
39);
40
41#[cfg(feature = "objc2-app-kit")]
42#[cfg(target_os = "macos")]
43extern_conformance!(
44    unsafe impl NSSeguePerforming for NCWidgetListViewController {}
45);
46
47#[cfg(feature = "objc2-app-kit")]
48#[cfg(target_os = "macos")]
49extern_conformance!(
50    unsafe impl NSUserInterfaceItemIdentification for NCWidgetListViewController {}
51);
52
53#[cfg(feature = "objc2-app-kit")]
54#[cfg(target_os = "macos")]
55impl NCWidgetListViewController {
56    extern_methods!(
57        #[unsafe(method(delegate))]
58        #[unsafe(method_family = none)]
59        pub unsafe fn delegate(
60            &self,
61        ) -> Option<Retained<ProtocolObject<dyn NCWidgetListViewDelegate>>>;
62
63        /// Setter for [`delegate`][Self::delegate].
64        ///
65        /// This is a [weak property][objc2::topics::weak_property].
66        #[unsafe(method(setDelegate:))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn setDelegate(
69            &self,
70            delegate: Option<&ProtocolObject<dyn NCWidgetListViewDelegate>>,
71        );
72
73        #[unsafe(method(contents))]
74        #[unsafe(method_family = none)]
75        pub unsafe fn contents(&self) -> Retained<NSArray<AnyObject>>;
76
77        /// Setter for [`contents`][Self::contents].
78        ///
79        /// This is [copied][objc2_foundation::NSCopying::copy] when set.
80        ///
81        /// # Safety
82        ///
83        /// `contents` generic should be of the correct type.
84        #[unsafe(method(setContents:))]
85        #[unsafe(method_family = none)]
86        pub unsafe fn setContents(&self, contents: &NSArray<AnyObject>);
87
88        #[unsafe(method(minimumVisibleRowCount))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn minimumVisibleRowCount(&self) -> NSUInteger;
91
92        /// Setter for [`minimumVisibleRowCount`][Self::minimumVisibleRowCount].
93        #[unsafe(method(setMinimumVisibleRowCount:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn setMinimumVisibleRowCount(&self, minimum_visible_row_count: NSUInteger);
96
97        #[unsafe(method(hasDividerLines))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn hasDividerLines(&self) -> bool;
100
101        /// Setter for [`hasDividerLines`][Self::hasDividerLines].
102        #[unsafe(method(setHasDividerLines:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setHasDividerLines(&self, has_divider_lines: bool);
105
106        #[unsafe(method(editing))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn editing(&self) -> bool;
109
110        /// Setter for [`editing`][Self::editing].
111        #[unsafe(method(setEditing:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setEditing(&self, editing: bool);
114
115        #[unsafe(method(showsAddButtonWhenEditing))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn showsAddButtonWhenEditing(&self) -> bool;
118
119        /// Setter for [`showsAddButtonWhenEditing`][Self::showsAddButtonWhenEditing].
120        #[unsafe(method(setShowsAddButtonWhenEditing:))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn setShowsAddButtonWhenEditing(&self, shows_add_button_when_editing: bool);
123
124        #[unsafe(method(viewControllerAtRow:makeIfNecessary:))]
125        #[unsafe(method_family = none)]
126        pub unsafe fn viewControllerAtRow_makeIfNecessary(
127            &self,
128            row: NSUInteger,
129            make_if_necesary: bool,
130        ) -> Retained<NSViewController>;
131
132        #[unsafe(method(rowForViewController:))]
133        #[unsafe(method_family = none)]
134        pub unsafe fn rowForViewController(&self, view_controller: &NSViewController)
135            -> NSUInteger;
136    );
137}
138
139/// Methods declared on superclass `NSViewController`.
140#[cfg(feature = "objc2-app-kit")]
141#[cfg(target_os = "macos")]
142impl NCWidgetListViewController {
143    extern_methods!(
144        #[unsafe(method(initWithNibName:bundle:))]
145        #[unsafe(method_family = init)]
146        pub unsafe fn initWithNibName_bundle(
147            this: Allocated<Self>,
148            nib_name_or_nil: Option<&NSNibName>,
149            nib_bundle_or_nil: Option<&NSBundle>,
150        ) -> Retained<Self>;
151
152        /// # Safety
153        ///
154        /// `coder` possibly has further requirements.
155        #[unsafe(method(initWithCoder:))]
156        #[unsafe(method_family = init)]
157        pub unsafe fn initWithCoder(
158            this: Allocated<Self>,
159            coder: &NSCoder,
160        ) -> Option<Retained<Self>>;
161    );
162}
163
164/// Methods declared on superclass `NSResponder`.
165#[cfg(feature = "objc2-app-kit")]
166#[cfg(target_os = "macos")]
167impl NCWidgetListViewController {
168    extern_methods!(
169        #[unsafe(method(init))]
170        #[unsafe(method_family = init)]
171        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
172    );
173}
174
175/// Methods declared on superclass `NSObject`.
176#[cfg(feature = "objc2-app-kit")]
177#[cfg(target_os = "macos")]
178impl NCWidgetListViewController {
179    extern_methods!(
180        #[unsafe(method(new))]
181        #[unsafe(method_family = new)]
182        pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
183    );
184}
185
186extern_protocol!(
187    /// [Apple's documentation](https://developer.apple.com/documentation/notificationcenter/ncwidgetlistviewdelegate?language=objc)
188    #[deprecated = "Use WidgetKit instead. Today View extensions have been deprecated."]
189    pub unsafe trait NCWidgetListViewDelegate: NSObjectProtocol {
190        #[cfg(feature = "objc2-app-kit")]
191        #[cfg(target_os = "macos")]
192        #[unsafe(method(widgetList:viewControllerForRow:))]
193        #[unsafe(method_family = none)]
194        unsafe fn widgetList_viewControllerForRow(
195            &self,
196            list: &NCWidgetListViewController,
197            row: NSUInteger,
198        ) -> Retained<NSViewController>;
199
200        #[cfg(feature = "objc2-app-kit")]
201        #[cfg(target_os = "macos")]
202        #[optional]
203        #[unsafe(method(widgetListPerformAddAction:))]
204        #[unsafe(method_family = none)]
205        unsafe fn widgetListPerformAddAction(&self, list: &NCWidgetListViewController);
206
207        #[cfg(feature = "objc2-app-kit")]
208        #[cfg(target_os = "macos")]
209        #[optional]
210        #[unsafe(method(widgetList:shouldReorderRow:))]
211        #[unsafe(method_family = none)]
212        unsafe fn widgetList_shouldReorderRow(
213            &self,
214            list: &NCWidgetListViewController,
215            row: NSUInteger,
216        ) -> bool;
217
218        #[cfg(feature = "objc2-app-kit")]
219        #[cfg(target_os = "macos")]
220        #[optional]
221        #[unsafe(method(widgetList:didReorderRow:toRow:))]
222        #[unsafe(method_family = none)]
223        unsafe fn widgetList_didReorderRow_toRow(
224            &self,
225            list: &NCWidgetListViewController,
226            row: NSUInteger,
227            new_index: NSUInteger,
228        );
229
230        #[cfg(feature = "objc2-app-kit")]
231        #[cfg(target_os = "macos")]
232        #[optional]
233        #[unsafe(method(widgetList:shouldRemoveRow:))]
234        #[unsafe(method_family = none)]
235        unsafe fn widgetList_shouldRemoveRow(
236            &self,
237            list: &NCWidgetListViewController,
238            row: NSUInteger,
239        ) -> bool;
240
241        #[cfg(feature = "objc2-app-kit")]
242        #[cfg(target_os = "macos")]
243        #[optional]
244        #[unsafe(method(widgetList:didRemoveRow:))]
245        #[unsafe(method_family = none)]
246        unsafe fn widgetList_didRemoveRow(
247            &self,
248            list: &NCWidgetListViewController,
249            row: NSUInteger,
250        );
251    }
252);