-
Notifications
You must be signed in to change notification settings - Fork 510
/
notificationcenter.cs
250 lines (204 loc) · 9.03 KB
/
notificationcenter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
using System;
using System.ComponentModel;
using CoreGraphics;
using ObjCRuntime;
using Foundation;
#if !MONOMAC
using UIKit;
using NSViewController = UIKit.UIViewController;
#else
using AppKit;
using UIEdgeInsets = AppKit.NSEdgeInsets;
using UIVibrancyEffect = Foundation.NSObject;
using UIVibrancyEffectStyle = Foundation.NSObject;
#endif
#if !NET
using NativeHandle = System.IntPtr;
#endif
namespace NotificationCenter {
/// <summary>Coordinates the display of a widget's content with its containing app.</summary>
///
/// <related type="externalDocumentation" href="https://developer.apple.com/library/ios/documentation/NotificationCenter/Reference/NCWidgetController_Class/index.html">Apple documentation for <c>NCWidgetController</c></related>
[BaseType (typeof (NSObject))]
[DisableDefaultCtor] // not meant to be user created
[Deprecated (PlatformName.iOS, 14, 0)]
[Deprecated (PlatformName.MacOSX, 11, 0)]
interface NCWidgetController {
[Static]
[Export ("widgetController")]
NCWidgetController GetWidgetController ();
[Export ("setHasContent:forWidgetWithBundleIdentifier:")]
void SetHasContent (bool flag, string bundleID);
}
/// <summary>Customizes the appearance and behavior of a widget.</summary>
///
/// <related type="externalDocumentation" href="https://developer.apple.com/library/ios/documentation/NotificationCenter/Reference/NCWidgetProviding_Protocol/index.html">Apple documentation for <c>NCWidgetProviding</c></related>
[Deprecated (PlatformName.iOS, 14, 0)]
[Deprecated (PlatformName.MacOSX, 11, 0)]
[Protocol, Model]
[BaseType (typeof (NSObject))]
interface NCWidgetProviding {
[Export ("widgetPerformUpdateWithCompletionHandler:")]
void WidgetPerformUpdate (Action<NCUpdateResult> completionHandler);
[Export ("widgetMarginInsetsForProposedMarginInsets:"), DelegateName ("NCWidgetProvidingMarginInsets"), DefaultValueFromArgument ("defaultMarginInsets")]
[Deprecated (PlatformName.iOS, 10, 0)]
UIEdgeInsets GetWidgetMarginInsets (UIEdgeInsets defaultMarginInsets);
[NoiOS]
[Export ("widgetAllowsEditing")]
bool WidgetAllowsEditing {
get;
#if !NET
[NotImplemented]
set;
#endif
}
[NoiOS]
[Export ("widgetDidBeginEditing")]
void WidgetDidBeginEditing ();
[NoiOS]
[Export ("widgetDidEndEditing")]
void WidgetDidEndEditing ();
[NoMac]
[Export ("widgetActiveDisplayModeDidChange:withMaximumSize:")]
void WidgetActiveDisplayModeDidChange (NCWidgetDisplayMode activeDisplayMode, CGSize maxSize);
}
/// <summary>Defines the appropriate vibrancy effect for widgets (extensions) displayed in the Today view.</summary>
[NoMac]
[BaseType (typeof (UIVibrancyEffect))]
#if NET
[Internal]
[Category]
#else
#pragma warning disable 0618 // warning CS0618: 'CategoryAttribute.CategoryAttribute(bool)' is obsolete: 'Inline the static members in this category in the category's class (and remove this obsolete once fixed)'
[Category (allowStaticMembers: true)] // Classic isn't internal so we need this
#pragma warning restore
#endif
interface UIVibrancyEffect_NotificationCenter {
[Internal]
[Deprecated (PlatformName.iOS, 10, 0, message: "Use 'UIVibrancyEffect.GetWidgetEffect' instead.")]
[Static, Export ("notificationCenterVibrancyEffect")]
UIVibrancyEffect NotificationCenterVibrancyEffect ();
}
/// <summary>Extension context methods and properties for an NDWidget.</summary>
[NoMac]
[Deprecated (PlatformName.iOS, 14, 0)]
[Category]
[BaseType (typeof (NSExtensionContext))]
interface NSExtensionContext_NCWidgetAdditions {
[Export ("widgetLargestAvailableDisplayMode")]
NCWidgetDisplayMode GetWidgetLargestAvailableDisplayMode ();
[Export ("setWidgetLargestAvailableDisplayMode:")]
void SetWidgetLargestAvailableDisplayMode (NCWidgetDisplayMode mode);
[Export ("widgetActiveDisplayMode")]
NCWidgetDisplayMode GetWidgetActiveDisplayMode ();
[Export ("widgetMaximumSizeForDisplayMode:")]
CGSize GetWidgetMaximumSize (NCWidgetDisplayMode displayMode);
}
[NoMac]
[Category]
[Internal] // only static methods, which are not _nice_ to use as extension methods
[Deprecated (PlatformName.iOS, 14, 0)]
[BaseType (typeof (UIVibrancyEffect))]
interface UIVibrancyEffect_NCWidgetAdditions {
[Deprecated (PlatformName.iOS, 13, 0, message: "Use 'UIVibrancyEffect.GetWidgetEffect' instead.")]
[Static]
[Export ("widgetPrimaryVibrancyEffect")]
UIVibrancyEffect GetWidgetPrimaryVibrancyEffect ();
[Deprecated (PlatformName.iOS, 13, 0, message: "Use 'UIVibrancyEffect.GetWidgetEffect' instead.")]
[Static]
[Export ("widgetSecondaryVibrancyEffect")]
UIVibrancyEffect GetWidgetSecondaryVibrancyEffect ();
[iOS (13, 0)]
[Static]
[Export ("widgetEffectForVibrancyStyle:")]
UIVibrancyEffect GetWidgetEffect (UIVibrancyEffectStyle vibrancyStyle);
}
[NoiOS]
[Deprecated (PlatformName.MacOSX, 11, 0)]
[BaseType (typeof (NSViewController), Delegates = new string [] { "Delegate" }, Events = new Type [] { typeof (NCWidgetListViewDelegate) })]
interface NCWidgetListViewController {
[Export ("initWithNibName:bundle:")]
NativeHandle Constructor ([NullAllowed] string nibNameOrNull, [NullAllowed] NSBundle nibBundleOrNull);
[NullAllowed, Export ("delegate", ArgumentSemantic.Weak)]
INCWidgetListViewDelegate Delegate { get; set; }
[Export ("contents", ArgumentSemantic.Copy)]
NSViewController [] Contents { get; set; }
[Export ("minimumVisibleRowCount", ArgumentSemantic.Assign)]
nuint MinimumVisibleRowCount { get; set; }
[Export ("hasDividerLines")]
bool HasDividerLines { get; set; }
[Export ("editing")]
bool Editing { get; set; }
[Export ("showsAddButtonWhenEditing")]
bool ShowsAddButtonWhenEditing { get; set; }
[Export ("viewControllerAtRow:makeIfNecessary:")]
NSViewController GetViewController (nuint row, bool makeIfNecesary);
[Export ("rowForViewController:")]
nuint GetRow (NSViewController viewController);
}
[NoiOS]
interface INCWidgetListViewDelegate { }
[NoiOS]
[Deprecated (PlatformName.MacOSX, 11, 0)]
[Protocol, Model]
[BaseType (typeof (NSObject))]
interface NCWidgetListViewDelegate {
[Abstract]
[Export ("widgetList:viewControllerForRow:"), DelegateName ("NCWidgetListViewGetController"), DefaultValue (null)]
NSViewController GetViewControllerForRow (NCWidgetListViewController list, nuint row);
[Export ("widgetListPerformAddAction:"), DelegateName ("NCWidgetListViewController")]
void PerformAddAction (NCWidgetListViewController list);
[Export ("widgetList:shouldReorderRow:"), DelegateName ("NCWidgetListViewControllerShouldReorderRow"), DefaultValue (false)]
bool ShouldReorderRow (NCWidgetListViewController list, nuint row);
[Export ("widgetList:didReorderRow:toRow:"), EventArgs ("NCWidgetListViewControllerDidReorder"), DefaultValue (false)]
void DidReorderRow (NCWidgetListViewController list, nuint row, nuint newIndex);
[Export ("widgetList:shouldRemoveRow:"), DelegateName ("NCWidgetListViewControllerShouldRemoveRow"), DefaultValue (false)]
bool ShouldRemoveRow (NCWidgetListViewController list, nuint row);
[Export ("widgetList:didRemoveRow:"), EventArgs ("NCWidgetListViewControllerDidRemoveRow"), DefaultValue (false)]
void DidRemoveRow (NCWidgetListViewController list, nuint row);
}
[NoiOS]
[Deprecated (PlatformName.MacOSX, 11, 0)]
[BaseType (typeof (NSViewController), Delegates = new string [] { "Delegate" }, Events = new Type [] { typeof (NCWidgetSearchViewDelegate) })]
interface NCWidgetSearchViewController {
[Export ("initWithNibName:bundle:")]
NativeHandle Constructor ([NullAllowed] string nibNameOrNull, [NullAllowed] NSBundle nibBundleOrNull);
[NullAllowed, Export ("delegate", ArgumentSemantic.Weak)]
INCWidgetSearchViewDelegate Delegate { get; set; }
[NullAllowed]
[Export ("searchResults", ArgumentSemantic.Copy)]
NSObject [] SearchResults { get; set; }
[NullAllowed]
[Export ("searchDescription")]
string SearchDescription { get; set; }
[NullAllowed]
[Export ("searchResultsPlaceholderString")]
string SearchResultsPlaceholderString { get; set; }
[NullAllowed]
[Export ("searchResultKeyPath")]
string SearchResultKeyPath { get; set; }
}
[NoiOS]
interface INCWidgetSearchViewDelegate { }
[NoiOS]
[Deprecated (PlatformName.MacOSX, 11, 0)]
[Protocol, Model]
[BaseType (typeof (NSObject))]
interface NCWidgetSearchViewDelegate {
#if !NET
[Abstract]
[Export ("widgetSearch:searchForTerm:maxResults:"), EventArgs ("NSWidgetSearchForTerm"), DefaultValue (false)]
void SearchForTearm (NCWidgetSearchViewController controller, string searchTerm, nuint max);
#else
[Abstract]
[Export ("widgetSearch:searchForTerm:maxResults:"), EventArgs ("NSWidgetSearchForTerm"), DefaultValue (false)]
void SearchForTerm (NCWidgetSearchViewController controller, string searchTerm, nuint max);
#endif
[Abstract]
[Export ("widgetSearchTermCleared:"), EventArgs ("NSWidgetSearchViewController"), DefaultValue (false)]
void TermCleared (NCWidgetSearchViewController controller);
[Abstract]
[Export ("widgetSearch:resultSelected:"), EventArgs ("NSWidgetSearchResultSelected"), DefaultValue (false)]
void ResultSelected (NCWidgetSearchViewController controller, NSObject obj);
}
}