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
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// `NSScrubberLayoutAttributes`describes the layout of a single
/// `NSScrubber`item.
///
/// `NSScrubberLayout`objects transact in terms of
/// `NSScrubberLayoutAttributes.``NSScrubberLayoutAttributes`can be subclassed if a layout object wants to include more layout information than the base implementation provides. Subclasses of
/// `NSScrubberLayoutAttributes`must implement
/// `isEqual:,``hash,`and the
/// `NSCopying`protocol.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrubberlayoutattributes?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSScrubberLayoutAttributes;
);
extern_conformance!(
unsafe impl NSCopying for NSScrubberLayoutAttributes {}
);
unsafe impl CopyingHelper for NSScrubberLayoutAttributes {
type Result = Self;
}
extern_conformance!(
unsafe impl NSObjectProtocol for NSScrubberLayoutAttributes {}
);
impl NSScrubberLayoutAttributes {
extern_methods!(
#[unsafe(method(itemIndex))]
#[unsafe(method_family = none)]
pub fn itemIndex(&self) -> NSInteger;
/// Setter for [`itemIndex`][Self::itemIndex].
#[unsafe(method(setItemIndex:))]
#[unsafe(method_family = none)]
pub fn setItemIndex(&self, item_index: NSInteger);
#[unsafe(method(frame))]
#[unsafe(method_family = none)]
pub fn frame(&self) -> NSRect;
/// Setter for [`frame`][Self::frame].
#[unsafe(method(setFrame:))]
#[unsafe(method_family = none)]
pub fn setFrame(&self, frame: NSRect);
#[cfg(feature = "objc2-core-foundation")]
#[unsafe(method(alpha))]
#[unsafe(method_family = none)]
pub fn alpha(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
/// Setter for [`alpha`][Self::alpha].
#[unsafe(method(setAlpha:))]
#[unsafe(method_family = none)]
pub fn setAlpha(&self, alpha: CGFloat);
#[unsafe(method(layoutAttributesForItemAtIndex:))]
#[unsafe(method_family = none)]
pub fn layoutAttributesForItemAtIndex(index: NSInteger) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl NSScrubberLayoutAttributes {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new() -> Retained<Self>;
);
}
impl DefaultRetained for NSScrubberLayoutAttributes {
#[inline]
fn default_retained() -> Retained<Self> {
Self::new()
}
}
extern_class!(
/// `NSScrubberLayout`is an abstract class that describes the layout of items within a
/// `NSScrubber`control.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrubberlayout?language=objc)
#[unsafe(super(NSObject))]
#[thread_kind = MainThreadOnly]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSScrubberLayout;
);
extern_conformance!(
unsafe impl NSCoding for NSScrubberLayout {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSScrubberLayout {}
);
impl NSScrubberLayout {
extern_methods!(
/// Specifies a class for describing layout attributes. By default, this is
/// `NSScrubberLayoutAttributes,`but subclasses may override this method to use a custom subclass of
/// `NSScrubberLayoutAttributes.`
#[unsafe(method(layoutAttributesClass))]
#[unsafe(method_family = none)]
pub fn layoutAttributesClass(mtm: MainThreadMarker) -> &'static AnyClass;
#[cfg(all(feature = "NSResponder", feature = "NSScrubber", feature = "NSView"))]
/// The NSScrubber control that this layout is assigned to, or
/// `nil`if the receiver is not assigned to a scrubber.
#[unsafe(method(scrubber))]
#[unsafe(method_family = none)]
pub fn scrubber(&self) -> Option<Retained<NSScrubber>>;
/// The currently visible rectangle, in the coordinate space of the scrubber content. Returns
/// `NSZeroRect`if the receiver is not assigned to a scrubber.
#[unsafe(method(visibleRect))]
#[unsafe(method_family = none)]
pub fn visibleRect(&self) -> NSRect;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
/// # Safety
///
/// `coder` possibly has further requirements.
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
/// Signals that layout has been invalidated and the NSScrubber should run a fresh layout pass. Subclasses may define more granular invalidation methods suitable for their own data structures, but those methods should always call up to -invalidateLayout.
#[unsafe(method(invalidateLayout))]
#[unsafe(method_family = none)]
pub fn invalidateLayout(&self);
/// Following any invalidation in layout,
/// `NSScrubber`will call
/// `prepareLayout`on its layout object prior to requesting any other layout information. Subclasses should use this method to perform upfront calculations and caching. The base implementation of this method does nothing.
#[unsafe(method(prepareLayout))]
#[unsafe(method_family = none)]
pub fn prepareLayout(&self);
/// Returns the content size for all elements within the scrubber. The base implementation returns
/// `NSZeroSize.`
#[unsafe(method(scrubberContentSize))]
#[unsafe(method_family = none)]
pub fn scrubberContentSize(&self) -> NSSize;
/// Returns the layout attributes for a single item within the scrubber. The base implementation returns
/// `nil.`
#[unsafe(method(layoutAttributesForItemAtIndex:))]
#[unsafe(method_family = none)]
pub fn layoutAttributesForItemAtIndex(
&self,
index: NSInteger,
) -> Option<Retained<NSScrubberLayoutAttributes>>;
/// Returns the set of layout attributes for all items within the provided rectangle. The base implementation returns an empty set.
#[unsafe(method(layoutAttributesForItemsInRect:))]
#[unsafe(method_family = none)]
pub fn layoutAttributesForItemsInRect(
&self,
rect: NSRect,
) -> Retained<NSSet<NSScrubberLayoutAttributes>>;
/// If
/// `YES,`the scrubber will invalidate its layout when the selection changes. The default value is
/// `NO.`Subclasses should return
/// `YES`if the selection index affects the item layout.
#[unsafe(method(shouldInvalidateLayoutForSelectionChange))]
#[unsafe(method_family = none)]
pub fn shouldInvalidateLayoutForSelectionChange(&self) -> bool;
/// If
/// `YES,`the scrubber will invalidate its layout when an item is highlighted. The default value is
/// `NO.`Subclasses should return
/// `YES`if the highlight state affects the item layout.
#[unsafe(method(shouldInvalidateLayoutForHighlightChange))]
#[unsafe(method_family = none)]
pub fn shouldInvalidateLayoutForHighlightChange(&self) -> bool;
/// If
/// `YES,`the scrubber will invalidate its layout in response to a change in the visible region. The default value is
/// `NO.`Subclasses which rely on the size or origin of the visible region should return
/// `YES.`
#[unsafe(method(shouldInvalidateLayoutForChangeFromVisibleRect:toVisibleRect:))]
#[unsafe(method_family = none)]
pub fn shouldInvalidateLayoutForChangeFromVisibleRect_toVisibleRect(
&self,
from_visible_rect: NSRect,
to_visible_rect: NSRect,
) -> bool;
/// If
/// `YES,`the layout object will automatically have its inputs and outputs mirrored in right-to-left interfaces. The default value is
/// `YES.`Subclasses that wish to handle RTL layout manually should return
/// `NO.`
#[unsafe(method(automaticallyMirrorsInRightToLeftLayout))]
#[unsafe(method_family = none)]
pub fn automaticallyMirrorsInRightToLeftLayout(&self) -> bool;
);
}
/// Methods declared on superclass `NSObject`.
impl NSScrubberLayout {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_protocol!(
/// [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrubberflowlayoutdelegate?language=objc)
#[cfg(feature = "NSScrubber")]
pub unsafe trait NSScrubberFlowLayoutDelegate: NSScrubberDelegate {
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[unsafe(method(scrubber:layout:sizeForItemAtIndex:))]
#[unsafe(method_family = none)]
fn scrubber_layout_sizeForItemAtIndex(
&self,
scrubber: &NSScrubber,
layout: &NSScrubberFlowLayout,
item_index: NSInteger,
) -> NSSize;
}
);
extern_class!(
/// `NSScrubberFlowLayout`is a concrete layout object that arranges items end-to-end in a linear strip. It supports a fixed inter-item spacing and both fixed- and variable-sized items.
///
/// If the associated scrubber's
/// `delegate`conforms to
/// `NSScrubberFlowLayoutDelegate,`and it implements the
/// `scrubber:layout:sizeForItemAtIndex:`method,
/// `NSScrubberFlowLayout`will obtain the item size from the delegate. If the delegate does not implement that method, or if the method returns
/// `NSZeroSize,`it will fall back to using the layout's
/// `itemSize`property. By default, NSScrubberFlowLayout does not invalidate its layout on selection change, highlight change, or visible rectangle change.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrubberflowlayout?language=objc)
#[unsafe(super(NSScrubberLayout, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSScrubberFlowLayout;
);
extern_conformance!(
unsafe impl NSCoding for NSScrubberFlowLayout {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSScrubberFlowLayout {}
);
impl NSScrubberFlowLayout {
extern_methods!(
#[cfg(feature = "objc2-core-foundation")]
/// The amount of horizontal spacing between items in points. The default value is 0.0.
#[unsafe(method(itemSpacing))]
#[unsafe(method_family = none)]
pub fn itemSpacing(&self) -> CGFloat;
#[cfg(feature = "objc2-core-foundation")]
/// Setter for [`itemSpacing`][Self::itemSpacing].
#[unsafe(method(setItemSpacing:))]
#[unsafe(method_family = none)]
pub fn setItemSpacing(&self, item_spacing: CGFloat);
/// The frame size for each item, if not provided by the scrubber's delegate. The default value is { 50.0, 30.0 }.
#[unsafe(method(itemSize))]
#[unsafe(method_family = none)]
pub fn itemSize(&self) -> NSSize;
/// Setter for [`itemSize`][Self::itemSize].
#[unsafe(method(setItemSize:))]
#[unsafe(method_family = none)]
pub fn setItemSize(&self, item_size: NSSize);
#[unsafe(method(invalidateLayoutForItemsAtIndexes:))]
#[unsafe(method_family = none)]
pub fn invalidateLayoutForItemsAtIndexes(&self, invalid_item_indexes: &NSIndexSet);
);
}
/// Methods declared on superclass `NSScrubberLayout`.
impl NSScrubberFlowLayout {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
/// # Safety
///
/// `coder` possibly has further requirements.
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl NSScrubberFlowLayout {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}
extern_class!(
/// `NSScrubberProportionalLayout`is a concrete layout object that sizes each item to some fraction of the scrubber's visible size.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsscrubberproportionallayout?language=objc)
#[unsafe(super(NSScrubberLayout, NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSScrubberProportionalLayout;
);
extern_conformance!(
unsafe impl NSCoding for NSScrubberProportionalLayout {}
);
extern_conformance!(
unsafe impl NSObjectProtocol for NSScrubberProportionalLayout {}
);
impl NSScrubberProportionalLayout {
extern_methods!(
/// The number of items that should fit within the scrubber's viewport at once.
#[unsafe(method(numberOfVisibleItems))]
#[unsafe(method_family = none)]
pub fn numberOfVisibleItems(&self) -> NSInteger;
/// Setter for [`numberOfVisibleItems`][Self::numberOfVisibleItems].
#[unsafe(method(setNumberOfVisibleItems:))]
#[unsafe(method_family = none)]
pub fn setNumberOfVisibleItems(&self, number_of_visible_items: NSInteger);
#[unsafe(method(initWithNumberOfVisibleItems:))]
#[unsafe(method_family = init)]
pub fn initWithNumberOfVisibleItems(
this: Allocated<Self>,
number_of_visible_items: NSInteger,
) -> Retained<Self>;
/// # Safety
///
/// `coder` possibly has further requirements.
#[unsafe(method(initWithCoder:))]
#[unsafe(method_family = init)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSScrubberLayout`.
impl NSScrubberProportionalLayout {
extern_methods!(
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub fn init(this: Allocated<Self>) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl NSScrubberProportionalLayout {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
);
}