Vendor dependencies for 0.3.0 release

This commit is contained in:
2025-09-27 10:29:08 -05:00
parent 0c8d39d483
commit 82ab7f317b
26803 changed files with 16134934 additions and 0 deletions

File diff suppressed because one or more lines are too long

128
vendor/objc2-app-kit/Cargo.lock generated vendored Normal file
View File

@@ -0,0 +1,128 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "bitflags"
version = "2.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1"
[[package]]
name = "block2"
version = "0.5.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c132eebf10f5cad5289222520a4a058514204aed6d791f1cf4fe8088b82d15f"
dependencies = [
"objc2",
]
[[package]]
name = "libc"
version = "0.2.154"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346"
[[package]]
name = "objc-sys"
version = "0.3.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cdb91bdd390c7ce1a8607f35f3ca7151b65afc0ff5ff3b34fa350f7d7c7e4310"
[[package]]
name = "objc2"
version = "0.5.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "46a785d4eeff09c14c487497c162e92766fbb3e4059a71840cecc03d9a50b804"
dependencies = [
"objc-sys",
"objc2-encode",
"objc2-proc-macros",
]
[[package]]
name = "objc2-app-kit"
version = "0.2.2"
dependencies = [
"bitflags",
"block2",
"libc",
"objc2",
"objc2-core-data",
"objc2-core-image",
"objc2-foundation",
"objc2-quartz-core",
]
[[package]]
name = "objc2-core-data"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "617fbf49e071c178c0b24c080767db52958f716d9eabdf0890523aeae54773ef"
dependencies = [
"bitflags",
"block2",
"objc2",
"objc2-foundation",
]
[[package]]
name = "objc2-core-image"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "55260963a527c99f1819c4f8e3b47fe04f9650694ef348ffd2227e8196d34c80"
dependencies = [
"block2",
"objc2",
"objc2-foundation",
"objc2-metal",
]
[[package]]
name = "objc2-encode"
version = "4.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7891e71393cd1f227313c9379a26a584ff3d7e6e7159e988851f0934c993f0f8"
[[package]]
name = "objc2-foundation"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ee638a5da3799329310ad4cfa62fbf045d5f56e3ef5ba4149e7452dcf89d5a8"
dependencies = [
"bitflags",
"block2",
"libc",
"objc2",
]
[[package]]
name = "objc2-metal"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "dd0cba1276f6023976a406a14ffa85e1fdd19df6b0f737b063b95f6c8c7aadd6"
dependencies = [
"bitflags",
"block2",
"objc2",
"objc2-foundation",
]
[[package]]
name = "objc2-proc-macros"
version = "0.1.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "462945f0c945291d6d9fc35f2a10e0f1c88951c05d10d148fae64c54a42b63f0"
[[package]]
name = "objc2-quartz-core"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e42bee7bff906b14b167da2bac5efe6b6a07e6f7c0a21a7308d40c960242dc7a"
dependencies = [
"bitflags",
"block2",
"objc2",
"objc2-foundation",
"objc2-metal",
]

View File

@@ -0,0 +1,31 @@
[features]
# Deprecated; this is the default on Apple platforms, and not applicable on other platforms.
apple = []
# Runtime selection. See `objc-sys` for details.
gnustep-1-7 = ["objc2/gnustep-1-7", "block2?/gnustep-1-7", "objc2-foundation/gnustep-1-7", "objc2-core-data?/gnustep-1-7", "objc2-quartz-core?/gnustep-1-7"]
gnustep-1-8 = ["gnustep-1-7", "objc2/gnustep-1-8", "block2?/gnustep-1-8", "objc2-foundation/gnustep-1-8", "objc2-core-data?/gnustep-1-8", "objc2-quartz-core?/gnustep-1-8"]
gnustep-1-9 = ["gnustep-1-8", "objc2/gnustep-1-9", "block2?/gnustep-1-9", "objc2-foundation/gnustep-1-9", "objc2-core-data?/gnustep-1-9", "objc2-quartz-core?/gnustep-1-9"]
gnustep-2-0 = ["gnustep-1-9", "objc2/gnustep-2-0", "block2?/gnustep-2-0", "objc2-foundation/gnustep-2-0", "objc2-core-data?/gnustep-2-0", "objc2-quartz-core?/gnustep-2-0"]
gnustep-2-1 = ["gnustep-2-0", "objc2/gnustep-2-1", "block2?/gnustep-2-1", "objc2-foundation/gnustep-2-1", "objc2-core-data?/gnustep-2-1", "objc2-quartz-core?/gnustep-2-1"]
[[example]]
name = "delegate"
required-features = [
"objc2-foundation/NSNotification",
"objc2-foundation/NSString",
"objc2-foundation/NSObject",
"objc2-foundation/NSThread",
"NSResponder",
"NSApplication",
"NSRunningApplication",
]
[[example]]
name = "nspasteboard"
required-features = [
"objc2-foundation/NSArray",
"objc2-foundation/NSString",
"objc2-foundation/NSObject",
"NSPasteboard",
]

2265
vendor/objc2-app-kit/Cargo.toml vendored Normal file

File diff suppressed because it is too large Load Diff

14
vendor/objc2-app-kit/README.md vendored Normal file
View File

@@ -0,0 +1,14 @@
# `objc2-app-kit`
[![Latest version](https://badgen.net/crates/v/objc2-app-kit)](https://crates.io/crates/objc2-app-kit)
[![License](https://badgen.net/badge/license/MIT/blue)](../LICENSE.txt)
[![Documentation](https://docs.rs/objc2-app-kit/badge.svg)](https://docs.rs/objc2-app-kit/)
[![CI](https://github.com/madsmtm/objc2/actions/workflows/ci.yml/badge.svg)](https://github.com/madsmtm/objc2/actions/workflows/ci.yml)
Rust bindings to Apple's framework AppKit.
This README is kept intentionally small to consolidate the documentation, see
[the Rust docs](https://docs.rs/objc2-app-kit/) for more details on this crate.
This crate is part of the [`objc2` project](https://github.com/madsmtm/objc2),
see that for related crates.

View File

@@ -0,0 +1,83 @@
#![deny(unsafe_op_in_unsafe_fn)]
use objc2::rc::Retained;
use objc2::runtime::ProtocolObject;
use objc2::{declare_class, msg_send_id, mutability, ClassType, DeclaredClass};
use objc2_app_kit::{NSApplication, NSApplicationActivationPolicy, NSApplicationDelegate};
use objc2_foundation::{
ns_string, MainThreadMarker, NSCopying, NSNotification, NSObject, NSObjectProtocol, NSString,
};
#[derive(Debug)]
#[allow(unused)]
struct Ivars {
ivar: u8,
another_ivar: bool,
box_ivar: Box<i32>,
maybe_box_ivar: Option<Box<i32>>,
id_ivar: Retained<NSString>,
maybe_id_ivar: Option<Retained<NSString>>,
}
declare_class!(
struct AppDelegate;
// SAFETY:
// - The superclass NSObject does not have any subclassing requirements.
// - Main thread only mutability is correct, since this is an application delegate.
// - `AppDelegate` does not implement `Drop`.
unsafe impl ClassType for AppDelegate {
type Super = NSObject;
type Mutability = mutability::MainThreadOnly;
const NAME: &'static str = "MyAppDelegate";
}
impl DeclaredClass for AppDelegate {
type Ivars = Ivars;
}
unsafe impl NSObjectProtocol for AppDelegate {}
unsafe impl NSApplicationDelegate for AppDelegate {
#[method(applicationDidFinishLaunching:)]
fn did_finish_launching(&self, notification: &NSNotification) {
println!("Did finish launching!");
// Do something with the notification
dbg!(notification);
}
#[method(applicationWillTerminate:)]
fn will_terminate(&self, _notification: &NSNotification) {
println!("Will terminate!");
}
}
);
impl AppDelegate {
fn new(ivar: u8, another_ivar: bool, mtm: MainThreadMarker) -> Retained<Self> {
let this = mtm.alloc();
let this = this.set_ivars(Ivars {
ivar,
another_ivar,
box_ivar: Box::new(2),
maybe_box_ivar: None,
id_ivar: NSString::from_str("abc"),
maybe_id_ivar: Some(ns_string!("def").copy()),
});
unsafe { msg_send_id![super(this), init] }
}
}
fn main() {
let mtm: MainThreadMarker = MainThreadMarker::new().unwrap();
let app = NSApplication::sharedApplication(mtm);
app.setActivationPolicy(NSApplicationActivationPolicy::Regular);
// configure the application delegate
let delegate = AppDelegate::new(42, true, mtm);
let object = ProtocolObject::from_ref(&*delegate);
app.setDelegate(Some(object));
// run the app
unsafe { app.run() };
}

View File

@@ -0,0 +1,64 @@
//! Read from the global pasteboard, and write a new string into it.
//!
//! Works on macOS 10.7+
#![deny(unsafe_op_in_unsafe_fn)]
use objc2::rc::Retained;
use objc2::runtime::{AnyClass, AnyObject, ProtocolObject};
use objc2::ClassType;
use objc2_app_kit::{NSPasteboard, NSPasteboardTypeString};
use objc2_foundation::{NSArray, NSCopying, NSString};
/// Simplest implementation
pub fn get_text_1(pasteboard: &NSPasteboard) -> Option<Retained<NSString>> {
unsafe { pasteboard.stringForType(NSPasteboardTypeString) }
}
/// More complex implementation using `readObjectsForClasses:options:`,
/// intended to show how some patterns might require more knowledge of
/// nitty-gritty details.
pub fn get_text_2(pasteboard: &NSPasteboard) -> Option<Retained<NSString>> {
// The NSPasteboard API is a bit weird, it requires you to pass classes as
// objects, which `objc2_foundation::NSArray` was not really made for - so
// we convert the class to an `AnyObject` type instead.
//
// TODO: Investigate and find a better way to express this in `objc2`.
let string_class = {
let cls: *const AnyClass = NSString::class();
let cls = cls as *mut AnyObject;
unsafe { Retained::retain(cls).unwrap() }
};
let class_array = NSArray::from_vec(vec![string_class]);
let objects = unsafe { pasteboard.readObjectsForClasses_options(&class_array, None) };
let obj: *const AnyObject = objects?.first()?;
// And this part is weird as well, since we now have to convert the object
// into an NSString, which we know it to be since that's what we told
// `readObjectsForClasses:options:`.
let obj = obj as *mut NSString;
Some(unsafe { Retained::retain(obj) }.unwrap())
}
pub fn set_text(pasteboard: &NSPasteboard, text: &NSString) {
let _ = unsafe { pasteboard.clearContents() };
let obj = ProtocolObject::from_retained(text.copy());
let objects = NSArray::from_vec(vec![obj]);
let res = unsafe { pasteboard.writeObjects(&objects) };
if !res {
panic!("Failed writing to pasteboard");
}
}
fn main() {
let pasteboard = unsafe { NSPasteboard::generalPasteboard() };
let impl_1 = get_text_1(&pasteboard);
let impl_2 = get_text_2(&pasteboard);
println!("Pasteboard text from implementation 1 was: {impl_1:?}");
println!("Pasteboard text from implementation 2 was: {impl_2:?}");
assert_eq!(impl_1, impl_2);
let s = NSString::from_str("Hello, world!");
set_text(&pasteboard, &s);
println!("Now the pasteboard text should be: {s:?}");
assert_eq!(Some(s), get_text_1(&pasteboard));
}

View File

@@ -0,0 +1,5 @@
#[cfg(feature = "NSResponder")]
pub fn NSApp(mtm: objc2_foundation::MainThreadMarker) -> objc2::rc::Retained<crate::NSApplication> {
// TODO: Use the `NSApp` static
crate::NSApplication::sharedApplication(mtm)
}

View File

@@ -0,0 +1,2 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT

View File

@@ -0,0 +1,32 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
pub const NSTextReadInapplicableDocumentTypeError: c_uint = 65806;
pub const NSTextWriteInapplicableDocumentTypeError: c_uint = 66062;
pub const NSTextReadWriteErrorMinimum: c_uint = 65792;
pub const NSTextReadWriteErrorMaximum: c_uint = 66303;
pub const NSFontAssetDownloadError: c_uint = 66304;
pub const NSFontErrorMinimum: c_uint = 66304;
pub const NSFontErrorMaximum: c_uint = 66335;
pub const NSServiceApplicationNotFoundError: c_uint = 66560;
pub const NSServiceApplicationLaunchFailedError: c_uint = 66561;
pub const NSServiceRequestTimedOutError: c_uint = 66562;
pub const NSServiceInvalidPasteboardDataError: c_uint = 66563;
pub const NSServiceMalformedServiceDictionaryError: c_uint = 66564;
pub const NSServiceMiscellaneousError: c_uint = 66800;
pub const NSServiceErrorMinimum: c_uint = 66560;
pub const NSServiceErrorMaximum: c_uint = 66817;
pub const NSSharingServiceNotConfiguredError: c_uint = 67072;
pub const NSSharingServiceErrorMinimum: c_uint = 67072;
pub const NSSharingServiceErrorMaximum: c_uint = 67327;
pub const NSWorkspaceAuthorizationInvalidError: c_uint = 67328;
pub const NSWorkspaceErrorMinimum: c_uint = 67328;
pub const NSWorkspaceErrorMaximum: c_uint = 67455;
pub const NSWindowSharingRequestAlreadyRequested: c_uint = 67456;
pub const NSWindowSharingRequestNoEligibleSession: c_uint = 67457;
pub const NSWindowSharingRequestUnspecifiedError: c_uint = 67458;
pub const NSWindowSharingErrorMinimum: c_uint = 67456;
pub const NSWindowSharingErrorMaximum: c_uint = 67466;

View File

@@ -0,0 +1,235 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSTypesetter")]
pub struct NSATSTypesetter;
#[cfg(feature = "NSTypesetter")]
unsafe impl ClassType for NSATSTypesetter {
#[inherits(NSObject)]
type Super = NSTypesetter;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSTypesetter")]
unsafe impl NSObjectProtocol for NSATSTypesetter {}
extern_methods!(
#[cfg(feature = "NSTypesetter")]
unsafe impl NSATSTypesetter {
#[method_id(@__retain_semantics Other sharedTypesetter)]
pub unsafe fn sharedTypesetter() -> Retained<NSATSTypesetter>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSTypesetter")]
unsafe impl NSATSTypesetter {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
/// NSPantherCompatibility
#[cfg(feature = "NSTypesetter")]
unsafe impl NSATSTypesetter {
#[deprecated]
#[method(lineFragmentRectForProposedRect:remainingRect:)]
pub unsafe fn lineFragmentRectForProposedRect_remainingRect(
&self,
proposed_rect: NSRect,
remaining_rect: NSRectPointer,
) -> NSRect;
}
);
extern_methods!(
/// NSPrimitiveInterface
#[cfg(feature = "NSTypesetter")]
unsafe impl NSATSTypesetter {
#[method(usesFontLeading)]
pub unsafe fn usesFontLeading(&self) -> bool;
#[method(setUsesFontLeading:)]
pub unsafe fn setUsesFontLeading(&self, uses_font_leading: bool);
#[cfg(feature = "NSLayoutManager")]
#[method(typesetterBehavior)]
pub unsafe fn typesetterBehavior(&self) -> NSTypesetterBehavior;
#[cfg(feature = "NSLayoutManager")]
#[method(setTypesetterBehavior:)]
pub unsafe fn setTypesetterBehavior(&self, typesetter_behavior: NSTypesetterBehavior);
#[method(hyphenationFactor)]
pub unsafe fn hyphenationFactor(&self) -> c_float;
#[method(setHyphenationFactor:)]
pub unsafe fn setHyphenationFactor(&self, hyphenation_factor: c_float);
#[method(lineFragmentPadding)]
pub unsafe fn lineFragmentPadding(&self) -> CGFloat;
#[method(setLineFragmentPadding:)]
pub unsafe fn setLineFragmentPadding(&self, line_fragment_padding: CGFloat);
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other substituteFontForFont:)]
pub unsafe fn substituteFontForFont(&self, original_font: &NSFont) -> Retained<NSFont>;
#[cfg(all(feature = "NSParagraphStyle", feature = "NSText"))]
#[method_id(@__retain_semantics Other textTabForGlyphLocation:writingDirection:maxLocation:)]
pub unsafe fn textTabForGlyphLocation_writingDirection_maxLocation(
&self,
glyph_location: CGFloat,
direction: NSWritingDirection,
max_location: CGFloat,
) -> Option<Retained<NSTextTab>>;
#[method(bidiProcessingEnabled)]
pub unsafe fn bidiProcessingEnabled(&self) -> bool;
#[method(setBidiProcessingEnabled:)]
pub unsafe fn setBidiProcessingEnabled(&self, bidi_processing_enabled: bool);
#[method_id(@__retain_semantics Other attributedString)]
pub unsafe fn attributedString(&self) -> Option<Retained<NSAttributedString>>;
#[method(setAttributedString:)]
pub unsafe fn setAttributedString(&self, attributed_string: Option<&NSAttributedString>);
#[method(setParagraphGlyphRange:separatorGlyphRange:)]
pub unsafe fn setParagraphGlyphRange_separatorGlyphRange(
&self,
paragraph_range: NSRange,
paragraph_separator_range: NSRange,
);
#[method(paragraphGlyphRange)]
pub unsafe fn paragraphGlyphRange(&self) -> NSRange;
#[method(paragraphSeparatorGlyphRange)]
pub unsafe fn paragraphSeparatorGlyphRange(&self) -> NSRange;
#[method(layoutParagraphAtPoint:)]
pub unsafe fn layoutParagraphAtPoint(
&self,
line_fragment_origin: NonNull<NSPoint>,
) -> NSUInteger;
#[method(lineSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:)]
pub unsafe fn lineSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
&self,
glyph_index: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[method(paragraphSpacingBeforeGlyphAtIndex:withProposedLineFragmentRect:)]
pub unsafe fn paragraphSpacingBeforeGlyphAtIndex_withProposedLineFragmentRect(
&self,
glyph_index: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[method(paragraphSpacingAfterGlyphAtIndex:withProposedLineFragmentRect:)]
pub unsafe fn paragraphSpacingAfterGlyphAtIndex_withProposedLineFragmentRect(
&self,
glyph_index: NSUInteger,
rect: NSRect,
) -> CGFloat;
#[cfg(feature = "NSLayoutManager")]
#[method_id(@__retain_semantics Other layoutManager)]
pub unsafe fn layoutManager(&self) -> Option<Retained<NSLayoutManager>>;
#[cfg(feature = "NSTextContainer")]
#[method_id(@__retain_semantics Other currentTextContainer)]
pub unsafe fn currentTextContainer(&self) -> Option<Retained<NSTextContainer>>;
#[method(setHardInvalidation:forGlyphRange:)]
pub unsafe fn setHardInvalidation_forGlyphRange(&self, flag: bool, glyph_range: NSRange);
#[method(getLineFragmentRect:usedRect:forParagraphSeparatorGlyphRange:atProposedOrigin:)]
pub unsafe fn getLineFragmentRect_usedRect_forParagraphSeparatorGlyphRange_atProposedOrigin(
&self,
line_fragment_rect: NonNull<NSRect>,
line_fragment_used_rect: NonNull<NSRect>,
paragraph_separator_glyph_range: NSRange,
line_origin: NSPoint,
);
}
);
extern_methods!(
/// NSLayoutPhaseInterface
#[cfg(feature = "NSTypesetter")]
unsafe impl NSATSTypesetter {
#[method(willSetLineFragmentRect:forGlyphRange:usedRect:baselineOffset:)]
pub unsafe fn willSetLineFragmentRect_forGlyphRange_usedRect_baselineOffset(
&self,
line_rect: NonNull<NSRect>,
glyph_range: NSRange,
used_rect: NonNull<NSRect>,
baseline_offset: NonNull<CGFloat>,
);
#[method(shouldBreakLineByWordBeforeCharacterAtIndex:)]
pub unsafe fn shouldBreakLineByWordBeforeCharacterAtIndex(
&self,
char_index: NSUInteger,
) -> bool;
#[method(shouldBreakLineByHyphenatingBeforeCharacterAtIndex:)]
pub unsafe fn shouldBreakLineByHyphenatingBeforeCharacterAtIndex(
&self,
char_index: NSUInteger,
) -> bool;
#[method(hyphenationFactorForGlyphAtIndex:)]
pub unsafe fn hyphenationFactorForGlyphAtIndex(&self, glyph_index: NSUInteger) -> c_float;
#[method(hyphenCharacterForGlyphAtIndex:)]
pub unsafe fn hyphenCharacterForGlyphAtIndex(&self, glyph_index: NSUInteger) -> UTF32Char;
#[cfg(feature = "NSTextContainer")]
#[method(boundingBoxForControlGlyphAtIndex:forTextContainer:proposedLineFragment:glyphPosition:characterIndex:)]
pub unsafe fn boundingBoxForControlGlyphAtIndex_forTextContainer_proposedLineFragment_glyphPosition_characterIndex(
&self,
glyph_index: NSUInteger,
text_container: &NSTextContainer,
proposed_rect: NSRect,
glyph_position: NSPoint,
char_index: NSUInteger,
) -> NSRect;
}
);
extern_methods!(
/// NSGlyphStorageInterface
#[cfg(feature = "NSTypesetter")]
unsafe impl NSATSTypesetter {
#[cfg(all(feature = "NSFont", feature = "NSLayoutManager"))]
#[deprecated]
#[method(getGlyphsInRange:glyphs:characterIndexes:glyphInscriptions:elasticBits:)]
pub unsafe fn getGlyphsInRange_glyphs_characterIndexes_glyphInscriptions_elasticBits(
&self,
glyphs_range: NSRange,
glyph_buffer: *mut NSGlyph,
char_index_buffer: *mut NSUInteger,
inscribe_buffer: *mut NSGlyphInscription,
elastic_buffer: *mut Bool,
) -> NSUInteger;
}
);

View File

@@ -0,0 +1,217 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_category!(
/// Category "NSAccessibility" on [`NSObject`].
#[doc(alias = "NSAccessibility")]
pub unsafe trait NSObjectNSAccessibility {
#[cfg(feature = "NSAccessibilityConstants")]
#[deprecated = "Use the NSAccessibility protocol methods instead (see NSAccessibilityProtocols.h)"]
#[method_id(@__retain_semantics Other accessibilityAttributeNames)]
unsafe fn accessibilityAttributeNames(
&self,
) -> Retained<NSArray<NSAccessibilityAttributeName>>;
#[cfg(feature = "NSAccessibilityConstants")]
#[deprecated = "Use the NSAccessibility protocol methods instead (see NSAccessibilityProtocols.h)"]
#[method_id(@__retain_semantics Other accessibilityAttributeValue:)]
unsafe fn accessibilityAttributeValue(
&self,
attribute: &NSAccessibilityAttributeName,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSAccessibilityConstants")]
#[deprecated = "Use the NSAccessibility protocol methods instead (see NSAccessibilityProtocols.h)"]
#[method(accessibilityIsAttributeSettable:)]
unsafe fn accessibilityIsAttributeSettable(
&self,
attribute: &NSAccessibilityAttributeName,
) -> bool;
#[cfg(feature = "NSAccessibilityConstants")]
#[deprecated = "Use the NSAccessibility protocol methods instead (see NSAccessibilityProtocols.h)"]
#[method(accessibilitySetValue:forAttribute:)]
unsafe fn accessibilitySetValue_forAttribute(
&self,
value: Option<&AnyObject>,
attribute: &NSAccessibilityAttributeName,
);
#[cfg(feature = "NSAccessibilityConstants")]
#[deprecated = "Use the NSAccessibility protocol methods instead (see NSAccessibilityProtocols.h)"]
#[method_id(@__retain_semantics Other accessibilityParameterizedAttributeNames)]
unsafe fn accessibilityParameterizedAttributeNames(
&self,
) -> Retained<NSArray<NSAccessibilityParameterizedAttributeName>>;
#[cfg(feature = "NSAccessibilityConstants")]
#[deprecated = "Use the NSAccessibility protocol methods instead (see NSAccessibilityProtocols.h)"]
#[method_id(@__retain_semantics Other accessibilityAttributeValue:forParameter:)]
unsafe fn accessibilityAttributeValue_forParameter(
&self,
attribute: &NSAccessibilityParameterizedAttributeName,
parameter: Option<&AnyObject>,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "NSAccessibilityConstants")]
#[deprecated = "Use the NSAccessibility protocol methods instead (see NSAccessibilityProtocols.h)"]
#[method_id(@__retain_semantics Other accessibilityActionNames)]
unsafe fn accessibilityActionNames(&self) -> Retained<NSArray<NSAccessibilityActionName>>;
#[cfg(feature = "NSAccessibilityConstants")]
#[deprecated = "Use the NSAccessibility protocol methods instead (see NSAccessibilityProtocols.h)"]
#[method_id(@__retain_semantics Other accessibilityActionDescription:)]
unsafe fn accessibilityActionDescription(
&self,
action: &NSAccessibilityActionName,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSAccessibilityConstants")]
#[deprecated = "Use the NSAccessibility protocol methods instead (see NSAccessibilityProtocols.h)"]
#[method(accessibilityPerformAction:)]
unsafe fn accessibilityPerformAction(&self, action: &NSAccessibilityActionName);
#[deprecated = "Use isAccessibilityElement instead"]
#[method(accessibilityIsIgnored)]
unsafe fn accessibilityIsIgnored(&self) -> bool;
#[method_id(@__retain_semantics Other accessibilityHitTest:)]
unsafe fn accessibilityHitTest(&self, point: NSPoint) -> Option<Retained<AnyObject>>;
#[method_id(@__retain_semantics Other accessibilityFocusedUIElement)]
unsafe fn accessibilityFocusedUIElement(&self) -> Option<Retained<AnyObject>>;
#[method(accessibilityIndexOfChild:)]
unsafe fn accessibilityIndexOfChild(&self, child: &AnyObject) -> NSUInteger;
#[cfg(feature = "NSAccessibilityConstants")]
#[method(accessibilityArrayAttributeCount:)]
unsafe fn accessibilityArrayAttributeCount(
&self,
attribute: &NSAccessibilityAttributeName,
) -> NSUInteger;
#[cfg(feature = "NSAccessibilityConstants")]
#[method_id(@__retain_semantics Other accessibilityArrayAttributeValues:index:maxCount:)]
unsafe fn accessibilityArrayAttributeValues_index_maxCount(
&self,
attribute: &NSAccessibilityAttributeName,
index: NSUInteger,
max_count: NSUInteger,
) -> Retained<NSArray>;
#[method(accessibilityNotifiesWhenDestroyed)]
unsafe fn accessibilityNotifiesWhenDestroyed(&self) -> bool;
}
unsafe impl NSObjectNSAccessibility for NSObject {}
);
extern_methods!(
/// NSWorkspaceAccessibilityDisplay
#[cfg(feature = "NSWorkspace")]
unsafe impl NSWorkspace {
#[method(accessibilityDisplayShouldIncreaseContrast)]
pub unsafe fn accessibilityDisplayShouldIncreaseContrast(&self) -> bool;
#[method(accessibilityDisplayShouldDifferentiateWithoutColor)]
pub unsafe fn accessibilityDisplayShouldDifferentiateWithoutColor(&self) -> bool;
#[method(accessibilityDisplayShouldReduceTransparency)]
pub unsafe fn accessibilityDisplayShouldReduceTransparency(&self) -> bool;
#[method(accessibilityDisplayShouldReduceMotion)]
pub unsafe fn accessibilityDisplayShouldReduceMotion(&self) -> bool;
#[method(accessibilityDisplayShouldInvertColors)]
pub unsafe fn accessibilityDisplayShouldInvertColors(&self) -> bool;
}
);
extern_methods!(
/// NSWorkspaceAccessibility
#[cfg(feature = "NSWorkspace")]
unsafe impl NSWorkspace {
#[method(isVoiceOverEnabled)]
pub unsafe fn isVoiceOverEnabled(&self) -> bool;
#[method(isSwitchControlEnabled)]
pub unsafe fn isSwitchControlEnabled(&self) -> bool;
}
);
extern "C" {
pub static NSWorkspaceAccessibilityDisplayOptionsDidChangeNotification:
&'static NSNotificationName;
}
extern "C" {
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
pub fn NSAccessibilityFrameInView(parent_view: &NSView, frame: NSRect) -> NSRect;
}
extern "C" {
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
pub fn NSAccessibilityPointInView(parent_view: &NSView, point: NSPoint) -> NSPoint;
}
extern "C" {
pub fn NSAccessibilitySetMayContainProtectedContent(flag: Bool) -> Bool;
}
extern "C" {
#[cfg(feature = "NSAccessibilityConstants")]
pub fn NSAccessibilityRoleDescription(
role: &NSAccessibilityRole,
subrole: Option<&NSAccessibilitySubrole>,
) -> *mut NSString;
}
extern "C" {
pub fn NSAccessibilityRoleDescriptionForUIElement(element: &AnyObject) -> *mut NSString;
}
extern "C" {
#[cfg(feature = "NSAccessibilityConstants")]
pub fn NSAccessibilityActionDescription(action: &NSAccessibilityActionName) -> *mut NSString;
}
extern "C" {
#[cfg(feature = "NSAccessibilityConstants")]
#[deprecated = "Exceptions are no longer appropriate for indicating errors in accessibility API. Unexpected values should be handled through appropriate type checking."]
pub fn NSAccessibilityRaiseBadArgumentException(
element: Option<&AnyObject>,
attribute: Option<&NSAccessibilityAttributeName>,
value: Option<&AnyObject>,
);
}
extern "C" {
pub fn NSAccessibilityUnignoredAncestor(element: &AnyObject) -> *mut AnyObject;
}
extern "C" {
pub fn NSAccessibilityUnignoredDescendant(element: &AnyObject) -> *mut AnyObject;
}
extern "C" {
pub fn NSAccessibilityUnignoredChildren(original_children: &NSArray) -> NonNull<NSArray>;
}
extern "C" {
pub fn NSAccessibilityUnignoredChildrenForOnlyChild(
original_child: &AnyObject,
) -> NonNull<NSArray>;
}
extern "C" {
#[cfg(feature = "NSAccessibilityConstants")]
pub fn NSAccessibilityPostNotification(
element: &AnyObject,
notification: &NSAccessibilityNotificationName,
);
}

View File

@@ -0,0 +1,24 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
pub unsafe trait NSAccessibilityColor {
#[method_id(@__retain_semantics Other accessibilityName)]
unsafe fn accessibilityName(&self) -> Retained<NSString>;
}
unsafe impl ProtocolType for dyn NSAccessibilityColor {}
);
extern_methods!(
/// NSAccessibilityColorConformance
#[cfg(feature = "NSColor")]
unsafe impl NSColor {}
);
#[cfg(feature = "NSColor")]
unsafe impl NSAccessibilityColor for NSColor {}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,75 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAccessibilityCustomAction;
unsafe impl ClassType for NSAccessibilityCustomAction {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSAccessibilityCustomAction {}
extern_methods!(
unsafe impl NSAccessibilityCustomAction {
#[cfg(feature = "block2")]
#[method_id(@__retain_semantics Init initWithName:handler:)]
pub unsafe fn initWithName_handler(
this: Allocated<Self>,
name: &NSString,
handler: Option<&block2::Block<dyn Fn() -> Bool>>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithName:target:selector:)]
pub unsafe fn initWithName_target_selector(
this: Allocated<Self>,
name: &NSString,
target: &NSObject,
selector: Sel,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Retained<NSString>;
#[method(setName:)]
pub unsafe fn setName(&self, name: &NSString);
#[cfg(feature = "block2")]
#[method(handler)]
pub unsafe fn handler(&self) -> *mut block2::Block<dyn Fn() -> Bool>;
#[cfg(feature = "block2")]
#[method(setHandler:)]
pub unsafe fn setHandler(&self, handler: Option<&block2::Block<dyn Fn() -> Bool>>);
#[method_id(@__retain_semantics Other target)]
pub unsafe fn target(&self) -> Option<Retained<NSObject>>;
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&NSObject>);
#[method(selector)]
pub unsafe fn selector(&self) -> Option<Sel>;
#[method(setSelector:)]
pub unsafe fn setSelector(&self, selector: Option<Sel>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAccessibilityCustomAction {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,286 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAccessibilityCustomRotorSearchDirection(pub NSInteger);
impl NSAccessibilityCustomRotorSearchDirection {
#[doc(alias = "NSAccessibilityCustomRotorSearchDirectionPrevious")]
pub const Previous: Self = Self(0);
#[doc(alias = "NSAccessibilityCustomRotorSearchDirectionNext")]
pub const Next: Self = Self(1);
}
unsafe impl Encode for NSAccessibilityCustomRotorSearchDirection {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSAccessibilityCustomRotorSearchDirection {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAccessibilityCustomRotorType(pub NSInteger);
impl NSAccessibilityCustomRotorType {
#[doc(alias = "NSAccessibilityCustomRotorTypeCustom")]
pub const Custom: Self = Self(0);
#[doc(alias = "NSAccessibilityCustomRotorTypeAny")]
pub const Any: Self = Self(1);
#[doc(alias = "NSAccessibilityCustomRotorTypeAnnotation")]
pub const Annotation: Self = Self(2);
#[doc(alias = "NSAccessibilityCustomRotorTypeBoldText")]
pub const BoldText: Self = Self(3);
#[doc(alias = "NSAccessibilityCustomRotorTypeHeading")]
pub const Heading: Self = Self(4);
#[doc(alias = "NSAccessibilityCustomRotorTypeHeadingLevel1")]
pub const HeadingLevel1: Self = Self(5);
#[doc(alias = "NSAccessibilityCustomRotorTypeHeadingLevel2")]
pub const HeadingLevel2: Self = Self(6);
#[doc(alias = "NSAccessibilityCustomRotorTypeHeadingLevel3")]
pub const HeadingLevel3: Self = Self(7);
#[doc(alias = "NSAccessibilityCustomRotorTypeHeadingLevel4")]
pub const HeadingLevel4: Self = Self(8);
#[doc(alias = "NSAccessibilityCustomRotorTypeHeadingLevel5")]
pub const HeadingLevel5: Self = Self(9);
#[doc(alias = "NSAccessibilityCustomRotorTypeHeadingLevel6")]
pub const HeadingLevel6: Self = Self(10);
#[doc(alias = "NSAccessibilityCustomRotorTypeImage")]
pub const Image: Self = Self(11);
#[doc(alias = "NSAccessibilityCustomRotorTypeItalicText")]
pub const ItalicText: Self = Self(12);
#[doc(alias = "NSAccessibilityCustomRotorTypeLandmark")]
pub const Landmark: Self = Self(13);
#[doc(alias = "NSAccessibilityCustomRotorTypeLink")]
pub const Link: Self = Self(14);
#[doc(alias = "NSAccessibilityCustomRotorTypeList")]
pub const List: Self = Self(15);
#[doc(alias = "NSAccessibilityCustomRotorTypeMisspelledWord")]
pub const MisspelledWord: Self = Self(16);
#[doc(alias = "NSAccessibilityCustomRotorTypeTable")]
pub const Table: Self = Self(17);
#[doc(alias = "NSAccessibilityCustomRotorTypeTextField")]
pub const TextField: Self = Self(18);
#[doc(alias = "NSAccessibilityCustomRotorTypeUnderlinedText")]
pub const UnderlinedText: Self = Self(19);
#[doc(alias = "NSAccessibilityCustomRotorTypeVisitedLink")]
pub const VisitedLink: Self = Self(20);
#[doc(alias = "NSAccessibilityCustomRotorTypeAudiograph")]
pub const Audiograph: Self = Self(21);
}
unsafe impl Encode for NSAccessibilityCustomRotorType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSAccessibilityCustomRotorType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAccessibilityCustomRotor;
unsafe impl ClassType for NSAccessibilityCustomRotor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSAccessibilityCustomRotor {}
extern_methods!(
unsafe impl NSAccessibilityCustomRotor {
#[method_id(@__retain_semantics Init initWithLabel:itemSearchDelegate:)]
pub unsafe fn initWithLabel_itemSearchDelegate(
this: Allocated<Self>,
label: &NSString,
item_search_delegate: &ProtocolObject<dyn NSAccessibilityCustomRotorItemSearchDelegate>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithRotorType:itemSearchDelegate:)]
pub unsafe fn initWithRotorType_itemSearchDelegate(
this: Allocated<Self>,
rotor_type: NSAccessibilityCustomRotorType,
item_search_delegate: &ProtocolObject<dyn NSAccessibilityCustomRotorItemSearchDelegate>,
) -> Retained<Self>;
#[method(type)]
pub unsafe fn r#type(&self) -> NSAccessibilityCustomRotorType;
#[method(setType:)]
pub unsafe fn setType(&self, r#type: NSAccessibilityCustomRotorType);
#[method_id(@__retain_semantics Other label)]
pub unsafe fn label(&self) -> Retained<NSString>;
#[method(setLabel:)]
pub unsafe fn setLabel(&self, label: &NSString);
#[method_id(@__retain_semantics Other itemSearchDelegate)]
pub unsafe fn itemSearchDelegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSAccessibilityCustomRotorItemSearchDelegate>>>;
#[method(setItemSearchDelegate:)]
pub unsafe fn setItemSearchDelegate(
&self,
item_search_delegate: Option<
&ProtocolObject<dyn NSAccessibilityCustomRotorItemSearchDelegate>,
>,
);
#[cfg(feature = "NSAccessibilityProtocols")]
#[method_id(@__retain_semantics Other itemLoadingDelegate)]
pub unsafe fn itemLoadingDelegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSAccessibilityElementLoading>>>;
#[cfg(feature = "NSAccessibilityProtocols")]
#[method(setItemLoadingDelegate:)]
pub unsafe fn setItemLoadingDelegate(
&self,
item_loading_delegate: Option<&ProtocolObject<dyn NSAccessibilityElementLoading>>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAccessibilityCustomRotor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAccessibilityCustomRotorSearchParameters;
unsafe impl ClassType for NSAccessibilityCustomRotorSearchParameters {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSAccessibilityCustomRotorSearchParameters {}
extern_methods!(
unsafe impl NSAccessibilityCustomRotorSearchParameters {
#[method_id(@__retain_semantics Other currentItem)]
pub unsafe fn currentItem(&self) -> Option<Retained<NSAccessibilityCustomRotorItemResult>>;
#[method(setCurrentItem:)]
pub unsafe fn setCurrentItem(
&self,
current_item: Option<&NSAccessibilityCustomRotorItemResult>,
);
#[method(searchDirection)]
pub unsafe fn searchDirection(&self) -> NSAccessibilityCustomRotorSearchDirection;
#[method(setSearchDirection:)]
pub unsafe fn setSearchDirection(
&self,
search_direction: NSAccessibilityCustomRotorSearchDirection,
);
#[method_id(@__retain_semantics Other filterString)]
pub unsafe fn filterString(&self) -> Retained<NSString>;
#[method(setFilterString:)]
pub unsafe fn setFilterString(&self, filter_string: &NSString);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAccessibilityCustomRotorSearchParameters {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAccessibilityCustomRotorItemResult;
unsafe impl ClassType for NSAccessibilityCustomRotorItemResult {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSAccessibilityCustomRotorItemResult {}
extern_methods!(
unsafe impl NSAccessibilityCustomRotorItemResult {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSAccessibilityProtocols")]
#[method_id(@__retain_semantics Init initWithTargetElement:)]
pub unsafe fn initWithTargetElement(
this: Allocated<Self>,
target_element: &ProtocolObject<dyn NSAccessibilityElementProtocol>,
) -> Retained<Self>;
#[cfg(feature = "NSAccessibilityConstants")]
#[method_id(@__retain_semantics Init initWithItemLoadingToken:customLabel:)]
pub unsafe fn initWithItemLoadingToken_customLabel(
this: Allocated<Self>,
item_loading_token: &NSAccessibilityLoadingToken,
custom_label: &NSString,
) -> Retained<Self>;
#[cfg(feature = "NSAccessibilityProtocols")]
#[method_id(@__retain_semantics Other targetElement)]
pub unsafe fn targetElement(
&self,
) -> Option<Retained<ProtocolObject<dyn NSAccessibilityElementProtocol>>>;
#[cfg(feature = "NSAccessibilityConstants")]
#[method_id(@__retain_semantics Other itemLoadingToken)]
pub unsafe fn itemLoadingToken(&self) -> Option<Retained<NSAccessibilityLoadingToken>>;
#[method(targetRange)]
pub unsafe fn targetRange(&self) -> NSRange;
#[method(setTargetRange:)]
pub unsafe fn setTargetRange(&self, target_range: NSRange);
#[method_id(@__retain_semantics Other customLabel)]
pub unsafe fn customLabel(&self) -> Option<Retained<NSString>>;
#[method(setCustomLabel:)]
pub unsafe fn setCustomLabel(&self, custom_label: Option<&NSString>);
}
);
extern_protocol!(
pub unsafe trait NSAccessibilityCustomRotorItemSearchDelegate: NSObjectProtocol {
#[method_id(@__retain_semantics Other rotor:resultForSearchParameters:)]
unsafe fn rotor_resultForSearchParameters(
&self,
rotor: &NSAccessibilityCustomRotor,
search_parameters: &NSAccessibilityCustomRotorSearchParameters,
) -> Option<Retained<NSAccessibilityCustomRotorItemResult>>;
}
unsafe impl ProtocolType for dyn NSAccessibilityCustomRotorItemSearchDelegate {}
);

View File

@@ -0,0 +1,57 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAccessibilityElement;
unsafe impl ClassType for NSAccessibilityElement {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSAccessibilityProtocols")]
unsafe impl NSAccessibility for NSAccessibilityElement {}
unsafe impl NSObjectProtocol for NSAccessibilityElement {}
extern_methods!(
unsafe impl NSAccessibilityElement {
#[cfg(feature = "NSAccessibilityConstants")]
#[method_id(@__retain_semantics Other accessibilityElementWithRole:frame:label:parent:)]
pub unsafe fn accessibilityElementWithRole_frame_label_parent(
role: &NSAccessibilityRole,
frame: NSRect,
label: Option<&NSString>,
parent: Option<&AnyObject>,
) -> Retained<AnyObject>;
#[method(accessibilityAddChildElement:)]
pub unsafe fn accessibilityAddChildElement(&self, child_element: &NSAccessibilityElement);
#[method(accessibilityFrameInParentSpace)]
pub unsafe fn accessibilityFrameInParentSpace(&self) -> NSRect;
#[method(setAccessibilityFrameInParentSpace:)]
pub unsafe fn setAccessibilityFrameInParentSpace(
&self,
accessibility_frame_in_parent_space: NSRect,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAccessibilityElement {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,91 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCell")]
pub struct NSActionCell;
#[cfg(feature = "NSCell")]
unsafe impl ClassType for NSActionCell {
#[inherits(NSObject)]
type Super = NSCell;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSCell"))]
unsafe impl NSAccessibility for NSActionCell {}
#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSCell"))]
unsafe impl NSAccessibilityElementProtocol for NSActionCell {}
#[cfg(feature = "NSCell")]
unsafe impl NSCoding for NSActionCell {}
#[cfg(feature = "NSCell")]
unsafe impl NSCopying for NSActionCell {}
#[cfg(feature = "NSCell")]
unsafe impl NSObjectProtocol for NSActionCell {}
#[cfg(all(feature = "NSCell", feature = "NSUserInterfaceItemIdentification"))]
unsafe impl NSUserInterfaceItemIdentification for NSActionCell {}
extern_methods!(
#[cfg(feature = "NSCell")]
unsafe impl NSActionCell {
#[method_id(@__retain_semantics Other target)]
pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
#[method(action)]
pub unsafe fn action(&self) -> Option<Sel>;
#[method(setAction:)]
pub unsafe fn setAction(&self, action: Option<Sel>);
#[method(tag)]
pub unsafe fn tag(&self) -> NSInteger;
#[method(setTag:)]
pub unsafe fn setTag(&self, tag: NSInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSCell`
#[cfg(feature = "NSCell")]
unsafe impl NSActionCell {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initTextCell:)]
pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Init initImageCell:)]
pub unsafe fn initImageCell(
this: Allocated<Self>,
image: Option<&NSImage>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSCell")]
unsafe impl NSActionCell {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,24 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_category!(
/// Category "NSAppKitAdditions" on [`NSAffineTransform`].
#[doc(alias = "NSAppKitAdditions")]
pub unsafe trait NSAffineTransformNSAppKitAdditions {
#[cfg(feature = "NSBezierPath")]
#[method_id(@__retain_semantics Other transformBezierPath:)]
unsafe fn transformBezierPath(&self, path: &NSBezierPath) -> Retained<NSBezierPath>;
#[method(set)]
unsafe fn set(&self);
#[method(concat)]
unsafe fn concat(&self);
}
unsafe impl NSAffineTransformNSAppKitAdditions for NSAffineTransform {}
);

View File

@@ -0,0 +1,209 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAlertStyle(pub NSUInteger);
impl NSAlertStyle {
#[doc(alias = "NSAlertStyleWarning")]
pub const Warning: Self = Self(0);
#[doc(alias = "NSAlertStyleInformational")]
pub const Informational: Self = Self(1);
#[doc(alias = "NSAlertStyleCritical")]
pub const Critical: Self = Self(2);
}
unsafe impl Encode for NSAlertStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSAlertStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
#[cfg(feature = "NSApplication")]
pub static NSAlertFirstButtonReturn: NSModalResponse = 1000;
#[cfg(feature = "NSApplication")]
pub static NSAlertSecondButtonReturn: NSModalResponse = 1001;
#[cfg(feature = "NSApplication")]
pub static NSAlertThirdButtonReturn: NSModalResponse = 1002;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAlert;
unsafe impl ClassType for NSAlert {
type Super = NSObject;
type Mutability = MainThreadOnly;
}
);
unsafe impl NSObjectProtocol for NSAlert {}
extern_methods!(
unsafe impl NSAlert {
#[method_id(@__retain_semantics Other alertWithError:)]
pub unsafe fn alertWithError(error: &NSError, mtm: MainThreadMarker) -> Retained<NSAlert>;
#[method_id(@__retain_semantics Other messageText)]
pub unsafe fn messageText(&self) -> Retained<NSString>;
#[method(setMessageText:)]
pub unsafe fn setMessageText(&self, message_text: &NSString);
#[method_id(@__retain_semantics Other informativeText)]
pub unsafe fn informativeText(&self) -> Retained<NSString>;
#[method(setInformativeText:)]
pub unsafe fn setInformativeText(&self, informative_text: &NSString);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other icon)]
pub unsafe fn icon(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setIcon:)]
pub unsafe fn setIcon(&self, icon: Option<&NSImage>);
#[cfg(all(
feature = "NSButton",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other addButtonWithTitle:)]
pub unsafe fn addButtonWithTitle(&self, title: &NSString) -> Retained<NSButton>;
#[cfg(all(
feature = "NSButton",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other buttons)]
pub unsafe fn buttons(&self) -> Retained<NSArray<NSButton>>;
#[method(alertStyle)]
pub unsafe fn alertStyle(&self) -> NSAlertStyle;
#[method(setAlertStyle:)]
pub unsafe fn setAlertStyle(&self, alert_style: NSAlertStyle);
#[method(showsHelp)]
pub unsafe fn showsHelp(&self) -> bool;
#[method(setShowsHelp:)]
pub unsafe fn setShowsHelp(&self, shows_help: bool);
#[cfg(feature = "NSHelpManager")]
#[method_id(@__retain_semantics Other helpAnchor)]
pub unsafe fn helpAnchor(&self) -> Option<Retained<NSHelpAnchorName>>;
#[cfg(feature = "NSHelpManager")]
#[method(setHelpAnchor:)]
pub unsafe fn setHelpAnchor(&self, help_anchor: Option<&NSHelpAnchorName>);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSAlertDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSAlertDelegate>>);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method_id(@__retain_semantics Other accessoryView)]
pub unsafe fn accessoryView(&self) -> Option<Retained<NSView>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(setAccessoryView:)]
pub unsafe fn setAccessoryView(&self, accessory_view: Option<&NSView>);
#[method(layout)]
pub unsafe fn layout(&self);
#[cfg(feature = "NSApplication")]
#[method(runModal)]
pub unsafe fn runModal(&self) -> NSModalResponse;
#[method(showsSuppressionButton)]
pub unsafe fn showsSuppressionButton(&self) -> bool;
#[method(setShowsSuppressionButton:)]
pub unsafe fn setShowsSuppressionButton(&self, shows_suppression_button: bool);
#[cfg(all(
feature = "NSButton",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other suppressionButton)]
pub unsafe fn suppressionButton(&self) -> Option<Retained<NSButton>>;
#[cfg(all(
feature = "NSApplication",
feature = "NSResponder",
feature = "NSWindow",
feature = "block2"
))]
#[method(beginSheetModalForWindow:completionHandler:)]
pub unsafe fn beginSheetModalForWindow_completionHandler(
&self,
sheet_window: &NSWindow,
handler: Option<&block2::Block<dyn Fn(NSModalResponse)>>,
);
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[method_id(@__retain_semantics Other window)]
pub unsafe fn window(&self) -> Retained<NSWindow>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAlert {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait NSAlertDelegate: NSObjectProtocol + IsMainThreadOnly {
#[optional]
#[method(alertShowHelp:)]
unsafe fn alertShowHelp(&self, alert: &NSAlert) -> bool;
}
unsafe impl ProtocolType for dyn NSAlertDelegate {}
);
extern_methods!(
/// NSAlertDeprecated
unsafe impl NSAlert {
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[deprecated = "Use -beginSheetModalForWindow:completionHandler: instead"]
#[method(beginSheetModalForWindow:modalDelegate:didEndSelector:contextInfo:)]
pub unsafe fn beginSheetModalForWindow_modalDelegate_didEndSelector_contextInfo(
&self,
window: &NSWindow,
delegate: Option<&AnyObject>,
did_end_selector: Option<Sel>,
context_info: *mut c_void,
);
}
);
pub static NSWarningAlertStyle: NSAlertStyle = NSAlertStyle(NSAlertStyle::Warning.0);
pub static NSInformationalAlertStyle: NSAlertStyle = NSAlertStyle(NSAlertStyle::Informational.0);
pub static NSCriticalAlertStyle: NSAlertStyle = NSAlertStyle(NSAlertStyle::Critical.0);

View File

@@ -0,0 +1,89 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
pub unsafe trait NSAlignmentFeedbackToken: NSObjectProtocol {}
unsafe impl ProtocolType for dyn NSAlignmentFeedbackToken {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAlignmentFeedbackFilter;
unsafe impl ClassType for NSAlignmentFeedbackFilter {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSAlignmentFeedbackFilter {}
extern_methods!(
unsafe impl NSAlignmentFeedbackFilter {
#[cfg(feature = "NSEvent")]
#[method(inputEventMask)]
pub unsafe fn inputEventMask() -> NSEventMask;
#[cfg(feature = "NSEvent")]
#[method(updateWithEvent:)]
pub unsafe fn updateWithEvent(&self, event: &NSEvent);
#[cfg(all(feature = "NSGestureRecognizer", feature = "NSPanGestureRecognizer"))]
#[method(updateWithPanRecognizer:)]
pub unsafe fn updateWithPanRecognizer(&self, pan_recognizer: &NSPanGestureRecognizer);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method_id(@__retain_semantics Other alignmentFeedbackTokenForMovementInView:previousPoint:alignedPoint:defaultPoint:)]
pub unsafe fn alignmentFeedbackTokenForMovementInView_previousPoint_alignedPoint_defaultPoint(
&self,
view: Option<&NSView>,
previous_point: NSPoint,
aligned_point: NSPoint,
default_point: NSPoint,
) -> Option<Retained<ProtocolObject<dyn NSAlignmentFeedbackToken>>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method_id(@__retain_semantics Other alignmentFeedbackTokenForHorizontalMovementInView:previousX:alignedX:defaultX:)]
pub unsafe fn alignmentFeedbackTokenForHorizontalMovementInView_previousX_alignedX_defaultX(
&self,
view: Option<&NSView>,
previous_x: CGFloat,
aligned_x: CGFloat,
default_x: CGFloat,
) -> Option<Retained<ProtocolObject<dyn NSAlignmentFeedbackToken>>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method_id(@__retain_semantics Other alignmentFeedbackTokenForVerticalMovementInView:previousY:alignedY:defaultY:)]
pub unsafe fn alignmentFeedbackTokenForVerticalMovementInView_previousY_alignedY_defaultY(
&self,
view: Option<&NSView>,
previous_y: CGFloat,
aligned_y: CGFloat,
default_y: CGFloat,
) -> Option<Retained<ProtocolObject<dyn NSAlignmentFeedbackToken>>>;
#[cfg(feature = "NSHapticFeedback")]
#[method(performFeedback:performanceTime:)]
pub unsafe fn performFeedback_performanceTime(
&self,
alignment_feedback_tokens: &NSArray<ProtocolObject<dyn NSAlignmentFeedbackToken>>,
performance_time: NSHapticFeedbackPerformanceTime,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAlignmentFeedbackFilter {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,356 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAnimationCurve(pub NSUInteger);
impl NSAnimationCurve {
pub const NSAnimationEaseInOut: Self = Self(0);
pub const NSAnimationEaseIn: Self = Self(1);
pub const NSAnimationEaseOut: Self = Self(2);
pub const NSAnimationLinear: Self = Self(3);
}
unsafe impl Encode for NSAnimationCurve {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSAnimationCurve {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAnimationBlockingMode(pub NSUInteger);
impl NSAnimationBlockingMode {
pub const NSAnimationBlocking: Self = Self(0);
pub const NSAnimationNonblocking: Self = Self(1);
pub const NSAnimationNonblockingThreaded: Self = Self(2);
}
unsafe impl Encode for NSAnimationBlockingMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSAnimationBlockingMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type NSAnimationProgress = c_float;
extern "C" {
pub static NSAnimationProgressMarkNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSAnimationProgressMark: &'static NSString;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAnimation;
unsafe impl ClassType for NSAnimation {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSAnimation {}
unsafe impl NSCopying for NSAnimation {}
unsafe impl NSObjectProtocol for NSAnimation {}
extern_methods!(
unsafe impl NSAnimation {
#[method_id(@__retain_semantics Init initWithDuration:animationCurve:)]
pub unsafe fn initWithDuration_animationCurve(
this: Allocated<Self>,
duration: NSTimeInterval,
animation_curve: NSAnimationCurve,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method(startAnimation)]
pub unsafe fn startAnimation(&self);
#[method(stopAnimation)]
pub unsafe fn stopAnimation(&self);
#[method(isAnimating)]
pub unsafe fn isAnimating(&self) -> bool;
#[method(currentProgress)]
pub unsafe fn currentProgress(&self) -> NSAnimationProgress;
#[method(setCurrentProgress:)]
pub unsafe fn setCurrentProgress(&self, current_progress: NSAnimationProgress);
#[method(duration)]
pub unsafe fn duration(&self) -> NSTimeInterval;
#[method(setDuration:)]
pub unsafe fn setDuration(&self, duration: NSTimeInterval);
#[method(animationBlockingMode)]
pub unsafe fn animationBlockingMode(&self) -> NSAnimationBlockingMode;
#[method(setAnimationBlockingMode:)]
pub unsafe fn setAnimationBlockingMode(
&self,
animation_blocking_mode: NSAnimationBlockingMode,
);
#[method(frameRate)]
pub unsafe fn frameRate(&self) -> c_float;
#[method(setFrameRate:)]
pub unsafe fn setFrameRate(&self, frame_rate: c_float);
#[method(animationCurve)]
pub unsafe fn animationCurve(&self) -> NSAnimationCurve;
#[method(setAnimationCurve:)]
pub unsafe fn setAnimationCurve(&self, animation_curve: NSAnimationCurve);
#[method(currentValue)]
pub unsafe fn currentValue(&self) -> c_float;
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSAnimationDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSAnimationDelegate>>,
);
#[method_id(@__retain_semantics Other progressMarks)]
pub unsafe fn progressMarks(&self) -> Retained<NSArray<NSNumber>>;
#[method(setProgressMarks:)]
pub unsafe fn setProgressMarks(&self, progress_marks: &NSArray<NSNumber>);
#[method(addProgressMark:)]
pub unsafe fn addProgressMark(&self, progress_mark: NSAnimationProgress);
#[method(removeProgressMark:)]
pub unsafe fn removeProgressMark(&self, progress_mark: NSAnimationProgress);
#[method(startWhenAnimation:reachesProgress:)]
pub unsafe fn startWhenAnimation_reachesProgress(
&self,
animation: &NSAnimation,
start_progress: NSAnimationProgress,
);
#[method(stopWhenAnimation:reachesProgress:)]
pub unsafe fn stopWhenAnimation_reachesProgress(
&self,
animation: &NSAnimation,
stop_progress: NSAnimationProgress,
);
#[method(clearStartAnimation)]
pub unsafe fn clearStartAnimation(&self);
#[method(clearStopAnimation)]
pub unsafe fn clearStopAnimation(&self);
#[method_id(@__retain_semantics Other runLoopModesForAnimating)]
pub unsafe fn runLoopModesForAnimating(&self) -> Option<Retained<NSArray<NSRunLoopMode>>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAnimation {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait NSAnimationDelegate: NSObjectProtocol {
#[optional]
#[method(animationShouldStart:)]
unsafe fn animationShouldStart(&self, animation: &NSAnimation) -> bool;
#[optional]
#[method(animationDidStop:)]
unsafe fn animationDidStop(&self, animation: &NSAnimation);
#[optional]
#[method(animationDidEnd:)]
unsafe fn animationDidEnd(&self, animation: &NSAnimation);
#[optional]
#[method(animation:valueForProgress:)]
unsafe fn animation_valueForProgress(
&self,
animation: &NSAnimation,
progress: NSAnimationProgress,
) -> c_float;
#[optional]
#[method(animation:didReachProgressMark:)]
unsafe fn animation_didReachProgressMark(
&self,
animation: &NSAnimation,
progress: NSAnimationProgress,
);
}
unsafe impl ProtocolType for dyn NSAnimationDelegate {}
);
// NS_TYPED_ENUM
pub type NSViewAnimationKey = NSString;
extern "C" {
pub static NSViewAnimationTargetKey: &'static NSViewAnimationKey;
}
extern "C" {
pub static NSViewAnimationStartFrameKey: &'static NSViewAnimationKey;
}
extern "C" {
pub static NSViewAnimationEndFrameKey: &'static NSViewAnimationKey;
}
extern "C" {
pub static NSViewAnimationEffectKey: &'static NSViewAnimationKey;
}
// NS_TYPED_ENUM
pub type NSViewAnimationEffectName = NSString;
extern "C" {
pub static NSViewAnimationFadeInEffect: &'static NSViewAnimationEffectName;
}
extern "C" {
pub static NSViewAnimationFadeOutEffect: &'static NSViewAnimationEffectName;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSViewAnimation;
unsafe impl ClassType for NSViewAnimation {
#[inherits(NSObject)]
type Super = NSAnimation;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSViewAnimation {}
unsafe impl NSCopying for NSViewAnimation {}
unsafe impl NSObjectProtocol for NSViewAnimation {}
extern_methods!(
unsafe impl NSViewAnimation {
#[method_id(@__retain_semantics Init initWithViewAnimations:)]
pub unsafe fn initWithViewAnimations(
this: Allocated<Self>,
view_animations: &NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other viewAnimations)]
pub unsafe fn viewAnimations(
&self,
) -> Retained<NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>>;
#[method(setViewAnimations:)]
pub unsafe fn setViewAnimations(
&self,
view_animations: &NSArray<NSDictionary<NSViewAnimationKey, AnyObject>>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSAnimation`
unsafe impl NSViewAnimation {
#[method_id(@__retain_semantics Init initWithDuration:animationCurve:)]
pub unsafe fn initWithDuration_animationCurve(
this: Allocated<Self>,
duration: NSTimeInterval,
animation_curve: NSAnimationCurve,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSViewAnimation {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
pub type NSAnimatablePropertyKey = NSString;
extern_protocol!(
pub unsafe trait NSAnimatablePropertyContainer {
#[method_id(@__retain_semantics Other animator)]
unsafe fn animator(&self) -> Retained<Self>;
#[method_id(@__retain_semantics Other animations)]
unsafe fn animations(&self) -> Retained<NSDictionary<NSAnimatablePropertyKey, AnyObject>>;
#[method(setAnimations:)]
unsafe fn setAnimations(
&self,
animations: &NSDictionary<NSAnimatablePropertyKey, AnyObject>,
);
#[method_id(@__retain_semantics Other animationForKey:)]
unsafe fn animationForKey(
&self,
key: &NSAnimatablePropertyKey,
) -> Option<Retained<AnyObject>>;
#[method_id(@__retain_semantics Other defaultAnimationForKey:)]
unsafe fn defaultAnimationForKey(
key: &NSAnimatablePropertyKey,
) -> Option<Retained<AnyObject>>;
}
unsafe impl ProtocolType for dyn NSAnimatablePropertyContainer {}
);
extern "C" {
pub static NSAnimationTriggerOrderIn: &'static NSAnimatablePropertyKey;
}
extern "C" {
pub static NSAnimationTriggerOrderOut: &'static NSAnimatablePropertyKey;
}

View File

@@ -0,0 +1,78 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAnimationContext;
unsafe impl ClassType for NSAnimationContext {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSAnimationContext {}
extern_methods!(
unsafe impl NSAnimationContext {
#[cfg(feature = "block2")]
#[method(runAnimationGroup:completionHandler:)]
pub unsafe fn runAnimationGroup_completionHandler(
changes: &block2::Block<dyn Fn(NonNull<NSAnimationContext>) + '_>,
completion_handler: Option<&block2::Block<dyn Fn()>>,
);
#[cfg(feature = "block2")]
#[method(runAnimationGroup:)]
pub unsafe fn runAnimationGroup(
changes: &block2::Block<dyn Fn(NonNull<NSAnimationContext>) + '_>,
);
#[method(beginGrouping)]
pub unsafe fn beginGrouping();
#[method(endGrouping)]
pub unsafe fn endGrouping();
#[method_id(@__retain_semantics Other currentContext)]
pub unsafe fn currentContext() -> Retained<NSAnimationContext>;
#[method(duration)]
pub unsafe fn duration(&self) -> NSTimeInterval;
#[method(setDuration:)]
pub unsafe fn setDuration(&self, duration: NSTimeInterval);
#[cfg(feature = "block2")]
#[method(completionHandler)]
pub unsafe fn completionHandler(&self) -> *mut block2::Block<dyn Fn()>;
#[cfg(feature = "block2")]
#[method(setCompletionHandler:)]
pub unsafe fn setCompletionHandler(
&self,
completion_handler: Option<&block2::Block<dyn Fn()>>,
);
#[method(allowsImplicitAnimation)]
pub unsafe fn allowsImplicitAnimation(&self) -> bool;
#[method(setAllowsImplicitAnimation:)]
pub unsafe fn setAllowsImplicitAnimation(&self, allows_implicit_animation: bool);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAnimationContext {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,137 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSAppearanceName = NSString;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSAppearance;
unsafe impl ClassType for NSAppearance {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSAppearance {}
unsafe impl NSObjectProtocol for NSAppearance {}
unsafe impl NSSecureCoding for NSAppearance {}
extern_methods!(
unsafe impl NSAppearance {
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Retained<NSAppearanceName>;
#[deprecated = "Use -performAsCurrentDrawingAppearance: to temporarily set the drawing appearance, or +currentDrawingAppearance to access the currently drawing appearance."]
#[method_id(@__retain_semantics Other currentAppearance)]
pub unsafe fn currentAppearance() -> Option<Retained<NSAppearance>>;
#[deprecated = "Use -performAsCurrentDrawingAppearance: to temporarily set the drawing appearance, or +currentDrawingAppearance to access the currently drawing appearance."]
#[method(setCurrentAppearance:)]
pub unsafe fn setCurrentAppearance(current_appearance: Option<&NSAppearance>);
#[method_id(@__retain_semantics Other currentDrawingAppearance)]
pub unsafe fn currentDrawingAppearance() -> Retained<NSAppearance>;
#[cfg(feature = "block2")]
#[method(performAsCurrentDrawingAppearance:)]
pub unsafe fn performAsCurrentDrawingAppearance(
&self,
block: &block2::Block<dyn Fn() + '_>,
);
#[method_id(@__retain_semantics Other appearanceNamed:)]
pub fn appearanceNamed(name: &NSAppearanceName) -> Option<Retained<NSAppearance>>;
#[method_id(@__retain_semantics Init initWithAppearanceNamed:bundle:)]
pub unsafe fn initWithAppearanceNamed_bundle(
this: Allocated<Self>,
name: &NSAppearanceName,
bundle: Option<&NSBundle>,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method(allowsVibrancy)]
pub unsafe fn allowsVibrancy(&self) -> bool;
#[method_id(@__retain_semantics Other bestMatchFromAppearancesWithNames:)]
pub fn bestMatchFromAppearancesWithNames(
&self,
appearances: &NSArray<NSAppearanceName>,
) -> Option<Retained<NSAppearanceName>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSAppearance {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern "C" {
pub static NSAppearanceNameAqua: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameDarkAqua: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameLightContent: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameVibrantDark: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameVibrantLight: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameAccessibilityHighContrastAqua: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameAccessibilityHighContrastDarkAqua: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameAccessibilityHighContrastVibrantLight: &'static NSAppearanceName;
}
extern "C" {
pub static NSAppearanceNameAccessibilityHighContrastVibrantDark: &'static NSAppearanceName;
}
extern_protocol!(
pub unsafe trait NSAppearanceCustomization: NSObjectProtocol {
#[method_id(@__retain_semantics Other appearance)]
unsafe fn appearance(&self) -> Option<Retained<NSAppearance>>;
#[method(setAppearance:)]
unsafe fn setAppearance(&self, appearance: Option<&NSAppearance>);
#[method_id(@__retain_semantics Other effectiveAppearance)]
unsafe fn effectiveAppearance(&self) -> Retained<NSAppearance>;
}
unsafe impl ProtocolType for dyn NSAppearanceCustomization {}
);

View File

@@ -0,0 +1,17 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_category!(
/// Category "NSExtensions" on [`NSAppleScript`].
#[doc(alias = "NSExtensions")]
pub unsafe trait NSAppleScriptNSExtensions {
#[method_id(@__retain_semantics Other richTextSource)]
unsafe fn richTextSource(&self) -> Option<Retained<NSAttributedString>>;
}
unsafe impl NSAppleScriptNSExtensions for NSAppleScript {}
);

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,20 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_methods!(
/// NSScripting
#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
unsafe impl NSApplication {
#[cfg(feature = "NSDocument")]
#[method_id(@__retain_semantics Other orderedDocuments)]
pub unsafe fn orderedDocuments(&self) -> Retained<NSArray<NSDocument>>;
#[cfg(feature = "NSWindow")]
#[method_id(@__retain_semantics Other orderedWindows)]
pub unsafe fn orderedWindows(&self) -> Retained<NSArray<NSWindow>>;
}
);

View File

@@ -0,0 +1,238 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
pub struct NSArrayController;
#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
unsafe impl ClassType for NSArrayController {
#[inherits(NSController, NSObject)]
type Super = NSObjectController;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
unsafe impl NSCoding for NSArrayController {}
#[cfg(all(
feature = "NSController",
feature = "NSKeyValueBinding",
feature = "NSObjectController"
))]
unsafe impl NSEditor for NSArrayController {}
#[cfg(all(
feature = "NSController",
feature = "NSKeyValueBinding",
feature = "NSObjectController"
))]
unsafe impl NSEditorRegistration for NSArrayController {}
#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
unsafe impl NSObjectProtocol for NSArrayController {}
extern_methods!(
#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
unsafe impl NSArrayController {
#[method(rearrangeObjects)]
pub unsafe fn rearrangeObjects(&self);
#[method(automaticallyRearrangesObjects)]
pub unsafe fn automaticallyRearrangesObjects(&self) -> bool;
#[method(setAutomaticallyRearrangesObjects:)]
pub unsafe fn setAutomaticallyRearrangesObjects(
&self,
automatically_rearranges_objects: bool,
);
#[method_id(@__retain_semantics Other automaticRearrangementKeyPaths)]
pub unsafe fn automaticRearrangementKeyPaths(&self) -> Option<Retained<NSArray<NSString>>>;
#[method(didChangeArrangementCriteria)]
pub unsafe fn didChangeArrangementCriteria(&self);
#[method_id(@__retain_semantics Other sortDescriptors)]
pub unsafe fn sortDescriptors(&self) -> Retained<NSArray<NSSortDescriptor>>;
#[method(setSortDescriptors:)]
pub unsafe fn setSortDescriptors(&self, sort_descriptors: &NSArray<NSSortDescriptor>);
#[method_id(@__retain_semantics Other filterPredicate)]
pub unsafe fn filterPredicate(&self) -> Option<Retained<NSPredicate>>;
#[method(setFilterPredicate:)]
pub unsafe fn setFilterPredicate(&self, filter_predicate: Option<&NSPredicate>);
#[method(clearsFilterPredicateOnInsertion)]
pub unsafe fn clearsFilterPredicateOnInsertion(&self) -> bool;
#[method(setClearsFilterPredicateOnInsertion:)]
pub unsafe fn setClearsFilterPredicateOnInsertion(
&self,
clears_filter_predicate_on_insertion: bool,
);
#[method_id(@__retain_semantics Other arrangeObjects:)]
pub unsafe fn arrangeObjects(&self, objects: &NSArray) -> Retained<NSArray>;
#[method_id(@__retain_semantics Other arrangedObjects)]
pub unsafe fn arrangedObjects(&self) -> Retained<AnyObject>;
#[method(avoidsEmptySelection)]
pub unsafe fn avoidsEmptySelection(&self) -> bool;
#[method(setAvoidsEmptySelection:)]
pub unsafe fn setAvoidsEmptySelection(&self, avoids_empty_selection: bool);
#[method(preservesSelection)]
pub unsafe fn preservesSelection(&self) -> bool;
#[method(setPreservesSelection:)]
pub unsafe fn setPreservesSelection(&self, preserves_selection: bool);
#[method(selectsInsertedObjects)]
pub unsafe fn selectsInsertedObjects(&self) -> bool;
#[method(setSelectsInsertedObjects:)]
pub unsafe fn setSelectsInsertedObjects(&self, selects_inserted_objects: bool);
#[method(alwaysUsesMultipleValuesMarker)]
pub unsafe fn alwaysUsesMultipleValuesMarker(&self) -> bool;
#[method(setAlwaysUsesMultipleValuesMarker:)]
pub unsafe fn setAlwaysUsesMultipleValuesMarker(
&self,
always_uses_multiple_values_marker: bool,
);
#[method(setSelectionIndexes:)]
pub unsafe fn setSelectionIndexes(&self, indexes: &NSIndexSet) -> bool;
#[method_id(@__retain_semantics Other selectionIndexes)]
pub unsafe fn selectionIndexes(&self) -> Retained<NSIndexSet>;
#[method(setSelectionIndex:)]
pub unsafe fn setSelectionIndex(&self, index: NSUInteger) -> bool;
#[method(selectionIndex)]
pub unsafe fn selectionIndex(&self) -> NSUInteger;
#[method(addSelectionIndexes:)]
pub unsafe fn addSelectionIndexes(&self, indexes: &NSIndexSet) -> bool;
#[method(removeSelectionIndexes:)]
pub unsafe fn removeSelectionIndexes(&self, indexes: &NSIndexSet) -> bool;
#[method(setSelectedObjects:)]
pub unsafe fn setSelectedObjects(&self, objects: &NSArray) -> bool;
#[method_id(@__retain_semantics Other selectedObjects)]
pub unsafe fn selectedObjects(&self) -> Retained<NSArray>;
#[method(addSelectedObjects:)]
pub unsafe fn addSelectedObjects(&self, objects: &NSArray) -> bool;
#[method(removeSelectedObjects:)]
pub unsafe fn removeSelectedObjects(&self, objects: &NSArray) -> bool;
#[method(add:)]
pub unsafe fn add(&self, sender: Option<&AnyObject>);
#[method(remove:)]
pub unsafe fn remove(&self, sender: Option<&AnyObject>);
#[method(insert:)]
pub unsafe fn insert(&self, sender: Option<&AnyObject>);
#[method(canInsert)]
pub unsafe fn canInsert(&self) -> bool;
#[method(selectNext:)]
pub unsafe fn selectNext(&self, sender: Option<&AnyObject>);
#[method(selectPrevious:)]
pub unsafe fn selectPrevious(&self, sender: Option<&AnyObject>);
#[method(canSelectNext)]
pub unsafe fn canSelectNext(&self) -> bool;
#[method(canSelectPrevious)]
pub unsafe fn canSelectPrevious(&self) -> bool;
#[method(addObject:)]
pub unsafe fn addObject(&self, object: &AnyObject);
#[method(addObjects:)]
pub unsafe fn addObjects(&self, objects: &NSArray);
#[method(insertObject:atArrangedObjectIndex:)]
pub unsafe fn insertObject_atArrangedObjectIndex(
&self,
object: &AnyObject,
index: NSUInteger,
);
#[method(insertObjects:atArrangedObjectIndexes:)]
pub unsafe fn insertObjects_atArrangedObjectIndexes(
&self,
objects: &NSArray,
indexes: &NSIndexSet,
);
#[method(removeObjectAtArrangedObjectIndex:)]
pub unsafe fn removeObjectAtArrangedObjectIndex(&self, index: NSUInteger);
#[method(removeObjectsAtArrangedObjectIndexes:)]
pub unsafe fn removeObjectsAtArrangedObjectIndexes(&self, indexes: &NSIndexSet);
#[method(removeObject:)]
pub unsafe fn removeObject(&self, object: &AnyObject);
#[method(removeObjects:)]
pub unsafe fn removeObjects(&self, objects: &NSArray);
}
);
extern_methods!(
/// Methods declared on superclass `NSObjectController`
#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
unsafe impl NSArrayController {
#[method_id(@__retain_semantics Init initWithContent:)]
pub unsafe fn initWithContent(
this: Allocated<Self>,
content: Option<&AnyObject>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSController`
#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
unsafe impl NSArrayController {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSController", feature = "NSObjectController"))]
unsafe impl NSArrayController {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,912 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
pub static NSFontAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSParagraphStyleAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSForegroundColorAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSBackgroundColorAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSLigatureAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSKernAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSTrackingAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSStrikethroughStyleAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSUnderlineStyleAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSStrokeColorAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSStrokeWidthAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSShadowAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSTextEffectAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSAttachmentAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSLinkAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSBaselineOffsetAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSUnderlineColorAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSStrikethroughColorAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSWritingDirectionAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSCursorAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSToolTipAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSMarkedClauseSegmentAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSTextAlternativesAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSSpellingStateAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSSuperscriptAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSGlyphInfoAttributeName: &'static NSAttributedStringKey;
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSUnderlineStyle(pub NSInteger);
bitflags::bitflags! {
impl NSUnderlineStyle: NSInteger {
#[doc(alias = "NSUnderlineStyleNone")]
const None = 0x00;
#[doc(alias = "NSUnderlineStyleSingle")]
const Single = 0x01;
#[doc(alias = "NSUnderlineStyleThick")]
const Thick = 0x02;
#[doc(alias = "NSUnderlineStyleDouble")]
const Double = 0x09;
#[doc(alias = "NSUnderlineStylePatternSolid")]
const PatternSolid = 0x0000;
#[doc(alias = "NSUnderlineStylePatternDot")]
const PatternDot = 0x0100;
#[doc(alias = "NSUnderlineStylePatternDash")]
const PatternDash = 0x0200;
#[doc(alias = "NSUnderlineStylePatternDashDot")]
const PatternDashDot = 0x0300;
#[doc(alias = "NSUnderlineStylePatternDashDotDot")]
const PatternDashDotDot = 0x0400;
#[doc(alias = "NSUnderlineStyleByWord")]
const ByWord = 0x8000;
}
}
unsafe impl Encode for NSUnderlineStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSUnderlineStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWritingDirectionFormatType(pub NSInteger);
impl NSWritingDirectionFormatType {
pub const NSWritingDirectionEmbedding: Self = Self(0 << 1);
pub const NSWritingDirectionOverride: Self = Self(1 << 1);
}
unsafe impl Encode for NSWritingDirectionFormatType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSWritingDirectionFormatType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_TYPED_ENUM
pub type NSTextEffectStyle = NSString;
extern "C" {
pub static NSTextEffectLetterpressStyle: &'static NSTextEffectStyle;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSpellingState(pub NSInteger);
impl NSSpellingState {
#[doc(alias = "NSSpellingStateSpellingFlag")]
pub const SpellingFlag: Self = Self(1 << 0);
#[doc(alias = "NSSpellingStateGrammarFlag")]
pub const GrammarFlag: Self = Self(1 << 1);
}
unsafe impl Encode for NSSpellingState {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSSpellingState {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_category!(
/// Category on [`NSMutableAttributedString`].
pub unsafe trait NSAttributedStringAttributeFixing {
#[method(fixAttributesInRange:)]
unsafe fn fixAttributesInRange(&self, range: NSRange);
#[method(fixFontAttributeInRange:)]
unsafe fn fixFontAttributeInRange(&self, range: NSRange);
#[method(fixParagraphStyleAttributeInRange:)]
unsafe fn fixParagraphStyleAttributeInRange(&self, range: NSRange);
#[method(fixAttachmentAttributeInRange:)]
unsafe fn fixAttachmentAttributeInRange(&self, range: NSRange);
}
unsafe impl NSAttributedStringAttributeFixing for NSMutableAttributedString {}
);
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSAttributedStringDocumentType = NSString;
extern "C" {
pub static NSPlainTextDocumentType: &'static NSAttributedStringDocumentType;
}
extern "C" {
pub static NSRTFTextDocumentType: &'static NSAttributedStringDocumentType;
}
extern "C" {
pub static NSRTFDTextDocumentType: &'static NSAttributedStringDocumentType;
}
extern "C" {
pub static NSHTMLTextDocumentType: &'static NSAttributedStringDocumentType;
}
extern "C" {
pub static NSMacSimpleTextDocumentType: &'static NSAttributedStringDocumentType;
}
extern "C" {
pub static NSDocFormatTextDocumentType: &'static NSAttributedStringDocumentType;
}
extern "C" {
pub static NSWordMLTextDocumentType: &'static NSAttributedStringDocumentType;
}
extern "C" {
pub static NSWebArchiveTextDocumentType: &'static NSAttributedStringDocumentType;
}
extern "C" {
pub static NSOfficeOpenXMLTextDocumentType: &'static NSAttributedStringDocumentType;
}
extern "C" {
pub static NSOpenDocumentTextDocumentType: &'static NSAttributedStringDocumentType;
}
// NS_TYPED_ENUM
pub type NSTextLayoutSectionKey = NSString;
extern "C" {
pub static NSTextLayoutSectionOrientation: &'static NSTextLayoutSectionKey;
}
extern "C" {
pub static NSTextLayoutSectionRange: &'static NSTextLayoutSectionKey;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTextScalingType(pub NSInteger);
impl NSTextScalingType {
pub const NSTextScalingStandard: Self = Self(0);
pub const NSTextScalingiOS: Self = Self(1);
}
unsafe impl Encode for NSTextScalingType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSTextScalingType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSAttributedStringDocumentAttributeKey = NSString;
extern "C" {
pub static NSDocumentTypeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSConvertedDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSCocoaVersionDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSFileTypeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSTitleDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSCompanyDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSCopyrightDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSSubjectDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSAuthorDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSKeywordsDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSCommentDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSEditorDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSCreationTimeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSModificationTimeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSManagerDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSCategoryDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSAppearanceDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSCharacterEncodingDocumentAttribute:
&'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSDefaultAttributesDocumentAttribute:
&'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSPaperSizeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSLeftMarginDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSRightMarginDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSTopMarginDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSBottomMarginDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSViewSizeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSViewZoomDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSViewModeDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSReadOnlyDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSBackgroundColorDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSHyphenationFactorDocumentAttribute:
&'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSDefaultTabIntervalDocumentAttribute:
&'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSTextLayoutSectionsAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSExcludedElementsDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSTextEncodingNameDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSPrefixSpacesDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSDefaultFontExcludedDocumentAttribute:
&'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSTextScalingDocumentAttribute: &'static NSAttributedStringDocumentAttributeKey;
}
extern "C" {
pub static NSSourceTextScalingDocumentAttribute:
&'static NSAttributedStringDocumentAttributeKey;
}
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSAttributedStringDocumentReadingOptionKey = NSString;
extern "C" {
pub static NSDocumentTypeDocumentOption: &'static NSAttributedStringDocumentReadingOptionKey;
}
extern "C" {
pub static NSDefaultAttributesDocumentOption:
&'static NSAttributedStringDocumentReadingOptionKey;
}
extern "C" {
pub static NSCharacterEncodingDocumentOption:
&'static NSAttributedStringDocumentReadingOptionKey;
}
extern "C" {
pub static NSTextEncodingNameDocumentOption:
&'static NSAttributedStringDocumentReadingOptionKey;
}
extern "C" {
pub static NSBaseURLDocumentOption: &'static NSAttributedStringDocumentReadingOptionKey;
}
extern "C" {
pub static NSTimeoutDocumentOption: &'static NSAttributedStringDocumentReadingOptionKey;
}
extern "C" {
pub static NSWebPreferencesDocumentOption: &'static NSAttributedStringDocumentReadingOptionKey;
}
extern "C" {
pub static NSWebResourceLoadDelegateDocumentOption:
&'static NSAttributedStringDocumentReadingOptionKey;
}
extern "C" {
pub static NSTextSizeMultiplierDocumentOption:
&'static NSAttributedStringDocumentReadingOptionKey;
}
extern "C" {
pub static NSFileTypeDocumentOption: &'static NSAttributedStringDocumentReadingOptionKey;
}
extern "C" {
pub static NSTargetTextScalingDocumentOption:
&'static NSAttributedStringDocumentReadingOptionKey;
}
extern "C" {
pub static NSSourceTextScalingDocumentOption:
&'static NSAttributedStringDocumentReadingOptionKey;
}
extern_category!(
/// Category on [`NSAttributedString`].
pub unsafe trait NSAttributedStringDocumentFormats {
#[method_id(@__retain_semantics Init initWithURL:options:documentAttributes:error:_)]
unsafe fn initWithURL_options_documentAttributes_error(
this: Allocated<Self>,
url: &NSURL,
options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
dict: Option<
&mut Option<
Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
>,
>,
) -> Result<Retained<Self>, Retained<NSError>>;
#[method_id(@__retain_semantics Init initWithData:options:documentAttributes:error:_)]
unsafe fn initWithData_options_documentAttributes_error(
this: Allocated<Self>,
data: &NSData,
options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
dict: Option<
&mut Option<
Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
>,
>,
) -> Result<Retained<Self>, Retained<NSError>>;
#[method_id(@__retain_semantics Other dataFromRange:documentAttributes:error:_)]
unsafe fn dataFromRange_documentAttributes_error(
&self,
range: NSRange,
dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
) -> Result<Retained<NSData>, Retained<NSError>>;
#[method_id(@__retain_semantics Other fileWrapperFromRange:documentAttributes:error:_)]
unsafe fn fileWrapperFromRange_documentAttributes_error(
&self,
range: NSRange,
dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
) -> Result<Retained<NSFileWrapper>, Retained<NSError>>;
#[method_id(@__retain_semantics Init initWithRTF:documentAttributes:)]
unsafe fn initWithRTF_documentAttributes(
this: Allocated<Self>,
data: &NSData,
dict: Option<
&mut Option<
Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
>,
>,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithRTFD:documentAttributes:)]
unsafe fn initWithRTFD_documentAttributes(
this: Allocated<Self>,
data: &NSData,
dict: Option<
&mut Option<
Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
>,
>,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithHTML:documentAttributes:)]
unsafe fn initWithHTML_documentAttributes(
this: Allocated<Self>,
data: &NSData,
dict: Option<
&mut Option<
Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
>,
>,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithHTML:baseURL:documentAttributes:)]
unsafe fn initWithHTML_baseURL_documentAttributes(
this: Allocated<Self>,
data: &NSData,
base: &NSURL,
dict: Option<
&mut Option<
Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
>,
>,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithDocFormat:documentAttributes:)]
unsafe fn initWithDocFormat_documentAttributes(
this: Allocated<Self>,
data: &NSData,
dict: Option<
&mut Option<
Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
>,
>,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithHTML:options:documentAttributes:)]
unsafe fn initWithHTML_options_documentAttributes(
this: Allocated<Self>,
data: &NSData,
options: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
dict: Option<
&mut Option<
Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
>,
>,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithRTFDFileWrapper:documentAttributes:)]
unsafe fn initWithRTFDFileWrapper_documentAttributes(
this: Allocated<Self>,
wrapper: &NSFileWrapper,
dict: Option<
&mut Option<
Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
>,
>,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Other RTFFromRange:documentAttributes:)]
unsafe fn RTFFromRange_documentAttributes(
&self,
range: NSRange,
dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
) -> Option<Retained<NSData>>;
#[method_id(@__retain_semantics Other RTFDFromRange:documentAttributes:)]
unsafe fn RTFDFromRange_documentAttributes(
&self,
range: NSRange,
dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
) -> Option<Retained<NSData>>;
#[method_id(@__retain_semantics Other RTFDFileWrapperFromRange:documentAttributes:)]
unsafe fn RTFDFileWrapperFromRange_documentAttributes(
&self,
range: NSRange,
dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
) -> Option<Retained<NSFileWrapper>>;
#[method_id(@__retain_semantics Other docFormatFromRange:documentAttributes:)]
unsafe fn docFormatFromRange_documentAttributes(
&self,
range: NSRange,
dict: &NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>,
) -> Option<Retained<NSData>>;
}
unsafe impl NSAttributedStringDocumentFormats for NSAttributedString {}
);
extern_category!(
/// Category on [`NSMutableAttributedString`].
pub unsafe trait NSMutableAttributedStringDocumentFormats {
#[method(readFromURL:options:documentAttributes:error:_)]
unsafe fn readFromURL_options_documentAttributes_error(
&self,
url: &NSURL,
opts: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
dict: Option<
&mut Option<
Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
>,
>,
) -> Result<(), Retained<NSError>>;
#[method(readFromData:options:documentAttributes:error:_)]
unsafe fn readFromData_options_documentAttributes_error(
&self,
data: &NSData,
opts: &NSDictionary<NSAttributedStringDocumentReadingOptionKey, AnyObject>,
dict: Option<
&mut Option<
Retained<NSDictionary<NSAttributedStringDocumentAttributeKey, AnyObject>>,
>,
>,
) -> Result<(), Retained<NSError>>;
}
unsafe impl NSMutableAttributedStringDocumentFormats for NSMutableAttributedString {}
);
extern_category!(
/// Category on [`NSAttributedString`].
pub unsafe trait NSAttributedStringKitAdditions {
#[method_id(@__retain_semantics Other fontAttributesInRange:)]
unsafe fn fontAttributesInRange(
&self,
range: NSRange,
) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
#[method_id(@__retain_semantics Other rulerAttributesInRange:)]
unsafe fn rulerAttributesInRange(
&self,
range: NSRange,
) -> Retained<NSDictionary<NSAttributedStringKey, AnyObject>>;
#[method(containsAttachmentsInRange:)]
unsafe fn containsAttachmentsInRange(&self, range: NSRange) -> bool;
#[method(lineBreakBeforeIndex:withinRange:)]
unsafe fn lineBreakBeforeIndex_withinRange(
&self,
location: NSUInteger,
a_range: NSRange,
) -> NSUInteger;
#[method(lineBreakByHyphenatingBeforeIndex:withinRange:)]
unsafe fn lineBreakByHyphenatingBeforeIndex_withinRange(
&self,
location: NSUInteger,
a_range: NSRange,
) -> NSUInteger;
#[method(doubleClickAtIndex:)]
unsafe fn doubleClickAtIndex(&self, location: NSUInteger) -> NSRange;
#[method(nextWordFromIndex:forward:)]
unsafe fn nextWordFromIndex_forward(
&self,
location: NSUInteger,
is_forward: bool,
) -> NSUInteger;
#[cfg(feature = "NSTextTable")]
#[method(rangeOfTextBlock:atIndex:)]
unsafe fn rangeOfTextBlock_atIndex(
&self,
block: &NSTextBlock,
location: NSUInteger,
) -> NSRange;
#[cfg(feature = "NSTextTable")]
#[method(rangeOfTextTable:atIndex:)]
unsafe fn rangeOfTextTable_atIndex(
&self,
table: &NSTextTable,
location: NSUInteger,
) -> NSRange;
#[cfg(feature = "NSTextList")]
#[method(rangeOfTextList:atIndex:)]
unsafe fn rangeOfTextList_atIndex(
&self,
list: &NSTextList,
location: NSUInteger,
) -> NSRange;
#[cfg(feature = "NSTextList")]
#[method(itemNumberInTextList:atIndex:)]
unsafe fn itemNumberInTextList_atIndex(
&self,
list: &NSTextList,
location: NSUInteger,
) -> NSInteger;
}
unsafe impl NSAttributedStringKitAdditions for NSAttributedString {}
);
extern_category!(
/// Category on [`NSAttributedString`].
pub unsafe trait NSAttributedStringPasteboardAdditions {
#[method_id(@__retain_semantics Other textTypes)]
unsafe fn textTypes() -> Retained<NSArray<NSString>>;
#[method_id(@__retain_semantics Other textUnfilteredTypes)]
unsafe fn textUnfilteredTypes() -> Retained<NSArray<NSString>>;
}
unsafe impl NSAttributedStringPasteboardAdditions for NSAttributedString {}
);
#[cfg(feature = "NSPasteboard")]
unsafe impl NSPasteboardReading for NSAttributedString {}
#[cfg(feature = "NSPasteboard")]
unsafe impl NSPasteboardWriting for NSAttributedString {}
extern_category!(
/// Category on [`NSMutableAttributedString`].
pub unsafe trait NSMutableAttributedStringKitAdditions {
#[method(superscriptRange:)]
unsafe fn superscriptRange(&self, range: NSRange);
#[method(subscriptRange:)]
unsafe fn subscriptRange(&self, range: NSRange);
#[method(unscriptRange:)]
unsafe fn unscriptRange(&self, range: NSRange);
#[cfg(feature = "NSFontManager")]
#[method(applyFontTraits:range:)]
unsafe fn applyFontTraits_range(&self, trait_mask: NSFontTraitMask, range: NSRange);
#[cfg(feature = "NSText")]
#[method(setAlignment:range:)]
unsafe fn setAlignment_range(&self, alignment: NSTextAlignment, range: NSRange);
#[cfg(feature = "NSText")]
#[method(setBaseWritingDirection:range:)]
unsafe fn setBaseWritingDirection_range(
&self,
writing_direction: NSWritingDirection,
range: NSRange,
);
}
unsafe impl NSMutableAttributedStringKitAdditions for NSMutableAttributedString {}
);
pub static NSUnderlinePatternSolid: NSUnderlineStyle =
NSUnderlineStyle(NSUnderlineStyle::PatternSolid.0);
pub static NSUnderlinePatternDot: NSUnderlineStyle =
NSUnderlineStyle(NSUnderlineStyle::PatternDot.0);
pub static NSUnderlinePatternDash: NSUnderlineStyle =
NSUnderlineStyle(NSUnderlineStyle::PatternDash.0);
pub static NSUnderlinePatternDashDot: NSUnderlineStyle =
NSUnderlineStyle(NSUnderlineStyle::PatternDashDot.0);
pub static NSUnderlinePatternDashDotDot: NSUnderlineStyle =
NSUnderlineStyle(NSUnderlineStyle::PatternDashDotDot.0);
pub static NSUnderlineByWord: NSUnderlineStyle = NSUnderlineStyle(NSUnderlineStyle::ByWord.0);
extern "C" {
pub static NSCharacterShapeAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSUsesScreenFontsDocumentAttribute: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSObliquenessAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSExpansionAttributeName: &'static NSAttributedStringKey;
}
extern "C" {
pub static NSVerticalGlyphFormAttributeName: &'static NSAttributedStringKey;
}
#[deprecated = "Use NSUnderlineStyleNone instead"]
pub const NSNoUnderlineStyle: c_uint = 0;
#[deprecated = "Use NSUnderlineStyleSingle instead"]
pub const NSSingleUnderlineStyle: c_uint = 1;
extern "C" {
pub static NSUnderlineStrikethroughMask: NSUInteger;
}
extern "C" {
pub static NSUnderlineByWordMask: NSUInteger;
}
extern_category!(
/// Category "NSDeprecatedKitAdditions" on [`NSAttributedString`].
#[doc(alias = "NSDeprecatedKitAdditions")]
pub unsafe trait NSAttributedStringNSDeprecatedKitAdditions {
#[method(containsAttachments)]
unsafe fn containsAttachments(&self) -> bool;
#[deprecated]
#[method_id(@__retain_semantics Other textFileTypes)]
unsafe fn textFileTypes() -> Retained<NSArray>;
#[deprecated]
#[method_id(@__retain_semantics Other textPasteboardTypes)]
unsafe fn textPasteboardTypes() -> Retained<NSArray>;
#[deprecated]
#[method_id(@__retain_semantics Other textUnfilteredFileTypes)]
unsafe fn textUnfilteredFileTypes() -> Retained<NSArray>;
#[deprecated]
#[method_id(@__retain_semantics Other textUnfilteredPasteboardTypes)]
unsafe fn textUnfilteredPasteboardTypes() -> Retained<NSArray>;
#[deprecated = "Use -initWithURL:options:documentAttributes:error: instead"]
#[method_id(@__retain_semantics Init initWithURL:documentAttributes:)]
unsafe fn initWithURL_documentAttributes(
this: Allocated<Self>,
url: &NSURL,
dict: Option<&mut Option<Retained<NSDictionary>>>,
) -> Option<Retained<Self>>;
#[deprecated = "Use -initWithURL:options:documentAttributes:error: instead"]
#[method_id(@__retain_semantics Init initWithPath:documentAttributes:)]
unsafe fn initWithPath_documentAttributes(
this: Allocated<Self>,
path: &NSString,
dict: Option<&mut Option<Retained<NSDictionary>>>,
) -> Option<Retained<Self>>;
#[deprecated = "Use NSDataDetector instead"]
#[method_id(@__retain_semantics Other URLAtIndex:effectiveRange:)]
unsafe fn URLAtIndex_effectiveRange(
&self,
location: NSUInteger,
effective_range: NSRangePointer,
) -> Option<Retained<NSURL>>;
}
unsafe impl NSAttributedStringNSDeprecatedKitAdditions for NSAttributedString {}
);

View File

@@ -0,0 +1,454 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLineCapStyle(pub NSUInteger);
impl NSLineCapStyle {
#[doc(alias = "NSLineCapStyleButt")]
pub const Butt: Self = Self(0);
#[doc(alias = "NSLineCapStyleRound")]
pub const Round: Self = Self(1);
#[doc(alias = "NSLineCapStyleSquare")]
pub const Square: Self = Self(2);
}
unsafe impl Encode for NSLineCapStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSLineCapStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSLineJoinStyle(pub NSUInteger);
impl NSLineJoinStyle {
#[doc(alias = "NSLineJoinStyleMiter")]
pub const Miter: Self = Self(0);
#[doc(alias = "NSLineJoinStyleRound")]
pub const Round: Self = Self(1);
#[doc(alias = "NSLineJoinStyleBevel")]
pub const Bevel: Self = Self(2);
}
unsafe impl Encode for NSLineJoinStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSLineJoinStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWindingRule(pub NSUInteger);
impl NSWindingRule {
#[doc(alias = "NSWindingRuleNonZero")]
pub const NonZero: Self = Self(0);
#[doc(alias = "NSWindingRuleEvenOdd")]
pub const EvenOdd: Self = Self(1);
}
unsafe impl Encode for NSWindingRule {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSWindingRule {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBezierPathElement(pub NSUInteger);
impl NSBezierPathElement {
#[doc(alias = "NSBezierPathElementMoveTo")]
pub const MoveTo: Self = Self(0);
#[doc(alias = "NSBezierPathElementLineTo")]
pub const LineTo: Self = Self(1);
#[doc(alias = "NSBezierPathElementCubicCurveTo")]
pub const CubicCurveTo: Self = Self(2);
#[doc(alias = "NSBezierPathElementClosePath")]
pub const ClosePath: Self = Self(3);
#[doc(alias = "NSBezierPathElementQuadraticCurveTo")]
pub const QuadraticCurveTo: Self = Self(4);
#[deprecated]
#[doc(alias = "NSBezierPathElementCurveTo")]
pub const CurveTo: Self = Self(NSBezierPathElement::CubicCurveTo.0);
}
unsafe impl Encode for NSBezierPathElement {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBezierPathElement {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSBezierPath;
unsafe impl ClassType for NSBezierPath {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSBezierPath {}
unsafe impl NSCopying for NSBezierPath {}
unsafe impl NSObjectProtocol for NSBezierPath {}
unsafe impl NSSecureCoding for NSBezierPath {}
extern_methods!(
unsafe impl NSBezierPath {
#[method_id(@__retain_semantics Other bezierPath)]
pub unsafe fn bezierPath() -> Retained<NSBezierPath>;
#[method_id(@__retain_semantics Other bezierPathWithRect:)]
pub unsafe fn bezierPathWithRect(rect: NSRect) -> Retained<NSBezierPath>;
#[method_id(@__retain_semantics Other bezierPathWithOvalInRect:)]
pub unsafe fn bezierPathWithOvalInRect(rect: NSRect) -> Retained<NSBezierPath>;
#[method_id(@__retain_semantics Other bezierPathWithRoundedRect:xRadius:yRadius:)]
pub unsafe fn bezierPathWithRoundedRect_xRadius_yRadius(
rect: NSRect,
x_radius: CGFloat,
y_radius: CGFloat,
) -> Retained<NSBezierPath>;
#[method(fillRect:)]
pub unsafe fn fillRect(rect: NSRect);
#[method(strokeRect:)]
pub unsafe fn strokeRect(rect: NSRect);
#[method(clipRect:)]
pub unsafe fn clipRect(rect: NSRect);
#[method(strokeLineFromPoint:toPoint:)]
pub unsafe fn strokeLineFromPoint_toPoint(point1: NSPoint, point2: NSPoint);
#[method(drawPackedGlyphs:atPoint:)]
pub unsafe fn drawPackedGlyphs_atPoint(packed_glyphs: NonNull<c_char>, point: NSPoint);
#[method(defaultMiterLimit)]
pub unsafe fn defaultMiterLimit() -> CGFloat;
#[method(setDefaultMiterLimit:)]
pub unsafe fn setDefaultMiterLimit(default_miter_limit: CGFloat);
#[method(defaultFlatness)]
pub unsafe fn defaultFlatness() -> CGFloat;
#[method(setDefaultFlatness:)]
pub unsafe fn setDefaultFlatness(default_flatness: CGFloat);
#[method(defaultWindingRule)]
pub unsafe fn defaultWindingRule() -> NSWindingRule;
#[method(setDefaultWindingRule:)]
pub unsafe fn setDefaultWindingRule(default_winding_rule: NSWindingRule);
#[method(defaultLineCapStyle)]
pub unsafe fn defaultLineCapStyle() -> NSLineCapStyle;
#[method(setDefaultLineCapStyle:)]
pub unsafe fn setDefaultLineCapStyle(default_line_cap_style: NSLineCapStyle);
#[method(defaultLineJoinStyle)]
pub unsafe fn defaultLineJoinStyle() -> NSLineJoinStyle;
#[method(setDefaultLineJoinStyle:)]
pub unsafe fn setDefaultLineJoinStyle(default_line_join_style: NSLineJoinStyle);
#[method(defaultLineWidth)]
pub unsafe fn defaultLineWidth() -> CGFloat;
#[method(setDefaultLineWidth:)]
pub unsafe fn setDefaultLineWidth(default_line_width: CGFloat);
#[method(moveToPoint:)]
pub unsafe fn moveToPoint(&self, point: NSPoint);
#[method(lineToPoint:)]
pub unsafe fn lineToPoint(&self, point: NSPoint);
#[method(curveToPoint:controlPoint1:controlPoint2:)]
pub unsafe fn curveToPoint_controlPoint1_controlPoint2(
&self,
end_point: NSPoint,
control_point1: NSPoint,
control_point2: NSPoint,
);
#[method(curveToPoint:controlPoint:)]
pub unsafe fn curveToPoint_controlPoint(&self, end_point: NSPoint, control_point: NSPoint);
#[method(closePath)]
pub unsafe fn closePath(&self);
#[method(removeAllPoints)]
pub unsafe fn removeAllPoints(&self);
#[method(relativeMoveToPoint:)]
pub unsafe fn relativeMoveToPoint(&self, point: NSPoint);
#[method(relativeLineToPoint:)]
pub unsafe fn relativeLineToPoint(&self, point: NSPoint);
#[method(relativeCurveToPoint:controlPoint1:controlPoint2:)]
pub unsafe fn relativeCurveToPoint_controlPoint1_controlPoint2(
&self,
end_point: NSPoint,
control_point1: NSPoint,
control_point2: NSPoint,
);
#[method(relativeCurveToPoint:controlPoint:)]
pub unsafe fn relativeCurveToPoint_controlPoint(
&self,
end_point: NSPoint,
control_point: NSPoint,
);
#[method(lineWidth)]
pub unsafe fn lineWidth(&self) -> CGFloat;
#[method(setLineWidth:)]
pub unsafe fn setLineWidth(&self, line_width: CGFloat);
#[method(lineCapStyle)]
pub unsafe fn lineCapStyle(&self) -> NSLineCapStyle;
#[method(setLineCapStyle:)]
pub unsafe fn setLineCapStyle(&self, line_cap_style: NSLineCapStyle);
#[method(lineJoinStyle)]
pub unsafe fn lineJoinStyle(&self) -> NSLineJoinStyle;
#[method(setLineJoinStyle:)]
pub unsafe fn setLineJoinStyle(&self, line_join_style: NSLineJoinStyle);
#[method(windingRule)]
pub unsafe fn windingRule(&self) -> NSWindingRule;
#[method(setWindingRule:)]
pub unsafe fn setWindingRule(&self, winding_rule: NSWindingRule);
#[method(miterLimit)]
pub unsafe fn miterLimit(&self) -> CGFloat;
#[method(setMiterLimit:)]
pub unsafe fn setMiterLimit(&self, miter_limit: CGFloat);
#[method(flatness)]
pub unsafe fn flatness(&self) -> CGFloat;
#[method(setFlatness:)]
pub unsafe fn setFlatness(&self, flatness: CGFloat);
#[method(getLineDash:count:phase:)]
pub unsafe fn getLineDash_count_phase(
&self,
pattern: *mut CGFloat,
count: *mut NSInteger,
phase: *mut CGFloat,
);
#[method(setLineDash:count:phase:)]
pub unsafe fn setLineDash_count_phase(
&self,
pattern: *mut CGFloat,
count: NSInteger,
phase: CGFloat,
);
#[method(stroke)]
pub unsafe fn stroke(&self);
#[method(fill)]
pub unsafe fn fill(&self);
#[method(addClip)]
pub unsafe fn addClip(&self);
#[method(setClip)]
pub unsafe fn setClip(&self);
#[method_id(@__retain_semantics Other bezierPathByFlatteningPath)]
pub unsafe fn bezierPathByFlatteningPath(&self) -> Retained<NSBezierPath>;
#[method_id(@__retain_semantics Other bezierPathByReversingPath)]
pub unsafe fn bezierPathByReversingPath(&self) -> Retained<NSBezierPath>;
#[method(transformUsingAffineTransform:)]
pub unsafe fn transformUsingAffineTransform(&self, transform: &NSAffineTransform);
#[method(isEmpty)]
pub unsafe fn isEmpty(&self) -> bool;
#[method(currentPoint)]
pub unsafe fn currentPoint(&self) -> NSPoint;
#[method(controlPointBounds)]
pub unsafe fn controlPointBounds(&self) -> NSRect;
#[method(bounds)]
pub unsafe fn bounds(&self) -> NSRect;
#[method(elementCount)]
pub unsafe fn elementCount(&self) -> NSInteger;
#[method(elementAtIndex:associatedPoints:)]
pub unsafe fn elementAtIndex_associatedPoints(
&self,
index: NSInteger,
points: NSPointArray,
) -> NSBezierPathElement;
#[method(elementAtIndex:)]
pub unsafe fn elementAtIndex(&self, index: NSInteger) -> NSBezierPathElement;
#[method(setAssociatedPoints:atIndex:)]
pub unsafe fn setAssociatedPoints_atIndex(&self, points: NSPointArray, index: NSInteger);
#[method(appendBezierPath:)]
pub unsafe fn appendBezierPath(&self, path: &NSBezierPath);
#[method(appendBezierPathWithRect:)]
pub unsafe fn appendBezierPathWithRect(&self, rect: NSRect);
#[method(appendBezierPathWithPoints:count:)]
pub unsafe fn appendBezierPathWithPoints_count(
&self,
points: NSPointArray,
count: NSInteger,
);
#[method(appendBezierPathWithOvalInRect:)]
pub unsafe fn appendBezierPathWithOvalInRect(&self, rect: NSRect);
#[method(appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:clockwise:)]
pub unsafe fn appendBezierPathWithArcWithCenter_radius_startAngle_endAngle_clockwise(
&self,
center: NSPoint,
radius: CGFloat,
start_angle: CGFloat,
end_angle: CGFloat,
clockwise: bool,
);
#[method(appendBezierPathWithArcWithCenter:radius:startAngle:endAngle:)]
pub unsafe fn appendBezierPathWithArcWithCenter_radius_startAngle_endAngle(
&self,
center: NSPoint,
radius: CGFloat,
start_angle: CGFloat,
end_angle: CGFloat,
);
#[method(appendBezierPathWithArcFromPoint:toPoint:radius:)]
pub unsafe fn appendBezierPathWithArcFromPoint_toPoint_radius(
&self,
point1: NSPoint,
point2: NSPoint,
radius: CGFloat,
);
#[method(appendBezierPathWithRoundedRect:xRadius:yRadius:)]
pub unsafe fn appendBezierPathWithRoundedRect_xRadius_yRadius(
&self,
rect: NSRect,
x_radius: CGFloat,
y_radius: CGFloat,
);
#[method(containsPoint:)]
pub unsafe fn containsPoint(&self, point: NSPoint) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSBezierPath {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
/// NSBezierPathDeprecated
unsafe impl NSBezierPath {
#[deprecated]
#[method(cachesBezierPath)]
pub unsafe fn cachesBezierPath(&self) -> bool;
#[deprecated]
#[method(setCachesBezierPath:)]
pub unsafe fn setCachesBezierPath(&self, flag: bool);
#[cfg(feature = "NSFont")]
#[deprecated = "Use -appendBezierPathWithCGGlyph:inFont: instead"]
#[method(appendBezierPathWithGlyph:inFont:)]
pub unsafe fn appendBezierPathWithGlyph_inFont(&self, glyph: NSGlyph, font: &NSFont);
#[cfg(feature = "NSFont")]
#[deprecated = "Use -appendBezierPathWithCGGlyphs:count:inFont: instead"]
#[method(appendBezierPathWithGlyphs:count:inFont:)]
pub unsafe fn appendBezierPathWithGlyphs_count_inFont(
&self,
glyphs: NonNull<NSGlyph>,
count: NSInteger,
font: &NSFont,
);
#[deprecated = "Use -appendBezierPathWithCGGlyphs:count:inFont: instead"]
#[method(appendBezierPathWithPackedGlyphs:)]
pub unsafe fn appendBezierPathWithPackedGlyphs(&self, packed_glyphs: NonNull<c_char>);
}
);
pub static NSButtLineCapStyle: NSLineCapStyle = NSLineCapStyle(NSLineCapStyle::Butt.0);
pub static NSRoundLineCapStyle: NSLineCapStyle = NSLineCapStyle(NSLineCapStyle::Round.0);
pub static NSSquareLineCapStyle: NSLineCapStyle = NSLineCapStyle(NSLineCapStyle::Square.0);
pub static NSMiterLineJoinStyle: NSLineJoinStyle = NSLineJoinStyle(NSLineJoinStyle::Miter.0);
pub static NSRoundLineJoinStyle: NSLineJoinStyle = NSLineJoinStyle(NSLineJoinStyle::Round.0);
pub static NSBevelLineJoinStyle: NSLineJoinStyle = NSLineJoinStyle(NSLineJoinStyle::Bevel.0);
pub static NSNonZeroWindingRule: NSWindingRule = NSWindingRule(NSWindingRule::NonZero.0);
pub static NSEvenOddWindingRule: NSWindingRule = NSWindingRule(NSWindingRule::EvenOdd.0);
pub static NSMoveToBezierPathElement: NSBezierPathElement =
NSBezierPathElement(NSBezierPathElement::MoveTo.0);
pub static NSLineToBezierPathElement: NSBezierPathElement =
NSBezierPathElement(NSBezierPathElement::LineTo.0);
pub static NSCurveToBezierPathElement: NSBezierPathElement =
NSBezierPathElement(NSBezierPathElement::CurveTo.0);
pub static NSClosePathBezierPathElement: NSBezierPathElement =
NSBezierPathElement(NSBezierPathElement::ClosePath.0);

View File

@@ -0,0 +1,493 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
use objc2_core_image::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTIFFCompression(pub NSUInteger);
impl NSTIFFCompression {
#[doc(alias = "NSTIFFCompressionNone")]
pub const None: Self = Self(1);
#[doc(alias = "NSTIFFCompressionCCITTFAX3")]
pub const CCITTFAX3: Self = Self(3);
#[doc(alias = "NSTIFFCompressionCCITTFAX4")]
pub const CCITTFAX4: Self = Self(4);
#[doc(alias = "NSTIFFCompressionLZW")]
pub const LZW: Self = Self(5);
#[doc(alias = "NSTIFFCompressionJPEG")]
pub const JPEG: Self = Self(6);
#[doc(alias = "NSTIFFCompressionNEXT")]
pub const NEXT: Self = Self(32766);
#[doc(alias = "NSTIFFCompressionPackBits")]
pub const PackBits: Self = Self(32773);
#[doc(alias = "NSTIFFCompressionOldJPEG")]
pub const OldJPEG: Self = Self(32865);
}
unsafe impl Encode for NSTIFFCompression {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSTIFFCompression {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBitmapImageFileType(pub NSUInteger);
impl NSBitmapImageFileType {
#[doc(alias = "NSBitmapImageFileTypeTIFF")]
pub const TIFF: Self = Self(0);
#[doc(alias = "NSBitmapImageFileTypeBMP")]
pub const BMP: Self = Self(1);
#[doc(alias = "NSBitmapImageFileTypeGIF")]
pub const GIF: Self = Self(2);
#[doc(alias = "NSBitmapImageFileTypeJPEG")]
pub const JPEG: Self = Self(3);
#[doc(alias = "NSBitmapImageFileTypePNG")]
pub const PNG: Self = Self(4);
#[doc(alias = "NSBitmapImageFileTypeJPEG2000")]
pub const JPEG2000: Self = Self(5);
}
unsafe impl Encode for NSBitmapImageFileType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBitmapImageFileType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSImageRepLoadStatus(pub NSInteger);
impl NSImageRepLoadStatus {
#[doc(alias = "NSImageRepLoadStatusUnknownType")]
pub const UnknownType: Self = Self(-1);
#[doc(alias = "NSImageRepLoadStatusReadingHeader")]
pub const ReadingHeader: Self = Self(-2);
#[doc(alias = "NSImageRepLoadStatusWillNeedAllData")]
pub const WillNeedAllData: Self = Self(-3);
#[doc(alias = "NSImageRepLoadStatusInvalidData")]
pub const InvalidData: Self = Self(-4);
#[doc(alias = "NSImageRepLoadStatusUnexpectedEOF")]
pub const UnexpectedEOF: Self = Self(-5);
#[doc(alias = "NSImageRepLoadStatusCompleted")]
pub const Completed: Self = Self(-6);
}
unsafe impl Encode for NSImageRepLoadStatus {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSImageRepLoadStatus {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBitmapFormat(pub NSUInteger);
bitflags::bitflags! {
impl NSBitmapFormat: NSUInteger {
#[doc(alias = "NSBitmapFormatAlphaFirst")]
const AlphaFirst = 1<<0;
#[doc(alias = "NSBitmapFormatAlphaNonpremultiplied")]
const AlphaNonpremultiplied = 1<<1;
#[doc(alias = "NSBitmapFormatFloatingPointSamples")]
const FloatingPointSamples = 1<<2;
#[doc(alias = "NSBitmapFormatSixteenBitLittleEndian")]
const SixteenBitLittleEndian = 1<<8;
#[doc(alias = "NSBitmapFormatThirtyTwoBitLittleEndian")]
const ThirtyTwoBitLittleEndian = 1<<9;
#[doc(alias = "NSBitmapFormatSixteenBitBigEndian")]
const SixteenBitBigEndian = 1<<10;
#[doc(alias = "NSBitmapFormatThirtyTwoBitBigEndian")]
const ThirtyTwoBitBigEndian = 1<<11;
}
}
unsafe impl Encode for NSBitmapFormat {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBitmapFormat {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSBitmapImageRepPropertyKey = NSString;
extern "C" {
pub static NSImageCompressionMethod: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageCompressionFactor: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageDitherTransparency: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageRGBColorTable: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageInterlaced: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageColorSyncProfileData: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageFrameCount: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageCurrentFrame: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageCurrentFrameDuration: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageLoopCount: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageGamma: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageProgressive: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageEXIFData: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageIPTCData: &'static NSBitmapImageRepPropertyKey;
}
extern "C" {
pub static NSImageFallbackBackgroundColor: &'static NSBitmapImageRepPropertyKey;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSImageRep")]
pub struct NSBitmapImageRep;
#[cfg(feature = "NSImageRep")]
unsafe impl ClassType for NSBitmapImageRep {
#[inherits(NSObject)]
type Super = NSImageRep;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSImageRep")]
unsafe impl NSCoding for NSBitmapImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSCopying for NSBitmapImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSObjectProtocol for NSBitmapImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSSecureCoding for NSBitmapImageRep {}
extern_methods!(
#[cfg(feature = "NSImageRep")]
unsafe impl NSBitmapImageRep {
#[deprecated = "Use -[NSView cacheDisplayInRect:toBitmapImageRep:] to snapshot a view."]
#[method_id(@__retain_semantics Init initWithFocusedViewRect:)]
pub unsafe fn initWithFocusedViewRect(
this: Allocated<Self>,
rect: NSRect,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSGraphics")]
#[method_id(@__retain_semantics Init initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bytesPerRow:bitsPerPixel:)]
pub unsafe fn initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bytesPerRow_bitsPerPixel(
this: Allocated<Self>,
planes: *mut *mut c_uchar,
width: NSInteger,
height: NSInteger,
bps: NSInteger,
spp: NSInteger,
alpha: bool,
is_planar: bool,
color_space_name: &NSColorSpaceName,
r_bytes: NSInteger,
p_bits: NSInteger,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSGraphics")]
#[method_id(@__retain_semantics Init initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:)]
pub unsafe fn initWithBitmapDataPlanes_pixelsWide_pixelsHigh_bitsPerSample_samplesPerPixel_hasAlpha_isPlanar_colorSpaceName_bitmapFormat_bytesPerRow_bitsPerPixel(
this: Allocated<Self>,
planes: *mut *mut c_uchar,
width: NSInteger,
height: NSInteger,
bps: NSInteger,
spp: NSInteger,
alpha: bool,
is_planar: bool,
color_space_name: &NSColorSpaceName,
bitmap_format: NSBitmapFormat,
r_bytes: NSInteger,
p_bits: NSInteger,
) -> Option<Retained<Self>>;
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
#[method_id(@__retain_semantics Init initWithCIImage:)]
pub unsafe fn initWithCIImage(this: Allocated<Self>, ci_image: &CIImage) -> Retained<Self>;
#[method_id(@__retain_semantics Other imageRepsWithData:)]
pub unsafe fn imageRepsWithData(data: &NSData) -> Retained<NSArray<NSImageRep>>;
#[method_id(@__retain_semantics Other imageRepWithData:)]
pub unsafe fn imageRepWithData(data: &NSData) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithData:)]
pub unsafe fn initWithData(this: Allocated<Self>, data: &NSData) -> Option<Retained<Self>>;
#[method(bitmapData)]
pub unsafe fn bitmapData(&self) -> *mut c_uchar;
#[method(getBitmapDataPlanes:)]
pub unsafe fn getBitmapDataPlanes(&self, data: NonNull<*mut c_uchar>);
#[method(isPlanar)]
pub unsafe fn isPlanar(&self) -> bool;
#[method(samplesPerPixel)]
pub unsafe fn samplesPerPixel(&self) -> NSInteger;
#[method(bitsPerPixel)]
pub unsafe fn bitsPerPixel(&self) -> NSInteger;
#[method(bytesPerRow)]
pub unsafe fn bytesPerRow(&self) -> NSInteger;
#[method(bytesPerPlane)]
pub unsafe fn bytesPerPlane(&self) -> NSInteger;
#[method(numberOfPlanes)]
pub unsafe fn numberOfPlanes(&self) -> NSInteger;
#[method(bitmapFormat)]
pub unsafe fn bitmapFormat(&self) -> NSBitmapFormat;
#[method(getCompression:factor:)]
pub unsafe fn getCompression_factor(
&self,
compression: *mut NSTIFFCompression,
factor: *mut c_float,
);
#[method(setCompression:factor:)]
pub unsafe fn setCompression_factor(&self, compression: NSTIFFCompression, factor: c_float);
#[method_id(@__retain_semantics Other TIFFRepresentation)]
pub unsafe fn TIFFRepresentation(&self) -> Option<Retained<NSData>>;
#[method_id(@__retain_semantics Other TIFFRepresentationUsingCompression:factor:)]
pub unsafe fn TIFFRepresentationUsingCompression_factor(
&self,
comp: NSTIFFCompression,
factor: c_float,
) -> Option<Retained<NSData>>;
#[method_id(@__retain_semantics Other TIFFRepresentationOfImageRepsInArray:)]
pub unsafe fn TIFFRepresentationOfImageRepsInArray(
array: &NSArray<NSImageRep>,
) -> Option<Retained<NSData>>;
#[method_id(@__retain_semantics Other TIFFRepresentationOfImageRepsInArray:usingCompression:factor:)]
pub unsafe fn TIFFRepresentationOfImageRepsInArray_usingCompression_factor(
array: &NSArray<NSImageRep>,
comp: NSTIFFCompression,
factor: c_float,
) -> Option<Retained<NSData>>;
#[method(getTIFFCompressionTypes:count:)]
pub unsafe fn getTIFFCompressionTypes_count(
list: NonNull<*mut NSTIFFCompression>,
num_types: NonNull<NSInteger>,
);
#[method_id(@__retain_semantics Other localizedNameForTIFFCompressionType:)]
pub unsafe fn localizedNameForTIFFCompressionType(
compression: NSTIFFCompression,
) -> Option<Retained<NSString>>;
#[method(canBeCompressedUsing:)]
pub unsafe fn canBeCompressedUsing(&self, compression: NSTIFFCompression) -> bool;
#[cfg(feature = "NSColor")]
#[method(colorizeByMappingGray:toColor:blackMapping:whiteMapping:)]
pub unsafe fn colorizeByMappingGray_toColor_blackMapping_whiteMapping(
&self,
mid_point: CGFloat,
mid_point_color: Option<&NSColor>,
shadow_color: Option<&NSColor>,
light_color: Option<&NSColor>,
);
#[method_id(@__retain_semantics Init initForIncrementalLoad)]
pub unsafe fn initForIncrementalLoad(this: Allocated<Self>) -> Retained<Self>;
#[method(incrementalLoadFromData:complete:)]
pub unsafe fn incrementalLoadFromData_complete(
&self,
data: &NSData,
complete: bool,
) -> NSInteger;
#[cfg(feature = "NSColor")]
#[method(setColor:atX:y:)]
pub unsafe fn setColor_atX_y(&self, color: &NSColor, x: NSInteger, y: NSInteger);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other colorAtX:y:)]
pub unsafe fn colorAtX_y(&self, x: NSInteger, y: NSInteger) -> Option<Retained<NSColor>>;
#[method(getPixel:atX:y:)]
pub unsafe fn getPixel_atX_y(&self, p: NonNull<NSUInteger>, x: NSInteger, y: NSInteger);
#[method(setPixel:atX:y:)]
pub unsafe fn setPixel_atX_y(&self, p: NonNull<NSUInteger>, x: NSInteger, y: NSInteger);
#[cfg(feature = "NSColorSpace")]
#[method_id(@__retain_semantics Other colorSpace)]
pub unsafe fn colorSpace(&self) -> Retained<NSColorSpace>;
#[cfg(all(feature = "NSColorSpace", feature = "NSGraphics"))]
#[method_id(@__retain_semantics Other bitmapImageRepByConvertingToColorSpace:renderingIntent:)]
pub unsafe fn bitmapImageRepByConvertingToColorSpace_renderingIntent(
&self,
target_space: &NSColorSpace,
rendering_intent: NSColorRenderingIntent,
) -> Option<Retained<NSBitmapImageRep>>;
#[cfg(feature = "NSColorSpace")]
#[method_id(@__retain_semantics Other bitmapImageRepByRetaggingWithColorSpace:)]
pub unsafe fn bitmapImageRepByRetaggingWithColorSpace(
&self,
new_space: &NSColorSpace,
) -> Option<Retained<NSBitmapImageRep>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSImageRep`
#[cfg(feature = "NSImageRep")]
unsafe impl NSBitmapImageRep {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSImageRep")]
unsafe impl NSBitmapImageRep {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
/// NSBitmapImageFileTypeExtensions
#[cfg(feature = "NSImageRep")]
unsafe impl NSBitmapImageRep {
#[method_id(@__retain_semantics Other representationOfImageRepsInArray:usingType:properties:)]
pub unsafe fn representationOfImageRepsInArray_usingType_properties(
image_reps: &NSArray<NSImageRep>,
storage_type: NSBitmapImageFileType,
properties: &NSDictionary<NSBitmapImageRepPropertyKey, AnyObject>,
) -> Option<Retained<NSData>>;
#[method_id(@__retain_semantics Other representationUsingType:properties:)]
pub unsafe fn representationUsingType_properties(
&self,
storage_type: NSBitmapImageFileType,
properties: &NSDictionary<NSBitmapImageRepPropertyKey, AnyObject>,
) -> Option<Retained<NSData>>;
#[method(setProperty:withValue:)]
pub unsafe fn setProperty_withValue(
&self,
property: &NSBitmapImageRepPropertyKey,
value: Option<&AnyObject>,
);
#[method_id(@__retain_semantics Other valueForProperty:)]
pub unsafe fn valueForProperty(
&self,
property: &NSBitmapImageRepPropertyKey,
) -> Option<Retained<AnyObject>>;
}
);
pub static NSTIFFFileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::TIFF.0);
pub static NSBMPFileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::BMP.0);
pub static NSGIFFileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::GIF.0);
pub static NSJPEGFileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::JPEG.0);
pub static NSPNGFileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::PNG.0);
pub static NSJPEG2000FileType: NSBitmapImageFileType =
NSBitmapImageFileType(NSBitmapImageFileType::JPEG2000.0);
pub static NSAlphaFirstBitmapFormat: NSBitmapFormat = NSBitmapFormat(NSBitmapFormat::AlphaFirst.0);
pub static NSAlphaNonpremultipliedBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::AlphaNonpremultiplied.0);
pub static NSFloatingPointSamplesBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::FloatingPointSamples.0);
pub static NS16BitLittleEndianBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::SixteenBitLittleEndian.0);
pub static NS32BitLittleEndianBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::ThirtyTwoBitLittleEndian.0);
pub static NS16BitBigEndianBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::SixteenBitBigEndian.0);
pub static NS32BitBigEndianBitmapFormat: NSBitmapFormat =
NSBitmapFormat(NSBitmapFormat::ThirtyTwoBitBigEndian.0);

View File

@@ -0,0 +1,242 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSTitlePosition(pub NSUInteger);
impl NSTitlePosition {
pub const NSNoTitle: Self = Self(0);
pub const NSAboveTop: Self = Self(1);
pub const NSAtTop: Self = Self(2);
pub const NSBelowTop: Self = Self(3);
pub const NSAboveBottom: Self = Self(4);
pub const NSAtBottom: Self = Self(5);
pub const NSBelowBottom: Self = Self(6);
}
unsafe impl Encode for NSTitlePosition {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSTitlePosition {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBoxType(pub NSUInteger);
impl NSBoxType {
pub const NSBoxPrimary: Self = Self(0);
pub const NSBoxSeparator: Self = Self(2);
pub const NSBoxCustom: Self = Self(4);
}
unsafe impl Encode for NSBoxType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBoxType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
pub struct NSBox;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl ClassType for NSBox {
#[inherits(NSResponder, NSObject)]
type Super = NSView;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibility for NSBox {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSBox {}
#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAnimatablePropertyContainer for NSBox {}
#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAppearanceCustomization for NSBox {}
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSBox {}
#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSDraggingDestination for NSBox {}
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSBox {}
#[cfg(all(
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSBox {}
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSBox {
#[method(boxType)]
pub unsafe fn boxType(&self) -> NSBoxType;
#[method(setBoxType:)]
pub unsafe fn setBoxType(&self, box_type: NSBoxType);
#[method(titlePosition)]
pub unsafe fn titlePosition(&self) -> NSTitlePosition;
#[method(setTitlePosition:)]
pub unsafe fn setTitlePosition(&self, title_position: NSTitlePosition);
#[method_id(@__retain_semantics Other title)]
pub unsafe fn title(&self) -> Retained<NSString>;
#[method(setTitle:)]
pub unsafe fn setTitle(&self, title: &NSString);
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other titleFont)]
pub unsafe fn titleFont(&self) -> Retained<NSFont>;
#[cfg(feature = "NSFont")]
#[method(setTitleFont:)]
pub unsafe fn setTitleFont(&self, title_font: &NSFont);
#[method(borderRect)]
pub unsafe fn borderRect(&self) -> NSRect;
#[method(titleRect)]
pub unsafe fn titleRect(&self) -> NSRect;
#[method_id(@__retain_semantics Other titleCell)]
pub unsafe fn titleCell(&self) -> Retained<AnyObject>;
#[method(contentViewMargins)]
pub unsafe fn contentViewMargins(&self) -> NSSize;
#[method(setContentViewMargins:)]
pub unsafe fn setContentViewMargins(&self, content_view_margins: NSSize);
#[method(sizeToFit)]
pub unsafe fn sizeToFit(&self);
#[method(setFrameFromContentFrame:)]
pub unsafe fn setFrameFromContentFrame(&self, content_frame: NSRect);
#[method_id(@__retain_semantics Other contentView)]
pub unsafe fn contentView(&self) -> Option<Retained<NSView>>;
#[method(setContentView:)]
pub unsafe fn setContentView(&self, content_view: Option<&NSView>);
#[method(isTransparent)]
pub unsafe fn isTransparent(&self) -> bool;
#[method(setTransparent:)]
pub unsafe fn setTransparent(&self, transparent: bool);
#[method(borderWidth)]
pub unsafe fn borderWidth(&self) -> CGFloat;
#[method(setBorderWidth:)]
pub unsafe fn setBorderWidth(&self, border_width: CGFloat);
#[method(cornerRadius)]
pub unsafe fn cornerRadius(&self) -> CGFloat;
#[method(setCornerRadius:)]
pub unsafe fn setCornerRadius(&self, corner_radius: CGFloat);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other borderColor)]
pub unsafe fn borderColor(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setBorderColor:)]
pub unsafe fn setBorderColor(&self, border_color: &NSColor);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other fillColor)]
pub unsafe fn fillColor(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setFillColor:)]
pub unsafe fn setFillColor(&self, fill_color: &NSColor);
}
);
extern_methods!(
/// Methods declared on superclass `NSView`
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSBox {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSBox {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSBox {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSDeprecated
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSBox {
#[deprecated = "borderType is only applicable to NSBoxOldStyle, which is deprecated. To replace a borderType of NSNoBorder, use the `transparent` property."]
#[method(borderType)]
pub unsafe fn borderType(&self) -> NSBorderType;
#[deprecated = "borderType is only applicable to NSBoxOldStyle, which is deprecated. To replace a borderType of NSNoBorder, use the `transparent` property."]
#[method(setBorderType:)]
pub unsafe fn setBorderType(&self, border_type: NSBorderType);
#[deprecated]
#[method(setTitleWithMnemonic:)]
pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
}
);
pub static NSBoxSecondary: NSBoxType = NSBoxType(1);
pub static NSBoxOldStyle: NSBoxType = NSBoxType(3);

View File

@@ -0,0 +1,980 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[cfg(feature = "NSApplication")]
pub static NSAppKitVersionNumberWithContinuousScrollingBrowser: NSAppKitVersion = 680.0 as _;
#[cfg(feature = "NSApplication")]
pub static NSAppKitVersionNumberWithColumnResizingBrowser: NSAppKitVersion = 685.0 as _;
pub type NSBrowserColumnsAutosaveName = NSString;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBrowserColumnResizingType(pub NSUInteger);
impl NSBrowserColumnResizingType {
pub const NSBrowserNoColumnResizing: Self = Self(0);
pub const NSBrowserAutoColumnResizing: Self = Self(1);
pub const NSBrowserUserColumnResizing: Self = Self(2);
}
unsafe impl Encode for NSBrowserColumnResizingType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBrowserColumnResizingType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBrowserDropOperation(pub NSUInteger);
impl NSBrowserDropOperation {
pub const NSBrowserDropOn: Self = Self(0);
pub const NSBrowserDropAbove: Self = Self(1);
}
unsafe impl Encode for NSBrowserDropOperation {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBrowserDropOperation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
pub struct NSBrowser;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl ClassType for NSBrowser {
#[inherits(NSView, NSResponder, NSObject)]
type Super = NSControl;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibility for NSBrowser {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSBrowser {}
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAnimatablePropertyContainer for NSBrowser {}
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAppearanceCustomization for NSBrowser {}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSBrowser {}
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSDraggingDestination for NSBrowser {}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSBrowser {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSBrowser {}
extern_methods!(
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSBrowser {
#[method(cellClass)]
pub unsafe fn cellClass(mtm: MainThreadMarker) -> &'static AnyClass;
#[method(loadColumnZero)]
pub unsafe fn loadColumnZero(&self);
#[method(isLoaded)]
pub unsafe fn isLoaded(&self) -> bool;
#[method(doubleAction)]
pub unsafe fn doubleAction(&self) -> Option<Sel>;
#[method(setDoubleAction:)]
pub unsafe fn setDoubleAction(&self, double_action: Option<Sel>);
#[method(setCellClass:)]
pub unsafe fn setCellClass(&self, factory_id: &AnyClass);
#[method_id(@__retain_semantics Other cellPrototype)]
pub unsafe fn cellPrototype(&self) -> Option<Retained<AnyObject>>;
#[method(setCellPrototype:)]
pub unsafe fn setCellPrototype(&self, cell_prototype: Option<&AnyObject>);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSBrowserDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSBrowserDelegate>>);
#[method(reusesColumns)]
pub unsafe fn reusesColumns(&self) -> bool;
#[method(setReusesColumns:)]
pub unsafe fn setReusesColumns(&self, reuses_columns: bool);
#[method(hasHorizontalScroller)]
pub unsafe fn hasHorizontalScroller(&self) -> bool;
#[method(setHasHorizontalScroller:)]
pub unsafe fn setHasHorizontalScroller(&self, has_horizontal_scroller: bool);
#[method(autohidesScroller)]
pub unsafe fn autohidesScroller(&self) -> bool;
#[method(setAutohidesScroller:)]
pub unsafe fn setAutohidesScroller(&self, autohides_scroller: bool);
#[method(separatesColumns)]
pub unsafe fn separatesColumns(&self) -> bool;
#[method(setSeparatesColumns:)]
pub unsafe fn setSeparatesColumns(&self, separates_columns: bool);
#[method(isTitled)]
pub unsafe fn isTitled(&self) -> bool;
#[method(setTitled:)]
pub unsafe fn setTitled(&self, titled: bool);
#[method(minColumnWidth)]
pub unsafe fn minColumnWidth(&self) -> CGFloat;
#[method(setMinColumnWidth:)]
pub unsafe fn setMinColumnWidth(&self, min_column_width: CGFloat);
#[method(maxVisibleColumns)]
pub unsafe fn maxVisibleColumns(&self) -> NSInteger;
#[method(setMaxVisibleColumns:)]
pub unsafe fn setMaxVisibleColumns(&self, max_visible_columns: NSInteger);
#[method(allowsMultipleSelection)]
pub unsafe fn allowsMultipleSelection(&self) -> bool;
#[method(setAllowsMultipleSelection:)]
pub unsafe fn setAllowsMultipleSelection(&self, allows_multiple_selection: bool);
#[method(allowsBranchSelection)]
pub unsafe fn allowsBranchSelection(&self) -> bool;
#[method(setAllowsBranchSelection:)]
pub unsafe fn setAllowsBranchSelection(&self, allows_branch_selection: bool);
#[method(allowsEmptySelection)]
pub unsafe fn allowsEmptySelection(&self) -> bool;
#[method(setAllowsEmptySelection:)]
pub unsafe fn setAllowsEmptySelection(&self, allows_empty_selection: bool);
#[method(takesTitleFromPreviousColumn)]
pub unsafe fn takesTitleFromPreviousColumn(&self) -> bool;
#[method(setTakesTitleFromPreviousColumn:)]
pub unsafe fn setTakesTitleFromPreviousColumn(
&self,
takes_title_from_previous_column: bool,
);
#[method(sendsActionOnArrowKeys)]
pub unsafe fn sendsActionOnArrowKeys(&self) -> bool;
#[method(setSendsActionOnArrowKeys:)]
pub unsafe fn setSendsActionOnArrowKeys(&self, sends_action_on_arrow_keys: bool);
#[method_id(@__retain_semantics Other itemAtIndexPath:)]
pub unsafe fn itemAtIndexPath(
&self,
index_path: &NSIndexPath,
) -> Option<Retained<AnyObject>>;
#[method_id(@__retain_semantics Other itemAtRow:inColumn:)]
pub unsafe fn itemAtRow_inColumn(
&self,
row: NSInteger,
column: NSInteger,
) -> Option<Retained<AnyObject>>;
#[method_id(@__retain_semantics Other indexPathForColumn:)]
pub unsafe fn indexPathForColumn(&self, column: NSInteger) -> Retained<NSIndexPath>;
#[method(isLeafItem:)]
pub unsafe fn isLeafItem(&self, item: Option<&AnyObject>) -> bool;
#[method(reloadDataForRowIndexes:inColumn:)]
pub unsafe fn reloadDataForRowIndexes_inColumn(
&self,
row_indexes: &NSIndexSet,
column: NSInteger,
);
#[method_id(@__retain_semantics Other parentForItemsInColumn:)]
pub unsafe fn parentForItemsInColumn(
&self,
column: NSInteger,
) -> Option<Retained<AnyObject>>;
#[method(scrollRowToVisible:inColumn:)]
pub unsafe fn scrollRowToVisible_inColumn(&self, row: NSInteger, column: NSInteger);
#[method(setTitle:ofColumn:)]
pub unsafe fn setTitle_ofColumn(&self, string: &NSString, column: NSInteger);
#[method_id(@__retain_semantics Other titleOfColumn:)]
pub unsafe fn titleOfColumn(&self, column: NSInteger) -> Option<Retained<NSString>>;
#[method_id(@__retain_semantics Other pathSeparator)]
pub unsafe fn pathSeparator(&self) -> Retained<NSString>;
#[method(setPathSeparator:)]
pub unsafe fn setPathSeparator(&self, path_separator: &NSString);
#[method(setPath:)]
pub unsafe fn setPath(&self, path: &NSString) -> bool;
#[method_id(@__retain_semantics Other path)]
pub unsafe fn path(&self) -> Retained<NSString>;
#[method_id(@__retain_semantics Other pathToColumn:)]
pub unsafe fn pathToColumn(&self, column: NSInteger) -> Retained<NSString>;
#[method(clickedColumn)]
pub unsafe fn clickedColumn(&self) -> NSInteger;
#[method(clickedRow)]
pub unsafe fn clickedRow(&self) -> NSInteger;
#[method(selectedColumn)]
pub unsafe fn selectedColumn(&self) -> NSInteger;
#[method_id(@__retain_semantics Other selectedCell)]
pub unsafe fn selectedCell(&self) -> Option<Retained<AnyObject>>;
#[method_id(@__retain_semantics Other selectedCellInColumn:)]
pub unsafe fn selectedCellInColumn(&self, column: NSInteger)
-> Option<Retained<AnyObject>>;
#[cfg(feature = "NSCell")]
#[method_id(@__retain_semantics Other selectedCells)]
pub unsafe fn selectedCells(&self) -> Option<Retained<NSArray<NSCell>>>;
#[method(selectRow:inColumn:)]
pub unsafe fn selectRow_inColumn(&self, row: NSInteger, column: NSInteger);
#[method(selectedRowInColumn:)]
pub unsafe fn selectedRowInColumn(&self, column: NSInteger) -> NSInteger;
#[method_id(@__retain_semantics Other selectionIndexPath)]
pub unsafe fn selectionIndexPath(&self) -> Option<Retained<NSIndexPath>>;
#[method(setSelectionIndexPath:)]
pub unsafe fn setSelectionIndexPath(&self, selection_index_path: Option<&NSIndexPath>);
#[method_id(@__retain_semantics Other selectionIndexPaths)]
pub unsafe fn selectionIndexPaths(&self) -> Retained<NSArray<NSIndexPath>>;
#[method(setSelectionIndexPaths:)]
pub unsafe fn setSelectionIndexPaths(&self, selection_index_paths: &NSArray<NSIndexPath>);
#[method(selectRowIndexes:inColumn:)]
pub unsafe fn selectRowIndexes_inColumn(&self, indexes: &NSIndexSet, column: NSInteger);
#[method_id(@__retain_semantics Other selectedRowIndexesInColumn:)]
pub unsafe fn selectedRowIndexesInColumn(
&self,
column: NSInteger,
) -> Option<Retained<NSIndexSet>>;
#[method(reloadColumn:)]
pub unsafe fn reloadColumn(&self, column: NSInteger);
#[method(validateVisibleColumns)]
pub unsafe fn validateVisibleColumns(&self);
#[method(scrollColumnsRightBy:)]
pub unsafe fn scrollColumnsRightBy(&self, shift_amount: NSInteger);
#[method(scrollColumnsLeftBy:)]
pub unsafe fn scrollColumnsLeftBy(&self, shift_amount: NSInteger);
#[method(scrollColumnToVisible:)]
pub unsafe fn scrollColumnToVisible(&self, column: NSInteger);
#[method(lastColumn)]
pub unsafe fn lastColumn(&self) -> NSInteger;
#[method(setLastColumn:)]
pub unsafe fn setLastColumn(&self, last_column: NSInteger);
#[method(addColumn)]
pub unsafe fn addColumn(&self);
#[method(numberOfVisibleColumns)]
pub unsafe fn numberOfVisibleColumns(&self) -> NSInteger;
#[method(firstVisibleColumn)]
pub unsafe fn firstVisibleColumn(&self) -> NSInteger;
#[method(lastVisibleColumn)]
pub unsafe fn lastVisibleColumn(&self) -> NSInteger;
#[method_id(@__retain_semantics Other loadedCellAtRow:column:)]
pub unsafe fn loadedCellAtRow_column(
&self,
row: NSInteger,
col: NSInteger,
) -> Option<Retained<AnyObject>>;
#[method(selectAll:)]
pub unsafe fn selectAll(&self, sender: Option<&AnyObject>);
#[method(tile)]
pub unsafe fn tile(&self);
#[method(doClick:)]
pub unsafe fn doClick(&self, sender: Option<&AnyObject>);
#[method(doDoubleClick:)]
pub unsafe fn doDoubleClick(&self, sender: Option<&AnyObject>);
#[method(sendAction)]
pub unsafe fn sendAction(&self) -> bool;
#[method(titleFrameOfColumn:)]
pub unsafe fn titleFrameOfColumn(&self, column: NSInteger) -> NSRect;
#[method(drawTitleOfColumn:inRect:)]
pub unsafe fn drawTitleOfColumn_inRect(&self, column: NSInteger, rect: NSRect);
#[method(titleHeight)]
pub unsafe fn titleHeight(&self) -> CGFloat;
#[method(frameOfColumn:)]
pub unsafe fn frameOfColumn(&self, column: NSInteger) -> NSRect;
#[method(frameOfInsideOfColumn:)]
pub unsafe fn frameOfInsideOfColumn(&self, column: NSInteger) -> NSRect;
#[method(frameOfRow:inColumn:)]
pub unsafe fn frameOfRow_inColumn(&self, row: NSInteger, column: NSInteger) -> NSRect;
#[method(getRow:column:forPoint:)]
pub unsafe fn getRow_column_forPoint(
&self,
row: *mut NSInteger,
column: *mut NSInteger,
point: NSPoint,
) -> bool;
#[method(columnWidthForColumnContentWidth:)]
pub unsafe fn columnWidthForColumnContentWidth(
&self,
column_content_width: CGFloat,
) -> CGFloat;
#[method(columnContentWidthForColumnWidth:)]
pub unsafe fn columnContentWidthForColumnWidth(&self, column_width: CGFloat) -> CGFloat;
#[method(columnResizingType)]
pub unsafe fn columnResizingType(&self) -> NSBrowserColumnResizingType;
#[method(setColumnResizingType:)]
pub unsafe fn setColumnResizingType(
&self,
column_resizing_type: NSBrowserColumnResizingType,
);
#[method(prefersAllColumnUserResizing)]
pub unsafe fn prefersAllColumnUserResizing(&self) -> bool;
#[method(setPrefersAllColumnUserResizing:)]
pub unsafe fn setPrefersAllColumnUserResizing(
&self,
prefers_all_column_user_resizing: bool,
);
#[method(setWidth:ofColumn:)]
pub unsafe fn setWidth_ofColumn(&self, column_width: CGFloat, column_index: NSInteger);
#[method(widthOfColumn:)]
pub unsafe fn widthOfColumn(&self, column: NSInteger) -> CGFloat;
#[method(rowHeight)]
pub unsafe fn rowHeight(&self) -> CGFloat;
#[method(setRowHeight:)]
pub unsafe fn setRowHeight(&self, row_height: CGFloat);
#[method(noteHeightOfRowsWithIndexesChanged:inColumn:)]
pub unsafe fn noteHeightOfRowsWithIndexesChanged_inColumn(
&self,
index_set: &NSIndexSet,
column_index: NSInteger,
);
#[method(setDefaultColumnWidth:)]
pub unsafe fn setDefaultColumnWidth(&self, column_width: CGFloat);
#[method(defaultColumnWidth)]
pub unsafe fn defaultColumnWidth(&self) -> CGFloat;
#[method_id(@__retain_semantics Other columnsAutosaveName)]
pub unsafe fn columnsAutosaveName(&self) -> Retained<NSBrowserColumnsAutosaveName>;
#[method(setColumnsAutosaveName:)]
pub unsafe fn setColumnsAutosaveName(
&self,
columns_autosave_name: &NSBrowserColumnsAutosaveName,
);
#[method(removeSavedColumnsWithAutosaveName:)]
pub unsafe fn removeSavedColumnsWithAutosaveName(
name: &NSBrowserColumnsAutosaveName,
mtm: MainThreadMarker,
);
#[cfg(feature = "NSEvent")]
#[method(canDragRowsWithIndexes:inColumn:withEvent:)]
pub unsafe fn canDragRowsWithIndexes_inColumn_withEvent(
&self,
row_indexes: &NSIndexSet,
column: NSInteger,
event: &NSEvent,
) -> bool;
#[cfg(all(feature = "NSEvent", feature = "NSImage"))]
#[method_id(@__retain_semantics Other draggingImageForRowsWithIndexes:inColumn:withEvent:offset:)]
pub unsafe fn draggingImageForRowsWithIndexes_inColumn_withEvent_offset(
&self,
row_indexes: &NSIndexSet,
column: NSInteger,
event: &NSEvent,
drag_image_offset: NSPointPointer,
) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSDragging")]
#[method(setDraggingSourceOperationMask:forLocal:)]
pub unsafe fn setDraggingSourceOperationMask_forLocal(
&self,
mask: NSDragOperation,
is_local: bool,
);
#[method(allowsTypeSelect)]
pub unsafe fn allowsTypeSelect(&self) -> bool;
#[method(setAllowsTypeSelect:)]
pub unsafe fn setAllowsTypeSelect(&self, allows_type_select: bool);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other backgroundColor)]
pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setBackgroundColor:)]
pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);
#[cfg(feature = "NSEvent")]
#[method(editItemAtIndexPath:withEvent:select:)]
pub unsafe fn editItemAtIndexPath_withEvent_select(
&self,
index_path: &NSIndexPath,
event: Option<&NSEvent>,
select: bool,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSControl`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSBrowser {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSBrowser {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSBrowser {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern "C" {
pub static NSBrowserColumnConfigurationDidChangeNotification: &'static NSNotificationName;
}
extern_protocol!(
pub unsafe trait NSBrowserDelegate: NSObjectProtocol + IsMainThreadOnly {
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:numberOfRowsInColumn:)]
unsafe fn browser_numberOfRowsInColumn(
&self,
sender: &NSBrowser,
column: NSInteger,
) -> NSInteger;
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(browser:createRowsForColumn:inMatrix:)]
unsafe fn browser_createRowsForColumn_inMatrix(
&self,
sender: &NSBrowser,
column: NSInteger,
matrix: &NSMatrix,
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:numberOfChildrenOfItem:)]
unsafe fn browser_numberOfChildrenOfItem(
&self,
browser: &NSBrowser,
item: Option<&AnyObject>,
) -> NSInteger;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other browser:child:ofItem:)]
unsafe fn browser_child_ofItem(
&self,
browser: &NSBrowser,
index: NSInteger,
item: Option<&AnyObject>,
) -> Retained<AnyObject>;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:isLeafItem:)]
unsafe fn browser_isLeafItem(&self, browser: &NSBrowser, item: Option<&AnyObject>) -> bool;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other browser:objectValueForItem:)]
unsafe fn browser_objectValueForItem(
&self,
browser: &NSBrowser,
item: Option<&AnyObject>,
) -> Option<Retained<AnyObject>>;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:heightOfRow:inColumn:)]
unsafe fn browser_heightOfRow_inColumn(
&self,
browser: &NSBrowser,
row: NSInteger,
column_index: NSInteger,
) -> CGFloat;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other rootItemForBrowser:)]
unsafe fn rootItemForBrowser(&self, browser: &NSBrowser) -> Option<Retained<AnyObject>>;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:setObjectValue:forItem:)]
unsafe fn browser_setObjectValue_forItem(
&self,
browser: &NSBrowser,
object: Option<&AnyObject>,
item: Option<&AnyObject>,
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:shouldEditItem:)]
unsafe fn browser_shouldEditItem(
&self,
browser: &NSBrowser,
item: Option<&AnyObject>,
) -> bool;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:willDisplayCell:atRow:column:)]
unsafe fn browser_willDisplayCell_atRow_column(
&self,
sender: &NSBrowser,
cell: &AnyObject,
row: NSInteger,
column: NSInteger,
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other browser:titleOfColumn:)]
unsafe fn browser_titleOfColumn(
&self,
sender: &NSBrowser,
column: NSInteger,
) -> Option<Retained<NSString>>;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:selectCellWithString:inColumn:)]
unsafe fn browser_selectCellWithString_inColumn(
&self,
sender: &NSBrowser,
title: &NSString,
column: NSInteger,
) -> bool;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:selectRow:inColumn:)]
unsafe fn browser_selectRow_inColumn(
&self,
sender: &NSBrowser,
row: NSInteger,
column: NSInteger,
) -> bool;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:isColumnValid:)]
unsafe fn browser_isColumnValid(&self, sender: &NSBrowser, column: NSInteger) -> bool;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browserWillScroll:)]
unsafe fn browserWillScroll(&self, sender: &NSBrowser);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browserDidScroll:)]
unsafe fn browserDidScroll(&self, sender: &NSBrowser);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:shouldSizeColumn:forUserResize:toWidth:)]
unsafe fn browser_shouldSizeColumn_forUserResize_toWidth(
&self,
browser: &NSBrowser,
column_index: NSInteger,
for_user_resize: bool,
suggested_width: CGFloat,
) -> CGFloat;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:sizeToFitWidthOfColumn:)]
unsafe fn browser_sizeToFitWidthOfColumn(
&self,
browser: &NSBrowser,
column_index: NSInteger,
) -> CGFloat;
#[optional]
#[method(browserColumnConfigurationDidChange:)]
unsafe fn browserColumnConfigurationDidChange(&self, notification: &NSNotification);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:shouldShowCellExpansionForRow:column:)]
unsafe fn browser_shouldShowCellExpansionForRow_column(
&self,
browser: &NSBrowser,
row: NSInteger,
column: NSInteger,
) -> bool;
#[cfg(all(
feature = "NSControl",
feature = "NSPasteboard",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(browser:writeRowsWithIndexes:inColumn:toPasteboard:)]
unsafe fn browser_writeRowsWithIndexes_inColumn_toPasteboard(
&self,
browser: &NSBrowser,
row_indexes: &NSIndexSet,
column: NSInteger,
pasteboard: &NSPasteboard,
) -> bool;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[deprecated = "Use NSFilePromiseReceiver objects instead"]
#[optional]
#[method_id(@__retain_semantics Other browser:namesOfPromisedFilesDroppedAtDestination:forDraggedRowsWithIndexes:inColumn:)]
unsafe fn browser_namesOfPromisedFilesDroppedAtDestination_forDraggedRowsWithIndexes_inColumn(
&self,
browser: &NSBrowser,
drop_destination: &NSURL,
row_indexes: &NSIndexSet,
column: NSInteger,
) -> Retained<NSArray<NSString>>;
#[cfg(all(
feature = "NSControl",
feature = "NSEvent",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(browser:canDragRowsWithIndexes:inColumn:withEvent:)]
unsafe fn browser_canDragRowsWithIndexes_inColumn_withEvent(
&self,
browser: &NSBrowser,
row_indexes: &NSIndexSet,
column: NSInteger,
event: &NSEvent,
) -> bool;
#[cfg(all(
feature = "NSControl",
feature = "NSEvent",
feature = "NSImage",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method_id(@__retain_semantics Other browser:draggingImageForRowsWithIndexes:inColumn:withEvent:offset:)]
unsafe fn browser_draggingImageForRowsWithIndexes_inColumn_withEvent_offset(
&self,
browser: &NSBrowser,
row_indexes: &NSIndexSet,
column: NSInteger,
event: &NSEvent,
drag_image_offset: NSPointPointer,
) -> Option<Retained<NSImage>>;
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(browser:validateDrop:proposedRow:column:dropOperation:)]
unsafe fn browser_validateDrop_proposedRow_column_dropOperation(
&self,
browser: &NSBrowser,
info: &ProtocolObject<dyn NSDraggingInfo>,
row: NonNull<NSInteger>,
column: NonNull<NSInteger>,
drop_operation: NonNull<NSBrowserDropOperation>,
) -> NSDragOperation;
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(browser:acceptDrop:atRow:column:dropOperation:)]
unsafe fn browser_acceptDrop_atRow_column_dropOperation(
&self,
browser: &NSBrowser,
info: &ProtocolObject<dyn NSDraggingInfo>,
row: NSInteger,
column: NSInteger,
drop_operation: NSBrowserDropOperation,
) -> bool;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other browser:typeSelectStringForRow:inColumn:)]
unsafe fn browser_typeSelectStringForRow_inColumn(
&self,
browser: &NSBrowser,
row: NSInteger,
column: NSInteger,
) -> Option<Retained<NSString>>;
#[cfg(all(
feature = "NSControl",
feature = "NSEvent",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(browser:shouldTypeSelectForEvent:withCurrentSearchString:)]
unsafe fn browser_shouldTypeSelectForEvent_withCurrentSearchString(
&self,
browser: &NSBrowser,
event: &NSEvent,
search_string: Option<&NSString>,
) -> bool;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:nextTypeSelectMatchFromRow:toRow:inColumn:forString:)]
unsafe fn browser_nextTypeSelectMatchFromRow_toRow_inColumn_forString(
&self,
browser: &NSBrowser,
start_row: NSInteger,
end_row: NSInteger,
column: NSInteger,
search_string: Option<&NSString>,
) -> NSInteger;
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSView",
feature = "NSViewController"
))]
#[optional]
#[method_id(@__retain_semantics Other browser:previewViewControllerForLeafItem:)]
unsafe fn browser_previewViewControllerForLeafItem(
&self,
browser: &NSBrowser,
item: &AnyObject,
) -> Option<Retained<NSViewController>>;
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSView",
feature = "NSViewController"
))]
#[optional]
#[method_id(@__retain_semantics Other browser:headerViewControllerForItem:)]
unsafe fn browser_headerViewControllerForItem(
&self,
browser: &NSBrowser,
item: Option<&AnyObject>,
) -> Option<Retained<NSViewController>>;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(browser:didChangeLastColumn:toColumn:)]
unsafe fn browser_didChangeLastColumn_toColumn(
&self,
browser: &NSBrowser,
old_last_column: NSInteger,
column: NSInteger,
);
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method_id(@__retain_semantics Other browser:selectionIndexesForProposedSelection:inColumn:)]
unsafe fn browser_selectionIndexesForProposedSelection_inColumn(
&self,
browser: &NSBrowser,
proposed_selection_indexes: &NSIndexSet,
column: NSInteger,
) -> Retained<NSIndexSet>;
}
unsafe impl ProtocolType for dyn NSBrowserDelegate {}
);
extern_methods!(
/// NSDeprecated
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSBrowser {
#[deprecated]
#[method(setAcceptsArrowKeys:)]
pub unsafe fn setAcceptsArrowKeys(&self, flag: bool);
#[deprecated]
#[method(acceptsArrowKeys)]
pub unsafe fn acceptsArrowKeys(&self) -> bool;
#[deprecated]
#[method(displayColumn:)]
pub unsafe fn displayColumn(&self, column: NSInteger);
#[deprecated]
#[method(displayAllColumns)]
pub unsafe fn displayAllColumns(&self);
#[cfg(feature = "NSScroller")]
#[deprecated]
#[method(scrollViaScroller:)]
pub unsafe fn scrollViaScroller(&self, sender: Option<&NSScroller>);
#[deprecated]
#[method(updateScroller)]
pub unsafe fn updateScroller(&self);
#[deprecated = "Use the item based NSBrowser instead"]
#[method(setMatrixClass:)]
pub unsafe fn setMatrixClass(&self, factory_id: &AnyClass);
#[deprecated = "Use the item based NSBrowser instead"]
#[method(matrixClass)]
pub unsafe fn matrixClass(&self) -> &'static AnyClass;
#[cfg(feature = "NSMatrix")]
#[deprecated = "Use the item based NSBrowser instead"]
#[method(columnOfMatrix:)]
pub unsafe fn columnOfMatrix(&self, matrix: &NSMatrix) -> NSInteger;
#[cfg(feature = "NSMatrix")]
#[deprecated = "Use the item based NSBrowser instead"]
#[method_id(@__retain_semantics Other matrixInColumn:)]
pub unsafe fn matrixInColumn(&self, column: NSInteger) -> Option<Retained<NSMatrix>>;
}
);

View File

@@ -0,0 +1,122 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCell")]
pub struct NSBrowserCell;
#[cfg(feature = "NSCell")]
unsafe impl ClassType for NSBrowserCell {
#[inherits(NSObject)]
type Super = NSCell;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSCell"))]
unsafe impl NSAccessibility for NSBrowserCell {}
#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSCell"))]
unsafe impl NSAccessibilityElementProtocol for NSBrowserCell {}
#[cfg(feature = "NSCell")]
unsafe impl NSCoding for NSBrowserCell {}
#[cfg(feature = "NSCell")]
unsafe impl NSCopying for NSBrowserCell {}
#[cfg(feature = "NSCell")]
unsafe impl NSObjectProtocol for NSBrowserCell {}
#[cfg(all(feature = "NSCell", feature = "NSUserInterfaceItemIdentification"))]
unsafe impl NSUserInterfaceItemIdentification for NSBrowserCell {}
extern_methods!(
#[cfg(feature = "NSCell")]
unsafe impl NSBrowserCell {
#[method_id(@__retain_semantics Init initTextCell:)]
pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Init initImageCell:)]
pub unsafe fn initImageCell(
this: Allocated<Self>,
image: Option<&NSImage>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other branchImage)]
pub unsafe fn branchImage(mtm: MainThreadMarker) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other highlightedBranchImage)]
pub unsafe fn highlightedBranchImage(mtm: MainThreadMarker) -> Option<Retained<NSImage>>;
#[cfg(all(feature = "NSColor", feature = "NSResponder", feature = "NSView"))]
#[method_id(@__retain_semantics Other highlightColorInView:)]
pub unsafe fn highlightColorInView(
&self,
control_view: &NSView,
) -> Option<Retained<NSColor>>;
#[method(isLeaf)]
pub unsafe fn isLeaf(&self) -> bool;
#[method(setLeaf:)]
pub unsafe fn setLeaf(&self, leaf: bool);
#[method(isLoaded)]
pub unsafe fn isLoaded(&self) -> bool;
#[method(setLoaded:)]
pub unsafe fn setLoaded(&self, loaded: bool);
#[method(reset)]
pub unsafe fn reset(&self);
#[method(set)]
pub unsafe fn set(&self);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other image)]
pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setImage:)]
pub unsafe fn setImage(&self, image: Option<&NSImage>);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other alternateImage)]
pub unsafe fn alternateImage(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setAlternateImage:)]
pub unsafe fn setAlternateImage(&self, alternate_image: Option<&NSImage>);
}
);
extern_methods!(
/// Methods declared on superclass `NSCell`
#[cfg(feature = "NSCell")]
unsafe impl NSBrowserCell {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSCell")]
unsafe impl NSBrowserCell {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,410 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
pub struct NSButton;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl ClassType for NSButton {
#[inherits(NSView, NSResponder, NSObject)]
type Super = NSControl;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibility for NSButton {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibilityButton for NSButton {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSButton {}
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAnimatablePropertyContainer for NSButton {}
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAppearanceCustomization for NSButton {}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSButton {}
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSDraggingDestination for NSButton {}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSButton {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceCompression",
feature = "NSView"
))]
unsafe impl NSUserInterfaceCompression for NSButton {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSButton {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceValidation",
feature = "NSView"
))]
unsafe impl NSUserInterfaceValidations for NSButton {}
extern_methods!(
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSButton {
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other buttonWithTitle:image:target:action:)]
pub unsafe fn buttonWithTitle_image_target_action(
title: &NSString,
image: &NSImage,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other buttonWithTitle:target:action:)]
pub unsafe fn buttonWithTitle_target_action(
title: &NSString,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other buttonWithImage:target:action:)]
pub unsafe fn buttonWithImage_target_action(
image: &NSImage,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other checkboxWithTitle:target:action:)]
pub unsafe fn checkboxWithTitle_target_action(
title: &NSString,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other radioButtonWithTitle:target:action:)]
pub unsafe fn radioButtonWithTitle_target_action(
title: &NSString,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[cfg(feature = "NSButtonCell")]
#[method(setButtonType:)]
pub unsafe fn setButtonType(&self, r#type: NSButtonType);
#[method_id(@__retain_semantics Other title)]
pub unsafe fn title(&self) -> Retained<NSString>;
#[method(setTitle:)]
pub unsafe fn setTitle(&self, title: &NSString);
#[method_id(@__retain_semantics Other attributedTitle)]
pub unsafe fn attributedTitle(&self) -> Retained<NSAttributedString>;
#[method(setAttributedTitle:)]
pub unsafe fn setAttributedTitle(&self, attributed_title: &NSAttributedString);
#[method_id(@__retain_semantics Other alternateTitle)]
pub unsafe fn alternateTitle(&self) -> Retained<NSString>;
#[method(setAlternateTitle:)]
pub unsafe fn setAlternateTitle(&self, alternate_title: &NSString);
#[method_id(@__retain_semantics Other attributedAlternateTitle)]
pub unsafe fn attributedAlternateTitle(&self) -> Retained<NSAttributedString>;
#[method(setAttributedAlternateTitle:)]
pub unsafe fn setAttributedAlternateTitle(
&self,
attributed_alternate_title: &NSAttributedString,
);
#[method(hasDestructiveAction)]
pub unsafe fn hasDestructiveAction(&self) -> bool;
#[method(setHasDestructiveAction:)]
pub unsafe fn setHasDestructiveAction(&self, has_destructive_action: bool);
#[cfg(feature = "NSSound")]
#[method_id(@__retain_semantics Other sound)]
pub unsafe fn sound(&self) -> Option<Retained<NSSound>>;
#[cfg(feature = "NSSound")]
#[method(setSound:)]
pub unsafe fn setSound(&self, sound: Option<&NSSound>);
#[method(isSpringLoaded)]
pub unsafe fn isSpringLoaded(&self) -> bool;
#[method(setSpringLoaded:)]
pub unsafe fn setSpringLoaded(&self, spring_loaded: bool);
#[method(maxAcceleratorLevel)]
pub unsafe fn maxAcceleratorLevel(&self) -> NSInteger;
#[method(setMaxAcceleratorLevel:)]
pub unsafe fn setMaxAcceleratorLevel(&self, max_accelerator_level: NSInteger);
#[method(setPeriodicDelay:interval:)]
pub unsafe fn setPeriodicDelay_interval(&self, delay: c_float, interval: c_float);
#[method(getPeriodicDelay:interval:)]
pub unsafe fn getPeriodicDelay_interval(
&self,
delay: NonNull<c_float>,
interval: NonNull<c_float>,
);
#[cfg(feature = "NSButtonCell")]
#[method(bezelStyle)]
pub unsafe fn bezelStyle(&self) -> NSBezelStyle;
#[cfg(feature = "NSButtonCell")]
#[method(setBezelStyle:)]
pub unsafe fn setBezelStyle(&self, bezel_style: NSBezelStyle);
#[method(isBordered)]
pub unsafe fn isBordered(&self) -> bool;
#[method(setBordered:)]
pub unsafe fn setBordered(&self, bordered: bool);
#[method(isTransparent)]
pub unsafe fn isTransparent(&self) -> bool;
#[method(setTransparent:)]
pub unsafe fn setTransparent(&self, transparent: bool);
#[method(showsBorderOnlyWhileMouseInside)]
pub unsafe fn showsBorderOnlyWhileMouseInside(&self) -> bool;
#[method(setShowsBorderOnlyWhileMouseInside:)]
pub unsafe fn setShowsBorderOnlyWhileMouseInside(
&self,
shows_border_only_while_mouse_inside: bool,
);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other bezelColor)]
pub unsafe fn bezelColor(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColor")]
#[method(setBezelColor:)]
pub unsafe fn setBezelColor(&self, bezel_color: Option<&NSColor>);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other contentTintColor)]
pub unsafe fn contentTintColor(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColor")]
#[method(setContentTintColor:)]
pub unsafe fn setContentTintColor(&self, content_tint_color: Option<&NSColor>);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other image)]
pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setImage:)]
pub unsafe fn setImage(&self, image: Option<&NSImage>);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other alternateImage)]
pub unsafe fn alternateImage(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setAlternateImage:)]
pub unsafe fn setAlternateImage(&self, alternate_image: Option<&NSImage>);
#[cfg(feature = "NSCell")]
#[method(imagePosition)]
pub unsafe fn imagePosition(&self) -> NSCellImagePosition;
#[cfg(feature = "NSCell")]
#[method(setImagePosition:)]
pub unsafe fn setImagePosition(&self, image_position: NSCellImagePosition);
#[cfg(feature = "NSCell")]
#[method(imageScaling)]
pub unsafe fn imageScaling(&self) -> NSImageScaling;
#[cfg(feature = "NSCell")]
#[method(setImageScaling:)]
pub unsafe fn setImageScaling(&self, image_scaling: NSImageScaling);
#[method(imageHugsTitle)]
pub unsafe fn imageHugsTitle(&self) -> bool;
#[method(setImageHugsTitle:)]
pub unsafe fn setImageHugsTitle(&self, image_hugs_title: bool);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other symbolConfiguration)]
pub unsafe fn symbolConfiguration(&self) -> Option<Retained<NSImageSymbolConfiguration>>;
#[cfg(feature = "NSImage")]
#[method(setSymbolConfiguration:)]
pub unsafe fn setSymbolConfiguration(
&self,
symbol_configuration: Option<&NSImageSymbolConfiguration>,
);
#[cfg(feature = "NSCell")]
#[method(state)]
pub unsafe fn state(&self) -> NSControlStateValue;
#[cfg(feature = "NSCell")]
#[method(setState:)]
pub unsafe fn setState(&self, state: NSControlStateValue);
#[method(allowsMixedState)]
pub unsafe fn allowsMixedState(&self) -> bool;
#[method(setAllowsMixedState:)]
pub unsafe fn setAllowsMixedState(&self, allows_mixed_state: bool);
#[method(setNextState)]
pub unsafe fn setNextState(&self);
#[method(highlight:)]
pub unsafe fn highlight(&self, flag: bool);
#[method_id(@__retain_semantics Other keyEquivalent)]
pub unsafe fn keyEquivalent(&self) -> Retained<NSString>;
#[method(setKeyEquivalent:)]
pub unsafe fn setKeyEquivalent(&self, key_equivalent: &NSString);
#[cfg(feature = "NSEvent")]
#[method(keyEquivalentModifierMask)]
pub unsafe fn keyEquivalentModifierMask(&self) -> NSEventModifierFlags;
#[cfg(feature = "NSEvent")]
#[method(setKeyEquivalentModifierMask:)]
pub unsafe fn setKeyEquivalentModifierMask(
&self,
key_equivalent_modifier_mask: NSEventModifierFlags,
);
#[cfg(feature = "NSEvent")]
#[method(performKeyEquivalent:)]
pub unsafe fn performKeyEquivalent(&self, key: &NSEvent) -> bool;
#[cfg(feature = "NSUserInterfaceCompression")]
#[method(compressWithPrioritizedCompressionOptions:)]
pub unsafe fn compressWithPrioritizedCompressionOptions(
&self,
prioritized_options: &NSArray<NSUserInterfaceCompressionOptions>,
);
#[cfg(feature = "NSUserInterfaceCompression")]
#[method(minimumSizeWithPrioritizedCompressionOptions:)]
pub unsafe fn minimumSizeWithPrioritizedCompressionOptions(
&self,
prioritized_options: &NSArray<NSUserInterfaceCompressionOptions>,
) -> NSSize;
#[cfg(feature = "NSUserInterfaceCompression")]
#[method_id(@__retain_semantics Other activeCompressionOptions)]
pub unsafe fn activeCompressionOptions(
&self,
) -> Retained<NSUserInterfaceCompressionOptions>;
}
);
extern_methods!(
/// Methods declared on superclass `NSControl`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSButton {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSButton {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSButton {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSButtonDeprecated
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSButton {
#[deprecated = "Mnemonics are not used on macOS. Set the title property directly instead."]
#[method(setTitleWithMnemonic:)]
pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
}
);

View File

@@ -0,0 +1,485 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSButtonType(pub NSUInteger);
impl NSButtonType {
#[doc(alias = "NSButtonTypeMomentaryLight")]
pub const MomentaryLight: Self = Self(0);
#[doc(alias = "NSButtonTypePushOnPushOff")]
pub const PushOnPushOff: Self = Self(1);
#[doc(alias = "NSButtonTypeToggle")]
pub const Toggle: Self = Self(2);
#[doc(alias = "NSButtonTypeSwitch")]
pub const Switch: Self = Self(3);
#[doc(alias = "NSButtonTypeRadio")]
pub const Radio: Self = Self(4);
#[doc(alias = "NSButtonTypeMomentaryChange")]
pub const MomentaryChange: Self = Self(5);
#[doc(alias = "NSButtonTypeOnOff")]
pub const OnOff: Self = Self(6);
#[doc(alias = "NSButtonTypeMomentaryPushIn")]
pub const MomentaryPushIn: Self = Self(7);
#[doc(alias = "NSButtonTypeAccelerator")]
pub const Accelerator: Self = Self(8);
#[doc(alias = "NSButtonTypeMultiLevelAccelerator")]
pub const MultiLevelAccelerator: Self = Self(9);
}
unsafe impl Encode for NSButtonType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSButtonType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBezelStyle(pub NSUInteger);
impl NSBezelStyle {
#[doc(alias = "NSBezelStyleAutomatic")]
pub const Automatic: Self = Self(0);
#[doc(alias = "NSBezelStylePush")]
pub const Push: Self = Self(1);
#[doc(alias = "NSBezelStyleFlexiblePush")]
pub const FlexiblePush: Self = Self(2);
#[doc(alias = "NSBezelStyleDisclosure")]
pub const Disclosure: Self = Self(5);
#[doc(alias = "NSBezelStyleCircular")]
pub const Circular: Self = Self(7);
#[doc(alias = "NSBezelStyleHelpButton")]
pub const HelpButton: Self = Self(9);
#[doc(alias = "NSBezelStyleSmallSquare")]
pub const SmallSquare: Self = Self(10);
#[doc(alias = "NSBezelStyleToolbar")]
pub const Toolbar: Self = Self(11);
#[doc(alias = "NSBezelStyleAccessoryBarAction")]
pub const AccessoryBarAction: Self = Self(12);
#[doc(alias = "NSBezelStyleAccessoryBar")]
pub const AccessoryBar: Self = Self(13);
#[doc(alias = "NSBezelStylePushDisclosure")]
pub const PushDisclosure: Self = Self(14);
#[doc(alias = "NSBezelStyleBadge")]
pub const Badge: Self = Self(15);
#[deprecated]
#[doc(alias = "NSBezelStyleShadowlessSquare")]
pub const ShadowlessSquare: Self = Self(6);
#[deprecated]
#[doc(alias = "NSBezelStyleTexturedSquare")]
pub const TexturedSquare: Self = Self(8);
#[deprecated]
#[doc(alias = "NSBezelStyleRounded")]
pub const Rounded: Self = Self(NSBezelStyle::Push.0);
#[deprecated]
#[doc(alias = "NSBezelStyleRegularSquare")]
pub const RegularSquare: Self = Self(NSBezelStyle::FlexiblePush.0);
#[deprecated]
#[doc(alias = "NSBezelStyleTexturedRounded")]
pub const TexturedRounded: Self = Self(NSBezelStyle::Toolbar.0);
#[deprecated]
#[doc(alias = "NSBezelStyleRoundRect")]
pub const RoundRect: Self = Self(NSBezelStyle::AccessoryBarAction.0);
#[deprecated]
#[doc(alias = "NSBezelStyleRecessed")]
pub const Recessed: Self = Self(NSBezelStyle::AccessoryBar.0);
#[deprecated]
#[doc(alias = "NSBezelStyleRoundedDisclosure")]
pub const RoundedDisclosure: Self = Self(NSBezelStyle::PushDisclosure.0);
#[deprecated]
#[doc(alias = "NSBezelStyleInline")]
pub const Inline: Self = Self(NSBezelStyle::Badge.0);
}
unsafe impl Encode for NSBezelStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBezelStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
pub struct NSButtonCell;
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl ClassType for NSButtonCell {
#[inherits(NSCell, NSObject)]
type Super = NSActionCell;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
unsafe impl NSAccessibility for NSButtonCell {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
unsafe impl NSAccessibilityElementProtocol for NSButtonCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSCoding for NSButtonCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSCopying for NSButtonCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSObjectProtocol for NSButtonCell {}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSUserInterfaceItemIdentification"
))]
unsafe impl NSUserInterfaceItemIdentification for NSButtonCell {}
extern_methods!(
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSButtonCell {
#[method_id(@__retain_semantics Init initTextCell:)]
pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Init initImageCell:)]
pub unsafe fn initImageCell(
this: Allocated<Self>,
image: Option<&NSImage>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[method(bezelStyle)]
pub unsafe fn bezelStyle(&self) -> NSBezelStyle;
#[method(setBezelStyle:)]
pub unsafe fn setBezelStyle(&self, bezel_style: NSBezelStyle);
#[method(setButtonType:)]
pub unsafe fn setButtonType(&self, r#type: NSButtonType);
#[method(highlightsBy)]
pub unsafe fn highlightsBy(&self) -> NSCellStyleMask;
#[method(setHighlightsBy:)]
pub unsafe fn setHighlightsBy(&self, highlights_by: NSCellStyleMask);
#[method(showsStateBy)]
pub unsafe fn showsStateBy(&self) -> NSCellStyleMask;
#[method(setShowsStateBy:)]
pub unsafe fn setShowsStateBy(&self, shows_state_by: NSCellStyleMask);
#[method_id(@__retain_semantics Other title)]
pub unsafe fn title(&self) -> Retained<NSString>;
#[method(setTitle:)]
pub unsafe fn setTitle(&self, title: Option<&NSString>);
#[method_id(@__retain_semantics Other attributedTitle)]
pub unsafe fn attributedTitle(&self) -> Retained<NSAttributedString>;
#[method(setAttributedTitle:)]
pub unsafe fn setAttributedTitle(&self, attributed_title: &NSAttributedString);
#[method_id(@__retain_semantics Other alternateTitle)]
pub unsafe fn alternateTitle(&self) -> Retained<NSString>;
#[method(setAlternateTitle:)]
pub unsafe fn setAlternateTitle(&self, alternate_title: &NSString);
#[method_id(@__retain_semantics Other attributedAlternateTitle)]
pub unsafe fn attributedAlternateTitle(&self) -> Retained<NSAttributedString>;
#[method(setAttributedAlternateTitle:)]
pub unsafe fn setAttributedAlternateTitle(
&self,
attributed_alternate_title: &NSAttributedString,
);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other alternateImage)]
pub unsafe fn alternateImage(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setAlternateImage:)]
pub unsafe fn setAlternateImage(&self, alternate_image: Option<&NSImage>);
#[method(imagePosition)]
pub unsafe fn imagePosition(&self) -> NSCellImagePosition;
#[method(setImagePosition:)]
pub unsafe fn setImagePosition(&self, image_position: NSCellImagePosition);
#[method(imageScaling)]
pub unsafe fn imageScaling(&self) -> NSImageScaling;
#[method(setImageScaling:)]
pub unsafe fn setImageScaling(&self, image_scaling: NSImageScaling);
#[method_id(@__retain_semantics Other keyEquivalent)]
pub unsafe fn keyEquivalent(&self) -> Retained<NSString>;
#[method(setKeyEquivalent:)]
pub unsafe fn setKeyEquivalent(&self, key_equivalent: &NSString);
#[cfg(feature = "NSEvent")]
#[method(keyEquivalentModifierMask)]
pub unsafe fn keyEquivalentModifierMask(&self) -> NSEventModifierFlags;
#[cfg(feature = "NSEvent")]
#[method(setKeyEquivalentModifierMask:)]
pub unsafe fn setKeyEquivalentModifierMask(
&self,
key_equivalent_modifier_mask: NSEventModifierFlags,
);
#[method(isTransparent)]
pub unsafe fn isTransparent(&self) -> bool;
#[method(setTransparent:)]
pub unsafe fn setTransparent(&self, transparent: bool);
#[method(isOpaque)]
pub unsafe fn isOpaque(&self) -> bool;
#[method(imageDimsWhenDisabled)]
pub unsafe fn imageDimsWhenDisabled(&self) -> bool;
#[method(setImageDimsWhenDisabled:)]
pub unsafe fn setImageDimsWhenDisabled(&self, image_dims_when_disabled: bool);
#[method(showsBorderOnlyWhileMouseInside)]
pub unsafe fn showsBorderOnlyWhileMouseInside(&self) -> bool;
#[method(setShowsBorderOnlyWhileMouseInside:)]
pub unsafe fn setShowsBorderOnlyWhileMouseInside(
&self,
shows_border_only_while_mouse_inside: bool,
);
#[cfg(feature = "NSSound")]
#[method_id(@__retain_semantics Other sound)]
pub unsafe fn sound(&self) -> Option<Retained<NSSound>>;
#[cfg(feature = "NSSound")]
#[method(setSound:)]
pub unsafe fn setSound(&self, sound: Option<&NSSound>);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other backgroundColor)]
pub unsafe fn backgroundColor(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColor")]
#[method(setBackgroundColor:)]
pub unsafe fn setBackgroundColor(&self, background_color: Option<&NSColor>);
#[method(setPeriodicDelay:interval:)]
pub unsafe fn setPeriodicDelay_interval(&self, delay: c_float, interval: c_float);
#[method(getPeriodicDelay:interval:)]
pub unsafe fn getPeriodicDelay_interval(
&self,
delay: NonNull<c_float>,
interval: NonNull<c_float>,
);
#[method(performClick:)]
pub unsafe fn performClick(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSEvent")]
#[method(mouseEntered:)]
pub unsafe fn mouseEntered(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(mouseExited:)]
pub unsafe fn mouseExited(&self, event: &NSEvent);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(drawBezelWithFrame:inView:)]
pub unsafe fn drawBezelWithFrame_inView(&self, frame: NSRect, control_view: &NSView);
#[cfg(all(feature = "NSImage", feature = "NSResponder", feature = "NSView"))]
#[method(drawImage:withFrame:inView:)]
pub unsafe fn drawImage_withFrame_inView(
&self,
image: &NSImage,
frame: NSRect,
control_view: &NSView,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(drawTitle:withFrame:inView:)]
pub unsafe fn drawTitle_withFrame_inView(
&self,
title: &NSAttributedString,
frame: NSRect,
control_view: &NSView,
) -> NSRect;
}
);
extern_methods!(
/// Methods declared on superclass `NSCell`
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSButtonCell {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSButtonCell {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
// NS_ENUM
#[deprecated]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGradientType(pub NSUInteger);
impl NSGradientType {
pub const NSGradientNone: Self = Self(0);
pub const NSGradientConcaveWeak: Self = Self(1);
pub const NSGradientConcaveStrong: Self = Self(2);
pub const NSGradientConvexWeak: Self = Self(3);
pub const NSGradientConvexStrong: Self = Self(4);
}
unsafe impl Encode for NSGradientType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSGradientType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static NSMomentaryLightButton: NSButtonType = NSButtonType(NSButtonType::MomentaryLight.0);
pub static NSPushOnPushOffButton: NSButtonType = NSButtonType(NSButtonType::PushOnPushOff.0);
pub static NSToggleButton: NSButtonType = NSButtonType(NSButtonType::Toggle.0);
pub static NSSwitchButton: NSButtonType = NSButtonType(NSButtonType::Switch.0);
pub static NSRadioButton: NSButtonType = NSButtonType(NSButtonType::Radio.0);
pub static NSMomentaryChangeButton: NSButtonType = NSButtonType(NSButtonType::MomentaryChange.0);
pub static NSOnOffButton: NSButtonType = NSButtonType(NSButtonType::OnOff.0);
pub static NSMomentaryPushInButton: NSButtonType = NSButtonType(NSButtonType::MomentaryPushIn.0);
pub static NSAcceleratorButton: NSButtonType = NSButtonType(NSButtonType::Accelerator.0);
pub static NSMultiLevelAcceleratorButton: NSButtonType =
NSButtonType(NSButtonType::MultiLevelAccelerator.0);
pub static NSMomentaryPushButton: NSButtonType = NSButtonType(NSButtonType::MomentaryLight.0);
pub static NSMomentaryLight: NSButtonType = NSButtonType(NSButtonType::MomentaryPushIn.0);
pub static NSRoundedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Push.0);
pub static NSRegularSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::FlexiblePush.0);
pub static NSDisclosureBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Disclosure.0);
pub static NSShadowlessSquareBezelStyle: NSBezelStyle =
NSBezelStyle(NSBezelStyle::ShadowlessSquare.0);
pub static NSCircularBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Circular.0);
pub static NSTexturedSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::TexturedSquare.0);
pub static NSHelpButtonBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::HelpButton.0);
pub static NSSmallSquareBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::SmallSquare.0);
pub static NSTexturedRoundedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Toolbar.0);
pub static NSRoundRectBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::AccessoryBarAction.0);
pub static NSRecessedBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::AccessoryBar.0);
pub static NSRoundedDisclosureBezelStyle: NSBezelStyle =
NSBezelStyle(NSBezelStyle::PushDisclosure.0);
pub static NSInlineBezelStyle: NSBezelStyle = NSBezelStyle(NSBezelStyle::Badge.0);
pub static NSSmallIconButtonBezelStyle: NSBezelStyle = NSBezelStyle(2);
pub static NSThickSquareBezelStyle: NSBezelStyle = NSBezelStyle(3);
pub static NSThickerSquareBezelStyle: NSBezelStyle = NSBezelStyle(4);
extern_methods!(
/// NSDeprecated
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSButtonCell {
#[deprecated = "The gradientType property is unused, and setting it has no effect."]
#[method(gradientType)]
pub unsafe fn gradientType(&self) -> NSGradientType;
#[deprecated = "The gradientType property is unused, and setting it has no effect."]
#[method(setGradientType:)]
pub unsafe fn setGradientType(&self, gradient_type: NSGradientType);
#[deprecated = "Mnemonics are not used on macOS. Set the title property directly instead."]
#[method(setTitleWithMnemonic:)]
pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
#[deprecated = "Mnemonics are not used on macOS. Set the alternateTitle property directly instead."]
#[method(setAlternateTitleWithMnemonic:)]
pub unsafe fn setAlternateTitleWithMnemonic(
&self,
string_with_ampersand: Option<&NSString>,
);
#[deprecated = "Mnemonics are not used on macOS. Calling this method has no effect."]
#[method(setAlternateMnemonicLocation:)]
pub unsafe fn setAlternateMnemonicLocation(&self, location: NSUInteger);
#[deprecated = "Mnemonics are not used on macOS. This property always returns NSNotFound."]
#[method(alternateMnemonicLocation)]
pub unsafe fn alternateMnemonicLocation(&self) -> NSUInteger;
#[deprecated = "Mnemonics are not used on macOS. This property always returns an empty string."]
#[method_id(@__retain_semantics Other alternateMnemonic)]
pub unsafe fn alternateMnemonic(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSFont")]
#[deprecated = "The keyEquivalentFont property is no longer used. It always returns the NSButtonCell's font, and setting it has no effect."]
#[method_id(@__retain_semantics Other keyEquivalentFont)]
pub unsafe fn keyEquivalentFont(&self) -> Option<Retained<NSFont>>;
#[cfg(feature = "NSFont")]
#[deprecated = "The keyEquivalentFont property is no longer used. It always returns the NSButtonCell's font, and setting it has no effect."]
#[method(setKeyEquivalentFont:)]
pub unsafe fn setKeyEquivalentFont(&self, key_equivalent_font: Option<&NSFont>);
#[deprecated = "The keyEquivalentFont property is no longer used. Setting it has no effect."]
#[method(setKeyEquivalentFont:size:)]
pub unsafe fn setKeyEquivalentFont_size(&self, font_name: &NSString, font_size: CGFloat);
}
);

View File

@@ -0,0 +1,136 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSTouchBarItem")]
pub struct NSButtonTouchBarItem;
#[cfg(feature = "NSTouchBarItem")]
unsafe impl ClassType for NSButtonTouchBarItem {
#[inherits(NSObject)]
type Super = NSTouchBarItem;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSCoding for NSButtonTouchBarItem {}
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSObjectProtocol for NSButtonTouchBarItem {}
extern_methods!(
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSButtonTouchBarItem {
#[method_id(@__retain_semantics Other buttonTouchBarItemWithIdentifier:title:target:action:)]
pub unsafe fn buttonTouchBarItemWithIdentifier_title_target_action(
identifier: &NSTouchBarItemIdentifier,
title: &NSString,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other buttonTouchBarItemWithIdentifier:image:target:action:)]
pub unsafe fn buttonTouchBarItemWithIdentifier_image_target_action(
identifier: &NSTouchBarItemIdentifier,
image: &NSImage,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other buttonTouchBarItemWithIdentifier:title:image:target:action:)]
pub unsafe fn buttonTouchBarItemWithIdentifier_title_image_target_action(
identifier: &NSTouchBarItemIdentifier,
title: &NSString,
image: &NSImage,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other title)]
pub unsafe fn title(&self) -> Retained<NSString>;
#[method(setTitle:)]
pub unsafe fn setTitle(&self, title: &NSString);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other image)]
pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setImage:)]
pub unsafe fn setImage(&self, image: Option<&NSImage>);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other bezelColor)]
pub unsafe fn bezelColor(&self) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColor")]
#[method(setBezelColor:)]
pub unsafe fn setBezelColor(&self, bezel_color: Option<&NSColor>);
#[method_id(@__retain_semantics Other target)]
pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
#[method(action)]
pub unsafe fn action(&self) -> Option<Sel>;
#[method(setAction:)]
pub unsafe fn setAction(&self, action: Option<Sel>);
#[method(isEnabled)]
pub unsafe fn isEnabled(&self) -> bool;
#[method(setEnabled:)]
pub unsafe fn setEnabled(&self, enabled: bool);
#[method_id(@__retain_semantics Other customizationLabel)]
pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
#[method(setCustomizationLabel:)]
pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
}
);
extern_methods!(
/// Methods declared on superclass `NSTouchBarItem`
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSButtonTouchBarItem {
#[method_id(@__retain_semantics Init initWithIdentifier:)]
pub unsafe fn initWithIdentifier(
this: Allocated<Self>,
identifier: &NSTouchBarItemIdentifier,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSButtonTouchBarItem {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,112 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
use objc2_core_image::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSImageRep")]
pub struct NSCIImageRep;
#[cfg(feature = "NSImageRep")]
unsafe impl ClassType for NSCIImageRep {
#[inherits(NSObject)]
type Super = NSImageRep;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSImageRep")]
unsafe impl NSCoding for NSCIImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSCopying for NSCIImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSObjectProtocol for NSCIImageRep {}
extern_methods!(
#[cfg(feature = "NSImageRep")]
unsafe impl NSCIImageRep {
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
#[method_id(@__retain_semantics Other imageRepWithCIImage:)]
pub unsafe fn imageRepWithCIImage(image: &CIImage) -> Retained<Self>;
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
#[method_id(@__retain_semantics Init initWithCIImage:)]
pub unsafe fn initWithCIImage(this: Allocated<Self>, image: &CIImage) -> Retained<Self>;
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
#[method_id(@__retain_semantics Other CIImage)]
pub unsafe fn CIImage(&self) -> Retained<CIImage>;
}
);
extern_methods!(
/// Methods declared on superclass `NSImageRep`
#[cfg(feature = "NSImageRep")]
unsafe impl NSCIImageRep {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSImageRep")]
unsafe impl NSCIImageRep {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_category!(
/// Category "NSAppKitAdditions" on [`CIImage`].
#[doc(alias = "NSAppKitAdditions")]
pub unsafe trait CIImageNSAppKitAdditions {
#[cfg(all(feature = "NSBitmapImageRep", feature = "NSImageRep"))]
#[method_id(@__retain_semantics Init initWithBitmapImageRep:)]
unsafe fn initWithBitmapImageRep(
this: Allocated<Self>,
bitmap_image_rep: &NSBitmapImageRep,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSGraphics")]
#[method(drawInRect:fromRect:operation:fraction:)]
unsafe fn drawInRect_fromRect_operation_fraction(
&self,
rect: NSRect,
from_rect: NSRect,
op: NSCompositingOperation,
delta: CGFloat,
);
#[cfg(feature = "NSGraphics")]
#[method(drawAtPoint:fromRect:operation:fraction:)]
unsafe fn drawAtPoint_fromRect_operation_fraction(
&self,
point: NSPoint,
from_rect: NSRect,
op: NSCompositingOperation,
delta: CGFloat,
);
}
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
unsafe impl CIImageNSAppKitAdditions for CIImage {}
);

View File

@@ -0,0 +1,87 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSImageRep")]
#[deprecated]
pub struct NSCachedImageRep;
#[cfg(feature = "NSImageRep")]
unsafe impl ClassType for NSCachedImageRep {
#[inherits(NSObject)]
type Super = NSImageRep;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSImageRep")]
unsafe impl NSCoding for NSCachedImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSCopying for NSCachedImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSObjectProtocol for NSCachedImageRep {}
extern_methods!(
#[cfg(feature = "NSImageRep")]
unsafe impl NSCachedImageRep {
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[deprecated]
#[method_id(@__retain_semantics Init initWithWindow:rect:)]
pub unsafe fn initWithWindow_rect(
this: Allocated<Self>,
win: Option<&NSWindow>,
rect: NSRect,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSGraphics")]
#[deprecated]
#[method_id(@__retain_semantics Init initWithSize:depth:separate:alpha:)]
pub unsafe fn initWithSize_depth_separate_alpha(
this: Allocated<Self>,
size: NSSize,
depth: NSWindowDepth,
flag: bool,
alpha: bool,
) -> Option<Retained<Self>>;
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[deprecated]
#[method_id(@__retain_semantics Other window)]
pub unsafe fn window(&self, mtm: MainThreadMarker) -> Option<Retained<NSWindow>>;
#[deprecated]
#[method(rect)]
pub unsafe fn rect(&self) -> NSRect;
}
);
extern_methods!(
/// Methods declared on superclass `NSImageRep`
#[cfg(feature = "NSImageRep")]
unsafe impl NSCachedImageRep {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSImageRep")]
unsafe impl NSCachedImageRep {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,229 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
__inner_extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSTouchBarItem")]
pub struct NSCandidateListTouchBarItem<CandidateType: ?Sized = AnyObject> {
__superclass: NSTouchBarItem,
_inner0: PhantomData<*mut CandidateType>,
notunwindsafe: PhantomData<&'static mut ()>,
}
#[cfg(feature = "NSTouchBarItem")]
unsafe impl<CandidateType: ?Sized + Message> ClassType
for NSCandidateListTouchBarItem<CandidateType>
{
#[inherits(NSObject)]
type Super = NSTouchBarItem;
type Mutability = MainThreadOnly;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
#[cfg(feature = "NSTouchBarItem")]
unsafe impl<CandidateType: ?Sized + NSCoding> NSCoding
for NSCandidateListTouchBarItem<CandidateType>
{
}
#[cfg(feature = "NSTouchBarItem")]
unsafe impl<CandidateType: ?Sized> NSObjectProtocol for NSCandidateListTouchBarItem<CandidateType> {}
extern_methods!(
#[cfg(feature = "NSTouchBarItem")]
unsafe impl<CandidateType: Message> NSCandidateListTouchBarItem<CandidateType> {
#[cfg(all(
feature = "NSResponder",
feature = "NSTextInputClient",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other client)]
pub unsafe fn client(&self) -> Option<Retained<NSView>>;
#[cfg(all(
feature = "NSResponder",
feature = "NSTextInputClient",
feature = "NSView"
))]
#[method(setClient:)]
pub unsafe fn setClient(&self, client: Option<&NSView>);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSCandidateListTouchBarItemDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSCandidateListTouchBarItemDelegate>>,
);
#[method(isCollapsed)]
pub unsafe fn isCollapsed(&self) -> bool;
#[method(setCollapsed:)]
pub unsafe fn setCollapsed(&self, collapsed: bool);
#[method(allowsCollapsing)]
pub unsafe fn allowsCollapsing(&self) -> bool;
#[method(setAllowsCollapsing:)]
pub unsafe fn setAllowsCollapsing(&self, allows_collapsing: bool);
#[method(isCandidateListVisible)]
pub unsafe fn isCandidateListVisible(&self) -> bool;
#[method(updateWithInsertionPointVisibility:)]
pub unsafe fn updateWithInsertionPointVisibility(&self, is_visible: bool);
#[method(allowsTextInputContextCandidates)]
pub unsafe fn allowsTextInputContextCandidates(&self) -> bool;
#[method(setAllowsTextInputContextCandidates:)]
pub unsafe fn setAllowsTextInputContextCandidates(
&self,
allows_text_input_context_candidates: bool,
);
#[cfg(feature = "block2")]
#[method(attributedStringForCandidate)]
pub unsafe fn attributedStringForCandidate(
&self,
) -> *mut block2::Block<
dyn Fn(NonNull<CandidateType>, NSInteger) -> NonNull<NSAttributedString>,
>;
#[cfg(feature = "block2")]
#[method(setAttributedStringForCandidate:)]
pub unsafe fn setAttributedStringForCandidate(
&self,
attributed_string_for_candidate: Option<
&block2::Block<
dyn Fn(NonNull<CandidateType>, NSInteger) -> NonNull<NSAttributedString>,
>,
>,
);
#[method_id(@__retain_semantics Other candidates)]
pub unsafe fn candidates(&self) -> Retained<NSArray<CandidateType>>;
#[method(setCandidates:forSelectedRange:inString:)]
pub unsafe fn setCandidates_forSelectedRange_inString(
&self,
candidates: &NSArray<CandidateType>,
selected_range: NSRange,
original_string: Option<&NSString>,
);
#[method_id(@__retain_semantics Other customizationLabel)]
pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
#[method(setCustomizationLabel:)]
pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
}
);
extern_methods!(
/// Methods declared on superclass `NSTouchBarItem`
#[cfg(feature = "NSTouchBarItem")]
unsafe impl<CandidateType: Message> NSCandidateListTouchBarItem<CandidateType> {
#[method_id(@__retain_semantics Init initWithIdentifier:)]
pub unsafe fn initWithIdentifier(
this: Allocated<Self>,
identifier: &NSTouchBarItemIdentifier,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSTouchBarItem")]
unsafe impl<CandidateType: Message> NSCandidateListTouchBarItem<CandidateType> {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait NSCandidateListTouchBarItemDelegate:
NSObjectProtocol + IsMainThreadOnly
{
#[cfg(feature = "NSTouchBarItem")]
#[optional]
#[method(candidateListTouchBarItem:beginSelectingCandidateAtIndex:)]
unsafe fn candidateListTouchBarItem_beginSelectingCandidateAtIndex(
&self,
an_item: &NSCandidateListTouchBarItem,
index: NSInteger,
);
#[cfg(feature = "NSTouchBarItem")]
#[optional]
#[method(candidateListTouchBarItem:changeSelectionFromCandidateAtIndex:toIndex:)]
unsafe fn candidateListTouchBarItem_changeSelectionFromCandidateAtIndex_toIndex(
&self,
an_item: &NSCandidateListTouchBarItem,
previous_index: NSInteger,
index: NSInteger,
);
#[cfg(feature = "NSTouchBarItem")]
#[optional]
#[method(candidateListTouchBarItem:endSelectingCandidateAtIndex:)]
unsafe fn candidateListTouchBarItem_endSelectingCandidateAtIndex(
&self,
an_item: &NSCandidateListTouchBarItem,
index: NSInteger,
);
#[cfg(feature = "NSTouchBarItem")]
#[optional]
#[method(candidateListTouchBarItem:changedCandidateListVisibility:)]
unsafe fn candidateListTouchBarItem_changedCandidateListVisibility(
&self,
an_item: &NSCandidateListTouchBarItem,
is_visible: bool,
);
}
unsafe impl ProtocolType for dyn NSCandidateListTouchBarItemDelegate {}
);
extern_methods!(
/// NSCandidateListTouchBarItem
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSView {
#[cfg(feature = "NSTouchBarItem")]
#[method_id(@__retain_semantics Other candidateListTouchBarItem)]
pub unsafe fn candidateListTouchBarItem(
&self,
) -> Option<Retained<NSCandidateListTouchBarItem>>;
}
);
extern "C" {
#[cfg(feature = "NSTouchBarItem")]
pub static NSTouchBarItemIdentifierCandidateList: &'static NSTouchBarItemIdentifier;
}

View File

@@ -0,0 +1,990 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCellType(pub NSUInteger);
impl NSCellType {
pub const NSNullCellType: Self = Self(0);
pub const NSTextCellType: Self = Self(1);
pub const NSImageCellType: Self = Self(2);
}
unsafe impl Encode for NSCellType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCellType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCellAttribute(pub NSUInteger);
impl NSCellAttribute {
pub const NSCellDisabled: Self = Self(0);
pub const NSCellState: Self = Self(1);
pub const NSPushInCell: Self = Self(2);
pub const NSCellEditable: Self = Self(3);
pub const NSChangeGrayCell: Self = Self(4);
pub const NSCellHighlighted: Self = Self(5);
pub const NSCellLightsByContents: Self = Self(6);
pub const NSCellLightsByGray: Self = Self(7);
pub const NSChangeBackgroundCell: Self = Self(8);
pub const NSCellLightsByBackground: Self = Self(9);
pub const NSCellIsBordered: Self = Self(10);
pub const NSCellHasOverlappingImage: Self = Self(11);
pub const NSCellHasImageHorizontal: Self = Self(12);
pub const NSCellHasImageOnLeftOrBottom: Self = Self(13);
pub const NSCellChangesContents: Self = Self(14);
pub const NSCellIsInsetButton: Self = Self(15);
pub const NSCellAllowsMixedState: Self = Self(16);
}
unsafe impl Encode for NSCellAttribute {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCellAttribute {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCellImagePosition(pub NSUInteger);
impl NSCellImagePosition {
pub const NSNoImage: Self = Self(0);
pub const NSImageOnly: Self = Self(1);
pub const NSImageLeft: Self = Self(2);
pub const NSImageRight: Self = Self(3);
pub const NSImageBelow: Self = Self(4);
pub const NSImageAbove: Self = Self(5);
pub const NSImageOverlaps: Self = Self(6);
pub const NSImageLeading: Self = Self(7);
pub const NSImageTrailing: Self = Self(8);
}
unsafe impl Encode for NSCellImagePosition {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCellImagePosition {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSImageScaling(pub NSUInteger);
impl NSImageScaling {
pub const NSImageScaleProportionallyDown: Self = Self(0);
pub const NSImageScaleAxesIndependently: Self = Self(1);
pub const NSImageScaleNone: Self = Self(2);
pub const NSImageScaleProportionallyUpOrDown: Self = Self(3);
#[deprecated = "Use NSImageScaleProportionallyDown instead"]
pub const NSScaleProportionally: Self = Self(0);
#[deprecated = "Use NSImageScaleAxesIndependently instead"]
pub const NSScaleToFit: Self = Self(1);
#[deprecated = "Use NSImageScaleNone instead"]
pub const NSScaleNone: Self = Self(2);
}
unsafe impl Encode for NSImageScaling {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSImageScaling {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSControlStateValue = NSInteger;
pub static NSControlStateValueMixed: NSControlStateValue = -1;
pub static NSControlStateValueOff: NSControlStateValue = 0;
pub static NSControlStateValueOn: NSControlStateValue = 1;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCellStyleMask(pub NSUInteger);
bitflags::bitflags! {
impl NSCellStyleMask: NSUInteger {
const NSNoCellMask = 0;
const NSContentsCellMask = 1;
const NSPushInCellMask = 2;
const NSChangeGrayCellMask = 4;
const NSChangeBackgroundCellMask = 8;
}
}
unsafe impl Encode for NSCellStyleMask {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCellStyleMask {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSControlTint(pub NSUInteger);
impl NSControlTint {
pub const NSDefaultControlTint: Self = Self(0);
pub const NSBlueControlTint: Self = Self(1);
pub const NSGraphiteControlTint: Self = Self(6);
pub const NSClearControlTint: Self = Self(7);
}
unsafe impl Encode for NSControlTint {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSControlTint {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSControlSize(pub NSUInteger);
impl NSControlSize {
#[doc(alias = "NSControlSizeRegular")]
pub const Regular: Self = Self(0);
#[doc(alias = "NSControlSizeSmall")]
pub const Small: Self = Self(1);
#[doc(alias = "NSControlSizeMini")]
pub const Mini: Self = Self(2);
#[doc(alias = "NSControlSizeLarge")]
pub const Large: Self = Self(3);
}
unsafe impl Encode for NSControlSize {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSControlSize {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCell;
unsafe impl ClassType for NSCell {
type Super = NSObject;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "NSAccessibilityProtocols")]
unsafe impl NSAccessibility for NSCell {}
#[cfg(feature = "NSAccessibilityProtocols")]
unsafe impl NSAccessibilityElementProtocol for NSCell {}
unsafe impl NSCoding for NSCell {}
unsafe impl NSCopying for NSCell {}
unsafe impl NSObjectProtocol for NSCell {}
#[cfg(feature = "NSUserInterfaceItemIdentification")]
unsafe impl NSUserInterfaceItemIdentification for NSCell {}
extern_methods!(
unsafe impl NSCell {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initTextCell:)]
pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Init initImageCell:)]
pub unsafe fn initImageCell(
this: Allocated<Self>,
image: Option<&NSImage>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[method(prefersTrackingUntilMouseUp)]
pub unsafe fn prefersTrackingUntilMouseUp(mtm: MainThreadMarker) -> bool;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method_id(@__retain_semantics Other controlView)]
pub unsafe fn controlView(&self) -> Option<Retained<NSView>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(setControlView:)]
pub unsafe fn setControlView(&self, control_view: Option<&NSView>);
#[method(type)]
pub unsafe fn r#type(&self) -> NSCellType;
#[method(setType:)]
pub unsafe fn setType(&self, r#type: NSCellType);
#[method(state)]
pub unsafe fn state(&self) -> NSControlStateValue;
#[method(setState:)]
pub unsafe fn setState(&self, state: NSControlStateValue);
#[method_id(@__retain_semantics Other target)]
pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
#[method(action)]
pub unsafe fn action(&self) -> Option<Sel>;
#[method(setAction:)]
pub unsafe fn setAction(&self, action: Option<Sel>);
#[method(tag)]
pub unsafe fn tag(&self) -> NSInteger;
#[method(setTag:)]
pub unsafe fn setTag(&self, tag: NSInteger);
#[method_id(@__retain_semantics Other title)]
pub unsafe fn title(&self) -> Retained<NSString>;
#[method(setTitle:)]
pub unsafe fn setTitle(&self, title: &NSString);
#[method(isOpaque)]
pub unsafe fn isOpaque(&self) -> bool;
#[method(isEnabled)]
pub unsafe fn isEnabled(&self) -> bool;
#[method(setEnabled:)]
pub unsafe fn setEnabled(&self, enabled: bool);
#[cfg(feature = "NSEvent")]
#[method(sendActionOn:)]
pub unsafe fn sendActionOn(&self, mask: NSEventMask) -> NSInteger;
#[method(isContinuous)]
pub unsafe fn isContinuous(&self) -> bool;
#[method(setContinuous:)]
pub unsafe fn setContinuous(&self, continuous: bool);
#[method(isEditable)]
pub unsafe fn isEditable(&self) -> bool;
#[method(setEditable:)]
pub unsafe fn setEditable(&self, editable: bool);
#[method(isSelectable)]
pub unsafe fn isSelectable(&self) -> bool;
#[method(setSelectable:)]
pub unsafe fn setSelectable(&self, selectable: bool);
#[method(isBordered)]
pub unsafe fn isBordered(&self) -> bool;
#[method(setBordered:)]
pub unsafe fn setBordered(&self, bordered: bool);
#[method(isBezeled)]
pub unsafe fn isBezeled(&self) -> bool;
#[method(setBezeled:)]
pub unsafe fn setBezeled(&self, bezeled: bool);
#[method(isScrollable)]
pub unsafe fn isScrollable(&self) -> bool;
#[method(setScrollable:)]
pub unsafe fn setScrollable(&self, scrollable: bool);
#[method(isHighlighted)]
pub unsafe fn isHighlighted(&self) -> bool;
#[method(setHighlighted:)]
pub unsafe fn setHighlighted(&self, highlighted: bool);
#[cfg(feature = "NSText")]
#[method(alignment)]
pub unsafe fn alignment(&self) -> NSTextAlignment;
#[cfg(feature = "NSText")]
#[method(setAlignment:)]
pub unsafe fn setAlignment(&self, alignment: NSTextAlignment);
#[method(wraps)]
pub unsafe fn wraps(&self) -> bool;
#[method(setWraps:)]
pub unsafe fn setWraps(&self, wraps: bool);
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other font)]
pub unsafe fn font(&self) -> Option<Retained<NSFont>>;
#[cfg(feature = "NSFont")]
#[method(setFont:)]
pub unsafe fn setFont(&self, font: Option<&NSFont>);
#[method_id(@__retain_semantics Other keyEquivalent)]
pub unsafe fn keyEquivalent(&self) -> Retained<NSString>;
#[method_id(@__retain_semantics Other formatter)]
pub unsafe fn formatter(&self) -> Option<Retained<NSFormatter>>;
#[method(setFormatter:)]
pub unsafe fn setFormatter(&self, formatter: Option<&NSFormatter>);
#[method_id(@__retain_semantics Other objectValue)]
pub unsafe fn objectValue(&self) -> Option<Retained<AnyObject>>;
#[method(setObjectValue:)]
pub unsafe fn setObjectValue(&self, object_value: Option<&AnyObject>);
#[method(hasValidObjectValue)]
pub unsafe fn hasValidObjectValue(&self) -> bool;
#[method_id(@__retain_semantics Other stringValue)]
pub unsafe fn stringValue(&self) -> Retained<NSString>;
#[method(setStringValue:)]
pub unsafe fn setStringValue(&self, string_value: &NSString);
#[method(compare:)]
pub unsafe fn compare(&self, other_cell: &AnyObject) -> NSComparisonResult;
#[method(intValue)]
pub unsafe fn intValue(&self) -> c_int;
#[method(setIntValue:)]
pub unsafe fn setIntValue(&self, int_value: c_int);
#[method(floatValue)]
pub unsafe fn floatValue(&self) -> c_float;
#[method(setFloatValue:)]
pub unsafe fn setFloatValue(&self, float_value: c_float);
#[method(doubleValue)]
pub unsafe fn doubleValue(&self) -> c_double;
#[method(setDoubleValue:)]
pub unsafe fn setDoubleValue(&self, double_value: c_double);
#[method(integerValue)]
pub unsafe fn integerValue(&self) -> NSInteger;
#[method(setIntegerValue:)]
pub unsafe fn setIntegerValue(&self, integer_value: NSInteger);
#[method(takeIntValueFrom:)]
pub unsafe fn takeIntValueFrom(&self, sender: Option<&AnyObject>);
#[method(takeFloatValueFrom:)]
pub unsafe fn takeFloatValueFrom(&self, sender: Option<&AnyObject>);
#[method(takeDoubleValueFrom:)]
pub unsafe fn takeDoubleValueFrom(&self, sender: Option<&AnyObject>);
#[method(takeStringValueFrom:)]
pub unsafe fn takeStringValueFrom(&self, sender: Option<&AnyObject>);
#[method(takeObjectValueFrom:)]
pub unsafe fn takeObjectValueFrom(&self, sender: Option<&AnyObject>);
#[method(takeIntegerValueFrom:)]
pub unsafe fn takeIntegerValueFrom(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other image)]
pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setImage:)]
pub unsafe fn setImage(&self, image: Option<&NSImage>);
#[method(controlSize)]
pub unsafe fn controlSize(&self) -> NSControlSize;
#[method(setControlSize:)]
pub unsafe fn setControlSize(&self, control_size: NSControlSize);
#[method_id(@__retain_semantics Other representedObject)]
pub unsafe fn representedObject(&self) -> Option<Retained<AnyObject>>;
#[method(setRepresentedObject:)]
pub unsafe fn setRepresentedObject(&self, represented_object: Option<&AnyObject>);
#[method(cellAttribute:)]
pub unsafe fn cellAttribute(&self, parameter: NSCellAttribute) -> NSInteger;
#[method(setCellAttribute:to:)]
pub unsafe fn setCellAttribute_to(&self, parameter: NSCellAttribute, value: NSInteger);
#[method(imageRectForBounds:)]
pub unsafe fn imageRectForBounds(&self, rect: NSRect) -> NSRect;
#[method(titleRectForBounds:)]
pub unsafe fn titleRectForBounds(&self, rect: NSRect) -> NSRect;
#[method(drawingRectForBounds:)]
pub unsafe fn drawingRectForBounds(&self, rect: NSRect) -> NSRect;
#[method(cellSize)]
pub unsafe fn cellSize(&self) -> NSSize;
#[method(cellSizeForBounds:)]
pub unsafe fn cellSizeForBounds(&self, rect: NSRect) -> NSSize;
#[cfg(all(feature = "NSColor", feature = "NSResponder", feature = "NSView"))]
#[method_id(@__retain_semantics Other highlightColorWithFrame:inView:)]
pub unsafe fn highlightColorWithFrame_inView(
&self,
cell_frame: NSRect,
control_view: &NSView,
) -> Option<Retained<NSColor>>;
#[method(calcDrawInfo:)]
pub unsafe fn calcDrawInfo(&self, rect: NSRect);
#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
#[method_id(@__retain_semantics Other setUpFieldEditorAttributes:)]
pub unsafe fn setUpFieldEditorAttributes(&self, text_obj: &NSText) -> Retained<NSText>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(drawInteriorWithFrame:inView:)]
pub unsafe fn drawInteriorWithFrame_inView(
&self,
cell_frame: NSRect,
control_view: &NSView,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(drawWithFrame:inView:)]
pub unsafe fn drawWithFrame_inView(&self, cell_frame: NSRect, control_view: &NSView);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(highlight:withFrame:inView:)]
pub unsafe fn highlight_withFrame_inView(
&self,
flag: bool,
cell_frame: NSRect,
control_view: &NSView,
);
#[method(mouseDownFlags)]
pub unsafe fn mouseDownFlags(&self) -> NSInteger;
#[method(getPeriodicDelay:interval:)]
pub unsafe fn getPeriodicDelay_interval(
&self,
delay: NonNull<c_float>,
interval: NonNull<c_float>,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(startTrackingAt:inView:)]
pub unsafe fn startTrackingAt_inView(
&self,
start_point: NSPoint,
control_view: &NSView,
) -> bool;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(continueTracking:at:inView:)]
pub unsafe fn continueTracking_at_inView(
&self,
last_point: NSPoint,
current_point: NSPoint,
control_view: &NSView,
) -> bool;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(stopTracking:at:inView:mouseIsUp:)]
pub unsafe fn stopTracking_at_inView_mouseIsUp(
&self,
last_point: NSPoint,
stop_point: NSPoint,
control_view: &NSView,
flag: bool,
);
#[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
#[method(trackMouse:inRect:ofView:untilMouseUp:)]
pub unsafe fn trackMouse_inRect_ofView_untilMouseUp(
&self,
event: &NSEvent,
cell_frame: NSRect,
control_view: &NSView,
flag: bool,
) -> bool;
#[cfg(all(
feature = "NSEvent",
feature = "NSResponder",
feature = "NSText",
feature = "NSView"
))]
#[method(editWithFrame:inView:editor:delegate:event:)]
pub unsafe fn editWithFrame_inView_editor_delegate_event(
&self,
rect: NSRect,
control_view: &NSView,
text_obj: &NSText,
delegate: Option<&AnyObject>,
event: Option<&NSEvent>,
);
#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
#[method(selectWithFrame:inView:editor:delegate:start:length:)]
pub unsafe fn selectWithFrame_inView_editor_delegate_start_length(
&self,
rect: NSRect,
control_view: &NSView,
text_obj: &NSText,
delegate: Option<&AnyObject>,
sel_start: NSInteger,
sel_length: NSInteger,
);
#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
#[method(endEditing:)]
pub unsafe fn endEditing(&self, text_obj: &NSText);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(resetCursorRect:inView:)]
pub unsafe fn resetCursorRect_inView(&self, cell_frame: NSRect, control_view: &NSView);
#[cfg(feature = "NSMenu")]
#[method_id(@__retain_semantics Other menu)]
pub unsafe fn menu(&self) -> Option<Retained<NSMenu>>;
#[cfg(feature = "NSMenu")]
#[method(setMenu:)]
pub unsafe fn setMenu(&self, menu: Option<&NSMenu>);
#[cfg(all(
feature = "NSEvent",
feature = "NSMenu",
feature = "NSResponder",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other menuForEvent:inRect:ofView:)]
pub unsafe fn menuForEvent_inRect_ofView(
&self,
event: &NSEvent,
cell_frame: NSRect,
view: &NSView,
) -> Option<Retained<NSMenu>>;
#[cfg(feature = "NSMenu")]
#[method_id(@__retain_semantics Other defaultMenu)]
pub unsafe fn defaultMenu(mtm: MainThreadMarker) -> Option<Retained<NSMenu>>;
#[method(sendsActionOnEndEditing)]
pub unsafe fn sendsActionOnEndEditing(&self) -> bool;
#[method(setSendsActionOnEndEditing:)]
pub unsafe fn setSendsActionOnEndEditing(&self, sends_action_on_end_editing: bool);
#[cfg(feature = "NSText")]
#[method(baseWritingDirection)]
pub unsafe fn baseWritingDirection(&self) -> NSWritingDirection;
#[cfg(feature = "NSText")]
#[method(setBaseWritingDirection:)]
pub unsafe fn setBaseWritingDirection(&self, base_writing_direction: NSWritingDirection);
#[cfg(feature = "NSParagraphStyle")]
#[method(lineBreakMode)]
pub unsafe fn lineBreakMode(&self) -> NSLineBreakMode;
#[cfg(feature = "NSParagraphStyle")]
#[method(setLineBreakMode:)]
pub unsafe fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
#[method(allowsUndo)]
pub unsafe fn allowsUndo(&self) -> bool;
#[method(setAllowsUndo:)]
pub unsafe fn setAllowsUndo(&self, allows_undo: bool);
#[method(truncatesLastVisibleLine)]
pub unsafe fn truncatesLastVisibleLine(&self) -> bool;
#[method(setTruncatesLastVisibleLine:)]
pub unsafe fn setTruncatesLastVisibleLine(&self, truncates_last_visible_line: bool);
#[cfg(feature = "NSUserInterfaceLayout")]
#[method(userInterfaceLayoutDirection)]
pub unsafe fn userInterfaceLayoutDirection(&self) -> NSUserInterfaceLayoutDirection;
#[cfg(feature = "NSUserInterfaceLayout")]
#[method(setUserInterfaceLayoutDirection:)]
pub unsafe fn setUserInterfaceLayoutDirection(
&self,
user_interface_layout_direction: NSUserInterfaceLayoutDirection,
);
#[cfg(all(
feature = "NSResponder",
feature = "NSText",
feature = "NSTextView",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other fieldEditorForView:)]
pub unsafe fn fieldEditorForView(
&self,
control_view: &NSView,
) -> Option<Retained<NSTextView>>;
#[method(usesSingleLineMode)]
pub unsafe fn usesSingleLineMode(&self) -> bool;
#[method(setUsesSingleLineMode:)]
pub unsafe fn setUsesSingleLineMode(&self, uses_single_line_mode: bool);
#[cfg(all(
feature = "NSDraggingItem",
feature = "NSResponder",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other draggingImageComponentsWithFrame:inView:)]
pub unsafe fn draggingImageComponentsWithFrame_inView(
&self,
frame: NSRect,
view: &NSView,
) -> Retained<NSArray<NSDraggingImageComponent>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSCell {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSKeyboardUI
unsafe impl NSCell {
#[method(refusesFirstResponder)]
pub unsafe fn refusesFirstResponder(&self) -> bool;
#[method(setRefusesFirstResponder:)]
pub unsafe fn setRefusesFirstResponder(&self, refuses_first_responder: bool);
#[method(acceptsFirstResponder)]
pub unsafe fn acceptsFirstResponder(&self) -> bool;
#[method(showsFirstResponder)]
pub unsafe fn showsFirstResponder(&self) -> bool;
#[method(setShowsFirstResponder:)]
pub unsafe fn setShowsFirstResponder(&self, shows_first_responder: bool);
#[method(performClick:)]
pub unsafe fn performClick(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSGraphics")]
#[method(focusRingType)]
pub unsafe fn focusRingType(&self) -> NSFocusRingType;
#[cfg(feature = "NSGraphics")]
#[method(setFocusRingType:)]
pub unsafe fn setFocusRingType(&self, focus_ring_type: NSFocusRingType);
#[cfg(feature = "NSGraphics")]
#[method(defaultFocusRingType)]
pub unsafe fn defaultFocusRingType(mtm: MainThreadMarker) -> NSFocusRingType;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(drawFocusRingMaskWithFrame:inView:)]
pub unsafe fn drawFocusRingMaskWithFrame_inView(
&self,
cell_frame: NSRect,
control_view: &NSView,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(focusRingMaskBoundsForFrame:inView:)]
pub unsafe fn focusRingMaskBoundsForFrame_inView(
&self,
cell_frame: NSRect,
control_view: &NSView,
) -> NSRect;
#[method(wantsNotificationForMarkedText)]
pub unsafe fn wantsNotificationForMarkedText(&self) -> bool;
}
);
extern_methods!(
/// NSCellAttributedStringMethods
unsafe impl NSCell {
#[method_id(@__retain_semantics Other attributedStringValue)]
pub unsafe fn attributedStringValue(&self) -> Retained<NSAttributedString>;
#[method(setAttributedStringValue:)]
pub unsafe fn setAttributedStringValue(&self, attributed_string_value: &NSAttributedString);
#[method(allowsEditingTextAttributes)]
pub unsafe fn allowsEditingTextAttributes(&self) -> bool;
#[method(setAllowsEditingTextAttributes:)]
pub unsafe fn setAllowsEditingTextAttributes(&self, allows_editing_text_attributes: bool);
#[method(importsGraphics)]
pub unsafe fn importsGraphics(&self) -> bool;
#[method(setImportsGraphics:)]
pub unsafe fn setImportsGraphics(&self, imports_graphics: bool);
}
);
extern_methods!(
/// NSCellMixedState
unsafe impl NSCell {
#[method(allowsMixedState)]
pub unsafe fn allowsMixedState(&self) -> bool;
#[method(setAllowsMixedState:)]
pub unsafe fn setAllowsMixedState(&self, allows_mixed_state: bool);
#[method(nextState)]
pub unsafe fn nextState(&self) -> NSInteger;
#[method(setNextState)]
pub unsafe fn setNextState(&self);
}
);
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCellHitResult(pub NSUInteger);
bitflags::bitflags! {
impl NSCellHitResult: NSUInteger {
const NSCellHitNone = 0;
const NSCellHitContentArea = 1<<0;
const NSCellHitEditableTextArea = 1<<1;
const NSCellHitTrackableArea = 1<<2;
}
}
unsafe impl Encode for NSCellHitResult {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCellHitResult {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_methods!(
/// NSCellHitTest
unsafe impl NSCell {
#[cfg(all(feature = "NSEvent", feature = "NSResponder", feature = "NSView"))]
#[method(hitTestForEvent:inRect:ofView:)]
pub unsafe fn hitTestForEvent_inRect_ofView(
&self,
event: &NSEvent,
cell_frame: NSRect,
control_view: &NSView,
) -> NSCellHitResult;
}
);
extern_methods!(
/// NSCellExpansion
unsafe impl NSCell {
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(expansionFrameWithFrame:inView:)]
pub unsafe fn expansionFrameWithFrame_inView(
&self,
cell_frame: NSRect,
view: &NSView,
) -> NSRect;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(drawWithExpansionFrame:inView:)]
pub unsafe fn drawWithExpansionFrame_inView(&self, cell_frame: NSRect, view: &NSView);
}
);
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBackgroundStyle(pub NSInteger);
impl NSBackgroundStyle {
#[doc(alias = "NSBackgroundStyleNormal")]
pub const Normal: Self = Self(0);
#[doc(alias = "NSBackgroundStyleEmphasized")]
pub const Emphasized: Self = Self(1);
#[doc(alias = "NSBackgroundStyleRaised")]
pub const Raised: Self = Self(2);
#[doc(alias = "NSBackgroundStyleLowered")]
pub const Lowered: Self = Self(3);
}
unsafe impl Encode for NSBackgroundStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSBackgroundStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_methods!(
/// NSCellBackgroundStyle
unsafe impl NSCell {
#[method(backgroundStyle)]
pub unsafe fn backgroundStyle(&self) -> NSBackgroundStyle;
#[method(setBackgroundStyle:)]
pub unsafe fn setBackgroundStyle(&self, background_style: NSBackgroundStyle);
#[method(interiorBackgroundStyle)]
pub unsafe fn interiorBackgroundStyle(&self) -> NSBackgroundStyle;
}
);
extern "C" {
#[cfg(all(feature = "NSGraphics", feature = "NSImage"))]
pub fn NSDrawThreePartImage(
frame: NSRect,
start_cap: Option<&NSImage>,
center_fill: Option<&NSImage>,
end_cap: Option<&NSImage>,
vertical: Bool,
op: NSCompositingOperation,
alpha_fraction: CGFloat,
flipped: Bool,
);
}
extern "C" {
#[cfg(all(feature = "NSGraphics", feature = "NSImage"))]
pub fn NSDrawNinePartImage(
frame: NSRect,
top_left_corner: Option<&NSImage>,
top_edge_fill: Option<&NSImage>,
top_right_corner: Option<&NSImage>,
left_edge_fill: Option<&NSImage>,
center_fill: Option<&NSImage>,
right_edge_fill: Option<&NSImage>,
bottom_left_corner: Option<&NSImage>,
bottom_edge_fill: Option<&NSImage>,
bottom_right_corner: Option<&NSImage>,
op: NSCompositingOperation,
alpha_fraction: CGFloat,
flipped: Bool,
);
}
extern_methods!(
/// NSDeprecated
unsafe impl NSCell {
#[deprecated = "The controlTint property is not respected on 10.14 and later. For custom cells, use +[NSColor controlAccentColor] to respect the user's preferred accent color when drawing."]
#[method(controlTint)]
pub unsafe fn controlTint(&self) -> NSControlTint;
#[deprecated = "The controlTint property is not respected on 10.14 and later. For custom cells, use +[NSColor controlAccentColor] to respect the user's preferred accent color when drawing."]
#[method(setControlTint:)]
pub unsafe fn setControlTint(&self, control_tint: NSControlTint);
#[deprecated]
#[method(entryType)]
pub unsafe fn entryType(&self) -> NSInteger;
#[deprecated]
#[method(setEntryType:)]
pub unsafe fn setEntryType(&self, r#type: NSInteger);
#[deprecated]
#[method(isEntryAcceptable:)]
pub unsafe fn isEntryAcceptable(&self, string: &NSString) -> bool;
#[deprecated]
#[method(setFloatingPointFormat:left:right:)]
pub unsafe fn setFloatingPointFormat_left_right(
&self,
auto_range: bool,
left_digits: NSUInteger,
right_digits: NSUInteger,
);
#[deprecated]
#[method(setMnemonicLocation:)]
pub unsafe fn setMnemonicLocation(&self, location: NSUInteger);
#[deprecated]
#[method(mnemonicLocation)]
pub unsafe fn mnemonicLocation(&self) -> NSUInteger;
#[deprecated]
#[method_id(@__retain_semantics Other mnemonic)]
pub unsafe fn mnemonic(&self) -> Retained<NSString>;
#[deprecated]
#[method(setTitleWithMnemonic:)]
pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: &NSString);
}
);
pub static NSBackgroundStyleLight: NSBackgroundStyle =
NSBackgroundStyle(NSBackgroundStyle::Normal.0);
pub static NSBackgroundStyleDark: NSBackgroundStyle =
NSBackgroundStyle(NSBackgroundStyle::Emphasized.0);
pub type NSCellStateValue = NSControlStateValue;
pub static NSMixedState: NSControlStateValue = NSControlStateValueMixed;
pub static NSOffState: NSControlStateValue = NSControlStateValueOff;
pub static NSOnState: NSControlStateValue = NSControlStateValueOn;
pub static NSRegularControlSize: NSControlSize = NSControlSize(NSControlSize::Regular.0);
pub static NSSmallControlSize: NSControlSize = NSControlSize(NSControlSize::Small.0);
pub static NSMiniControlSize: NSControlSize = NSControlSize(NSControlSize::Mini.0);
extern "C" {
pub static NSControlTintDidChangeNotification: &'static NSNotificationName;
}
#[deprecated = "Use formatters instead"]
pub const NSAnyType: c_uint = 0;
#[deprecated = "Use formatters instead"]
pub const NSIntType: c_uint = 1;
#[deprecated = "Use formatters instead"]
pub const NSPositiveIntType: c_uint = 2;
#[deprecated = "Use formatters instead"]
pub const NSFloatType: c_uint = 3;
#[deprecated = "Use formatters instead"]
pub const NSPositiveFloatType: c_uint = 4;
#[deprecated = "Use formatters instead"]
pub const NSDoubleType: c_uint = 6;
#[deprecated = "Use formatters instead"]
pub const NSPositiveDoubleType: c_uint = 7;

View File

@@ -0,0 +1,79 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSGestureRecognizer")]
pub struct NSClickGestureRecognizer;
#[cfg(feature = "NSGestureRecognizer")]
unsafe impl ClassType for NSClickGestureRecognizer {
#[inherits(NSObject)]
type Super = NSGestureRecognizer;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "NSGestureRecognizer")]
unsafe impl NSCoding for NSClickGestureRecognizer {}
#[cfg(feature = "NSGestureRecognizer")]
unsafe impl NSObjectProtocol for NSClickGestureRecognizer {}
extern_methods!(
#[cfg(feature = "NSGestureRecognizer")]
unsafe impl NSClickGestureRecognizer {
#[method(buttonMask)]
pub unsafe fn buttonMask(&self) -> NSUInteger;
#[method(setButtonMask:)]
pub unsafe fn setButtonMask(&self, button_mask: NSUInteger);
#[method(numberOfClicksRequired)]
pub unsafe fn numberOfClicksRequired(&self) -> NSInteger;
#[method(setNumberOfClicksRequired:)]
pub unsafe fn setNumberOfClicksRequired(&self, number_of_clicks_required: NSInteger);
#[method(numberOfTouchesRequired)]
pub unsafe fn numberOfTouchesRequired(&self) -> NSInteger;
#[method(setNumberOfTouchesRequired:)]
pub unsafe fn setNumberOfTouchesRequired(&self, number_of_touches_required: NSInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSGestureRecognizer`
#[cfg(feature = "NSGestureRecognizer")]
unsafe impl NSClickGestureRecognizer {
#[method_id(@__retain_semantics Init initWithTarget:action:)]
pub unsafe fn initWithTarget_action(
this: Allocated<Self>,
target: Option<&AnyObject>,
action: Option<Sel>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSGestureRecognizer")]
unsafe impl NSClickGestureRecognizer {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,187 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
pub struct NSClipView;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl ClassType for NSClipView {
#[inherits(NSResponder, NSObject)]
type Super = NSView;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibility for NSClipView {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSClipView {}
#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAnimatablePropertyContainer for NSClipView {}
#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAppearanceCustomization for NSClipView {}
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSClipView {}
#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSDraggingDestination for NSClipView {}
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSClipView {}
#[cfg(all(
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSClipView {}
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSClipView {
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other backgroundColor)]
pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setBackgroundColor:)]
pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);
#[method(drawsBackground)]
pub unsafe fn drawsBackground(&self) -> bool;
#[method(setDrawsBackground:)]
pub unsafe fn setDrawsBackground(&self, draws_background: bool);
#[method_id(@__retain_semantics Other documentView)]
pub unsafe fn documentView(&self) -> Option<Retained<NSView>>;
#[method(setDocumentView:)]
pub unsafe fn setDocumentView(&self, document_view: Option<&NSView>);
#[method(documentRect)]
pub unsafe fn documentRect(&self) -> NSRect;
#[cfg(feature = "NSCursor")]
#[method_id(@__retain_semantics Other documentCursor)]
pub unsafe fn documentCursor(&self) -> Option<Retained<NSCursor>>;
#[cfg(feature = "NSCursor")]
#[method(setDocumentCursor:)]
pub unsafe fn setDocumentCursor(&self, document_cursor: Option<&NSCursor>);
#[method(documentVisibleRect)]
pub unsafe fn documentVisibleRect(&self) -> NSRect;
#[method(viewFrameChanged:)]
pub unsafe fn viewFrameChanged(&self, notification: &NSNotification);
#[method(viewBoundsChanged:)]
pub unsafe fn viewBoundsChanged(&self, notification: &NSNotification);
#[cfg(feature = "NSEvent")]
#[method(autoscroll:)]
pub unsafe fn autoscroll(&self, event: &NSEvent) -> bool;
#[method(scrollToPoint:)]
pub unsafe fn scrollToPoint(&self, new_origin: NSPoint);
#[method(constrainBoundsRect:)]
pub unsafe fn constrainBoundsRect(&self, proposed_bounds: NSRect) -> NSRect;
#[method(contentInsets)]
pub unsafe fn contentInsets(&self) -> NSEdgeInsets;
#[method(setContentInsets:)]
pub unsafe fn setContentInsets(&self, content_insets: NSEdgeInsets);
#[method(automaticallyAdjustsContentInsets)]
pub unsafe fn automaticallyAdjustsContentInsets(&self) -> bool;
#[method(setAutomaticallyAdjustsContentInsets:)]
pub unsafe fn setAutomaticallyAdjustsContentInsets(
&self,
automatically_adjusts_content_insets: bool,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSView`
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSClipView {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSClipView {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSClipView {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSClipViewSuperview
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSView {
#[method(reflectScrolledClipView:)]
pub unsafe fn reflectScrolledClipView(&self, clip_view: &NSClipView);
#[method(scrollClipView:toPoint:)]
pub unsafe fn scrollClipView_toPoint(&self, clip_view: &NSClipView, point: NSPoint);
}
);
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSClipView {
#[deprecated = "Use -constrainBoundsRect: instead."]
#[method(constrainScrollPoint:)]
pub unsafe fn constrainScrollPoint(&self, new_origin: NSPoint) -> NSPoint;
#[deprecated = "Setting this property has no effect. NSClipView will always minimize the area of the document view that is invalidated. To force invalidation of the document view, use -[NSView setNeedsDisplayInRect:]."]
#[method(copiesOnScroll)]
pub unsafe fn copiesOnScroll(&self) -> bool;
#[deprecated = "Setting this property has no effect. NSClipView will always minimize the area of the document view that is invalidated. To force invalidation of the document view, use -[NSView setNeedsDisplayInRect:]."]
#[method(setCopiesOnScroll:)]
pub unsafe fn setCopiesOnScroll(&self, copies_on_scroll: bool);
}
);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,293 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCollectionViewScrollDirection(pub NSInteger);
impl NSCollectionViewScrollDirection {
#[doc(alias = "NSCollectionViewScrollDirectionVertical")]
pub const Vertical: Self = Self(0);
#[doc(alias = "NSCollectionViewScrollDirectionHorizontal")]
pub const Horizontal: Self = Self(1);
}
unsafe impl Encode for NSCollectionViewScrollDirection {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSCollectionViewScrollDirection {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
#[cfg(feature = "NSCollectionView")]
pub static NSCollectionElementKindSectionHeader:
&'static NSCollectionViewSupplementaryElementKind;
}
extern "C" {
#[cfg(feature = "NSCollectionView")]
pub static NSCollectionElementKindSectionFooter:
&'static NSCollectionViewSupplementaryElementKind;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCollectionViewLayout")]
pub struct NSCollectionViewFlowLayoutInvalidationContext;
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl ClassType for NSCollectionViewFlowLayoutInvalidationContext {
#[inherits(NSObject)]
type Super = NSCollectionViewLayoutInvalidationContext;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSObjectProtocol for NSCollectionViewFlowLayoutInvalidationContext {}
extern_methods!(
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCollectionViewFlowLayoutInvalidationContext {
#[method(invalidateFlowLayoutDelegateMetrics)]
pub unsafe fn invalidateFlowLayoutDelegateMetrics(&self) -> bool;
#[method(setInvalidateFlowLayoutDelegateMetrics:)]
pub unsafe fn setInvalidateFlowLayoutDelegateMetrics(
&self,
invalidate_flow_layout_delegate_metrics: bool,
);
#[method(invalidateFlowLayoutAttributes)]
pub unsafe fn invalidateFlowLayoutAttributes(&self) -> bool;
#[method(setInvalidateFlowLayoutAttributes:)]
pub unsafe fn setInvalidateFlowLayoutAttributes(
&self,
invalidate_flow_layout_attributes: bool,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCollectionViewFlowLayoutInvalidationContext {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
#[cfg(feature = "NSCollectionView")]
pub unsafe trait NSCollectionViewDelegateFlowLayout:
NSCollectionViewDelegate + IsMainThreadOnly
{
#[cfg(all(
feature = "NSCollectionViewLayout",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(collectionView:layout:sizeForItemAtIndexPath:)]
unsafe fn collectionView_layout_sizeForItemAtIndexPath(
&self,
collection_view: &NSCollectionView,
collection_view_layout: &NSCollectionViewLayout,
index_path: &NSIndexPath,
) -> NSSize;
#[cfg(all(
feature = "NSCollectionViewLayout",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(collectionView:layout:insetForSectionAtIndex:)]
unsafe fn collectionView_layout_insetForSectionAtIndex(
&self,
collection_view: &NSCollectionView,
collection_view_layout: &NSCollectionViewLayout,
section: NSInteger,
) -> NSEdgeInsets;
#[cfg(all(
feature = "NSCollectionViewLayout",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(collectionView:layout:minimumLineSpacingForSectionAtIndex:)]
unsafe fn collectionView_layout_minimumLineSpacingForSectionAtIndex(
&self,
collection_view: &NSCollectionView,
collection_view_layout: &NSCollectionViewLayout,
section: NSInteger,
) -> CGFloat;
#[cfg(all(
feature = "NSCollectionViewLayout",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(collectionView:layout:minimumInteritemSpacingForSectionAtIndex:)]
unsafe fn collectionView_layout_minimumInteritemSpacingForSectionAtIndex(
&self,
collection_view: &NSCollectionView,
collection_view_layout: &NSCollectionViewLayout,
section: NSInteger,
) -> CGFloat;
#[cfg(all(
feature = "NSCollectionViewLayout",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(collectionView:layout:referenceSizeForHeaderInSection:)]
unsafe fn collectionView_layout_referenceSizeForHeaderInSection(
&self,
collection_view: &NSCollectionView,
collection_view_layout: &NSCollectionViewLayout,
section: NSInteger,
) -> NSSize;
#[cfg(all(
feature = "NSCollectionViewLayout",
feature = "NSResponder",
feature = "NSView"
))]
#[optional]
#[method(collectionView:layout:referenceSizeForFooterInSection:)]
unsafe fn collectionView_layout_referenceSizeForFooterInSection(
&self,
collection_view: &NSCollectionView,
collection_view_layout: &NSCollectionViewLayout,
section: NSInteger,
) -> NSSize;
}
#[cfg(feature = "NSCollectionView")]
unsafe impl ProtocolType for dyn NSCollectionViewDelegateFlowLayout {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCollectionViewLayout")]
pub struct NSCollectionViewFlowLayout;
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl ClassType for NSCollectionViewFlowLayout {
#[inherits(NSObject)]
type Super = NSCollectionViewLayout;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCoding for NSCollectionViewFlowLayout {}
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSObjectProtocol for NSCollectionViewFlowLayout {}
extern_methods!(
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCollectionViewFlowLayout {
#[method(minimumLineSpacing)]
pub unsafe fn minimumLineSpacing(&self) -> CGFloat;
#[method(setMinimumLineSpacing:)]
pub unsafe fn setMinimumLineSpacing(&self, minimum_line_spacing: CGFloat);
#[method(minimumInteritemSpacing)]
pub unsafe fn minimumInteritemSpacing(&self) -> CGFloat;
#[method(setMinimumInteritemSpacing:)]
pub unsafe fn setMinimumInteritemSpacing(&self, minimum_interitem_spacing: CGFloat);
#[method(itemSize)]
pub unsafe fn itemSize(&self) -> NSSize;
#[method(setItemSize:)]
pub unsafe fn setItemSize(&self, item_size: NSSize);
#[method(estimatedItemSize)]
pub unsafe fn estimatedItemSize(&self) -> NSSize;
#[method(setEstimatedItemSize:)]
pub unsafe fn setEstimatedItemSize(&self, estimated_item_size: NSSize);
#[method(scrollDirection)]
pub unsafe fn scrollDirection(&self) -> NSCollectionViewScrollDirection;
#[method(setScrollDirection:)]
pub unsafe fn setScrollDirection(&self, scroll_direction: NSCollectionViewScrollDirection);
#[method(headerReferenceSize)]
pub unsafe fn headerReferenceSize(&self) -> NSSize;
#[method(setHeaderReferenceSize:)]
pub unsafe fn setHeaderReferenceSize(&self, header_reference_size: NSSize);
#[method(footerReferenceSize)]
pub unsafe fn footerReferenceSize(&self) -> NSSize;
#[method(setFooterReferenceSize:)]
pub unsafe fn setFooterReferenceSize(&self, footer_reference_size: NSSize);
#[method(sectionInset)]
pub unsafe fn sectionInset(&self) -> NSEdgeInsets;
#[method(setSectionInset:)]
pub unsafe fn setSectionInset(&self, section_inset: NSEdgeInsets);
#[method(sectionHeadersPinToVisibleBounds)]
pub unsafe fn sectionHeadersPinToVisibleBounds(&self) -> bool;
#[method(setSectionHeadersPinToVisibleBounds:)]
pub unsafe fn setSectionHeadersPinToVisibleBounds(
&self,
section_headers_pin_to_visible_bounds: bool,
);
#[method(sectionFootersPinToVisibleBounds)]
pub unsafe fn sectionFootersPinToVisibleBounds(&self) -> bool;
#[method(setSectionFootersPinToVisibleBounds:)]
pub unsafe fn setSectionFootersPinToVisibleBounds(
&self,
section_footers_pin_to_visible_bounds: bool,
);
#[method(sectionAtIndexIsCollapsed:)]
pub unsafe fn sectionAtIndexIsCollapsed(&self, section_index: NSUInteger) -> bool;
#[method(collapseSectionAtIndex:)]
pub unsafe fn collapseSectionAtIndex(&self, section_index: NSUInteger);
#[method(expandSectionAtIndex:)]
pub unsafe fn expandSectionAtIndex(&self, section_index: NSUInteger);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCollectionViewFlowLayout {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,92 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCollectionViewLayout")]
pub struct NSCollectionViewGridLayout;
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl ClassType for NSCollectionViewGridLayout {
#[inherits(NSObject)]
type Super = NSCollectionViewLayout;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCoding for NSCollectionViewGridLayout {}
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSObjectProtocol for NSCollectionViewGridLayout {}
extern_methods!(
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCollectionViewGridLayout {
#[method(margins)]
pub unsafe fn margins(&self) -> NSEdgeInsets;
#[method(setMargins:)]
pub unsafe fn setMargins(&self, margins: NSEdgeInsets);
#[method(minimumInteritemSpacing)]
pub unsafe fn minimumInteritemSpacing(&self) -> CGFloat;
#[method(setMinimumInteritemSpacing:)]
pub unsafe fn setMinimumInteritemSpacing(&self, minimum_interitem_spacing: CGFloat);
#[method(minimumLineSpacing)]
pub unsafe fn minimumLineSpacing(&self) -> CGFloat;
#[method(setMinimumLineSpacing:)]
pub unsafe fn setMinimumLineSpacing(&self, minimum_line_spacing: CGFloat);
#[method(maximumNumberOfRows)]
pub unsafe fn maximumNumberOfRows(&self) -> NSUInteger;
#[method(setMaximumNumberOfRows:)]
pub unsafe fn setMaximumNumberOfRows(&self, maximum_number_of_rows: NSUInteger);
#[method(maximumNumberOfColumns)]
pub unsafe fn maximumNumberOfColumns(&self) -> NSUInteger;
#[method(setMaximumNumberOfColumns:)]
pub unsafe fn setMaximumNumberOfColumns(&self, maximum_number_of_columns: NSUInteger);
#[method(minimumItemSize)]
pub unsafe fn minimumItemSize(&self) -> NSSize;
#[method(setMinimumItemSize:)]
pub unsafe fn setMinimumItemSize(&self, minimum_item_size: NSSize);
#[method(maximumItemSize)]
pub unsafe fn maximumItemSize(&self) -> NSSize;
#[method(setMaximumItemSize:)]
pub unsafe fn setMaximumItemSize(&self, maximum_item_size: NSSize);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other backgroundColors)]
pub unsafe fn backgroundColors(&self) -> Retained<NSArray<NSColor>>;
#[cfg(feature = "NSColor")]
#[method(setBackgroundColors:)]
pub unsafe fn setBackgroundColors(&self, background_colors: Option<&NSArray<NSColor>>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCollectionViewGridLayout {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,524 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCollectionElementCategory(pub NSInteger);
impl NSCollectionElementCategory {
#[doc(alias = "NSCollectionElementCategoryItem")]
pub const Item: Self = Self(0);
#[doc(alias = "NSCollectionElementCategorySupplementaryView")]
pub const SupplementaryView: Self = Self(1);
#[doc(alias = "NSCollectionElementCategoryDecorationView")]
pub const DecorationView: Self = Self(2);
#[doc(alias = "NSCollectionElementCategoryInterItemGap")]
pub const InterItemGap: Self = Self(3);
}
unsafe impl Encode for NSCollectionElementCategory {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSCollectionElementCategory {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub type NSCollectionViewDecorationElementKind = NSString;
extern "C" {
#[cfg(feature = "NSCollectionView")]
pub static NSCollectionElementKindInterItemGapIndicator:
&'static NSCollectionViewSupplementaryElementKind;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCollectionViewLayoutAttributes;
unsafe impl ClassType for NSCollectionViewLayoutAttributes {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for NSCollectionViewLayoutAttributes {}
unsafe impl NSObjectProtocol for NSCollectionViewLayoutAttributes {}
extern_methods!(
unsafe impl NSCollectionViewLayoutAttributes {
#[method(frame)]
pub unsafe fn frame(&self) -> NSRect;
#[method(setFrame:)]
pub unsafe fn setFrame(&self, frame: NSRect);
#[method(size)]
pub unsafe fn size(&self) -> NSSize;
#[method(setSize:)]
pub unsafe fn setSize(&self, size: NSSize);
#[method(alpha)]
pub unsafe fn alpha(&self) -> CGFloat;
#[method(setAlpha:)]
pub unsafe fn setAlpha(&self, alpha: CGFloat);
#[method(zIndex)]
pub unsafe fn zIndex(&self) -> NSInteger;
#[method(setZIndex:)]
pub unsafe fn setZIndex(&self, z_index: NSInteger);
#[method(isHidden)]
pub unsafe fn isHidden(&self) -> bool;
#[method(setHidden:)]
pub unsafe fn setHidden(&self, hidden: bool);
#[method_id(@__retain_semantics Other indexPath)]
pub unsafe fn indexPath(&self) -> Option<Retained<NSIndexPath>>;
#[method(setIndexPath:)]
pub unsafe fn setIndexPath(&self, index_path: Option<&NSIndexPath>);
#[method(representedElementCategory)]
pub unsafe fn representedElementCategory(&self) -> NSCollectionElementCategory;
#[method_id(@__retain_semantics Other representedElementKind)]
pub unsafe fn representedElementKind(&self) -> Option<Retained<NSString>>;
#[method_id(@__retain_semantics Other layoutAttributesForItemWithIndexPath:)]
pub unsafe fn layoutAttributesForItemWithIndexPath(
index_path: &NSIndexPath,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other layoutAttributesForInterItemGapBeforeIndexPath:)]
pub unsafe fn layoutAttributesForInterItemGapBeforeIndexPath(
index_path: &NSIndexPath,
) -> Retained<Self>;
#[cfg(feature = "NSCollectionView")]
#[method_id(@__retain_semantics Other layoutAttributesForSupplementaryViewOfKind:withIndexPath:)]
pub unsafe fn layoutAttributesForSupplementaryViewOfKind_withIndexPath(
element_kind: &NSCollectionViewSupplementaryElementKind,
index_path: &NSIndexPath,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other layoutAttributesForDecorationViewOfKind:withIndexPath:)]
pub unsafe fn layoutAttributesForDecorationViewOfKind_withIndexPath(
decoration_view_kind: &NSCollectionViewDecorationElementKind,
index_path: &NSIndexPath,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSCollectionViewLayoutAttributes {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCollectionUpdateAction(pub NSInteger);
impl NSCollectionUpdateAction {
#[doc(alias = "NSCollectionUpdateActionInsert")]
pub const Insert: Self = Self(0);
#[doc(alias = "NSCollectionUpdateActionDelete")]
pub const Delete: Self = Self(1);
#[doc(alias = "NSCollectionUpdateActionReload")]
pub const Reload: Self = Self(2);
#[doc(alias = "NSCollectionUpdateActionMove")]
pub const Move: Self = Self(3);
#[doc(alias = "NSCollectionUpdateActionNone")]
pub const None: Self = Self(4);
}
unsafe impl Encode for NSCollectionUpdateAction {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSCollectionUpdateAction {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCollectionViewUpdateItem;
unsafe impl ClassType for NSCollectionViewUpdateItem {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSCollectionViewUpdateItem {}
extern_methods!(
unsafe impl NSCollectionViewUpdateItem {
#[method_id(@__retain_semantics Other indexPathBeforeUpdate)]
pub unsafe fn indexPathBeforeUpdate(&self) -> Option<Retained<NSIndexPath>>;
#[method_id(@__retain_semantics Other indexPathAfterUpdate)]
pub unsafe fn indexPathAfterUpdate(&self) -> Option<Retained<NSIndexPath>>;
#[method(updateAction)]
pub unsafe fn updateAction(&self) -> NSCollectionUpdateAction;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSCollectionViewUpdateItem {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCollectionViewLayoutInvalidationContext;
unsafe impl ClassType for NSCollectionViewLayoutInvalidationContext {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSCollectionViewLayoutInvalidationContext {}
extern_methods!(
unsafe impl NSCollectionViewLayoutInvalidationContext {
#[method(invalidateEverything)]
pub unsafe fn invalidateEverything(&self) -> bool;
#[method(invalidateDataSourceCounts)]
pub unsafe fn invalidateDataSourceCounts(&self) -> bool;
#[method(invalidateItemsAtIndexPaths:)]
pub unsafe fn invalidateItemsAtIndexPaths(&self, index_paths: &NSSet<NSIndexPath>);
#[cfg(feature = "NSCollectionView")]
#[method(invalidateSupplementaryElementsOfKind:atIndexPaths:)]
pub unsafe fn invalidateSupplementaryElementsOfKind_atIndexPaths(
&self,
element_kind: &NSCollectionViewSupplementaryElementKind,
index_paths: &NSSet<NSIndexPath>,
);
#[method(invalidateDecorationElementsOfKind:atIndexPaths:)]
pub unsafe fn invalidateDecorationElementsOfKind_atIndexPaths(
&self,
element_kind: &NSCollectionViewDecorationElementKind,
index_paths: &NSSet<NSIndexPath>,
);
#[method_id(@__retain_semantics Other invalidatedItemIndexPaths)]
pub unsafe fn invalidatedItemIndexPaths(&self) -> Option<Retained<NSSet<NSIndexPath>>>;
#[cfg(feature = "NSCollectionView")]
#[method_id(@__retain_semantics Other invalidatedSupplementaryIndexPaths)]
pub unsafe fn invalidatedSupplementaryIndexPaths(
&self,
) -> Option<
Retained<NSDictionary<NSCollectionViewSupplementaryElementKind, NSSet<NSIndexPath>>>,
>;
#[method_id(@__retain_semantics Other invalidatedDecorationIndexPaths)]
pub unsafe fn invalidatedDecorationIndexPaths(
&self,
) -> Option<Retained<NSDictionary<NSCollectionViewDecorationElementKind, NSSet<NSIndexPath>>>>;
#[method(contentOffsetAdjustment)]
pub unsafe fn contentOffsetAdjustment(&self) -> NSPoint;
#[method(setContentOffsetAdjustment:)]
pub unsafe fn setContentOffsetAdjustment(&self, content_offset_adjustment: NSPoint);
#[method(contentSizeAdjustment)]
pub unsafe fn contentSizeAdjustment(&self) -> NSSize;
#[method(setContentSizeAdjustment:)]
pub unsafe fn setContentSizeAdjustment(&self, content_size_adjustment: NSSize);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSCollectionViewLayoutInvalidationContext {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCollectionViewLayout;
unsafe impl ClassType for NSCollectionViewLayout {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSCollectionViewLayout {}
unsafe impl NSObjectProtocol for NSCollectionViewLayout {}
extern_methods!(
unsafe impl NSCollectionViewLayout {
#[cfg(all(
feature = "NSCollectionView",
feature = "NSResponder",
feature = "NSView"
))]
#[method_id(@__retain_semantics Other collectionView)]
pub unsafe fn collectionView(
&self,
mtm: MainThreadMarker,
) -> Option<Retained<NSCollectionView>>;
#[method(invalidateLayout)]
pub unsafe fn invalidateLayout(&self);
#[method(invalidateLayoutWithContext:)]
pub unsafe fn invalidateLayoutWithContext(
&self,
context: &NSCollectionViewLayoutInvalidationContext,
);
#[method(registerClass:forDecorationViewOfKind:)]
pub unsafe fn registerClass_forDecorationViewOfKind(
&self,
view_class: Option<&AnyClass>,
element_kind: &NSCollectionViewDecorationElementKind,
);
#[cfg(feature = "NSNib")]
#[method(registerNib:forDecorationViewOfKind:)]
pub unsafe fn registerNib_forDecorationViewOfKind(
&self,
nib: Option<&NSNib>,
element_kind: &NSCollectionViewDecorationElementKind,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSCollectionViewLayout {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
/// NSSubclassingHooks
unsafe impl NSCollectionViewLayout {
#[method(layoutAttributesClass)]
pub unsafe fn layoutAttributesClass() -> &'static AnyClass;
#[method(invalidationContextClass)]
pub unsafe fn invalidationContextClass() -> &'static AnyClass;
#[method(prepareLayout)]
pub unsafe fn prepareLayout(&self);
#[method_id(@__retain_semantics Other layoutAttributesForElementsInRect:)]
pub unsafe fn layoutAttributesForElementsInRect(
&self,
rect: NSRect,
) -> Retained<NSArray<NSCollectionViewLayoutAttributes>>;
#[method_id(@__retain_semantics Other layoutAttributesForItemAtIndexPath:)]
pub unsafe fn layoutAttributesForItemAtIndexPath(
&self,
index_path: &NSIndexPath,
) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
#[cfg(feature = "NSCollectionView")]
#[method_id(@__retain_semantics Other layoutAttributesForSupplementaryViewOfKind:atIndexPath:)]
pub unsafe fn layoutAttributesForSupplementaryViewOfKind_atIndexPath(
&self,
element_kind: &NSCollectionViewSupplementaryElementKind,
index_path: &NSIndexPath,
) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
#[method_id(@__retain_semantics Other layoutAttributesForDecorationViewOfKind:atIndexPath:)]
pub unsafe fn layoutAttributesForDecorationViewOfKind_atIndexPath(
&self,
element_kind: &NSCollectionViewDecorationElementKind,
index_path: &NSIndexPath,
) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
#[method_id(@__retain_semantics Other layoutAttributesForDropTargetAtPoint:)]
pub unsafe fn layoutAttributesForDropTargetAtPoint(
&self,
point_in_collection_view: NSPoint,
) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
#[method_id(@__retain_semantics Other layoutAttributesForInterItemGapBeforeIndexPath:)]
pub unsafe fn layoutAttributesForInterItemGapBeforeIndexPath(
&self,
index_path: &NSIndexPath,
) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
#[method(shouldInvalidateLayoutForBoundsChange:)]
pub unsafe fn shouldInvalidateLayoutForBoundsChange(&self, new_bounds: NSRect) -> bool;
#[method_id(@__retain_semantics Other invalidationContextForBoundsChange:)]
pub unsafe fn invalidationContextForBoundsChange(
&self,
new_bounds: NSRect,
) -> Retained<NSCollectionViewLayoutInvalidationContext>;
#[method(shouldInvalidateLayoutForPreferredLayoutAttributes:withOriginalAttributes:)]
pub unsafe fn shouldInvalidateLayoutForPreferredLayoutAttributes_withOriginalAttributes(
&self,
preferred_attributes: &NSCollectionViewLayoutAttributes,
original_attributes: &NSCollectionViewLayoutAttributes,
) -> bool;
#[method_id(@__retain_semantics Other invalidationContextForPreferredLayoutAttributes:withOriginalAttributes:)]
pub unsafe fn invalidationContextForPreferredLayoutAttributes_withOriginalAttributes(
&self,
preferred_attributes: &NSCollectionViewLayoutAttributes,
original_attributes: &NSCollectionViewLayoutAttributes,
) -> Retained<NSCollectionViewLayoutInvalidationContext>;
#[method(targetContentOffsetForProposedContentOffset:withScrollingVelocity:)]
pub unsafe fn targetContentOffsetForProposedContentOffset_withScrollingVelocity(
&self,
proposed_content_offset: NSPoint,
velocity: NSPoint,
) -> NSPoint;
#[method(targetContentOffsetForProposedContentOffset:)]
pub unsafe fn targetContentOffsetForProposedContentOffset(
&self,
proposed_content_offset: NSPoint,
) -> NSPoint;
#[method(collectionViewContentSize)]
pub unsafe fn collectionViewContentSize(&self) -> NSSize;
}
);
extern_methods!(
/// NSUpdateSupportHooks
unsafe impl NSCollectionViewLayout {
#[method(prepareForCollectionViewUpdates:)]
pub unsafe fn prepareForCollectionViewUpdates(
&self,
update_items: &NSArray<NSCollectionViewUpdateItem>,
);
#[method(finalizeCollectionViewUpdates)]
pub unsafe fn finalizeCollectionViewUpdates(&self);
#[method(prepareForAnimatedBoundsChange:)]
pub unsafe fn prepareForAnimatedBoundsChange(&self, old_bounds: NSRect);
#[method(finalizeAnimatedBoundsChange)]
pub unsafe fn finalizeAnimatedBoundsChange(&self);
#[method(prepareForTransitionToLayout:)]
pub unsafe fn prepareForTransitionToLayout(&self, new_layout: &NSCollectionViewLayout);
#[method(prepareForTransitionFromLayout:)]
pub unsafe fn prepareForTransitionFromLayout(&self, old_layout: &NSCollectionViewLayout);
#[method(finalizeLayoutTransition)]
pub unsafe fn finalizeLayoutTransition(&self);
#[method_id(@__retain_semantics Other initialLayoutAttributesForAppearingItemAtIndexPath:)]
pub unsafe fn initialLayoutAttributesForAppearingItemAtIndexPath(
&self,
item_index_path: &NSIndexPath,
) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
#[method_id(@__retain_semantics Other finalLayoutAttributesForDisappearingItemAtIndexPath:)]
pub unsafe fn finalLayoutAttributesForDisappearingItemAtIndexPath(
&self,
item_index_path: &NSIndexPath,
) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
#[cfg(feature = "NSCollectionView")]
#[method_id(@__retain_semantics Other initialLayoutAttributesForAppearingSupplementaryElementOfKind:atIndexPath:)]
pub unsafe fn initialLayoutAttributesForAppearingSupplementaryElementOfKind_atIndexPath(
&self,
element_kind: &NSCollectionViewSupplementaryElementKind,
element_index_path: &NSIndexPath,
) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
#[cfg(feature = "NSCollectionView")]
#[method_id(@__retain_semantics Other finalLayoutAttributesForDisappearingSupplementaryElementOfKind:atIndexPath:)]
pub unsafe fn finalLayoutAttributesForDisappearingSupplementaryElementOfKind_atIndexPath(
&self,
element_kind: &NSCollectionViewSupplementaryElementKind,
element_index_path: &NSIndexPath,
) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
#[method_id(@__retain_semantics Other initialLayoutAttributesForAppearingDecorationElementOfKind:atIndexPath:)]
pub unsafe fn initialLayoutAttributesForAppearingDecorationElementOfKind_atIndexPath(
&self,
element_kind: &NSCollectionViewDecorationElementKind,
decoration_index_path: &NSIndexPath,
) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
#[method_id(@__retain_semantics Other finalLayoutAttributesForDisappearingDecorationElementOfKind:atIndexPath:)]
pub unsafe fn finalLayoutAttributesForDisappearingDecorationElementOfKind_atIndexPath(
&self,
element_kind: &NSCollectionViewDecorationElementKind,
decoration_index_path: &NSIndexPath,
) -> Option<Retained<NSCollectionViewLayoutAttributes>>;
#[cfg(feature = "NSCollectionView")]
#[method_id(@__retain_semantics Other indexPathsToDeleteForSupplementaryViewOfKind:)]
pub unsafe fn indexPathsToDeleteForSupplementaryViewOfKind(
&self,
element_kind: &NSCollectionViewSupplementaryElementKind,
) -> Retained<NSSet<NSIndexPath>>;
#[method_id(@__retain_semantics Other indexPathsToDeleteForDecorationViewOfKind:)]
pub unsafe fn indexPathsToDeleteForDecorationViewOfKind(
&self,
element_kind: &NSCollectionViewDecorationElementKind,
) -> Retained<NSSet<NSIndexPath>>;
#[cfg(feature = "NSCollectionView")]
#[method_id(@__retain_semantics Other indexPathsToInsertForSupplementaryViewOfKind:)]
pub unsafe fn indexPathsToInsertForSupplementaryViewOfKind(
&self,
element_kind: &NSCollectionViewSupplementaryElementKind,
) -> Retained<NSSet<NSIndexPath>>;
#[method_id(@__retain_semantics Other indexPathsToInsertForDecorationViewOfKind:)]
pub unsafe fn indexPathsToInsertForDecorationViewOfKind(
&self,
element_kind: &NSCollectionViewDecorationElementKind,
) -> Retained<NSSet<NSIndexPath>>;
}
);

View File

@@ -0,0 +1,76 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub type NSCollectionViewTransitionLayoutAnimatedKey = NSString;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSCollectionViewLayout")]
pub struct NSCollectionViewTransitionLayout;
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl ClassType for NSCollectionViewTransitionLayout {
#[inherits(NSObject)]
type Super = NSCollectionViewLayout;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCoding for NSCollectionViewTransitionLayout {}
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSObjectProtocol for NSCollectionViewTransitionLayout {}
extern_methods!(
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCollectionViewTransitionLayout {
#[method(transitionProgress)]
pub unsafe fn transitionProgress(&self) -> CGFloat;
#[method(setTransitionProgress:)]
pub unsafe fn setTransitionProgress(&self, transition_progress: CGFloat);
#[method_id(@__retain_semantics Other currentLayout)]
pub unsafe fn currentLayout(&self) -> Retained<NSCollectionViewLayout>;
#[method_id(@__retain_semantics Other nextLayout)]
pub unsafe fn nextLayout(&self) -> Retained<NSCollectionViewLayout>;
#[method_id(@__retain_semantics Init initWithCurrentLayout:nextLayout:)]
pub unsafe fn initWithCurrentLayout_nextLayout(
this: Allocated<Self>,
current_layout: &NSCollectionViewLayout,
new_layout: &NSCollectionViewLayout,
) -> Retained<Self>;
#[method(updateValue:forAnimatedKey:)]
pub unsafe fn updateValue_forAnimatedKey(
&self,
value: CGFloat,
key: &NSCollectionViewTransitionLayoutAnimatedKey,
);
#[method(valueForAnimatedKey:)]
pub unsafe fn valueForAnimatedKey(
&self,
key: &NSCollectionViewTransitionLayoutAnimatedKey,
) -> CGFloat;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSCollectionViewLayout")]
unsafe impl NSCollectionViewTransitionLayout {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,731 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
use objc2_core_image::*;
use objc2_foundation::*;
use crate::*;
#[cfg(feature = "NSApplication")]
pub static NSAppKitVersionNumberWithPatternColorLeakFix: NSAppKitVersion = 641.0 as _;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorType(pub NSInteger);
impl NSColorType {
#[doc(alias = "NSColorTypeComponentBased")]
pub const ComponentBased: Self = Self(0);
#[doc(alias = "NSColorTypePattern")]
pub const Pattern: Self = Self(1);
#[doc(alias = "NSColorTypeCatalog")]
pub const Catalog: Self = Self(2);
}
unsafe impl Encode for NSColorType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSColorType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorSystemEffect(pub NSInteger);
impl NSColorSystemEffect {
#[doc(alias = "NSColorSystemEffectNone")]
pub const None: Self = Self(0);
#[doc(alias = "NSColorSystemEffectPressed")]
pub const Pressed: Self = Self(1);
#[doc(alias = "NSColorSystemEffectDeepPressed")]
pub const DeepPressed: Self = Self(2);
#[doc(alias = "NSColorSystemEffectDisabled")]
pub const Disabled: Self = Self(3);
#[doc(alias = "NSColorSystemEffectRollover")]
pub const Rollover: Self = Self(4);
}
unsafe impl Encode for NSColorSystemEffect {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSColorSystemEffect {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSColor;
unsafe impl ClassType for NSColor {
type Super = NSObject;
type Mutability = Immutable;
}
);
unsafe impl Send for NSColor {}
unsafe impl Sync for NSColor {}
unsafe impl NSCoding for NSColor {}
unsafe impl NSCopying for NSColor {}
unsafe impl NSObjectProtocol for NSColor {}
#[cfg(feature = "NSPasteboard")]
unsafe impl NSPasteboardReading for NSColor {}
#[cfg(feature = "NSPasteboard")]
unsafe impl NSPasteboardWriting for NSColor {}
unsafe impl NSSecureCoding for NSColor {}
extern_methods!(
unsafe impl NSColor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSColorSpace")]
#[method_id(@__retain_semantics Other colorWithColorSpace:components:count:)]
pub unsafe fn colorWithColorSpace_components_count(
space: &NSColorSpace,
components: NonNull<CGFloat>,
number_of_components: NSInteger,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithSRGBRed:green:blue:alpha:)]
pub unsafe fn colorWithSRGBRed_green_blue_alpha(
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithGenericGamma22White:alpha:)]
pub unsafe fn colorWithGenericGamma22White_alpha(
white: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithDisplayP3Red:green:blue:alpha:)]
pub unsafe fn colorWithDisplayP3Red_green_blue_alpha(
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithWhite:alpha:)]
pub unsafe fn colorWithWhite_alpha(white: CGFloat, alpha: CGFloat) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithRed:green:blue:alpha:)]
pub unsafe fn colorWithRed_green_blue_alpha(
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithHue:saturation:brightness:alpha:)]
pub unsafe fn colorWithHue_saturation_brightness_alpha(
hue: CGFloat,
saturation: CGFloat,
brightness: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[cfg(feature = "NSColorSpace")]
#[method_id(@__retain_semantics Other colorWithColorSpace:hue:saturation:brightness:alpha:)]
pub unsafe fn colorWithColorSpace_hue_saturation_brightness_alpha(
space: &NSColorSpace,
hue: CGFloat,
saturation: CGFloat,
brightness: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[cfg(feature = "NSColorList")]
#[method_id(@__retain_semantics Other colorWithCatalogName:colorName:)]
pub unsafe fn colorWithCatalogName_colorName(
list_name: &NSColorListName,
color_name: &NSColorName,
) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColorList")]
#[method_id(@__retain_semantics Other colorNamed:bundle:)]
pub unsafe fn colorNamed_bundle(
name: &NSColorName,
bundle: Option<&NSBundle>,
) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColorList")]
#[method_id(@__retain_semantics Other colorNamed:)]
pub unsafe fn colorNamed(name: &NSColorName) -> Option<Retained<NSColor>>;
#[cfg(all(feature = "NSAppearance", feature = "NSColorList", feature = "block2"))]
#[method_id(@__retain_semantics Other colorWithName:dynamicProvider:)]
pub unsafe fn colorWithName_dynamicProvider(
color_name: Option<&NSColorName>,
dynamic_provider: &block2::Block<dyn Fn(NonNull<NSAppearance>) -> NonNull<NSColor>>,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithDeviceWhite:alpha:)]
pub unsafe fn colorWithDeviceWhite_alpha(
white: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithDeviceRed:green:blue:alpha:)]
pub unsafe fn colorWithDeviceRed_green_blue_alpha(
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithDeviceHue:saturation:brightness:alpha:)]
pub unsafe fn colorWithDeviceHue_saturation_brightness_alpha(
hue: CGFloat,
saturation: CGFloat,
brightness: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithDeviceCyan:magenta:yellow:black:alpha:)]
pub unsafe fn colorWithDeviceCyan_magenta_yellow_black_alpha(
cyan: CGFloat,
magenta: CGFloat,
yellow: CGFloat,
black: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithCalibratedWhite:alpha:)]
pub unsafe fn colorWithCalibratedWhite_alpha(
white: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithCalibratedRed:green:blue:alpha:)]
pub unsafe fn colorWithCalibratedRed_green_blue_alpha(
red: CGFloat,
green: CGFloat,
blue: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other colorWithCalibratedHue:saturation:brightness:alpha:)]
pub unsafe fn colorWithCalibratedHue_saturation_brightness_alpha(
hue: CGFloat,
saturation: CGFloat,
brightness: CGFloat,
alpha: CGFloat,
) -> Retained<NSColor>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other colorWithPatternImage:)]
pub unsafe fn colorWithPatternImage(image: &NSImage) -> Retained<NSColor>;
#[method(type)]
pub unsafe fn r#type(&self) -> NSColorType;
#[method_id(@__retain_semantics Other colorUsingType:)]
pub unsafe fn colorUsingType(&self, r#type: NSColorType) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSColorSpace")]
#[method_id(@__retain_semantics Other colorUsingColorSpace:)]
pub unsafe fn colorUsingColorSpace(
&self,
space: &NSColorSpace,
) -> Option<Retained<NSColor>>;
#[method_id(@__retain_semantics Other blackColor)]
pub unsafe fn blackColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other darkGrayColor)]
pub unsafe fn darkGrayColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other lightGrayColor)]
pub unsafe fn lightGrayColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other whiteColor)]
pub unsafe fn whiteColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other grayColor)]
pub unsafe fn grayColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other redColor)]
pub unsafe fn redColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other greenColor)]
pub unsafe fn greenColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other blueColor)]
pub unsafe fn blueColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other cyanColor)]
pub unsafe fn cyanColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other yellowColor)]
pub unsafe fn yellowColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other magentaColor)]
pub unsafe fn magentaColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other orangeColor)]
pub unsafe fn orangeColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other purpleColor)]
pub unsafe fn purpleColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other brownColor)]
pub unsafe fn brownColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other clearColor)]
pub unsafe fn clearColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other labelColor)]
pub unsafe fn labelColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other secondaryLabelColor)]
pub unsafe fn secondaryLabelColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other tertiaryLabelColor)]
pub unsafe fn tertiaryLabelColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other quaternaryLabelColor)]
pub unsafe fn quaternaryLabelColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other quinaryLabelColor)]
pub unsafe fn quinaryLabelColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other linkColor)]
pub unsafe fn linkColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other placeholderTextColor)]
pub unsafe fn placeholderTextColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other windowFrameTextColor)]
pub unsafe fn windowFrameTextColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other selectedMenuItemTextColor)]
pub unsafe fn selectedMenuItemTextColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other alternateSelectedControlTextColor)]
pub unsafe fn alternateSelectedControlTextColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other headerTextColor)]
pub unsafe fn headerTextColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other separatorColor)]
pub unsafe fn separatorColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other gridColor)]
pub unsafe fn gridColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other windowBackgroundColor)]
pub unsafe fn windowBackgroundColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other underPageBackgroundColor)]
pub unsafe fn underPageBackgroundColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other controlBackgroundColor)]
pub unsafe fn controlBackgroundColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other selectedContentBackgroundColor)]
pub unsafe fn selectedContentBackgroundColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other unemphasizedSelectedContentBackgroundColor)]
pub unsafe fn unemphasizedSelectedContentBackgroundColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other alternatingContentBackgroundColors)]
pub unsafe fn alternatingContentBackgroundColors() -> Retained<NSArray<NSColor>>;
#[method_id(@__retain_semantics Other findHighlightColor)]
pub unsafe fn findHighlightColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other textColor)]
pub unsafe fn textColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other textBackgroundColor)]
pub unsafe fn textBackgroundColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other textInsertionPointColor)]
pub unsafe fn textInsertionPointColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other selectedTextColor)]
pub unsafe fn selectedTextColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other selectedTextBackgroundColor)]
pub unsafe fn selectedTextBackgroundColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other unemphasizedSelectedTextBackgroundColor)]
pub unsafe fn unemphasizedSelectedTextBackgroundColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other unemphasizedSelectedTextColor)]
pub unsafe fn unemphasizedSelectedTextColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other controlColor)]
pub unsafe fn controlColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other controlTextColor)]
pub unsafe fn controlTextColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other selectedControlColor)]
pub unsafe fn selectedControlColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other selectedControlTextColor)]
pub unsafe fn selectedControlTextColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other disabledControlTextColor)]
pub unsafe fn disabledControlTextColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other keyboardFocusIndicatorColor)]
pub unsafe fn keyboardFocusIndicatorColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other scrubberTexturedBackgroundColor)]
pub unsafe fn scrubberTexturedBackgroundColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemRedColor)]
pub unsafe fn systemRedColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemGreenColor)]
pub unsafe fn systemGreenColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemBlueColor)]
pub unsafe fn systemBlueColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemOrangeColor)]
pub unsafe fn systemOrangeColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemYellowColor)]
pub unsafe fn systemYellowColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemBrownColor)]
pub unsafe fn systemBrownColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemPinkColor)]
pub unsafe fn systemPinkColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemPurpleColor)]
pub unsafe fn systemPurpleColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemGrayColor)]
pub unsafe fn systemGrayColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemTealColor)]
pub unsafe fn systemTealColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemIndigoColor)]
pub unsafe fn systemIndigoColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemMintColor)]
pub unsafe fn systemMintColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemCyanColor)]
pub unsafe fn systemCyanColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other systemFillColor)]
pub unsafe fn systemFillColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other secondarySystemFillColor)]
pub unsafe fn secondarySystemFillColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other tertiarySystemFillColor)]
pub unsafe fn tertiarySystemFillColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other quaternarySystemFillColor)]
pub unsafe fn quaternarySystemFillColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other quinarySystemFillColor)]
pub unsafe fn quinarySystemFillColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other controlAccentColor)]
pub unsafe fn controlAccentColor() -> Retained<NSColor>;
#[cfg(feature = "NSCell")]
#[method(currentControlTint)]
pub unsafe fn currentControlTint() -> NSControlTint;
#[cfg(feature = "NSCell")]
#[deprecated = "NSControlTint does not describe the full range of available control accent colors. Use +[NSColor controlAccentColor] instead."]
#[method_id(@__retain_semantics Other colorForControlTint:)]
pub unsafe fn colorForControlTint(control_tint: NSControlTint) -> Retained<NSColor>;
#[method_id(@__retain_semantics Other highlightColor)]
pub unsafe fn highlightColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other shadowColor)]
pub unsafe fn shadowColor() -> Retained<NSColor>;
#[method_id(@__retain_semantics Other highlightWithLevel:)]
pub unsafe fn highlightWithLevel(&self, val: CGFloat) -> Option<Retained<NSColor>>;
#[method_id(@__retain_semantics Other shadowWithLevel:)]
pub unsafe fn shadowWithLevel(&self, val: CGFloat) -> Option<Retained<NSColor>>;
#[method_id(@__retain_semantics Other colorWithSystemEffect:)]
pub unsafe fn colorWithSystemEffect(
&self,
system_effect: NSColorSystemEffect,
) -> Retained<NSColor>;
#[method(set)]
pub unsafe fn set(&self);
#[method(setFill)]
pub unsafe fn setFill(&self);
#[method(setStroke)]
pub unsafe fn setStroke(&self);
#[method_id(@__retain_semantics Other blendedColorWithFraction:ofColor:)]
pub unsafe fn blendedColorWithFraction_ofColor(
&self,
fraction: CGFloat,
color: &NSColor,
) -> Option<Retained<NSColor>>;
#[method_id(@__retain_semantics Other colorWithAlphaComponent:)]
pub unsafe fn colorWithAlphaComponent(&self, alpha: CGFloat) -> Retained<NSColor>;
#[cfg(feature = "NSColorList")]
#[method_id(@__retain_semantics Other catalogNameComponent)]
pub unsafe fn catalogNameComponent(&self) -> Retained<NSColorListName>;
#[cfg(feature = "NSColorList")]
#[method_id(@__retain_semantics Other colorNameComponent)]
pub unsafe fn colorNameComponent(&self) -> Retained<NSColorName>;
#[method_id(@__retain_semantics Other localizedCatalogNameComponent)]
pub unsafe fn localizedCatalogNameComponent(&self) -> Retained<NSString>;
#[method_id(@__retain_semantics Other localizedColorNameComponent)]
pub unsafe fn localizedColorNameComponent(&self) -> Retained<NSString>;
#[method(redComponent)]
pub unsafe fn redComponent(&self) -> CGFloat;
#[method(greenComponent)]
pub unsafe fn greenComponent(&self) -> CGFloat;
#[method(blueComponent)]
pub unsafe fn blueComponent(&self) -> CGFloat;
#[method(getRed:green:blue:alpha:)]
pub unsafe fn getRed_green_blue_alpha(
&self,
red: *mut CGFloat,
green: *mut CGFloat,
blue: *mut CGFloat,
alpha: *mut CGFloat,
);
#[method(hueComponent)]
pub unsafe fn hueComponent(&self) -> CGFloat;
#[method(saturationComponent)]
pub unsafe fn saturationComponent(&self) -> CGFloat;
#[method(brightnessComponent)]
pub unsafe fn brightnessComponent(&self) -> CGFloat;
#[method(getHue:saturation:brightness:alpha:)]
pub unsafe fn getHue_saturation_brightness_alpha(
&self,
hue: *mut CGFloat,
saturation: *mut CGFloat,
brightness: *mut CGFloat,
alpha: *mut CGFloat,
);
#[method(whiteComponent)]
pub unsafe fn whiteComponent(&self) -> CGFloat;
#[method(getWhite:alpha:)]
pub unsafe fn getWhite_alpha(&self, white: *mut CGFloat, alpha: *mut CGFloat);
#[method(cyanComponent)]
pub unsafe fn cyanComponent(&self) -> CGFloat;
#[method(magentaComponent)]
pub unsafe fn magentaComponent(&self) -> CGFloat;
#[method(yellowComponent)]
pub unsafe fn yellowComponent(&self) -> CGFloat;
#[method(blackComponent)]
pub unsafe fn blackComponent(&self) -> CGFloat;
#[method(getCyan:magenta:yellow:black:alpha:)]
pub unsafe fn getCyan_magenta_yellow_black_alpha(
&self,
cyan: *mut CGFloat,
magenta: *mut CGFloat,
yellow: *mut CGFloat,
black: *mut CGFloat,
alpha: *mut CGFloat,
);
#[cfg(feature = "NSColorSpace")]
#[method_id(@__retain_semantics Other colorSpace)]
pub unsafe fn colorSpace(&self) -> Retained<NSColorSpace>;
#[method(numberOfComponents)]
pub unsafe fn numberOfComponents(&self) -> NSInteger;
#[method(getComponents:)]
pub unsafe fn getComponents(&self, components: NonNull<CGFloat>);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other patternImage)]
pub unsafe fn patternImage(&self) -> Retained<NSImage>;
#[method(alphaComponent)]
pub unsafe fn alphaComponent(&self) -> CGFloat;
#[cfg(feature = "NSPasteboard")]
#[method_id(@__retain_semantics Other colorFromPasteboard:)]
pub unsafe fn colorFromPasteboard(paste_board: &NSPasteboard) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSPasteboard")]
#[method(writeToPasteboard:)]
pub unsafe fn writeToPasteboard(&self, paste_board: &NSPasteboard);
#[method(drawSwatchInRect:)]
pub unsafe fn drawSwatchInRect(&self, rect: NSRect);
#[deprecated = "Use `showsAlpha` in `NSColorPanel` and `supportsAlpha` in `NSColorWell` to control alpha behavior for individual controls."]
#[method(ignoresAlpha)]
pub unsafe fn ignoresAlpha(mtm: MainThreadMarker) -> bool;
#[deprecated = "Use `showsAlpha` in `NSColorPanel` and `supportsAlpha` in `NSColorWell` to control alpha behavior for individual controls."]
#[method(setIgnoresAlpha:)]
pub unsafe fn setIgnoresAlpha(ignores_alpha: bool, mtm: MainThreadMarker);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSColor {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
/// NSDeprecated
unsafe impl NSColor {
#[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
#[method_id(@__retain_semantics Other controlHighlightColor)]
pub unsafe fn controlHighlightColor() -> Retained<NSColor>;
#[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
#[method_id(@__retain_semantics Other controlLightHighlightColor)]
pub unsafe fn controlLightHighlightColor() -> Retained<NSColor>;
#[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
#[method_id(@__retain_semantics Other controlShadowColor)]
pub unsafe fn controlShadowColor() -> Retained<NSColor>;
#[deprecated = "Use a color that matches the semantics being used, such as `separatorColor`"]
#[method_id(@__retain_semantics Other controlDarkShadowColor)]
pub unsafe fn controlDarkShadowColor() -> Retained<NSColor>;
#[deprecated = "Use NSScroller instead"]
#[method_id(@__retain_semantics Other scrollBarColor)]
pub unsafe fn scrollBarColor() -> Retained<NSColor>;
#[deprecated = "Use NSScroller instead"]
#[method_id(@__retain_semantics Other knobColor)]
pub unsafe fn knobColor() -> Retained<NSColor>;
#[deprecated = "Use NSScroller instead"]
#[method_id(@__retain_semantics Other selectedKnobColor)]
pub unsafe fn selectedKnobColor() -> Retained<NSColor>;
#[deprecated = "Use NSVisualEffectMaterialTitlebar"]
#[method_id(@__retain_semantics Other windowFrameColor)]
pub unsafe fn windowFrameColor() -> Retained<NSColor>;
#[deprecated = "Use NSVisualEffectMaterialSelection"]
#[method_id(@__retain_semantics Other selectedMenuItemColor)]
pub unsafe fn selectedMenuItemColor() -> Retained<NSColor>;
#[deprecated = "Use NSVisualEffectMaterialHeaderView"]
#[method_id(@__retain_semantics Other headerColor)]
pub unsafe fn headerColor() -> Retained<NSColor>;
#[deprecated]
#[method_id(@__retain_semantics Other secondarySelectedControlColor)]
pub unsafe fn secondarySelectedControlColor() -> Retained<NSColor>;
#[deprecated]
#[method_id(@__retain_semantics Other alternateSelectedControlColor)]
pub unsafe fn alternateSelectedControlColor() -> Retained<NSColor>;
#[deprecated]
#[method_id(@__retain_semantics Other controlAlternatingRowBackgroundColors)]
pub unsafe fn controlAlternatingRowBackgroundColors() -> Retained<NSArray<NSColor>>;
#[cfg(feature = "NSGraphics")]
#[deprecated = "Use -type and NSColorType instead"]
#[method_id(@__retain_semantics Other colorSpaceName)]
pub unsafe fn colorSpaceName(&self) -> Retained<NSColorSpaceName>;
#[cfg(feature = "NSGraphics")]
#[deprecated = "Use -colorUsingType: or -colorUsingColorSpace: instead"]
#[method_id(@__retain_semantics Other colorUsingColorSpaceName:device:)]
pub unsafe fn colorUsingColorSpaceName_device(
&self,
name: Option<&NSColorSpaceName>,
device_description: Option<&NSDictionary<NSDeviceDescriptionKey, AnyObject>>,
) -> Option<Retained<NSColor>>;
#[cfg(feature = "NSGraphics")]
#[deprecated = "Use -colorUsingType: or -colorUsingColorSpace: instead"]
#[method_id(@__retain_semantics Other colorUsingColorSpaceName:)]
pub unsafe fn colorUsingColorSpaceName(
&self,
name: &NSColorSpaceName,
) -> Option<Retained<NSColor>>;
}
);
extern_methods!(
/// NSQuartzCoreAdditions
unsafe impl NSColor {
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
#[method_id(@__retain_semantics Other colorWithCIColor:)]
pub unsafe fn colorWithCIColor(color: &CIColor) -> Retained<NSColor>;
}
);
extern_category!(
/// Category "NSAppKitAdditions" on [`CIColor`].
#[doc(alias = "NSAppKitAdditions")]
pub unsafe trait CIColorNSAppKitAdditions {
#[method_id(@__retain_semantics Init initWithColor:)]
unsafe fn initWithColor(this: Allocated<Self>, color: &NSColor) -> Option<Retained<Self>>;
}
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
unsafe impl CIColorNSAppKitAdditions for CIColor {}
);
extern "C" {
pub static NSSystemColorsDidChangeNotification: &'static NSNotificationName;
}

View File

@@ -0,0 +1,102 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub type NSColorListName = NSString;
pub type NSColorName = NSString;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSColorList;
unsafe impl ClassType for NSColorList {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSColorList {}
unsafe impl NSObjectProtocol for NSColorList {}
unsafe impl NSSecureCoding for NSColorList {}
extern_methods!(
unsafe impl NSColorList {
#[method_id(@__retain_semantics Other availableColorLists)]
pub unsafe fn availableColorLists() -> Retained<NSArray<NSColorList>>;
#[method_id(@__retain_semantics Other colorListNamed:)]
pub unsafe fn colorListNamed(name: &NSColorListName) -> Option<Retained<NSColorList>>;
#[method_id(@__retain_semantics Init initWithName:)]
pub unsafe fn initWithName(this: Allocated<Self>, name: &NSColorListName)
-> Retained<Self>;
#[method_id(@__retain_semantics Init initWithName:fromFile:)]
pub unsafe fn initWithName_fromFile(
this: Allocated<Self>,
name: &NSColorListName,
path: Option<&NSString>,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Option<Retained<NSColorListName>>;
#[cfg(feature = "NSColor")]
#[method(setColor:forKey:)]
pub unsafe fn setColor_forKey(&self, color: &NSColor, key: &NSColorName);
#[cfg(feature = "NSColor")]
#[method(insertColor:key:atIndex:)]
pub unsafe fn insertColor_key_atIndex(
&self,
color: &NSColor,
key: &NSColorName,
loc: NSUInteger,
);
#[method(removeColorWithKey:)]
pub unsafe fn removeColorWithKey(&self, key: &NSColorName);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other colorWithKey:)]
pub unsafe fn colorWithKey(&self, key: &NSColorName) -> Option<Retained<NSColor>>;
#[method_id(@__retain_semantics Other allKeys)]
pub unsafe fn allKeys(&self) -> Retained<NSArray<NSColorName>>;
#[method(isEditable)]
pub unsafe fn isEditable(&self) -> bool;
#[method(writeToURL:error:_)]
pub unsafe fn writeToURL_error(&self, url: Option<&NSURL>)
-> Result<(), Retained<NSError>>;
#[deprecated = "Use -writeToURL:error: instead"]
#[method(writeToFile:)]
pub unsafe fn writeToFile(&self, path: Option<&NSString>) -> bool;
#[method(removeFile)]
pub unsafe fn removeFile(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSColorList {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern "C" {
pub static NSColorListDidChangeNotification: &'static NSNotificationName;
}

View File

@@ -0,0 +1,313 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorPanelMode(pub NSInteger);
impl NSColorPanelMode {
#[doc(alias = "NSColorPanelModeNone")]
pub const None: Self = Self(-1);
#[doc(alias = "NSColorPanelModeGray")]
pub const Gray: Self = Self(0);
#[doc(alias = "NSColorPanelModeRGB")]
pub const RGB: Self = Self(1);
#[doc(alias = "NSColorPanelModeCMYK")]
pub const CMYK: Self = Self(2);
#[doc(alias = "NSColorPanelModeHSB")]
pub const HSB: Self = Self(3);
#[doc(alias = "NSColorPanelModeCustomPalette")]
pub const CustomPalette: Self = Self(4);
#[doc(alias = "NSColorPanelModeColorList")]
pub const ColorList: Self = Self(5);
#[doc(alias = "NSColorPanelModeWheel")]
pub const Wheel: Self = Self(6);
#[doc(alias = "NSColorPanelModeCrayon")]
pub const Crayon: Self = Self(7);
}
unsafe impl Encode for NSColorPanelMode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSColorPanelMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorPanelOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSColorPanelOptions: NSUInteger {
const NSColorPanelGrayModeMask = 0x00000001;
const NSColorPanelRGBModeMask = 0x00000002;
const NSColorPanelCMYKModeMask = 0x00000004;
const NSColorPanelHSBModeMask = 0x00000008;
const NSColorPanelCustomPaletteModeMask = 0x00000010;
const NSColorPanelColorListModeMask = 0x00000020;
const NSColorPanelWheelModeMask = 0x00000040;
const NSColorPanelCrayonModeMask = 0x00000080;
const NSColorPanelAllModesMask = 0x0000ffff;
}
}
unsafe impl Encode for NSColorPanelOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSColorPanelOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
pub struct NSColorPanel;
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl ClassType for NSColorPanel {
#[inherits(NSWindow, NSResponder, NSObject)]
type Super = NSPanel;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAccessibility for NSColorPanel {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAccessibilityElementProtocol for NSColorPanel {}
#[cfg(all(
feature = "NSAnimation",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAnimatablePropertyContainer for NSColorPanel {}
#[cfg(all(
feature = "NSAppearance",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAppearanceCustomization for NSColorPanel {}
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSCoding for NSColorPanel {}
#[cfg(all(
feature = "NSMenu",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSMenuItemValidation for NSColorPanel {}
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSObjectProtocol for NSColorPanel {}
#[cfg(all(
feature = "NSPanel",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSWindow"
))]
unsafe impl NSUserInterfaceItemIdentification for NSColorPanel {}
#[cfg(all(
feature = "NSPanel",
feature = "NSResponder",
feature = "NSUserInterfaceValidation",
feature = "NSWindow"
))]
unsafe impl NSUserInterfaceValidations for NSColorPanel {}
extern_methods!(
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSColorPanel {
#[method_id(@__retain_semantics Other sharedColorPanel)]
pub unsafe fn sharedColorPanel(mtm: MainThreadMarker) -> Retained<NSColorPanel>;
#[method(sharedColorPanelExists)]
pub unsafe fn sharedColorPanelExists(mtm: MainThreadMarker) -> bool;
#[cfg(all(feature = "NSColor", feature = "NSEvent", feature = "NSView"))]
#[method(dragColor:withEvent:fromView:)]
pub unsafe fn dragColor_withEvent_fromView(
color: &NSColor,
event: &NSEvent,
source_view: &NSView,
) -> bool;
#[method(setPickerMask:)]
pub unsafe fn setPickerMask(mask: NSColorPanelOptions, mtm: MainThreadMarker);
#[method(setPickerMode:)]
pub unsafe fn setPickerMode(mode: NSColorPanelMode, mtm: MainThreadMarker);
#[cfg(feature = "NSView")]
#[method_id(@__retain_semantics Other accessoryView)]
pub unsafe fn accessoryView(&self) -> Option<Retained<NSView>>;
#[cfg(feature = "NSView")]
#[method(setAccessoryView:)]
pub unsafe fn setAccessoryView(&self, accessory_view: Option<&NSView>);
#[method(isContinuous)]
pub unsafe fn isContinuous(&self) -> bool;
#[method(setContinuous:)]
pub unsafe fn setContinuous(&self, continuous: bool);
#[method(showsAlpha)]
pub unsafe fn showsAlpha(&self) -> bool;
#[method(setShowsAlpha:)]
pub unsafe fn setShowsAlpha(&self, shows_alpha: bool);
#[method(mode)]
pub unsafe fn mode(&self) -> NSColorPanelMode;
#[method(setMode:)]
pub unsafe fn setMode(&self, mode: NSColorPanelMode);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other color)]
pub unsafe fn color(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setColor:)]
pub unsafe fn setColor(&self, color: &NSColor);
#[method(alpha)]
pub unsafe fn alpha(&self) -> CGFloat;
#[method(setAction:)]
pub unsafe fn setAction(&self, selector: Option<Sel>);
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
#[cfg(feature = "NSColorList")]
#[method(attachColorList:)]
pub unsafe fn attachColorList(&self, color_list: &NSColorList);
#[cfg(feature = "NSColorList")]
#[method(detachColorList:)]
pub unsafe fn detachColorList(&self, color_list: &NSColorList);
}
);
extern_methods!(
/// Methods declared on superclass `NSWindow`
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSColorPanel {
#[cfg(feature = "NSGraphics")]
#[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:)]
pub unsafe fn initWithContentRect_styleMask_backing_defer(
this: Allocated<Self>,
content_rect: NSRect,
style: NSWindowStyleMask,
backing_store_type: NSBackingStoreType,
flag: bool,
) -> Retained<Self>;
#[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
#[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:screen:)]
pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
this: Allocated<Self>,
content_rect: NSRect,
style: NSWindowStyleMask,
backing_store_type: NSBackingStoreType,
flag: bool,
screen: Option<&NSScreen>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[cfg(feature = "NSViewController")]
#[method_id(@__retain_semantics Other windowWithContentViewController:)]
pub unsafe fn windowWithContentViewController(
content_view_controller: &NSViewController,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSColorPanel {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSColorPanel {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSColorPanel
#[cfg(all(feature = "NSApplication", feature = "NSResponder"))]
unsafe impl NSApplication {
#[method(orderFrontColorPanel:)]
pub unsafe fn orderFrontColorPanel(&self, sender: Option<&AnyObject>);
}
);
extern_protocol!(
pub unsafe trait NSColorChanging: NSObjectProtocol {
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
#[method(changeColor:)]
unsafe fn changeColor(&self, sender: Option<&NSColorPanel>);
}
unsafe impl ProtocolType for dyn NSColorChanging {}
);
extern "C" {
pub static NSColorPanelColorDidChangeNotification: &'static NSNotificationName;
}
pub static NSNoModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::None.0);
pub static NSGrayModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::Gray.0);
pub static NSRGBModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::RGB.0);
pub static NSCMYKModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::CMYK.0);
pub static NSHSBModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::HSB.0);
pub static NSCustomPaletteModeColorPanel: NSColorPanelMode =
NSColorPanelMode(NSColorPanelMode::CustomPalette.0);
pub static NSColorListModeColorPanel: NSColorPanelMode =
NSColorPanelMode(NSColorPanelMode::ColorList.0);
pub static NSWheelModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::Wheel.0);
pub static NSCrayonModeColorPanel: NSColorPanelMode = NSColorPanelMode(NSColorPanelMode::Crayon.0);

View File

@@ -0,0 +1,96 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSColorPicker;
unsafe impl ClassType for NSColorPicker {
type Super = NSObject;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "NSColorPicking")]
unsafe impl NSColorPickingDefault for NSColorPicker {}
unsafe impl NSObjectProtocol for NSColorPicker {}
extern_methods!(
unsafe impl NSColorPicker {
#[cfg(all(
feature = "NSColorPanel",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
#[method_id(@__retain_semantics Init initWithPickerMask:colorPanel:)]
pub unsafe fn initWithPickerMask_colorPanel(
this: Allocated<Self>,
mask: NSUInteger,
owning_color_panel: &NSColorPanel,
) -> Option<Retained<Self>>;
#[cfg(all(
feature = "NSColorPanel",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
#[method_id(@__retain_semantics Other colorPanel)]
pub unsafe fn colorPanel(&self) -> Retained<NSColorPanel>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other provideNewButtonImage)]
pub unsafe fn provideNewButtonImage(&self) -> Retained<NSImage>;
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSImage"
))]
#[method(insertNewButtonImage:in:)]
pub unsafe fn insertNewButtonImage_in(
&self,
new_button_image: &NSImage,
button_cell: &NSButtonCell,
);
#[method(viewSizeChanged:)]
pub unsafe fn viewSizeChanged(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSColorList")]
#[method(attachColorList:)]
pub unsafe fn attachColorList(&self, color_list: &NSColorList);
#[cfg(feature = "NSColorList")]
#[method(detachColorList:)]
pub unsafe fn detachColorList(&self, color_list: &NSColorList);
#[cfg(feature = "NSColorPanel")]
#[method(setMode:)]
pub unsafe fn setMode(&self, mode: NSColorPanelMode);
#[method_id(@__retain_semantics Other buttonToolTip)]
pub unsafe fn buttonToolTip(&self) -> Retained<NSString>;
#[method(minContentSize)]
pub unsafe fn minContentSize(&self) -> NSSize;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSColorPicker {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,143 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSTouchBarItem")]
pub struct NSColorPickerTouchBarItem;
#[cfg(feature = "NSTouchBarItem")]
unsafe impl ClassType for NSColorPickerTouchBarItem {
#[inherits(NSObject)]
type Super = NSTouchBarItem;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSCoding for NSColorPickerTouchBarItem {}
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSObjectProtocol for NSColorPickerTouchBarItem {}
extern_methods!(
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSColorPickerTouchBarItem {
#[method_id(@__retain_semantics Other colorPickerWithIdentifier:)]
pub unsafe fn colorPickerWithIdentifier(
identifier: &NSTouchBarItemIdentifier,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other textColorPickerWithIdentifier:)]
pub unsafe fn textColorPickerWithIdentifier(
identifier: &NSTouchBarItemIdentifier,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other strokeColorPickerWithIdentifier:)]
pub unsafe fn strokeColorPickerWithIdentifier(
identifier: &NSTouchBarItemIdentifier,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other colorPickerWithIdentifier:buttonImage:)]
pub unsafe fn colorPickerWithIdentifier_buttonImage(
identifier: &NSTouchBarItemIdentifier,
image: &NSImage,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other color)]
pub unsafe fn color(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setColor:)]
pub unsafe fn setColor(&self, color: &NSColor);
#[method(showsAlpha)]
pub unsafe fn showsAlpha(&self) -> bool;
#[method(setShowsAlpha:)]
pub unsafe fn setShowsAlpha(&self, shows_alpha: bool);
#[cfg(feature = "NSColorSpace")]
#[method_id(@__retain_semantics Other allowedColorSpaces)]
pub unsafe fn allowedColorSpaces(&self) -> Option<Retained<NSArray<NSColorSpace>>>;
#[cfg(feature = "NSColorSpace")]
#[method(setAllowedColorSpaces:)]
pub unsafe fn setAllowedColorSpaces(
&self,
allowed_color_spaces: Option<&NSArray<NSColorSpace>>,
);
#[cfg(feature = "NSColorList")]
#[method_id(@__retain_semantics Other colorList)]
pub unsafe fn colorList(&self) -> Option<Retained<NSColorList>>;
#[cfg(feature = "NSColorList")]
#[method(setColorList:)]
pub unsafe fn setColorList(&self, color_list: Option<&NSColorList>);
#[method_id(@__retain_semantics Other customizationLabel)]
pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
#[method(setCustomizationLabel:)]
pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
#[method_id(@__retain_semantics Other target)]
pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
#[method(action)]
pub unsafe fn action(&self) -> Option<Sel>;
#[method(setAction:)]
pub unsafe fn setAction(&self, action: Option<Sel>);
#[method(isEnabled)]
pub unsafe fn isEnabled(&self) -> bool;
#[method(setEnabled:)]
pub unsafe fn setEnabled(&self, enabled: bool);
}
);
extern_methods!(
/// Methods declared on superclass `NSTouchBarItem`
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSColorPickerTouchBarItem {
#[method_id(@__retain_semantics Init initWithIdentifier:)]
pub unsafe fn initWithIdentifier(
this: Allocated<Self>,
identifier: &NSTouchBarItemIdentifier,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSColorPickerTouchBarItem {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,88 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_protocol!(
pub unsafe trait NSColorPickingDefault: IsMainThreadOnly {
#[cfg(all(
feature = "NSColorPanel",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
#[method_id(@__retain_semantics Init initWithPickerMask:colorPanel:)]
unsafe fn initWithPickerMask_colorPanel(
this: Allocated<Self>,
mask: NSUInteger,
owning_color_panel: &NSColorPanel,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other provideNewButtonImage)]
unsafe fn provideNewButtonImage(&self) -> Retained<NSImage>;
#[cfg(all(
feature = "NSActionCell",
feature = "NSButtonCell",
feature = "NSCell",
feature = "NSImage"
))]
#[method(insertNewButtonImage:in:)]
unsafe fn insertNewButtonImage_in(
&self,
new_button_image: &NSImage,
button_cell: &NSButtonCell,
);
#[method(viewSizeChanged:)]
unsafe fn viewSizeChanged(&self, sender: Option<&AnyObject>);
#[method(alphaControlAddedOrRemoved:)]
unsafe fn alphaControlAddedOrRemoved(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSColorList")]
#[method(attachColorList:)]
unsafe fn attachColorList(&self, color_list: &NSColorList);
#[cfg(feature = "NSColorList")]
#[method(detachColorList:)]
unsafe fn detachColorList(&self, color_list: &NSColorList);
#[cfg(feature = "NSColorPanel")]
#[method(setMode:)]
unsafe fn setMode(&self, mode: NSColorPanelMode);
#[method_id(@__retain_semantics Other buttonToolTip)]
unsafe fn buttonToolTip(&self) -> Retained<NSString>;
#[method(minContentSize)]
unsafe fn minContentSize(&self) -> NSSize;
}
unsafe impl ProtocolType for dyn NSColorPickingDefault {}
);
extern_protocol!(
pub unsafe trait NSColorPickingCustom: NSColorPickingDefault + IsMainThreadOnly {
#[cfg(feature = "NSColorPanel")]
#[method(supportsMode:)]
unsafe fn supportsMode(&self, mode: NSColorPanelMode) -> bool;
#[cfg(feature = "NSColorPanel")]
#[method(currentMode)]
unsafe fn currentMode(&self) -> NSColorPanelMode;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method_id(@__retain_semantics Other provideNewView:)]
unsafe fn provideNewView(&self, initial_request: bool) -> Retained<NSView>;
#[cfg(feature = "NSColor")]
#[method(setColor:)]
unsafe fn setColor(&self, new_color: &NSColor);
}
unsafe impl ProtocolType for dyn NSColorPickingCustom {}
);

View File

@@ -0,0 +1,39 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSColorSampler;
unsafe impl ClassType for NSColorSampler {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSColorSampler {}
extern_methods!(
unsafe impl NSColorSampler {
#[cfg(all(feature = "NSColor", feature = "block2"))]
#[method(showSamplerWithSelectionHandler:)]
pub unsafe fn showSamplerWithSelectionHandler(
&self,
selection_handler: &block2::Block<dyn Fn(*mut NSColor)>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSColorSampler {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,160 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorSpaceModel(pub NSInteger);
impl NSColorSpaceModel {
#[doc(alias = "NSColorSpaceModelUnknown")]
pub const Unknown: Self = Self(-1);
#[doc(alias = "NSColorSpaceModelGray")]
pub const Gray: Self = Self(0);
#[doc(alias = "NSColorSpaceModelRGB")]
pub const RGB: Self = Self(1);
#[doc(alias = "NSColorSpaceModelCMYK")]
pub const CMYK: Self = Self(2);
#[doc(alias = "NSColorSpaceModelLAB")]
pub const LAB: Self = Self(3);
#[doc(alias = "NSColorSpaceModelDeviceN")]
pub const DeviceN: Self = Self(4);
#[doc(alias = "NSColorSpaceModelIndexed")]
pub const Indexed: Self = Self(5);
#[doc(alias = "NSColorSpaceModelPatterned")]
pub const Patterned: Self = Self(6);
}
unsafe impl Encode for NSColorSpaceModel {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSColorSpaceModel {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSColorSpace;
unsafe impl ClassType for NSColorSpace {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSColorSpace {}
unsafe impl Sync for NSColorSpace {}
unsafe impl NSCoding for NSColorSpace {}
unsafe impl NSObjectProtocol for NSColorSpace {}
unsafe impl NSSecureCoding for NSColorSpace {}
extern_methods!(
unsafe impl NSColorSpace {
#[method_id(@__retain_semantics Init initWithICCProfileData:)]
pub unsafe fn initWithICCProfileData(
this: Allocated<Self>,
icc_data: &NSData,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Other ICCProfileData)]
pub unsafe fn ICCProfileData(&self) -> Option<Retained<NSData>>;
#[method_id(@__retain_semantics Init initWithColorSyncProfile:)]
pub unsafe fn initWithColorSyncProfile(
this: Allocated<Self>,
prof: NonNull<c_void>,
) -> Option<Retained<Self>>;
#[method(colorSyncProfile)]
pub unsafe fn colorSyncProfile(&self) -> *mut c_void;
#[method(numberOfColorComponents)]
pub unsafe fn numberOfColorComponents(&self) -> NSInteger;
#[method(colorSpaceModel)]
pub unsafe fn colorSpaceModel(&self) -> NSColorSpaceModel;
#[method_id(@__retain_semantics Other localizedName)]
pub unsafe fn localizedName(&self) -> Option<Retained<NSString>>;
#[method_id(@__retain_semantics Other sRGBColorSpace)]
pub unsafe fn sRGBColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other genericGamma22GrayColorSpace)]
pub unsafe fn genericGamma22GrayColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other extendedSRGBColorSpace)]
pub unsafe fn extendedSRGBColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other extendedGenericGamma22GrayColorSpace)]
pub unsafe fn extendedGenericGamma22GrayColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other displayP3ColorSpace)]
pub unsafe fn displayP3ColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other adobeRGB1998ColorSpace)]
pub unsafe fn adobeRGB1998ColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other genericRGBColorSpace)]
pub unsafe fn genericRGBColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other genericGrayColorSpace)]
pub unsafe fn genericGrayColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other genericCMYKColorSpace)]
pub unsafe fn genericCMYKColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other deviceRGBColorSpace)]
pub unsafe fn deviceRGBColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other deviceGrayColorSpace)]
pub unsafe fn deviceGrayColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other deviceCMYKColorSpace)]
pub unsafe fn deviceCMYKColorSpace() -> Retained<NSColorSpace>;
#[method_id(@__retain_semantics Other availableColorSpacesWithModel:)]
pub unsafe fn availableColorSpacesWithModel(
model: NSColorSpaceModel,
) -> Retained<NSArray<NSColorSpace>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSColorSpace {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
pub static NSUnknownColorSpaceModel: NSColorSpaceModel =
NSColorSpaceModel(NSColorSpaceModel::Unknown.0);
pub static NSGrayColorSpaceModel: NSColorSpaceModel = NSColorSpaceModel(NSColorSpaceModel::Gray.0);
pub static NSRGBColorSpaceModel: NSColorSpaceModel = NSColorSpaceModel(NSColorSpaceModel::RGB.0);
pub static NSCMYKColorSpaceModel: NSColorSpaceModel = NSColorSpaceModel(NSColorSpaceModel::CMYK.0);
pub static NSLABColorSpaceModel: NSColorSpaceModel = NSColorSpaceModel(NSColorSpaceModel::LAB.0);
pub static NSDeviceNColorSpaceModel: NSColorSpaceModel =
NSColorSpaceModel(NSColorSpaceModel::DeviceN.0);
pub static NSIndexedColorSpaceModel: NSColorSpaceModel =
NSColorSpaceModel(NSColorSpaceModel::Indexed.0);
pub static NSPatternColorSpaceModel: NSColorSpaceModel =
NSColorSpaceModel(NSColorSpaceModel::Patterned.0);

View File

@@ -0,0 +1,201 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorWellStyle(pub NSInteger);
impl NSColorWellStyle {
#[doc(alias = "NSColorWellStyleDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "NSColorWellStyleMinimal")]
pub const Minimal: Self = Self(1);
#[doc(alias = "NSColorWellStyleExpanded")]
pub const Expanded: Self = Self(2);
}
unsafe impl Encode for NSColorWellStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSColorWellStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
pub struct NSColorWell;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl ClassType for NSColorWell {
#[inherits(NSView, NSResponder, NSObject)]
type Super = NSControl;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibility for NSColorWell {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSColorWell {}
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAnimatablePropertyContainer for NSColorWell {}
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAppearanceCustomization for NSColorWell {}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSColorWell {}
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSDraggingDestination for NSColorWell {}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSColorWell {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSColorWell {}
extern_methods!(
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSColorWell {
#[method_id(@__retain_semantics Other colorWellWithStyle:)]
pub unsafe fn colorWellWithStyle(
style: NSColorWellStyle,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[method(deactivate)]
pub unsafe fn deactivate(&self);
#[method(activate:)]
pub unsafe fn activate(&self, exclusive: bool);
#[method(isActive)]
pub unsafe fn isActive(&self) -> bool;
#[method(drawWellInside:)]
pub unsafe fn drawWellInside(&self, inside_rect: NSRect);
#[deprecated = "This property will be deprecated in a future release."]
#[method(isBordered)]
pub unsafe fn isBordered(&self) -> bool;
#[deprecated = "This property will be deprecated in a future release."]
#[method(setBordered:)]
pub unsafe fn setBordered(&self, bordered: bool);
#[method(takeColorFrom:)]
pub unsafe fn takeColorFrom(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other color)]
pub unsafe fn color(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setColor:)]
pub unsafe fn setColor(&self, color: &NSColor);
#[method(colorWellStyle)]
pub unsafe fn colorWellStyle(&self) -> NSColorWellStyle;
#[method(setColorWellStyle:)]
pub unsafe fn setColorWellStyle(&self, color_well_style: NSColorWellStyle);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other image)]
pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setImage:)]
pub unsafe fn setImage(&self, image: Option<&NSImage>);
#[method_id(@__retain_semantics Other pulldownTarget)]
pub unsafe fn pulldownTarget(&self) -> Option<Retained<AnyObject>>;
#[method(setPulldownTarget:)]
pub unsafe fn setPulldownTarget(&self, pulldown_target: Option<&AnyObject>);
#[method(pulldownAction)]
pub unsafe fn pulldownAction(&self) -> Option<Sel>;
#[method(setPulldownAction:)]
pub unsafe fn setPulldownAction(&self, pulldown_action: Option<Sel>);
#[method(supportsAlpha)]
pub unsafe fn supportsAlpha(&self) -> bool;
#[method(setSupportsAlpha:)]
pub unsafe fn setSupportsAlpha(&self, supports_alpha: bool);
}
);
extern_methods!(
/// Methods declared on superclass `NSControl`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSColorWell {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSColorWell {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSColorWell {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,411 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
pub static NSComboBoxWillPopUpNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSComboBoxWillDismissNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSComboBoxSelectionDidChangeNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSComboBoxSelectionIsChangingNotification: &'static NSNotificationName;
}
extern_protocol!(
pub unsafe trait NSComboBoxDataSource: NSObjectProtocol + IsMainThreadOnly {
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
#[optional]
#[method(numberOfItemsInComboBox:)]
unsafe fn numberOfItemsInComboBox(&self, combo_box: &NSComboBox) -> NSInteger;
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
#[optional]
#[method_id(@__retain_semantics Other comboBox:objectValueForItemAtIndex:)]
unsafe fn comboBox_objectValueForItemAtIndex(
&self,
combo_box: &NSComboBox,
index: NSInteger,
) -> Option<Retained<AnyObject>>;
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
#[optional]
#[method(comboBox:indexOfItemWithStringValue:)]
unsafe fn comboBox_indexOfItemWithStringValue(
&self,
combo_box: &NSComboBox,
string: &NSString,
) -> NSUInteger;
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
#[optional]
#[method_id(@__retain_semantics Other comboBox:completedString:)]
unsafe fn comboBox_completedString(
&self,
combo_box: &NSComboBox,
string: &NSString,
) -> Option<Retained<NSString>>;
}
unsafe impl ProtocolType for dyn NSComboBoxDataSource {}
);
extern_protocol!(
#[cfg(all(feature = "NSControl", feature = "NSTextField"))]
pub unsafe trait NSComboBoxDelegate: NSTextFieldDelegate + IsMainThreadOnly {
#[optional]
#[method(comboBoxWillPopUp:)]
unsafe fn comboBoxWillPopUp(&self, notification: &NSNotification);
#[optional]
#[method(comboBoxWillDismiss:)]
unsafe fn comboBoxWillDismiss(&self, notification: &NSNotification);
#[optional]
#[method(comboBoxSelectionDidChange:)]
unsafe fn comboBoxSelectionDidChange(&self, notification: &NSNotification);
#[optional]
#[method(comboBoxSelectionIsChanging:)]
unsafe fn comboBoxSelectionIsChanging(&self, notification: &NSNotification);
}
#[cfg(all(feature = "NSControl", feature = "NSTextField"))]
unsafe impl ProtocolType for dyn NSComboBoxDelegate {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
pub struct NSComboBox;
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl ClassType for NSComboBox {
#[inherits(NSControl, NSView, NSResponder, NSObject)]
type Super = NSTextField;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSAccessibility for NSComboBox {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSComboBox {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSAccessibilityNavigableStaticText for NSComboBox {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSAccessibilityStaticText for NSComboBox {}
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSAnimatablePropertyContainer for NSComboBox {}
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSAppearanceCustomization for NSComboBox {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSCoding for NSComboBox {}
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSDraggingDestination for NSComboBox {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSObjectProtocol for NSComboBox {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextContent",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSTextContent for NSComboBox {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSComboBox {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSUserInterfaceValidation",
feature = "NSView"
))]
unsafe impl NSUserInterfaceValidations for NSComboBox {}
extern_methods!(
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSComboBox {
#[method(hasVerticalScroller)]
pub unsafe fn hasVerticalScroller(&self) -> bool;
#[method(setHasVerticalScroller:)]
pub unsafe fn setHasVerticalScroller(&self, has_vertical_scroller: bool);
#[method(intercellSpacing)]
pub unsafe fn intercellSpacing(&self) -> NSSize;
#[method(setIntercellSpacing:)]
pub unsafe fn setIntercellSpacing(&self, intercell_spacing: NSSize);
#[method(itemHeight)]
pub unsafe fn itemHeight(&self) -> CGFloat;
#[method(setItemHeight:)]
pub unsafe fn setItemHeight(&self, item_height: CGFloat);
#[method(numberOfVisibleItems)]
pub unsafe fn numberOfVisibleItems(&self) -> NSInteger;
#[method(setNumberOfVisibleItems:)]
pub unsafe fn setNumberOfVisibleItems(&self, number_of_visible_items: NSInteger);
#[method(isButtonBordered)]
pub unsafe fn isButtonBordered(&self) -> bool;
#[method(setButtonBordered:)]
pub unsafe fn setButtonBordered(&self, button_bordered: bool);
#[method(reloadData)]
pub unsafe fn reloadData(&self);
#[method(noteNumberOfItemsChanged)]
pub unsafe fn noteNumberOfItemsChanged(&self);
#[method(usesDataSource)]
pub unsafe fn usesDataSource(&self) -> bool;
#[method(setUsesDataSource:)]
pub unsafe fn setUsesDataSource(&self, uses_data_source: bool);
#[method(scrollItemAtIndexToTop:)]
pub unsafe fn scrollItemAtIndexToTop(&self, index: NSInteger);
#[method(scrollItemAtIndexToVisible:)]
pub unsafe fn scrollItemAtIndexToVisible(&self, index: NSInteger);
#[method(selectItemAtIndex:)]
pub unsafe fn selectItemAtIndex(&self, index: NSInteger);
#[method(deselectItemAtIndex:)]
pub unsafe fn deselectItemAtIndex(&self, index: NSInteger);
#[method(indexOfSelectedItem)]
pub unsafe fn indexOfSelectedItem(&self) -> NSInteger;
#[method(numberOfItems)]
pub unsafe fn numberOfItems(&self) -> NSInteger;
#[method(completes)]
pub unsafe fn completes(&self) -> bool;
#[method(setCompletes:)]
pub unsafe fn setCompletes(&self, completes: bool);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSComboBoxDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSComboBoxDelegate>>);
#[method_id(@__retain_semantics Other dataSource)]
pub unsafe fn dataSource(
&self,
) -> Option<Retained<ProtocolObject<dyn NSComboBoxDataSource>>>;
#[method(setDataSource:)]
pub unsafe fn setDataSource(
&self,
data_source: Option<&ProtocolObject<dyn NSComboBoxDataSource>>,
);
#[method(addItemWithObjectValue:)]
pub unsafe fn addItemWithObjectValue(&self, object: &AnyObject);
#[method(addItemsWithObjectValues:)]
pub unsafe fn addItemsWithObjectValues(&self, objects: &NSArray);
#[method(insertItemWithObjectValue:atIndex:)]
pub unsafe fn insertItemWithObjectValue_atIndex(
&self,
object: &AnyObject,
index: NSInteger,
);
#[method(removeItemWithObjectValue:)]
pub unsafe fn removeItemWithObjectValue(&self, object: &AnyObject);
#[method(removeItemAtIndex:)]
pub unsafe fn removeItemAtIndex(&self, index: NSInteger);
#[method(removeAllItems)]
pub unsafe fn removeAllItems(&self);
#[method(selectItemWithObjectValue:)]
pub unsafe fn selectItemWithObjectValue(&self, object: Option<&AnyObject>);
#[method_id(@__retain_semantics Other itemObjectValueAtIndex:)]
pub unsafe fn itemObjectValueAtIndex(&self, index: NSInteger) -> Retained<AnyObject>;
#[method_id(@__retain_semantics Other objectValueOfSelectedItem)]
pub unsafe fn objectValueOfSelectedItem(&self) -> Option<Retained<AnyObject>>;
#[method(indexOfItemWithObjectValue:)]
pub unsafe fn indexOfItemWithObjectValue(&self, object: &AnyObject) -> NSInteger;
#[method_id(@__retain_semantics Other objectValues)]
pub unsafe fn objectValues(&self) -> Retained<NSArray>;
}
);
extern_methods!(
/// Methods declared on superclass `NSControl`
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSComboBox {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSComboBox {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSTextField",
feature = "NSView"
))]
unsafe impl NSComboBox {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,301 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
pub struct NSComboBoxCell;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
unsafe impl ClassType for NSComboBoxCell {
#[inherits(NSActionCell, NSCell, NSObject)]
type Super = NSTextFieldCell;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
unsafe impl NSAccessibility for NSComboBoxCell {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
unsafe impl NSAccessibilityElementProtocol for NSComboBoxCell {}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
unsafe impl NSCoding for NSComboBoxCell {}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
unsafe impl NSCopying for NSComboBoxCell {}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
unsafe impl NSObjectProtocol for NSComboBoxCell {}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell",
feature = "NSUserInterfaceItemIdentification"
))]
unsafe impl NSUserInterfaceItemIdentification for NSComboBoxCell {}
extern_methods!(
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
unsafe impl NSComboBoxCell {
#[method(hasVerticalScroller)]
pub unsafe fn hasVerticalScroller(&self) -> bool;
#[method(setHasVerticalScroller:)]
pub unsafe fn setHasVerticalScroller(&self, has_vertical_scroller: bool);
#[method(intercellSpacing)]
pub unsafe fn intercellSpacing(&self) -> NSSize;
#[method(setIntercellSpacing:)]
pub unsafe fn setIntercellSpacing(&self, intercell_spacing: NSSize);
#[method(itemHeight)]
pub unsafe fn itemHeight(&self) -> CGFloat;
#[method(setItemHeight:)]
pub unsafe fn setItemHeight(&self, item_height: CGFloat);
#[method(numberOfVisibleItems)]
pub unsafe fn numberOfVisibleItems(&self) -> NSInteger;
#[method(setNumberOfVisibleItems:)]
pub unsafe fn setNumberOfVisibleItems(&self, number_of_visible_items: NSInteger);
#[method(isButtonBordered)]
pub unsafe fn isButtonBordered(&self) -> bool;
#[method(setButtonBordered:)]
pub unsafe fn setButtonBordered(&self, button_bordered: bool);
#[method(reloadData)]
pub unsafe fn reloadData(&self);
#[method(noteNumberOfItemsChanged)]
pub unsafe fn noteNumberOfItemsChanged(&self);
#[method(usesDataSource)]
pub unsafe fn usesDataSource(&self) -> bool;
#[method(setUsesDataSource:)]
pub unsafe fn setUsesDataSource(&self, uses_data_source: bool);
#[method(scrollItemAtIndexToTop:)]
pub unsafe fn scrollItemAtIndexToTop(&self, index: NSInteger);
#[method(scrollItemAtIndexToVisible:)]
pub unsafe fn scrollItemAtIndexToVisible(&self, index: NSInteger);
#[method(selectItemAtIndex:)]
pub unsafe fn selectItemAtIndex(&self, index: NSInteger);
#[method(deselectItemAtIndex:)]
pub unsafe fn deselectItemAtIndex(&self, index: NSInteger);
#[method(indexOfSelectedItem)]
pub unsafe fn indexOfSelectedItem(&self) -> NSInteger;
#[method(numberOfItems)]
pub unsafe fn numberOfItems(&self) -> NSInteger;
#[method(completes)]
pub unsafe fn completes(&self) -> bool;
#[method(setCompletes:)]
pub unsafe fn setCompletes(&self, completes: bool);
#[method_id(@__retain_semantics Other completedString:)]
pub unsafe fn completedString(&self, string: &NSString) -> Option<Retained<NSString>>;
#[method_id(@__retain_semantics Other dataSource)]
pub unsafe fn dataSource(
&self,
) -> Option<Retained<ProtocolObject<dyn NSComboBoxCellDataSource>>>;
#[method(setDataSource:)]
pub unsafe fn setDataSource(
&self,
data_source: Option<&ProtocolObject<dyn NSComboBoxCellDataSource>>,
);
#[method(addItemWithObjectValue:)]
pub unsafe fn addItemWithObjectValue(&self, object: &AnyObject);
#[method(addItemsWithObjectValues:)]
pub unsafe fn addItemsWithObjectValues(&self, objects: &NSArray);
#[method(insertItemWithObjectValue:atIndex:)]
pub unsafe fn insertItemWithObjectValue_atIndex(
&self,
object: &AnyObject,
index: NSInteger,
);
#[method(removeItemWithObjectValue:)]
pub unsafe fn removeItemWithObjectValue(&self, object: &AnyObject);
#[method(removeItemAtIndex:)]
pub unsafe fn removeItemAtIndex(&self, index: NSInteger);
#[method(removeAllItems)]
pub unsafe fn removeAllItems(&self);
#[method(selectItemWithObjectValue:)]
pub unsafe fn selectItemWithObjectValue(&self, object: Option<&AnyObject>);
#[method_id(@__retain_semantics Other itemObjectValueAtIndex:)]
pub unsafe fn itemObjectValueAtIndex(&self, index: NSInteger) -> Retained<AnyObject>;
#[method_id(@__retain_semantics Other objectValueOfSelectedItem)]
pub unsafe fn objectValueOfSelectedItem(&self) -> Option<Retained<AnyObject>>;
#[method(indexOfItemWithObjectValue:)]
pub unsafe fn indexOfItemWithObjectValue(&self, object: &AnyObject) -> NSInteger;
#[method_id(@__retain_semantics Other objectValues)]
pub unsafe fn objectValues(&self) -> Retained<NSArray>;
}
);
extern_methods!(
/// Methods declared on superclass `NSTextFieldCell`
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
unsafe impl NSComboBoxCell {
#[method_id(@__retain_semantics Init initTextCell:)]
pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Init initImageCell:)]
pub unsafe fn initImageCell(
this: Allocated<Self>,
image: Option<&NSImage>,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSCell`
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
unsafe impl NSComboBoxCell {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
unsafe impl NSComboBoxCell {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait NSComboBoxCellDataSource: NSObjectProtocol {
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
#[optional]
#[method(numberOfItemsInComboBoxCell:)]
unsafe fn numberOfItemsInComboBoxCell(&self, combo_box_cell: &NSComboBoxCell) -> NSInteger;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
#[optional]
#[method_id(@__retain_semantics Other comboBoxCell:objectValueForItemAtIndex:)]
unsafe fn comboBoxCell_objectValueForItemAtIndex(
&self,
combo_box_cell: &NSComboBoxCell,
index: NSInteger,
) -> Retained<AnyObject>;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
#[optional]
#[method(comboBoxCell:indexOfItemWithStringValue:)]
unsafe fn comboBoxCell_indexOfItemWithStringValue(
&self,
combo_box_cell: &NSComboBoxCell,
string: &NSString,
) -> NSUInteger;
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSTextFieldCell"
))]
#[optional]
#[method_id(@__retain_semantics Other comboBoxCell:completedString:)]
unsafe fn comboBoxCell_completedString(
&self,
combo_box_cell: &NSComboBoxCell,
uncompleted_string: &NSString,
) -> Option<Retained<NSString>>;
}
unsafe impl ProtocolType for dyn NSComboBoxCellDataSource {}
);

View File

@@ -0,0 +1,197 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSComboButtonStyle(pub NSInteger);
impl NSComboButtonStyle {
#[doc(alias = "NSComboButtonStyleSplit")]
pub const Split: Self = Self(0);
#[doc(alias = "NSComboButtonStyleUnified")]
pub const Unified: Self = Self(1);
}
unsafe impl Encode for NSComboButtonStyle {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSComboButtonStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
pub struct NSComboButton;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl ClassType for NSComboButton {
#[inherits(NSView, NSResponder, NSObject)]
type Super = NSControl;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibility for NSComboButton {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSComboButton {}
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAnimatablePropertyContainer for NSComboButton {}
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAppearanceCustomization for NSComboButton {}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSComboButton {}
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSDraggingDestination for NSComboButton {}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSComboButton {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSComboButton {}
extern_methods!(
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSComboButton {
#[cfg(feature = "NSMenu")]
#[method_id(@__retain_semantics Other comboButtonWithTitle:menu:target:action:)]
pub unsafe fn comboButtonWithTitle_menu_target_action(
title: &NSString,
menu: Option<&NSMenu>,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[cfg(all(feature = "NSImage", feature = "NSMenu"))]
#[method_id(@__retain_semantics Other comboButtonWithImage:menu:target:action:)]
pub unsafe fn comboButtonWithImage_menu_target_action(
image: &NSImage,
menu: Option<&NSMenu>,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[cfg(all(feature = "NSImage", feature = "NSMenu"))]
#[method_id(@__retain_semantics Other comboButtonWithTitle:image:menu:target:action:)]
pub unsafe fn comboButtonWithTitle_image_menu_target_action(
title: &NSString,
image: &NSImage,
menu: Option<&NSMenu>,
target: Option<&AnyObject>,
action: Option<Sel>,
mtm: MainThreadMarker,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other title)]
pub unsafe fn title(&self) -> Retained<NSString>;
#[method(setTitle:)]
pub unsafe fn setTitle(&self, title: &NSString);
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other image)]
pub unsafe fn image(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setImage:)]
pub unsafe fn setImage(&self, image: Option<&NSImage>);
#[cfg(feature = "NSCell")]
#[method(imageScaling)]
pub unsafe fn imageScaling(&self) -> NSImageScaling;
#[cfg(feature = "NSCell")]
#[method(setImageScaling:)]
pub unsafe fn setImageScaling(&self, image_scaling: NSImageScaling);
#[cfg(feature = "NSMenu")]
#[method_id(@__retain_semantics Other menu)]
pub unsafe fn menu(&self) -> Retained<NSMenu>;
#[cfg(feature = "NSMenu")]
#[method(setMenu:)]
pub unsafe fn setMenu(&self, menu: &NSMenu);
#[method(style)]
pub unsafe fn style(&self) -> NSComboButtonStyle;
#[method(setStyle:)]
pub unsafe fn setStyle(&self, style: NSComboButtonStyle);
}
);
extern_methods!(
/// Methods declared on superclass `NSControl`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSComboButton {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSComboButton {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSComboButton {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,496 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
pub struct NSControl;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl ClassType for NSControl {
#[inherits(NSResponder, NSObject)]
type Super = NSView;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibility for NSControl {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSControl {}
#[cfg(all(feature = "NSAnimation", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAnimatablePropertyContainer for NSControl {}
#[cfg(all(feature = "NSAppearance", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSAppearanceCustomization for NSControl {}
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSControl {}
#[cfg(all(feature = "NSDragging", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSDraggingDestination for NSControl {}
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSControl {}
#[cfg(all(
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSControl {}
extern_methods!(
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSControl {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Other target)]
pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
#[method(action)]
pub unsafe fn action(&self) -> Option<Sel>;
#[method(setAction:)]
pub unsafe fn setAction(&self, action: Option<Sel>);
#[method(tag)]
pub unsafe fn tag(&self) -> NSInteger;
#[method(setTag:)]
pub unsafe fn setTag(&self, tag: NSInteger);
#[method(ignoresMultiClick)]
pub unsafe fn ignoresMultiClick(&self) -> bool;
#[method(setIgnoresMultiClick:)]
pub unsafe fn setIgnoresMultiClick(&self, ignores_multi_click: bool);
#[method(isContinuous)]
pub unsafe fn isContinuous(&self) -> bool;
#[method(setContinuous:)]
pub unsafe fn setContinuous(&self, continuous: bool);
#[method(isEnabled)]
pub fn isEnabled(&self) -> bool;
#[method(setEnabled:)]
pub fn setEnabled(&self, enabled: bool);
#[method(refusesFirstResponder)]
pub unsafe fn refusesFirstResponder(&self) -> bool;
#[method(setRefusesFirstResponder:)]
pub unsafe fn setRefusesFirstResponder(&self, refuses_first_responder: bool);
#[method(isHighlighted)]
pub unsafe fn isHighlighted(&self) -> bool;
#[method(setHighlighted:)]
pub unsafe fn setHighlighted(&self, highlighted: bool);
#[cfg(feature = "NSCell")]
#[method(controlSize)]
pub unsafe fn controlSize(&self) -> NSControlSize;
#[cfg(feature = "NSCell")]
#[method(setControlSize:)]
pub unsafe fn setControlSize(&self, control_size: NSControlSize);
#[method_id(@__retain_semantics Other formatter)]
pub unsafe fn formatter(&self) -> Option<Retained<NSFormatter>>;
#[method(setFormatter:)]
pub unsafe fn setFormatter(&self, formatter: Option<&NSFormatter>);
#[method_id(@__retain_semantics Other objectValue)]
pub unsafe fn objectValue(&self) -> Option<Retained<AnyObject>>;
#[method(setObjectValue:)]
pub unsafe fn setObjectValue(&self, object_value: Option<&AnyObject>);
#[method_id(@__retain_semantics Other stringValue)]
pub unsafe fn stringValue(&self) -> Retained<NSString>;
#[method(setStringValue:)]
pub unsafe fn setStringValue(&self, string_value: &NSString);
#[method_id(@__retain_semantics Other attributedStringValue)]
pub unsafe fn attributedStringValue(&self) -> Retained<NSAttributedString>;
#[method(setAttributedStringValue:)]
pub unsafe fn setAttributedStringValue(&self, attributed_string_value: &NSAttributedString);
#[method(intValue)]
pub unsafe fn intValue(&self) -> c_int;
#[method(setIntValue:)]
pub unsafe fn setIntValue(&self, int_value: c_int);
#[method(integerValue)]
pub unsafe fn integerValue(&self) -> NSInteger;
#[method(setIntegerValue:)]
pub unsafe fn setIntegerValue(&self, integer_value: NSInteger);
#[method(floatValue)]
pub unsafe fn floatValue(&self) -> c_float;
#[method(setFloatValue:)]
pub unsafe fn setFloatValue(&self, float_value: c_float);
#[method(doubleValue)]
pub unsafe fn doubleValue(&self) -> c_double;
#[method(setDoubleValue:)]
pub unsafe fn setDoubleValue(&self, double_value: c_double);
#[method(sizeThatFits:)]
pub unsafe fn sizeThatFits(&self, size: NSSize) -> NSSize;
#[method(sizeToFit)]
pub unsafe fn sizeToFit(&self);
#[cfg(feature = "NSEvent")]
#[method(sendActionOn:)]
pub unsafe fn sendActionOn(&self, mask: NSEventMask) -> NSInteger;
#[method(sendAction:to:)]
pub unsafe fn sendAction_to(&self, action: Option<Sel>, target: Option<&AnyObject>)
-> bool;
#[method(takeIntValueFrom:)]
pub unsafe fn takeIntValueFrom(&self, sender: Option<&AnyObject>);
#[method(takeFloatValueFrom:)]
pub unsafe fn takeFloatValueFrom(&self, sender: Option<&AnyObject>);
#[method(takeDoubleValueFrom:)]
pub unsafe fn takeDoubleValueFrom(&self, sender: Option<&AnyObject>);
#[method(takeStringValueFrom:)]
pub unsafe fn takeStringValueFrom(&self, sender: Option<&AnyObject>);
#[method(takeObjectValueFrom:)]
pub unsafe fn takeObjectValueFrom(&self, sender: Option<&AnyObject>);
#[method(takeIntegerValueFrom:)]
pub unsafe fn takeIntegerValueFrom(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSEvent")]
#[method(mouseDown:)]
pub unsafe fn mouseDown(&self, event: &NSEvent);
#[method(performClick:)]
pub unsafe fn performClick(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other font)]
pub unsafe fn font(&self) -> Option<Retained<NSFont>>;
#[cfg(feature = "NSFont")]
#[method(setFont:)]
pub unsafe fn setFont(&self, font: Option<&NSFont>);
#[method(usesSingleLineMode)]
pub unsafe fn usesSingleLineMode(&self) -> bool;
#[method(setUsesSingleLineMode:)]
pub unsafe fn setUsesSingleLineMode(&self, uses_single_line_mode: bool);
#[cfg(feature = "NSParagraphStyle")]
#[method(lineBreakMode)]
pub unsafe fn lineBreakMode(&self) -> NSLineBreakMode;
#[cfg(feature = "NSParagraphStyle")]
#[method(setLineBreakMode:)]
pub unsafe fn setLineBreakMode(&self, line_break_mode: NSLineBreakMode);
#[cfg(feature = "NSText")]
#[method(alignment)]
pub unsafe fn alignment(&self) -> NSTextAlignment;
#[cfg(feature = "NSText")]
#[method(setAlignment:)]
pub unsafe fn setAlignment(&self, alignment: NSTextAlignment);
#[cfg(feature = "NSText")]
#[method(baseWritingDirection)]
pub unsafe fn baseWritingDirection(&self) -> NSWritingDirection;
#[cfg(feature = "NSText")]
#[method(setBaseWritingDirection:)]
pub unsafe fn setBaseWritingDirection(&self, base_writing_direction: NSWritingDirection);
#[method(allowsExpansionToolTips)]
pub unsafe fn allowsExpansionToolTips(&self) -> bool;
#[method(setAllowsExpansionToolTips:)]
pub unsafe fn setAllowsExpansionToolTips(&self, allows_expansion_tool_tips: bool);
#[method(expansionFrameWithFrame:)]
pub unsafe fn expansionFrameWithFrame(&self, content_frame: NSRect) -> NSRect;
#[method(drawWithExpansionFrame:inView:)]
pub unsafe fn drawWithExpansionFrame_inView(&self, content_frame: NSRect, view: &NSView);
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSControl {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSControl {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSControlEditableTextMethods
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSControl {
#[cfg(feature = "NSText")]
#[method_id(@__retain_semantics Other currentEditor)]
pub unsafe fn currentEditor(&self) -> Option<Retained<NSText>>;
#[method(abortEditing)]
pub unsafe fn abortEditing(&self) -> bool;
#[method(validateEditing)]
pub unsafe fn validateEditing(&self);
#[cfg(all(feature = "NSEvent", feature = "NSText"))]
#[method(editWithFrame:editor:delegate:event:)]
pub unsafe fn editWithFrame_editor_delegate_event(
&self,
rect: NSRect,
text_obj: &NSText,
delegate: Option<&AnyObject>,
event: &NSEvent,
);
#[cfg(feature = "NSText")]
#[method(selectWithFrame:editor:delegate:start:length:)]
pub unsafe fn selectWithFrame_editor_delegate_start_length(
&self,
rect: NSRect,
text_obj: &NSText,
delegate: Option<&AnyObject>,
sel_start: NSInteger,
sel_length: NSInteger,
);
#[cfg(feature = "NSText")]
#[method(endEditing:)]
pub unsafe fn endEditing(&self, text_obj: &NSText);
}
);
extern_protocol!(
pub unsafe trait NSControlTextEditingDelegate:
NSObjectProtocol + IsMainThreadOnly
{
#[optional]
#[method(controlTextDidBeginEditing:)]
unsafe fn controlTextDidBeginEditing(&self, obj: &NSNotification);
#[optional]
#[method(controlTextDidEndEditing:)]
unsafe fn controlTextDidEndEditing(&self, obj: &NSNotification);
#[optional]
#[method(controlTextDidChange:)]
unsafe fn controlTextDidChange(&self, obj: &NSNotification);
#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
#[optional]
#[method(control:textShouldBeginEditing:)]
unsafe fn control_textShouldBeginEditing(
&self,
control: &NSControl,
field_editor: &NSText,
) -> bool;
#[cfg(all(feature = "NSResponder", feature = "NSText", feature = "NSView"))]
#[optional]
#[method(control:textShouldEndEditing:)]
unsafe fn control_textShouldEndEditing(
&self,
control: &NSControl,
field_editor: &NSText,
) -> bool;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(control:didFailToFormatString:errorDescription:)]
unsafe fn control_didFailToFormatString_errorDescription(
&self,
control: &NSControl,
string: &NSString,
error: Option<&NSString>,
) -> bool;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(control:didFailToValidatePartialString:errorDescription:)]
unsafe fn control_didFailToValidatePartialString_errorDescription(
&self,
control: &NSControl,
string: &NSString,
error: Option<&NSString>,
);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[optional]
#[method(control:isValidObject:)]
unsafe fn control_isValidObject(
&self,
control: &NSControl,
obj: Option<&AnyObject>,
) -> bool;
#[cfg(all(
feature = "NSResponder",
feature = "NSText",
feature = "NSTextView",
feature = "NSView"
))]
#[optional]
#[method(control:textView:doCommandBySelector:)]
unsafe fn control_textView_doCommandBySelector(
&self,
control: &NSControl,
text_view: &NSTextView,
command_selector: Sel,
) -> bool;
#[cfg(all(
feature = "NSResponder",
feature = "NSText",
feature = "NSTextView",
feature = "NSView"
))]
#[optional]
#[method_id(@__retain_semantics Other control:textView:completions:forPartialWordRange:indexOfSelectedItem:)]
unsafe fn control_textView_completions_forPartialWordRange_indexOfSelectedItem(
&self,
control: &NSControl,
text_view: &NSTextView,
words: &NSArray<NSString>,
char_range: NSRange,
index: NonNull<NSInteger>,
) -> Retained<NSArray<NSString>>;
}
unsafe impl ProtocolType for dyn NSControlTextEditingDelegate {}
);
extern "C" {
pub static NSControlTextDidBeginEditingNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSControlTextDidEndEditingNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSControlTextDidChangeNotification: &'static NSNotificationName;
}
extern_methods!(
/// NSDeprecated
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
unsafe impl NSControl {
#[deprecated]
#[method(setFloatingPointFormat:left:right:)]
pub unsafe fn setFloatingPointFormat_left_right(
&self,
auto_range: bool,
left_digits: NSUInteger,
right_digits: NSUInteger,
);
#[method(cellClass)]
pub unsafe fn cellClass(mtm: MainThreadMarker) -> Option<&'static AnyClass>;
#[method(setCellClass:)]
pub unsafe fn setCellClass(cell_class: Option<&AnyClass>, mtm: MainThreadMarker);
#[cfg(feature = "NSCell")]
#[method_id(@__retain_semantics Other cell)]
pub unsafe fn cell(&self) -> Option<Retained<NSCell>>;
#[cfg(feature = "NSCell")]
#[method(setCell:)]
pub unsafe fn setCell(&self, cell: Option<&NSCell>);
#[cfg(feature = "NSCell")]
#[method_id(@__retain_semantics Other selectedCell)]
pub unsafe fn selectedCell(&self) -> Option<Retained<NSCell>>;
#[method(selectedTag)]
pub unsafe fn selectedTag(&self) -> NSInteger;
#[deprecated = "Set the needsDisplay property to YES instead"]
#[method(setNeedsDisplay)]
pub unsafe fn setNeedsDisplay(&self);
#[deprecated = "Override -layout instead. This method should never be called"]
#[method(calcSize)]
pub unsafe fn calcSize(&self);
#[cfg(feature = "NSCell")]
#[method(updateCell:)]
pub unsafe fn updateCell(&self, cell: &NSCell);
#[cfg(feature = "NSCell")]
#[method(updateCellInside:)]
pub unsafe fn updateCellInside(&self, cell: &NSCell);
#[cfg(feature = "NSCell")]
#[method(drawCellInside:)]
pub unsafe fn drawCellInside(&self, cell: &NSCell);
#[cfg(feature = "NSCell")]
#[method(drawCell:)]
pub unsafe fn drawCell(&self, cell: &NSCell);
#[cfg(feature = "NSCell")]
#[method(selectCell:)]
pub unsafe fn selectCell(&self, cell: &NSCell);
}
);

View File

@@ -0,0 +1,72 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSController;
unsafe impl ClassType for NSController {
type Super = NSObject;
type Mutability = MainThreadOnly;
}
);
unsafe impl NSCoding for NSController {}
#[cfg(feature = "NSKeyValueBinding")]
unsafe impl NSEditor for NSController {}
#[cfg(feature = "NSKeyValueBinding")]
unsafe impl NSEditorRegistration for NSController {}
unsafe impl NSObjectProtocol for NSController {}
extern_methods!(
unsafe impl NSController {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSKeyValueBinding")]
#[method(objectDidBeginEditing:)]
pub unsafe fn objectDidBeginEditing(&self, editor: &ProtocolObject<dyn NSEditor>);
#[cfg(feature = "NSKeyValueBinding")]
#[method(objectDidEndEditing:)]
pub unsafe fn objectDidEndEditing(&self, editor: &ProtocolObject<dyn NSEditor>);
#[method(discardEditing)]
pub unsafe fn discardEditing(&self);
#[method(commitEditing)]
pub unsafe fn commitEditing(&self) -> bool;
#[method(commitEditingWithDelegate:didCommitSelector:contextInfo:)]
pub unsafe fn commitEditingWithDelegate_didCommitSelector_contextInfo(
&self,
delegate: Option<&AnyObject>,
did_commit_selector: Option<Sel>,
context_info: *mut c_void,
);
#[method(isEditing)]
pub unsafe fn isEditing(&self) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSController {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,181 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCursor;
unsafe impl ClassType for NSCursor {
type Super = NSObject;
type Mutability = Immutable;
}
);
unsafe impl NSCoding for NSCursor {}
unsafe impl NSObjectProtocol for NSCursor {}
unsafe impl NSSecureCoding for NSCursor {}
extern_methods!(
unsafe impl NSCursor {
#[method_id(@__retain_semantics Other currentCursor)]
pub unsafe fn currentCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other currentSystemCursor)]
pub unsafe fn currentSystemCursor() -> Option<Retained<NSCursor>>;
#[method_id(@__retain_semantics Other arrowCursor)]
pub fn arrowCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other IBeamCursor)]
pub fn IBeamCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other pointingHandCursor)]
pub fn pointingHandCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other closedHandCursor)]
pub fn closedHandCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other openHandCursor)]
pub fn openHandCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other resizeLeftCursor)]
pub fn resizeLeftCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other resizeRightCursor)]
pub fn resizeRightCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other resizeLeftRightCursor)]
pub fn resizeLeftRightCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other resizeUpCursor)]
pub fn resizeUpCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other resizeDownCursor)]
pub fn resizeDownCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other resizeUpDownCursor)]
pub fn resizeUpDownCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other crosshairCursor)]
pub fn crosshairCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other disappearingItemCursor)]
pub fn disappearingItemCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other operationNotAllowedCursor)]
pub fn operationNotAllowedCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other dragLinkCursor)]
pub fn dragLinkCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other dragCopyCursor)]
pub fn dragCopyCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other contextualMenuCursor)]
pub fn contextualMenuCursor() -> Retained<NSCursor>;
#[method_id(@__retain_semantics Other IBeamCursorForVerticalLayout)]
pub fn IBeamCursorForVerticalLayout() -> Retained<NSCursor>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Init initWithImage:hotSpot:)]
pub fn initWithImage_hotSpot(
this: Allocated<Self>,
new_image: &NSImage,
point: NSPoint,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[method(hide)]
pub unsafe fn hide();
#[method(unhide)]
pub unsafe fn unhide();
#[method(setHiddenUntilMouseMoves:)]
pub unsafe fn setHiddenUntilMouseMoves(flag: bool);
#[method(pop)]
pub unsafe fn pop_class();
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other image)]
pub unsafe fn image(&self) -> Retained<NSImage>;
#[method(hotSpot)]
pub unsafe fn hotSpot(&self) -> NSPoint;
#[method(push)]
pub unsafe fn push(&self);
#[method(pop)]
pub unsafe fn pop(&self);
#[method(set)]
pub unsafe fn set(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSCursor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
#[cfg(feature = "NSApplication")]
pub static NSAppKitVersionNumberWithCursorSizeSupport: NSAppKitVersion = 682.0 as _;
extern_methods!(
/// NSDeprecated
unsafe impl NSCursor {
#[cfg(all(feature = "NSColor", feature = "NSImage"))]
#[deprecated = "Color hints are ignored. Use -initWithImage:hotSpot: instead"]
#[method_id(@__retain_semantics Init initWithImage:foregroundColorHint:backgroundColorHint:hotSpot:)]
pub unsafe fn initWithImage_foregroundColorHint_backgroundColorHint_hotSpot(
this: Allocated<Self>,
new_image: &NSImage,
fg: Option<&NSColor>,
bg: Option<&NSColor>,
hot_spot: NSPoint,
) -> Retained<Self>;
#[deprecated = "setOnMouseExited is unused and should not be called"]
#[method(setOnMouseExited:)]
pub unsafe fn setOnMouseExited(&self, flag: bool);
#[deprecated = "setOnMouseEntered is unused and should not be called"]
#[method(setOnMouseEntered:)]
pub unsafe fn setOnMouseEntered(&self, flag: bool);
#[deprecated = "isSetOnMouseExited is unused"]
#[method(isSetOnMouseExited)]
pub unsafe fn isSetOnMouseExited(&self) -> bool;
#[deprecated = "isSetOnMouseEntered is unused"]
#[method(isSetOnMouseEntered)]
pub unsafe fn isSetOnMouseEntered(&self) -> bool;
#[cfg(feature = "NSEvent")]
#[deprecated = "mouseEntered: is unused and should not be called"]
#[method(mouseEntered:)]
pub unsafe fn mouseEntered(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[deprecated = "mouseExited: is unused and should not be called"]
#[method(mouseExited:)]
pub unsafe fn mouseExited(&self, event: &NSEvent);
}
);

View File

@@ -0,0 +1,83 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSImageRep")]
pub struct NSCustomImageRep;
#[cfg(feature = "NSImageRep")]
unsafe impl ClassType for NSCustomImageRep {
#[inherits(NSObject)]
type Super = NSImageRep;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSImageRep")]
unsafe impl NSCoding for NSCustomImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSCopying for NSCustomImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSObjectProtocol for NSCustomImageRep {}
extern_methods!(
#[cfg(feature = "NSImageRep")]
unsafe impl NSCustomImageRep {
#[cfg(feature = "block2")]
#[method_id(@__retain_semantics Init initWithSize:flipped:drawingHandler:)]
pub unsafe fn initWithSize_flipped_drawingHandler(
this: Allocated<Self>,
size: NSSize,
drawing_handler_should_be_called_with_flipped_context: bool,
drawing_handler: &block2::Block<dyn Fn(NSRect) -> Bool>,
) -> Retained<Self>;
#[cfg(feature = "block2")]
#[method(drawingHandler)]
pub unsafe fn drawingHandler(&self) -> *mut block2::Block<dyn Fn(NSRect) -> Bool>;
#[method_id(@__retain_semantics Init initWithDrawSelector:delegate:)]
pub unsafe fn initWithDrawSelector_delegate(
this: Allocated<Self>,
selector: Sel,
delegate: &AnyObject,
) -> Retained<Self>;
#[method(drawSelector)]
pub unsafe fn drawSelector(&self) -> Option<Sel>;
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Retained<AnyObject>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSImageRep`
#[cfg(feature = "NSImageRep")]
unsafe impl NSCustomImageRep {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSImageRep")]
unsafe impl NSCustomImageRep {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,82 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSTouchBarItem")]
pub struct NSCustomTouchBarItem;
#[cfg(feature = "NSTouchBarItem")]
unsafe impl ClassType for NSCustomTouchBarItem {
#[inherits(NSObject)]
type Super = NSTouchBarItem;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSCoding for NSCustomTouchBarItem {}
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSObjectProtocol for NSCustomTouchBarItem {}
extern_methods!(
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSCustomTouchBarItem {
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method_id(@__retain_semantics Other view)]
pub unsafe fn view(&self) -> Retained<NSView>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(setView:)]
pub unsafe fn setView(&self, view: &NSView);
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
#[method_id(@__retain_semantics Other viewController)]
pub unsafe fn viewController(&self) -> Option<Retained<NSViewController>>;
#[cfg(all(feature = "NSResponder", feature = "NSViewController"))]
#[method(setViewController:)]
pub unsafe fn setViewController(&self, view_controller: Option<&NSViewController>);
#[method_id(@__retain_semantics Other customizationLabel)]
pub unsafe fn customizationLabel(&self) -> Retained<NSString>;
#[method(setCustomizationLabel:)]
pub unsafe fn setCustomizationLabel(&self, customization_label: Option<&NSString>);
}
);
extern_methods!(
/// Methods declared on superclass `NSTouchBarItem`
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSCustomTouchBarItem {
#[method_id(@__retain_semantics Init initWithIdentifier:)]
pub unsafe fn initWithIdentifier(
this: Allocated<Self>,
identifier: &NSTouchBarItemIdentifier,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSTouchBarItem")]
unsafe impl NSCustomTouchBarItem {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,59 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub type NSDataAssetName = NSString;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDataAsset;
unsafe impl ClassType for NSDataAsset {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCopying for NSDataAsset {}
unsafe impl NSObjectProtocol for NSDataAsset {}
extern_methods!(
unsafe impl NSDataAsset {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithName:)]
pub unsafe fn initWithName(
this: Allocated<Self>,
name: &NSDataAssetName,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithName:bundle:)]
pub unsafe fn initWithName_bundle(
this: Allocated<Self>,
name: &NSDataAssetName,
bundle: &NSBundle,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Other name)]
pub unsafe fn name(&self) -> Retained<NSDataAssetName>;
#[method_id(@__retain_semantics Other data)]
pub unsafe fn data(&self) -> Retained<NSData>;
#[method_id(@__retain_semantics Other typeIdentifier)]
pub unsafe fn typeIdentifier(&self) -> Retained<NSString>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDataAsset {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,230 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
pub struct NSDatePicker;
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl ClassType for NSDatePicker {
#[inherits(NSView, NSResponder, NSObject)]
type Super = NSControl;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibility for NSDatePicker {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSDatePicker {}
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAnimatablePropertyContainer for NSDatePicker {}
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAppearanceCustomization for NSDatePicker {}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSCoding for NSDatePicker {}
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSDraggingDestination for NSDatePicker {}
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSObjectProtocol for NSDatePicker {}
#[cfg(all(
feature = "NSControl",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSDatePicker {}
extern_methods!(
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSDatePicker {
#[cfg(feature = "NSDatePickerCell")]
#[method(datePickerStyle)]
pub unsafe fn datePickerStyle(&self) -> NSDatePickerStyle;
#[cfg(feature = "NSDatePickerCell")]
#[method(setDatePickerStyle:)]
pub unsafe fn setDatePickerStyle(&self, date_picker_style: NSDatePickerStyle);
#[method(isBezeled)]
pub unsafe fn isBezeled(&self) -> bool;
#[method(setBezeled:)]
pub unsafe fn setBezeled(&self, bezeled: bool);
#[method(isBordered)]
pub unsafe fn isBordered(&self) -> bool;
#[method(setBordered:)]
pub unsafe fn setBordered(&self, bordered: bool);
#[method(drawsBackground)]
pub unsafe fn drawsBackground(&self) -> bool;
#[method(setDrawsBackground:)]
pub unsafe fn setDrawsBackground(&self, draws_background: bool);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other backgroundColor)]
pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setBackgroundColor:)]
pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other textColor)]
pub unsafe fn textColor(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setTextColor:)]
pub unsafe fn setTextColor(&self, text_color: &NSColor);
#[cfg(feature = "NSDatePickerCell")]
#[method(datePickerMode)]
pub unsafe fn datePickerMode(&self) -> NSDatePickerMode;
#[cfg(feature = "NSDatePickerCell")]
#[method(setDatePickerMode:)]
pub unsafe fn setDatePickerMode(&self, date_picker_mode: NSDatePickerMode);
#[cfg(feature = "NSDatePickerCell")]
#[method(datePickerElements)]
pub unsafe fn datePickerElements(&self) -> NSDatePickerElementFlags;
#[cfg(feature = "NSDatePickerCell")]
#[method(setDatePickerElements:)]
pub unsafe fn setDatePickerElements(&self, date_picker_elements: NSDatePickerElementFlags);
#[method_id(@__retain_semantics Other calendar)]
pub unsafe fn calendar(&self) -> Option<Retained<NSCalendar>>;
#[method(setCalendar:)]
pub unsafe fn setCalendar(&self, calendar: Option<&NSCalendar>);
#[method_id(@__retain_semantics Other locale)]
pub unsafe fn locale(&self) -> Option<Retained<NSLocale>>;
#[method(setLocale:)]
pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);
#[method_id(@__retain_semantics Other timeZone)]
pub unsafe fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
#[method(setTimeZone:)]
pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
#[method_id(@__retain_semantics Other dateValue)]
pub unsafe fn dateValue(&self) -> Retained<NSDate>;
#[method(setDateValue:)]
pub unsafe fn setDateValue(&self, date_value: &NSDate);
#[method(timeInterval)]
pub unsafe fn timeInterval(&self) -> NSTimeInterval;
#[method(setTimeInterval:)]
pub unsafe fn setTimeInterval(&self, time_interval: NSTimeInterval);
#[method_id(@__retain_semantics Other minDate)]
pub unsafe fn minDate(&self) -> Option<Retained<NSDate>>;
#[method(setMinDate:)]
pub unsafe fn setMinDate(&self, min_date: Option<&NSDate>);
#[method_id(@__retain_semantics Other maxDate)]
pub unsafe fn maxDate(&self) -> Option<Retained<NSDate>>;
#[method(setMaxDate:)]
pub unsafe fn setMaxDate(&self, max_date: Option<&NSDate>);
#[method(presentsCalendarOverlay)]
pub unsafe fn presentsCalendarOverlay(&self) -> bool;
#[method(setPresentsCalendarOverlay:)]
pub unsafe fn setPresentsCalendarOverlay(&self, presents_calendar_overlay: bool);
#[cfg(feature = "NSDatePickerCell")]
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSDatePickerCellDelegate>>>;
#[cfg(feature = "NSDatePickerCell")]
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSDatePickerCellDelegate>>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSControl`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSDatePicker {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSDatePicker {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSControl", feature = "NSResponder", feature = "NSView"))]
unsafe impl NSDatePicker {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,288 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDatePickerStyle(pub NSUInteger);
impl NSDatePickerStyle {
#[doc(alias = "NSDatePickerStyleTextFieldAndStepper")]
pub const TextFieldAndStepper: Self = Self(0);
#[doc(alias = "NSDatePickerStyleClockAndCalendar")]
pub const ClockAndCalendar: Self = Self(1);
#[doc(alias = "NSDatePickerStyleTextField")]
pub const TextField: Self = Self(2);
}
unsafe impl Encode for NSDatePickerStyle {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDatePickerStyle {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDatePickerMode(pub NSUInteger);
impl NSDatePickerMode {
#[doc(alias = "NSDatePickerModeSingle")]
pub const Single: Self = Self(0);
#[doc(alias = "NSDatePickerModeRange")]
pub const Range: Self = Self(1);
}
unsafe impl Encode for NSDatePickerMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDatePickerMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDatePickerElementFlags(pub NSUInteger);
bitflags::bitflags! {
impl NSDatePickerElementFlags: NSUInteger {
const NSDatePickerElementFlagHourMinute = 0x000c;
const NSDatePickerElementFlagHourMinuteSecond = 0x000e;
const NSDatePickerElementFlagTimeZone = 0x0010;
const NSDatePickerElementFlagYearMonth = 0x00c0;
const NSDatePickerElementFlagYearMonthDay = 0x00e0;
const NSDatePickerElementFlagEra = 0x0100;
}
}
unsafe impl Encode for NSDatePickerElementFlags {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDatePickerElementFlags {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
pub struct NSDatePickerCell;
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl ClassType for NSDatePickerCell {
#[inherits(NSCell, NSObject)]
type Super = NSActionCell;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
unsafe impl NSAccessibility for NSDatePickerCell {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
unsafe impl NSAccessibilityElementProtocol for NSDatePickerCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSCoding for NSDatePickerCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSCopying for NSDatePickerCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSObjectProtocol for NSDatePickerCell {}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSUserInterfaceItemIdentification"
))]
unsafe impl NSUserInterfaceItemIdentification for NSDatePickerCell {}
extern_methods!(
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSDatePickerCell {
#[method_id(@__retain_semantics Init initTextCell:)]
pub unsafe fn initTextCell(this: Allocated<Self>, string: &NSString) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Init initImageCell:)]
pub unsafe fn initImageCell(
this: Allocated<Self>,
image: Option<&NSImage>,
) -> Retained<Self>;
#[method(datePickerStyle)]
pub unsafe fn datePickerStyle(&self) -> NSDatePickerStyle;
#[method(setDatePickerStyle:)]
pub unsafe fn setDatePickerStyle(&self, date_picker_style: NSDatePickerStyle);
#[method(drawsBackground)]
pub unsafe fn drawsBackground(&self) -> bool;
#[method(setDrawsBackground:)]
pub unsafe fn setDrawsBackground(&self, draws_background: bool);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other backgroundColor)]
pub unsafe fn backgroundColor(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setBackgroundColor:)]
pub unsafe fn setBackgroundColor(&self, background_color: &NSColor);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other textColor)]
pub unsafe fn textColor(&self) -> Retained<NSColor>;
#[cfg(feature = "NSColor")]
#[method(setTextColor:)]
pub unsafe fn setTextColor(&self, text_color: &NSColor);
#[method(datePickerMode)]
pub unsafe fn datePickerMode(&self) -> NSDatePickerMode;
#[method(setDatePickerMode:)]
pub unsafe fn setDatePickerMode(&self, date_picker_mode: NSDatePickerMode);
#[method(datePickerElements)]
pub unsafe fn datePickerElements(&self) -> NSDatePickerElementFlags;
#[method(setDatePickerElements:)]
pub unsafe fn setDatePickerElements(&self, date_picker_elements: NSDatePickerElementFlags);
#[method_id(@__retain_semantics Other calendar)]
pub unsafe fn calendar(&self) -> Option<Retained<NSCalendar>>;
#[method(setCalendar:)]
pub unsafe fn setCalendar(&self, calendar: Option<&NSCalendar>);
#[method_id(@__retain_semantics Other locale)]
pub unsafe fn locale(&self) -> Option<Retained<NSLocale>>;
#[method(setLocale:)]
pub unsafe fn setLocale(&self, locale: Option<&NSLocale>);
#[method_id(@__retain_semantics Other timeZone)]
pub unsafe fn timeZone(&self) -> Option<Retained<NSTimeZone>>;
#[method(setTimeZone:)]
pub unsafe fn setTimeZone(&self, time_zone: Option<&NSTimeZone>);
#[method_id(@__retain_semantics Other dateValue)]
pub unsafe fn dateValue(&self) -> Retained<NSDate>;
#[method(setDateValue:)]
pub unsafe fn setDateValue(&self, date_value: &NSDate);
#[method(timeInterval)]
pub unsafe fn timeInterval(&self) -> NSTimeInterval;
#[method(setTimeInterval:)]
pub unsafe fn setTimeInterval(&self, time_interval: NSTimeInterval);
#[method_id(@__retain_semantics Other minDate)]
pub unsafe fn minDate(&self) -> Option<Retained<NSDate>>;
#[method(setMinDate:)]
pub unsafe fn setMinDate(&self, min_date: Option<&NSDate>);
#[method_id(@__retain_semantics Other maxDate)]
pub unsafe fn maxDate(&self) -> Option<Retained<NSDate>>;
#[method(setMaxDate:)]
pub unsafe fn setMaxDate(&self, max_date: Option<&NSDate>);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSDatePickerCellDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSDatePickerCellDelegate>>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSCell`
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSDatePickerCell {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSDatePickerCell {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait NSDatePickerCellDelegate: NSObjectProtocol + IsMainThreadOnly {
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
#[optional]
#[method(datePickerCell:validateProposedDateValue:timeInterval:)]
unsafe fn datePickerCell_validateProposedDateValue_timeInterval(
&self,
date_picker_cell: &NSDatePickerCell,
proposed_date_value: &mut Retained<NSDate>,
proposed_time_interval: *mut NSTimeInterval,
);
}
unsafe impl ProtocolType for dyn NSDatePickerCellDelegate {}
);
pub static NSTextFieldAndStepperDatePickerStyle: NSDatePickerStyle =
NSDatePickerStyle(NSDatePickerStyle::TextFieldAndStepper.0);
pub static NSClockAndCalendarDatePickerStyle: NSDatePickerStyle =
NSDatePickerStyle(NSDatePickerStyle::ClockAndCalendar.0);
pub static NSTextFieldDatePickerStyle: NSDatePickerStyle =
NSDatePickerStyle(NSDatePickerStyle::TextField.0);
pub static NSSingleDateMode: NSDatePickerMode = NSDatePickerMode(NSDatePickerMode::Single.0);
pub static NSRangeDateMode: NSDatePickerMode = NSDatePickerMode(NSDatePickerMode::Range.0);
pub static NSHourMinuteDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::NSDatePickerElementFlagHourMinute.0);
pub static NSHourMinuteSecondDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::NSDatePickerElementFlagHourMinuteSecond.0);
pub static NSTimeZoneDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::NSDatePickerElementFlagTimeZone.0);
pub static NSYearMonthDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::NSDatePickerElementFlagYearMonth.0);
pub static NSYearMonthDayDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::NSDatePickerElementFlagYearMonthDay.0);
pub static NSEraDatePickerElementFlag: NSDatePickerElementFlags =
NSDatePickerElementFlags(NSDatePickerElementFlags::NSDatePickerElementFlagEra.0);

View File

@@ -0,0 +1,204 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDictionaryControllerKeyValuePair;
unsafe impl ClassType for NSDictionaryControllerKeyValuePair {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSDictionaryControllerKeyValuePair {}
extern_methods!(
unsafe impl NSDictionaryControllerKeyValuePair {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Other key)]
pub unsafe fn key(&self) -> Option<Retained<NSString>>;
#[method(setKey:)]
pub unsafe fn setKey(&self, key: Option<&NSString>);
#[method_id(@__retain_semantics Other value)]
pub unsafe fn value(&self) -> Option<Retained<AnyObject>>;
#[method(setValue:)]
pub unsafe fn setValue(&self, value: Option<&AnyObject>);
#[method_id(@__retain_semantics Other localizedKey)]
pub unsafe fn localizedKey(&self) -> Option<Retained<NSString>>;
#[method(setLocalizedKey:)]
pub unsafe fn setLocalizedKey(&self, localized_key: Option<&NSString>);
#[method(isExplicitlyIncluded)]
pub unsafe fn isExplicitlyIncluded(&self) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDictionaryControllerKeyValuePair {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(
feature = "NSArrayController",
feature = "NSController",
feature = "NSObjectController"
))]
pub struct NSDictionaryController;
#[cfg(all(
feature = "NSArrayController",
feature = "NSController",
feature = "NSObjectController"
))]
unsafe impl ClassType for NSDictionaryController {
#[inherits(NSObjectController, NSController, NSObject)]
type Super = NSArrayController;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSArrayController",
feature = "NSController",
feature = "NSObjectController"
))]
unsafe impl NSCoding for NSDictionaryController {}
#[cfg(all(
feature = "NSArrayController",
feature = "NSController",
feature = "NSKeyValueBinding",
feature = "NSObjectController"
))]
unsafe impl NSEditor for NSDictionaryController {}
#[cfg(all(
feature = "NSArrayController",
feature = "NSController",
feature = "NSKeyValueBinding",
feature = "NSObjectController"
))]
unsafe impl NSEditorRegistration for NSDictionaryController {}
#[cfg(all(
feature = "NSArrayController",
feature = "NSController",
feature = "NSObjectController"
))]
unsafe impl NSObjectProtocol for NSDictionaryController {}
extern_methods!(
#[cfg(all(
feature = "NSArrayController",
feature = "NSController",
feature = "NSObjectController"
))]
unsafe impl NSDictionaryController {
#[method_id(@__retain_semantics New newObject)]
pub unsafe fn newObject(&self) -> Retained<NSDictionaryControllerKeyValuePair>;
#[method_id(@__retain_semantics Other initialKey)]
pub unsafe fn initialKey(&self) -> Retained<NSString>;
#[method(setInitialKey:)]
pub unsafe fn setInitialKey(&self, initial_key: &NSString);
#[method_id(@__retain_semantics Other initialValue)]
pub unsafe fn initialValue(&self) -> Retained<AnyObject>;
#[method(setInitialValue:)]
pub unsafe fn setInitialValue(&self, initial_value: &AnyObject);
#[method_id(@__retain_semantics Other includedKeys)]
pub unsafe fn includedKeys(&self) -> Retained<NSArray<NSString>>;
#[method(setIncludedKeys:)]
pub unsafe fn setIncludedKeys(&self, included_keys: &NSArray<NSString>);
#[method_id(@__retain_semantics Other excludedKeys)]
pub unsafe fn excludedKeys(&self) -> Retained<NSArray<NSString>>;
#[method(setExcludedKeys:)]
pub unsafe fn setExcludedKeys(&self, excluded_keys: &NSArray<NSString>);
#[method_id(@__retain_semantics Other localizedKeyDictionary)]
pub unsafe fn localizedKeyDictionary(&self) -> Retained<NSDictionary<NSString, NSString>>;
#[method(setLocalizedKeyDictionary:)]
pub unsafe fn setLocalizedKeyDictionary(
&self,
localized_key_dictionary: &NSDictionary<NSString, NSString>,
);
#[method_id(@__retain_semantics Other localizedKeyTable)]
pub unsafe fn localizedKeyTable(&self) -> Option<Retained<NSString>>;
#[method(setLocalizedKeyTable:)]
pub unsafe fn setLocalizedKeyTable(&self, localized_key_table: Option<&NSString>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObjectController`
#[cfg(all(
feature = "NSArrayController",
feature = "NSController",
feature = "NSObjectController"
))]
unsafe impl NSDictionaryController {
#[method_id(@__retain_semantics Init initWithContent:)]
pub unsafe fn initWithContent(
this: Allocated<Self>,
content: Option<&AnyObject>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSController`
#[cfg(all(
feature = "NSArrayController",
feature = "NSController",
feature = "NSObjectController"
))]
unsafe impl NSDictionaryController {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(
feature = "NSArrayController",
feature = "NSController",
feature = "NSObjectController"
))]
unsafe impl NSDictionaryController {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,302 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
__inner_extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDiffableDataSourceSnapshot<
SectionIdentifierType: ?Sized = AnyObject,
ItemIdentifierType: ?Sized = AnyObject,
> {
__superclass: NSObject,
_inner0: PhantomData<*mut SectionIdentifierType>,
_inner1: PhantomData<*mut ItemIdentifierType>,
notunwindsafe: PhantomData<&'static mut ()>,
}
unsafe impl<SectionIdentifierType: ?Sized + Message, ItemIdentifierType: ?Sized + Message>
ClassType for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
{
type Super = NSObject;
type Mutability = InteriorMutable;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
unsafe impl<SectionIdentifierType: ?Sized + IsIdCloneable, ItemIdentifierType: ?Sized + IsIdCloneable>
NSCopying for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
{
}
unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSObjectProtocol
for NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
{
}
extern_methods!(
unsafe impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
{
#[method(numberOfItems)]
pub unsafe fn numberOfItems(&self) -> NSInteger;
#[method(numberOfSections)]
pub unsafe fn numberOfSections(&self) -> NSInteger;
#[method_id(@__retain_semantics Other sectionIdentifiers)]
pub unsafe fn sectionIdentifiers(&self) -> Retained<NSArray<SectionIdentifierType>>;
#[method_id(@__retain_semantics Other itemIdentifiers)]
pub unsafe fn itemIdentifiers(&self) -> Retained<NSArray<ItemIdentifierType>>;
#[method(numberOfItemsInSection:)]
pub unsafe fn numberOfItemsInSection(
&self,
section_identifier: &SectionIdentifierType,
) -> NSInteger;
#[method_id(@__retain_semantics Other itemIdentifiersInSectionWithIdentifier:)]
pub unsafe fn itemIdentifiersInSectionWithIdentifier(
&self,
section_identifier: &SectionIdentifierType,
) -> Retained<NSArray<ItemIdentifierType>>;
#[method_id(@__retain_semantics Other sectionIdentifierForSectionContainingItemIdentifier:)]
pub unsafe fn sectionIdentifierForSectionContainingItemIdentifier(
&self,
item_identifier: &ItemIdentifierType,
) -> Option<Retained<SectionIdentifierType>>;
#[method(indexOfItemIdentifier:)]
pub unsafe fn indexOfItemIdentifier(
&self,
item_identifier: &ItemIdentifierType,
) -> NSInteger;
#[method(indexOfSectionIdentifier:)]
pub unsafe fn indexOfSectionIdentifier(
&self,
section_identifier: &SectionIdentifierType,
) -> NSInteger;
#[method(appendItemsWithIdentifiers:)]
pub unsafe fn appendItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
#[method(appendItemsWithIdentifiers:intoSectionWithIdentifier:)]
pub unsafe fn appendItemsWithIdentifiers_intoSectionWithIdentifier(
&self,
identifiers: &NSArray<ItemIdentifierType>,
section_identifier: &SectionIdentifierType,
);
#[method(insertItemsWithIdentifiers:beforeItemWithIdentifier:)]
pub unsafe fn insertItemsWithIdentifiers_beforeItemWithIdentifier(
&self,
identifiers: &NSArray<ItemIdentifierType>,
item_identifier: &ItemIdentifierType,
);
#[method(insertItemsWithIdentifiers:afterItemWithIdentifier:)]
pub unsafe fn insertItemsWithIdentifiers_afterItemWithIdentifier(
&self,
identifiers: &NSArray<ItemIdentifierType>,
item_identifier: &ItemIdentifierType,
);
#[method(deleteItemsWithIdentifiers:)]
pub unsafe fn deleteItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
#[method(deleteAllItems)]
pub unsafe fn deleteAllItems(&self);
#[method(moveItemWithIdentifier:beforeItemWithIdentifier:)]
pub unsafe fn moveItemWithIdentifier_beforeItemWithIdentifier(
&self,
from_identifier: &ItemIdentifierType,
to_identifier: &ItemIdentifierType,
);
#[method(moveItemWithIdentifier:afterItemWithIdentifier:)]
pub unsafe fn moveItemWithIdentifier_afterItemWithIdentifier(
&self,
from_identifier: &ItemIdentifierType,
to_identifier: &ItemIdentifierType,
);
#[method(reloadItemsWithIdentifiers:)]
pub unsafe fn reloadItemsWithIdentifiers(&self, identifiers: &NSArray<ItemIdentifierType>);
#[method(appendSectionsWithIdentifiers:)]
pub unsafe fn appendSectionsWithIdentifiers(
&self,
section_identifiers: &NSArray<SectionIdentifierType>,
);
#[method(insertSectionsWithIdentifiers:beforeSectionWithIdentifier:)]
pub unsafe fn insertSectionsWithIdentifiers_beforeSectionWithIdentifier(
&self,
section_identifiers: &NSArray<SectionIdentifierType>,
to_section_identifier: &SectionIdentifierType,
);
#[method(insertSectionsWithIdentifiers:afterSectionWithIdentifier:)]
pub unsafe fn insertSectionsWithIdentifiers_afterSectionWithIdentifier(
&self,
section_identifiers: &NSArray<SectionIdentifierType>,
to_section_identifier: &SectionIdentifierType,
);
#[method(deleteSectionsWithIdentifiers:)]
pub unsafe fn deleteSectionsWithIdentifiers(
&self,
section_identifiers: &NSArray<SectionIdentifierType>,
);
#[method(moveSectionWithIdentifier:beforeSectionWithIdentifier:)]
pub unsafe fn moveSectionWithIdentifier_beforeSectionWithIdentifier(
&self,
from_section_identifier: &SectionIdentifierType,
to_section_identifier: &SectionIdentifierType,
);
#[method(moveSectionWithIdentifier:afterSectionWithIdentifier:)]
pub unsafe fn moveSectionWithIdentifier_afterSectionWithIdentifier(
&self,
from_section_identifier: &SectionIdentifierType,
to_section_identifier: &SectionIdentifierType,
);
#[method(reloadSectionsWithIdentifiers:)]
pub unsafe fn reloadSectionsWithIdentifiers(
&self,
section_identifiers: &NSArray<SectionIdentifierType>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>
{
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
#[cfg(all(
feature = "NSCollectionView",
feature = "NSResponder",
feature = "NSView",
feature = "block2"
))]
pub type NSCollectionViewDiffableDataSourceSupplementaryViewProvider = *mut block2::Block<
dyn Fn(NonNull<NSCollectionView>, NonNull<NSString>, NonNull<NSIndexPath>) -> *mut NSView,
>;
__inner_extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSCollectionViewDiffableDataSource<
SectionIdentifierType: ?Sized = AnyObject,
ItemIdentifierType: ?Sized = AnyObject,
> {
__superclass: NSObject,
_inner0: PhantomData<*mut SectionIdentifierType>,
_inner1: PhantomData<*mut ItemIdentifierType>,
notunwindsafe: PhantomData<&'static mut ()>,
}
unsafe impl<SectionIdentifierType: ?Sized + Message, ItemIdentifierType: ?Sized + Message>
ClassType
for NSCollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
{
type Super = NSObject;
type Mutability = InteriorMutable;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
unsafe impl<SectionIdentifierType: ?Sized, ItemIdentifierType: ?Sized> NSObjectProtocol
for NSCollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
{
}
extern_methods!(
unsafe impl<SectionIdentifierType: Message, ItemIdentifierType: Message>
NSCollectionViewDiffableDataSource<SectionIdentifierType, ItemIdentifierType>
{
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
#[method_id(@__retain_semantics Other snapshot)]
pub unsafe fn snapshot(
&self,
) -> Retained<NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>>;
#[method(applySnapshot:animatingDifferences:)]
pub unsafe fn applySnapshot_animatingDifferences(
&self,
snapshot: &NSDiffableDataSourceSnapshot<SectionIdentifierType, ItemIdentifierType>,
animating_differences: bool,
);
#[method_id(@__retain_semantics Other itemIdentifierForIndexPath:)]
pub unsafe fn itemIdentifierForIndexPath(
&self,
index_path: &NSIndexPath,
) -> Option<Retained<ItemIdentifierType>>;
#[method_id(@__retain_semantics Other indexPathForItemIdentifier:)]
pub unsafe fn indexPathForItemIdentifier(
&self,
identifier: &ItemIdentifierType,
) -> Option<Retained<NSIndexPath>>;
#[cfg(all(
feature = "NSCollectionView",
feature = "NSResponder",
feature = "NSView",
feature = "block2"
))]
#[method(supplementaryViewProvider)]
pub unsafe fn supplementaryViewProvider(
&self,
mtm: MainThreadMarker,
) -> NSCollectionViewDiffableDataSourceSupplementaryViewProvider;
#[cfg(all(
feature = "NSCollectionView",
feature = "NSResponder",
feature = "NSView",
feature = "block2"
))]
#[method(setSupplementaryViewProvider:)]
pub unsafe fn setSupplementaryViewProvider(
&self,
supplementary_view_provider: NSCollectionViewDiffableDataSourceSupplementaryViewProvider,
);
}
);

View File

@@ -0,0 +1,79 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
#[cfg(feature = "NSApplication")]
pub static NSAppKitVersionNumberWithDockTilePlugInSupport: NSAppKitVersion = 1001.0 as _;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDockTile;
unsafe impl ClassType for NSDockTile {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSDockTile {}
extern_methods!(
unsafe impl NSDockTile {
#[method(size)]
pub unsafe fn size(&self) -> NSSize;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method_id(@__retain_semantics Other contentView)]
pub unsafe fn contentView(&self, mtm: MainThreadMarker) -> Option<Retained<NSView>>;
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(setContentView:)]
pub unsafe fn setContentView(&self, content_view: Option<&NSView>);
#[method(display)]
pub unsafe fn display(&self);
#[method(showsApplicationBadge)]
pub unsafe fn showsApplicationBadge(&self) -> bool;
#[method(setShowsApplicationBadge:)]
pub unsafe fn setShowsApplicationBadge(&self, shows_application_badge: bool);
#[method_id(@__retain_semantics Other badgeLabel)]
pub unsafe fn badgeLabel(&self) -> Option<Retained<NSString>>;
#[method(setBadgeLabel:)]
pub unsafe fn setBadgeLabel(&self, badge_label: Option<&NSString>);
#[method_id(@__retain_semantics Other owner)]
pub unsafe fn owner(&self) -> Option<Retained<AnyObject>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDockTile {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait NSDockTilePlugIn: NSObjectProtocol {
#[method(setDockTile:)]
unsafe fn setDockTile(&self, dock_tile: Option<&NSDockTile>);
#[cfg(feature = "NSMenu")]
#[optional]
#[method_id(@__retain_semantics Other dockMenu)]
unsafe fn dockMenu(&self, mtm: MainThreadMarker) -> Option<Retained<NSMenu>>;
}
unsafe impl ProtocolType for dyn NSDockTilePlugIn {}
);

View File

@@ -0,0 +1,926 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDocumentChangeType(pub NSUInteger);
impl NSDocumentChangeType {
pub const NSChangeDone: Self = Self(0);
pub const NSChangeUndone: Self = Self(1);
pub const NSChangeRedone: Self = Self(5);
pub const NSChangeCleared: Self = Self(2);
pub const NSChangeReadOtherContents: Self = Self(3);
pub const NSChangeAutosaved: Self = Self(4);
pub const NSChangeDiscardable: Self = Self(256);
}
unsafe impl Encode for NSDocumentChangeType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDocumentChangeType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSaveOperationType(pub NSUInteger);
impl NSSaveOperationType {
pub const NSSaveOperation: Self = Self(0);
pub const NSSaveAsOperation: Self = Self(1);
pub const NSSaveToOperation: Self = Self(2);
pub const NSAutosaveInPlaceOperation: Self = Self(4);
pub const NSAutosaveElsewhereOperation: Self = Self(3);
pub const NSAutosaveAsOperation: Self = Self(5);
#[deprecated = "Use NSAutosaveElsewhereOperation instead"]
pub const NSAutosaveOperation: Self = Self(3);
}
unsafe impl Encode for NSSaveOperationType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSSaveOperationType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDocument;
unsafe impl ClassType for NSDocument {
type Super = NSObject;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "NSKeyValueBinding")]
unsafe impl NSEditorRegistration for NSDocument {}
unsafe impl NSFilePresenter for NSDocument {}
#[cfg(feature = "NSMenu")]
unsafe impl NSMenuItemValidation for NSDocument {}
unsafe impl NSObjectProtocol for NSDocument {}
#[cfg(feature = "NSUserInterfaceValidation")]
unsafe impl NSUserInterfaceValidations for NSDocument {}
extern_methods!(
unsafe impl NSDocument {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithType:error:_)]
pub unsafe fn initWithType_error(
this: Allocated<Self>,
type_name: &NSString,
) -> Result<Retained<Self>, Retained<NSError>>;
#[method(canConcurrentlyReadDocumentsOfType:)]
pub unsafe fn canConcurrentlyReadDocumentsOfType(
type_name: &NSString,
mtm: MainThreadMarker,
) -> bool;
#[method_id(@__retain_semantics Init initWithContentsOfURL:ofType:error:_)]
pub unsafe fn initWithContentsOfURL_ofType_error(
this: Allocated<Self>,
url: &NSURL,
type_name: &NSString,
) -> Result<Retained<Self>, Retained<NSError>>;
#[method_id(@__retain_semantics Init initForURL:withContentsOfURL:ofType:error:_)]
pub unsafe fn initForURL_withContentsOfURL_ofType_error(
this: Allocated<Self>,
url_or_nil: Option<&NSURL>,
contents_url: &NSURL,
type_name: &NSString,
) -> Result<Retained<Self>, Retained<NSError>>;
#[method_id(@__retain_semantics Other fileType)]
pub unsafe fn fileType(&self) -> Option<Retained<NSString>>;
#[method(setFileType:)]
pub unsafe fn setFileType(&self, file_type: Option<&NSString>);
#[method_id(@__retain_semantics Other fileURL)]
pub unsafe fn fileURL(&self) -> Option<Retained<NSURL>>;
#[method(setFileURL:)]
pub unsafe fn setFileURL(&self, file_url: Option<&NSURL>);
#[method_id(@__retain_semantics Other fileModificationDate)]
pub unsafe fn fileModificationDate(&self) -> Option<Retained<NSDate>>;
#[method(setFileModificationDate:)]
pub unsafe fn setFileModificationDate(&self, file_modification_date: Option<&NSDate>);
#[method(isDraft)]
pub unsafe fn isDraft(&self) -> bool;
#[method(setDraft:)]
pub unsafe fn setDraft(&self, draft: bool);
#[cfg(feature = "block2")]
#[method(performActivityWithSynchronousWaiting:usingBlock:)]
pub unsafe fn performActivityWithSynchronousWaiting_usingBlock(
&self,
wait_synchronously: bool,
block: &block2::Block<dyn Fn(NonNull<block2::Block<dyn Fn()>>)>,
);
#[cfg(feature = "block2")]
#[method(continueActivityUsingBlock:)]
pub unsafe fn continueActivityUsingBlock(&self, block: &block2::Block<dyn Fn() + '_>);
#[cfg(feature = "block2")]
#[method(continueAsynchronousWorkOnMainThreadUsingBlock:)]
pub unsafe fn continueAsynchronousWorkOnMainThreadUsingBlock(
&self,
block: &block2::Block<dyn Fn()>,
);
#[cfg(feature = "block2")]
#[method(performSynchronousFileAccessUsingBlock:)]
pub unsafe fn performSynchronousFileAccessUsingBlock(
&self,
block: &block2::Block<dyn Fn() + '_>,
);
#[cfg(feature = "block2")]
#[method(performAsynchronousFileAccessUsingBlock:)]
pub unsafe fn performAsynchronousFileAccessUsingBlock(
&self,
block: &block2::Block<dyn Fn(NonNull<block2::Block<dyn Fn()>>)>,
);
#[method(revertDocumentToSaved:)]
pub unsafe fn revertDocumentToSaved(&self, sender: Option<&AnyObject>);
#[method(revertToContentsOfURL:ofType:error:_)]
pub unsafe fn revertToContentsOfURL_ofType_error(
&self,
url: &NSURL,
type_name: &NSString,
) -> Result<(), Retained<NSError>>;
#[method(readFromURL:ofType:error:_)]
pub unsafe fn readFromURL_ofType_error(
&self,
url: &NSURL,
type_name: &NSString,
) -> Result<(), Retained<NSError>>;
#[method(readFromFileWrapper:ofType:error:_)]
pub unsafe fn readFromFileWrapper_ofType_error(
&self,
file_wrapper: &NSFileWrapper,
type_name: &NSString,
) -> Result<(), Retained<NSError>>;
#[method(readFromData:ofType:error:_)]
pub unsafe fn readFromData_ofType_error(
&self,
data: &NSData,
type_name: &NSString,
) -> Result<(), Retained<NSError>>;
#[method(isEntireFileLoaded)]
pub unsafe fn isEntireFileLoaded(&self) -> bool;
#[method(writeToURL:ofType:error:_)]
pub unsafe fn writeToURL_ofType_error(
&self,
url: &NSURL,
type_name: &NSString,
) -> Result<(), Retained<NSError>>;
#[method_id(@__retain_semantics Other fileWrapperOfType:error:_)]
pub unsafe fn fileWrapperOfType_error(
&self,
type_name: &NSString,
) -> Result<Retained<NSFileWrapper>, Retained<NSError>>;
#[method_id(@__retain_semantics Other dataOfType:error:_)]
pub unsafe fn dataOfType_error(
&self,
type_name: &NSString,
) -> Result<Retained<NSData>, Retained<NSError>>;
#[method(unblockUserInteraction)]
pub unsafe fn unblockUserInteraction(&self);
#[method(autosavingIsImplicitlyCancellable)]
pub unsafe fn autosavingIsImplicitlyCancellable(&self) -> bool;
#[method(writeSafelyToURL:ofType:forSaveOperation:error:_)]
pub unsafe fn writeSafelyToURL_ofType_forSaveOperation_error(
&self,
url: &NSURL,
type_name: &NSString,
save_operation: NSSaveOperationType,
) -> Result<(), Retained<NSError>>;
#[method(writeToURL:ofType:forSaveOperation:originalContentsURL:error:_)]
pub unsafe fn writeToURL_ofType_forSaveOperation_originalContentsURL_error(
&self,
url: &NSURL,
type_name: &NSString,
save_operation: NSSaveOperationType,
absolute_original_contents_url: Option<&NSURL>,
) -> Result<(), Retained<NSError>>;
#[method_id(@__retain_semantics Other fileAttributesToWriteToURL:ofType:forSaveOperation:originalContentsURL:error:_)]
pub unsafe fn fileAttributesToWriteToURL_ofType_forSaveOperation_originalContentsURL_error(
&self,
url: &NSURL,
type_name: &NSString,
save_operation: NSSaveOperationType,
absolute_original_contents_url: Option<&NSURL>,
) -> Result<Retained<NSDictionary<NSString, AnyObject>>, Retained<NSError>>;
#[method(keepBackupFile)]
pub unsafe fn keepBackupFile(&self) -> bool;
#[method_id(@__retain_semantics Other backupFileURL)]
pub unsafe fn backupFileURL(&self) -> Option<Retained<NSURL>>;
#[method(saveDocument:)]
pub unsafe fn saveDocument(&self, sender: Option<&AnyObject>);
#[method(saveDocumentAs:)]
pub unsafe fn saveDocumentAs(&self, sender: Option<&AnyObject>);
#[method(saveDocumentTo:)]
pub unsafe fn saveDocumentTo(&self, sender: Option<&AnyObject>);
#[method(saveDocumentWithDelegate:didSaveSelector:contextInfo:)]
pub unsafe fn saveDocumentWithDelegate_didSaveSelector_contextInfo(
&self,
delegate: Option<&AnyObject>,
did_save_selector: Option<Sel>,
context_info: *mut c_void,
);
#[method(runModalSavePanelForSaveOperation:delegate:didSaveSelector:contextInfo:)]
pub unsafe fn runModalSavePanelForSaveOperation_delegate_didSaveSelector_contextInfo(
&self,
save_operation: NSSaveOperationType,
delegate: Option<&AnyObject>,
did_save_selector: Option<Sel>,
context_info: *mut c_void,
);
#[method(shouldRunSavePanelWithAccessoryView)]
pub unsafe fn shouldRunSavePanelWithAccessoryView(&self) -> bool;
#[cfg(all(
feature = "NSPanel",
feature = "NSResponder",
feature = "NSSavePanel",
feature = "NSWindow"
))]
#[method(prepareSavePanel:)]
pub unsafe fn prepareSavePanel(&self, save_panel: &NSSavePanel) -> bool;
#[method(fileNameExtensionWasHiddenInLastRunSavePanel)]
pub unsafe fn fileNameExtensionWasHiddenInLastRunSavePanel(&self) -> bool;
#[method_id(@__retain_semantics Other fileTypeFromLastRunSavePanel)]
pub unsafe fn fileTypeFromLastRunSavePanel(&self) -> Option<Retained<NSString>>;
#[method(saveToURL:ofType:forSaveOperation:delegate:didSaveSelector:contextInfo:)]
pub unsafe fn saveToURL_ofType_forSaveOperation_delegate_didSaveSelector_contextInfo(
&self,
url: &NSURL,
type_name: &NSString,
save_operation: NSSaveOperationType,
delegate: Option<&AnyObject>,
did_save_selector: Option<Sel>,
context_info: *mut c_void,
);
#[cfg(feature = "block2")]
#[method(saveToURL:ofType:forSaveOperation:completionHandler:)]
pub unsafe fn saveToURL_ofType_forSaveOperation_completionHandler(
&self,
url: &NSURL,
type_name: &NSString,
save_operation: NSSaveOperationType,
completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
);
#[method(canAsynchronouslyWriteToURL:ofType:forSaveOperation:)]
pub unsafe fn canAsynchronouslyWriteToURL_ofType_forSaveOperation(
&self,
url: &NSURL,
type_name: &NSString,
save_operation: NSSaveOperationType,
) -> bool;
#[method(checkAutosavingSafetyAndReturnError:_)]
pub unsafe fn checkAutosavingSafetyAndReturnError(&self) -> Result<(), Retained<NSError>>;
#[method(scheduleAutosaving)]
pub unsafe fn scheduleAutosaving(&self);
#[method(hasUnautosavedChanges)]
pub unsafe fn hasUnautosavedChanges(&self) -> bool;
#[method(autosaveDocumentWithDelegate:didAutosaveSelector:contextInfo:)]
pub unsafe fn autosaveDocumentWithDelegate_didAutosaveSelector_contextInfo(
&self,
delegate: Option<&AnyObject>,
did_autosave_selector: Option<Sel>,
context_info: *mut c_void,
);
#[cfg(feature = "block2")]
#[method(autosaveWithImplicitCancellability:completionHandler:)]
pub unsafe fn autosaveWithImplicitCancellability_completionHandler(
&self,
autosaving_is_implicitly_cancellable: bool,
completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
);
#[method(autosavesInPlace)]
pub unsafe fn autosavesInPlace(mtm: MainThreadMarker) -> bool;
#[method(preservesVersions)]
pub unsafe fn preservesVersions(mtm: MainThreadMarker) -> bool;
#[method(browseDocumentVersions:)]
pub unsafe fn browseDocumentVersions(&self, sender: Option<&AnyObject>);
#[method(isBrowsingVersions)]
pub unsafe fn isBrowsingVersions(&self) -> bool;
#[cfg(feature = "block2")]
#[method(stopBrowsingVersionsWithCompletionHandler:)]
pub unsafe fn stopBrowsingVersionsWithCompletionHandler(
&self,
completion_handler: Option<&block2::Block<dyn Fn()>>,
);
#[method(autosavesDrafts)]
pub unsafe fn autosavesDrafts(mtm: MainThreadMarker) -> bool;
#[method_id(@__retain_semantics Other autosavingFileType)]
pub unsafe fn autosavingFileType(&self) -> Option<Retained<NSString>>;
#[method_id(@__retain_semantics Other autosavedContentsFileURL)]
pub unsafe fn autosavedContentsFileURL(&self) -> Option<Retained<NSURL>>;
#[method(setAutosavedContentsFileURL:)]
pub unsafe fn setAutosavedContentsFileURL(
&self,
autosaved_contents_file_url: Option<&NSURL>,
);
#[method(canCloseDocumentWithDelegate:shouldCloseSelector:contextInfo:)]
pub unsafe fn canCloseDocumentWithDelegate_shouldCloseSelector_contextInfo(
&self,
delegate: &AnyObject,
should_close_selector: Option<Sel>,
context_info: *mut c_void,
);
#[method(close)]
pub unsafe fn close(&self);
#[method(duplicateDocument:)]
pub unsafe fn duplicateDocument(&self, sender: Option<&AnyObject>);
#[method(duplicateDocumentWithDelegate:didDuplicateSelector:contextInfo:)]
pub unsafe fn duplicateDocumentWithDelegate_didDuplicateSelector_contextInfo(
&self,
delegate: Option<&AnyObject>,
did_duplicate_selector: Option<Sel>,
context_info: *mut c_void,
);
#[method_id(@__retain_semantics Other duplicateAndReturnError:_)]
pub unsafe fn duplicateAndReturnError(
&self,
) -> Result<Retained<NSDocument>, Retained<NSError>>;
#[method(renameDocument:)]
pub unsafe fn renameDocument(&self, sender: Option<&AnyObject>);
#[method(moveDocumentToUbiquityContainer:)]
pub unsafe fn moveDocumentToUbiquityContainer(&self, sender: Option<&AnyObject>);
#[method(moveDocument:)]
pub unsafe fn moveDocument(&self, sender: Option<&AnyObject>);
#[cfg(feature = "block2")]
#[method(moveDocumentWithCompletionHandler:)]
pub unsafe fn moveDocumentWithCompletionHandler(
&self,
completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
);
#[cfg(feature = "block2")]
#[method(moveToURL:completionHandler:)]
pub unsafe fn moveToURL_completionHandler(
&self,
url: &NSURL,
completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
);
#[method(lockDocument:)]
pub unsafe fn lockDocument(&self, sender: Option<&AnyObject>);
#[method(unlockDocument:)]
pub unsafe fn unlockDocument(&self, sender: Option<&AnyObject>);
#[cfg(feature = "block2")]
#[method(lockDocumentWithCompletionHandler:)]
pub unsafe fn lockDocumentWithCompletionHandler(
&self,
completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
);
#[cfg(feature = "block2")]
#[method(lockWithCompletionHandler:)]
pub unsafe fn lockWithCompletionHandler(
&self,
completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
);
#[cfg(feature = "block2")]
#[method(unlockDocumentWithCompletionHandler:)]
pub unsafe fn unlockDocumentWithCompletionHandler(
&self,
completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
);
#[cfg(feature = "block2")]
#[method(unlockWithCompletionHandler:)]
pub unsafe fn unlockWithCompletionHandler(
&self,
completion_handler: Option<&block2::Block<dyn Fn(*mut NSError)>>,
);
#[method(isLocked)]
pub unsafe fn isLocked(&self) -> bool;
#[method(runPageLayout:)]
pub unsafe fn runPageLayout(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSPrintInfo")]
#[method(runModalPageLayoutWithPrintInfo:delegate:didRunSelector:contextInfo:)]
pub unsafe fn runModalPageLayoutWithPrintInfo_delegate_didRunSelector_contextInfo(
&self,
print_info: &NSPrintInfo,
delegate: Option<&AnyObject>,
did_run_selector: Option<Sel>,
context_info: *mut c_void,
);
#[cfg(feature = "NSPageLayout")]
#[method(preparePageLayout:)]
pub unsafe fn preparePageLayout(&self, page_layout: &NSPageLayout) -> bool;
#[cfg(feature = "NSPrintInfo")]
#[method(shouldChangePrintInfo:)]
pub unsafe fn shouldChangePrintInfo(&self, new_print_info: &NSPrintInfo) -> bool;
#[cfg(feature = "NSPrintInfo")]
#[method_id(@__retain_semantics Other printInfo)]
pub unsafe fn printInfo(&self) -> Retained<NSPrintInfo>;
#[cfg(feature = "NSPrintInfo")]
#[method(setPrintInfo:)]
pub unsafe fn setPrintInfo(&self, print_info: &NSPrintInfo);
#[method(printDocument:)]
pub unsafe fn printDocument(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSPrintInfo")]
#[method(printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo:)]
pub unsafe fn printDocumentWithSettings_showPrintPanel_delegate_didPrintSelector_contextInfo(
&self,
print_settings: &NSDictionary<NSPrintInfoAttributeKey, AnyObject>,
show_print_panel: bool,
delegate: Option<&AnyObject>,
did_print_selector: Option<Sel>,
context_info: *mut c_void,
);
#[cfg(all(feature = "NSPrintInfo", feature = "NSPrintOperation"))]
#[method_id(@__retain_semantics Other printOperationWithSettings:error:_)]
pub unsafe fn printOperationWithSettings_error(
&self,
print_settings: &NSDictionary<NSPrintInfoAttributeKey, AnyObject>,
) -> Result<Retained<NSPrintOperation>, Retained<NSError>>;
#[cfg(feature = "NSPrintOperation")]
#[method(runModalPrintOperation:delegate:didRunSelector:contextInfo:)]
pub unsafe fn runModalPrintOperation_delegate_didRunSelector_contextInfo(
&self,
print_operation: &NSPrintOperation,
delegate: Option<&AnyObject>,
did_run_selector: Option<Sel>,
context_info: *mut c_void,
);
#[method(saveDocumentToPDF:)]
pub unsafe fn saveDocumentToPDF(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSPrintOperation")]
#[method_id(@__retain_semantics Other PDFPrintOperation)]
pub unsafe fn PDFPrintOperation(&self) -> Retained<NSPrintOperation>;
#[method(allowsDocumentSharing)]
pub unsafe fn allowsDocumentSharing(&self) -> bool;
#[cfg(all(feature = "NSSharingService", feature = "block2"))]
#[method(shareDocumentWithSharingService:completionHandler:)]
pub unsafe fn shareDocumentWithSharingService_completionHandler(
&self,
sharing_service: &NSSharingService,
completion_handler: Option<&block2::Block<dyn Fn(Bool)>>,
);
#[cfg(feature = "NSSharingService")]
#[method(prepareSharingServicePicker:)]
pub unsafe fn prepareSharingServicePicker(
&self,
sharing_service_picker: &NSSharingServicePicker,
);
#[cfg(feature = "NSPreviewRepresentingActivityItem")]
#[method_id(@__retain_semantics Other previewRepresentableActivityItems)]
pub unsafe fn previewRepresentableActivityItems(
&self,
) -> Option<Retained<NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>>>;
#[cfg(feature = "NSPreviewRepresentingActivityItem")]
#[method(setPreviewRepresentableActivityItems:)]
pub unsafe fn setPreviewRepresentableActivityItems(
&self,
preview_representable_activity_items: Option<
&NSArray<ProtocolObject<dyn NSPreviewRepresentableActivityItem>>,
>,
);
#[method(isDocumentEdited)]
pub unsafe fn isDocumentEdited(&self) -> bool;
#[method(isInViewingMode)]
pub unsafe fn isInViewingMode(&self) -> bool;
#[method(updateChangeCount:)]
pub unsafe fn updateChangeCount(&self, change: NSDocumentChangeType);
#[method_id(@__retain_semantics Other changeCountTokenForSaveOperation:)]
pub unsafe fn changeCountTokenForSaveOperation(
&self,
save_operation: NSSaveOperationType,
) -> Retained<AnyObject>;
#[method(updateChangeCountWithToken:forSaveOperation:)]
pub unsafe fn updateChangeCountWithToken_forSaveOperation(
&self,
change_count_token: &AnyObject,
save_operation: NSSaveOperationType,
);
#[method_id(@__retain_semantics Other undoManager)]
pub unsafe fn undoManager(&self) -> Option<Retained<NSUndoManager>>;
#[method(setUndoManager:)]
pub unsafe fn setUndoManager(&self, undo_manager: Option<&NSUndoManager>);
#[method(hasUndoManager)]
pub unsafe fn hasUndoManager(&self) -> bool;
#[method(setHasUndoManager:)]
pub unsafe fn setHasUndoManager(&self, has_undo_manager: bool);
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[method(presentError:modalForWindow:delegate:didPresentSelector:contextInfo:)]
pub unsafe fn presentError_modalForWindow_delegate_didPresentSelector_contextInfo(
&self,
error: &NSError,
window: &NSWindow,
delegate: Option<&AnyObject>,
did_present_selector: Option<Sel>,
context_info: *mut c_void,
);
#[method(presentError:)]
pub unsafe fn presentError(&self, error: &NSError) -> bool;
#[method_id(@__retain_semantics Other willPresentError:)]
pub unsafe fn willPresentError(&self, error: &NSError) -> Retained<NSError>;
#[method(willNotPresentError:)]
pub unsafe fn willNotPresentError(&self, error: &NSError);
#[method(makeWindowControllers)]
pub unsafe fn makeWindowControllers(&self);
#[cfg(feature = "NSNib")]
#[method_id(@__retain_semantics Other windowNibName)]
pub unsafe fn windowNibName(&self) -> Option<Retained<NSNibName>>;
#[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
#[method(windowControllerWillLoadNib:)]
pub unsafe fn windowControllerWillLoadNib(&self, window_controller: &NSWindowController);
#[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
#[method(windowControllerDidLoadNib:)]
pub unsafe fn windowControllerDidLoadNib(&self, window_controller: &NSWindowController);
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[method(setWindow:)]
pub unsafe fn setWindow(&self, window: Option<&NSWindow>);
#[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
#[method(addWindowController:)]
pub unsafe fn addWindowController(&self, window_controller: &NSWindowController);
#[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
#[method(removeWindowController:)]
pub unsafe fn removeWindowController(&self, window_controller: &NSWindowController);
#[method(showWindows)]
pub unsafe fn showWindows(&self);
#[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
#[method_id(@__retain_semantics Other windowControllers)]
pub unsafe fn windowControllers(&self) -> Retained<NSArray<NSWindowController>>;
#[cfg(all(feature = "NSResponder", feature = "NSWindowController"))]
#[method(shouldCloseWindowController:delegate:shouldCloseSelector:contextInfo:)]
pub unsafe fn shouldCloseWindowController_delegate_shouldCloseSelector_contextInfo(
&self,
window_controller: &NSWindowController,
delegate: Option<&AnyObject>,
should_close_selector: Option<Sel>,
context_info: *mut c_void,
);
#[method_id(@__retain_semantics Other displayName)]
pub unsafe fn displayName(&self) -> Retained<NSString>;
#[method_id(@__retain_semantics Other defaultDraftName)]
pub unsafe fn defaultDraftName(&self) -> Retained<NSString>;
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[method_id(@__retain_semantics Other windowForSheet)]
pub unsafe fn windowForSheet(&self) -> Option<Retained<NSWindow>>;
#[method_id(@__retain_semantics Other readableTypes)]
pub unsafe fn readableTypes(mtm: MainThreadMarker) -> Retained<NSArray<NSString>>;
#[method_id(@__retain_semantics Other writableTypes)]
pub unsafe fn writableTypes(mtm: MainThreadMarker) -> Retained<NSArray<NSString>>;
#[method(isNativeType:)]
pub unsafe fn isNativeType(r#type: &NSString, mtm: MainThreadMarker) -> bool;
#[method_id(@__retain_semantics Other writableTypesForSaveOperation:)]
pub unsafe fn writableTypesForSaveOperation(
&self,
save_operation: NSSaveOperationType,
) -> Retained<NSArray<NSString>>;
#[method_id(@__retain_semantics Other fileNameExtensionForType:saveOperation:)]
pub unsafe fn fileNameExtensionForType_saveOperation(
&self,
type_name: &NSString,
save_operation: NSSaveOperationType,
) -> Option<Retained<NSString>>;
#[cfg(feature = "NSUserInterfaceValidation")]
#[method(validateUserInterfaceItem:)]
pub unsafe fn validateUserInterfaceItem(
&self,
item: &ProtocolObject<dyn NSValidatedUserInterfaceItem>,
) -> bool;
#[method(usesUbiquitousStorage)]
pub unsafe fn usesUbiquitousStorage(mtm: MainThreadMarker) -> bool;
#[method_id(@__retain_semantics Other presentedItemURL)]
pub unsafe fn presentedItemURL(&self) -> Option<Retained<NSURL>>;
#[method_id(@__retain_semantics Other observedPresentedItemUbiquityAttributes)]
pub unsafe fn observedPresentedItemUbiquityAttributes(
&self,
) -> Retained<NSSet<NSURLResourceKey>>;
#[cfg(feature = "block2")]
#[method(relinquishPresentedItemToReader:)]
pub unsafe fn relinquishPresentedItemToReader(
&self,
reader: &block2::Block<dyn Fn(*mut block2::Block<dyn Fn()>)>,
);
#[cfg(feature = "block2")]
#[method(relinquishPresentedItemToWriter:)]
pub unsafe fn relinquishPresentedItemToWriter(
&self,
writer: &block2::Block<dyn Fn(*mut block2::Block<dyn Fn()>)>,
);
#[cfg(feature = "block2")]
#[method(savePresentedItemChangesWithCompletionHandler:)]
pub unsafe fn savePresentedItemChangesWithCompletionHandler(
&self,
completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
);
#[cfg(feature = "block2")]
#[method(accommodatePresentedItemDeletionWithCompletionHandler:)]
pub unsafe fn accommodatePresentedItemDeletionWithCompletionHandler(
&self,
completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
);
#[method(presentedItemDidMoveToURL:)]
pub unsafe fn presentedItemDidMoveToURL(&self, new_url: &NSURL);
#[method(presentedItemDidChange)]
pub unsafe fn presentedItemDidChange(&self);
#[method(presentedItemDidChangeUbiquityAttributes:)]
pub unsafe fn presentedItemDidChangeUbiquityAttributes(
&self,
attributes: &NSSet<NSURLResourceKey>,
);
#[method(presentedItemDidGainVersion:)]
pub unsafe fn presentedItemDidGainVersion(&self, version: &NSFileVersion);
#[method(presentedItemDidLoseVersion:)]
pub unsafe fn presentedItemDidLoseVersion(&self, version: &NSFileVersion);
#[method(presentedItemDidResolveConflictVersion:)]
pub unsafe fn presentedItemDidResolveConflictVersion(&self, version: &NSFileVersion);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDocument {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSDeprecated
unsafe impl NSDocument {
#[deprecated = "Use -saveToURL:ofType:forSaveOperation:completionHandler: instead"]
#[method(saveToURL:ofType:forSaveOperation:error:_)]
pub unsafe fn saveToURL_ofType_forSaveOperation_error(
&self,
url: &NSURL,
type_name: &NSString,
save_operation: NSSaveOperationType,
) -> Result<(), Retained<NSError>>;
#[deprecated]
#[method_id(@__retain_semantics Other dataRepresentationOfType:)]
pub unsafe fn dataRepresentationOfType(
&self,
r#type: &NSString,
) -> Option<Retained<NSData>>;
#[deprecated]
#[method_id(@__retain_semantics Other fileAttributesToWriteToFile:ofType:saveOperation:)]
pub unsafe fn fileAttributesToWriteToFile_ofType_saveOperation(
&self,
full_document_path: &NSString,
document_type_name: &NSString,
save_operation_type: NSSaveOperationType,
) -> Option<Retained<NSDictionary>>;
#[deprecated]
#[method_id(@__retain_semantics Other fileName)]
pub unsafe fn fileName(&self) -> Option<Retained<NSString>>;
#[deprecated]
#[method_id(@__retain_semantics Other fileWrapperRepresentationOfType:)]
pub unsafe fn fileWrapperRepresentationOfType(
&self,
r#type: &NSString,
) -> Option<Retained<NSFileWrapper>>;
#[deprecated]
#[method_id(@__retain_semantics Init initWithContentsOfFile:ofType:)]
pub unsafe fn initWithContentsOfFile_ofType(
this: Allocated<Self>,
absolute_path: &NSString,
type_name: &NSString,
) -> Option<Retained<Self>>;
#[deprecated]
#[method_id(@__retain_semantics Init initWithContentsOfURL:ofType:)]
pub unsafe fn initWithContentsOfURL_ofType(
this: Allocated<Self>,
url: &NSURL,
type_name: &NSString,
) -> Option<Retained<Self>>;
#[deprecated]
#[method(loadDataRepresentation:ofType:)]
pub unsafe fn loadDataRepresentation_ofType(
&self,
data: &NSData,
r#type: &NSString,
) -> bool;
#[deprecated]
#[method(loadFileWrapperRepresentation:ofType:)]
pub unsafe fn loadFileWrapperRepresentation_ofType(
&self,
wrapper: &NSFileWrapper,
r#type: &NSString,
) -> bool;
#[deprecated]
#[method(printShowingPrintPanel:)]
pub unsafe fn printShowingPrintPanel(&self, flag: bool);
#[deprecated]
#[method(readFromFile:ofType:)]
pub unsafe fn readFromFile_ofType(&self, file_name: &NSString, r#type: &NSString) -> bool;
#[deprecated]
#[method(readFromURL:ofType:)]
pub unsafe fn readFromURL_ofType(&self, url: &NSURL, r#type: &NSString) -> bool;
#[deprecated]
#[method(revertToSavedFromFile:ofType:)]
pub unsafe fn revertToSavedFromFile_ofType(
&self,
file_name: &NSString,
r#type: &NSString,
) -> bool;
#[deprecated]
#[method(revertToSavedFromURL:ofType:)]
pub unsafe fn revertToSavedFromURL_ofType(&self, url: &NSURL, r#type: &NSString) -> bool;
#[cfg(feature = "NSPrintInfo")]
#[deprecated]
#[method(runModalPageLayoutWithPrintInfo:)]
pub unsafe fn runModalPageLayoutWithPrintInfo(&self, print_info: &NSPrintInfo)
-> NSInteger;
#[deprecated]
#[method(saveToFile:saveOperation:delegate:didSaveSelector:contextInfo:)]
pub unsafe fn saveToFile_saveOperation_delegate_didSaveSelector_contextInfo(
&self,
file_name: &NSString,
save_operation: NSSaveOperationType,
delegate: Option<&AnyObject>,
did_save_selector: Option<Sel>,
context_info: *mut c_void,
);
#[deprecated]
#[method(setFileName:)]
pub unsafe fn setFileName(&self, file_name: Option<&NSString>);
#[deprecated]
#[method(writeToFile:ofType:)]
pub unsafe fn writeToFile_ofType(&self, file_name: &NSString, r#type: &NSString) -> bool;
#[deprecated]
#[method(writeToFile:ofType:originalFile:saveOperation:)]
pub unsafe fn writeToFile_ofType_originalFile_saveOperation(
&self,
full_document_path: &NSString,
document_type_name: &NSString,
full_original_document_path: Option<&NSString>,
save_operation_type: NSSaveOperationType,
) -> bool;
#[deprecated]
#[method(writeToURL:ofType:)]
pub unsafe fn writeToURL_ofType(&self, url: &NSURL, r#type: &NSString) -> bool;
#[deprecated]
#[method(writeWithBackupToFile:ofType:saveOperation:)]
pub unsafe fn writeWithBackupToFile_ofType_saveOperation(
&self,
full_document_path: &NSString,
document_type_name: &NSString,
save_operation_type: NSSaveOperationType,
) -> bool;
}
);

View File

@@ -0,0 +1,384 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDocumentController;
unsafe impl ClassType for NSDocumentController {
type Super = NSObject;
type Mutability = MainThreadOnly;
}
);
unsafe impl NSCoding for NSDocumentController {}
#[cfg(feature = "NSMenu")]
unsafe impl NSMenuItemValidation for NSDocumentController {}
unsafe impl NSObjectProtocol for NSDocumentController {}
#[cfg(feature = "NSUserInterfaceValidation")]
unsafe impl NSUserInterfaceValidations for NSDocumentController {}
extern_methods!(
unsafe impl NSDocumentController {
#[method_id(@__retain_semantics Other sharedDocumentController)]
pub unsafe fn sharedDocumentController(
mtm: MainThreadMarker,
) -> Retained<NSDocumentController>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSDocument")]
#[method_id(@__retain_semantics Other documents)]
pub unsafe fn documents(&self) -> Retained<NSArray<NSDocument>>;
#[cfg(feature = "NSDocument")]
#[method_id(@__retain_semantics Other currentDocument)]
pub unsafe fn currentDocument(&self) -> Option<Retained<NSDocument>>;
#[method_id(@__retain_semantics Other currentDirectory)]
pub unsafe fn currentDirectory(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSDocument")]
#[method_id(@__retain_semantics Other documentForURL:)]
pub unsafe fn documentForURL(&self, url: &NSURL) -> Option<Retained<NSDocument>>;
#[cfg(all(feature = "NSDocument", feature = "NSResponder", feature = "NSWindow"))]
#[method_id(@__retain_semantics Other documentForWindow:)]
pub unsafe fn documentForWindow(&self, window: &NSWindow) -> Option<Retained<NSDocument>>;
#[cfg(feature = "NSDocument")]
#[method(addDocument:)]
pub unsafe fn addDocument(&self, document: &NSDocument);
#[cfg(feature = "NSDocument")]
#[method(removeDocument:)]
pub unsafe fn removeDocument(&self, document: &NSDocument);
#[method(newDocument:)]
pub unsafe fn newDocument(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSDocument")]
#[method_id(@__retain_semantics Other openUntitledDocumentAndDisplay:error:_)]
pub unsafe fn openUntitledDocumentAndDisplay_error(
&self,
display_document: bool,
) -> Result<Retained<NSDocument>, Retained<NSError>>;
#[cfg(feature = "NSDocument")]
#[method_id(@__retain_semantics Other makeUntitledDocumentOfType:error:_)]
pub unsafe fn makeUntitledDocumentOfType_error(
&self,
type_name: &NSString,
) -> Result<Retained<NSDocument>, Retained<NSError>>;
#[method(openDocument:)]
pub unsafe fn openDocument(&self, sender: Option<&AnyObject>);
#[method_id(@__retain_semantics Other URLsFromRunningOpenPanel)]
pub unsafe fn URLsFromRunningOpenPanel(&self) -> Option<Retained<NSArray<NSURL>>>;
#[cfg(all(
feature = "NSOpenPanel",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSSavePanel",
feature = "NSWindow"
))]
#[method(runModalOpenPanel:forTypes:)]
pub unsafe fn runModalOpenPanel_forTypes(
&self,
open_panel: &NSOpenPanel,
types: Option<&NSArray<NSString>>,
) -> NSInteger;
#[cfg(feature = "block2")]
#[method(beginOpenPanelWithCompletionHandler:)]
pub unsafe fn beginOpenPanelWithCompletionHandler(
&self,
completion_handler: &block2::Block<dyn Fn(*mut NSArray<NSURL>)>,
);
#[cfg(all(
feature = "NSOpenPanel",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSSavePanel",
feature = "NSWindow",
feature = "block2"
))]
#[method(beginOpenPanel:forTypes:completionHandler:)]
pub unsafe fn beginOpenPanel_forTypes_completionHandler(
&self,
open_panel: &NSOpenPanel,
in_types: Option<&NSArray<NSString>>,
completion_handler: &block2::Block<dyn Fn(NSInteger)>,
);
#[cfg(all(feature = "NSDocument", feature = "block2"))]
#[method(openDocumentWithContentsOfURL:display:completionHandler:)]
pub unsafe fn openDocumentWithContentsOfURL_display_completionHandler(
&self,
url: &NSURL,
display_document: bool,
completion_handler: &block2::Block<dyn Fn(*mut NSDocument, Bool, *mut NSError)>,
);
#[cfg(feature = "NSDocument")]
#[method_id(@__retain_semantics Other makeDocumentWithContentsOfURL:ofType:error:_)]
pub unsafe fn makeDocumentWithContentsOfURL_ofType_error(
&self,
url: &NSURL,
type_name: &NSString,
) -> Result<Retained<NSDocument>, Retained<NSError>>;
#[cfg(all(feature = "NSDocument", feature = "block2"))]
#[method(reopenDocumentForURL:withContentsOfURL:display:completionHandler:)]
pub unsafe fn reopenDocumentForURL_withContentsOfURL_display_completionHandler(
&self,
url_or_nil: Option<&NSURL>,
contents_url: &NSURL,
display_document: bool,
completion_handler: &block2::Block<dyn Fn(*mut NSDocument, Bool, *mut NSError)>,
);
#[cfg(feature = "NSDocument")]
#[method_id(@__retain_semantics Other makeDocumentForURL:withContentsOfURL:ofType:error:_)]
pub unsafe fn makeDocumentForURL_withContentsOfURL_ofType_error(
&self,
url_or_nil: Option<&NSURL>,
contents_url: &NSURL,
type_name: &NSString,
) -> Result<Retained<NSDocument>, Retained<NSError>>;
#[method(autosavingDelay)]
pub unsafe fn autosavingDelay(&self) -> NSTimeInterval;
#[method(setAutosavingDelay:)]
pub unsafe fn setAutosavingDelay(&self, autosaving_delay: NSTimeInterval);
#[method(saveAllDocuments:)]
pub unsafe fn saveAllDocuments(&self, sender: Option<&AnyObject>);
#[method(hasEditedDocuments)]
pub unsafe fn hasEditedDocuments(&self) -> bool;
#[method(reviewUnsavedDocumentsWithAlertTitle:cancellable:delegate:didReviewAllSelector:contextInfo:)]
pub unsafe fn reviewUnsavedDocumentsWithAlertTitle_cancellable_delegate_didReviewAllSelector_contextInfo(
&self,
title: Option<&NSString>,
cancellable: bool,
delegate: Option<&AnyObject>,
did_review_all_selector: Option<Sel>,
context_info: *mut c_void,
);
#[method(closeAllDocumentsWithDelegate:didCloseAllSelector:contextInfo:)]
pub unsafe fn closeAllDocumentsWithDelegate_didCloseAllSelector_contextInfo(
&self,
delegate: Option<&AnyObject>,
did_close_all_selector: Option<Sel>,
context_info: *mut c_void,
);
#[cfg(feature = "NSDocument")]
#[method_id(@__retain_semantics Other duplicateDocumentWithContentsOfURL:copying:displayName:error:_)]
pub unsafe fn duplicateDocumentWithContentsOfURL_copying_displayName_error(
&self,
url: &NSURL,
duplicate_by_copying: bool,
display_name_or_nil: Option<&NSString>,
) -> Result<Retained<NSDocument>, Retained<NSError>>;
#[method(allowsAutomaticShareMenu)]
pub unsafe fn allowsAutomaticShareMenu(&self) -> bool;
#[cfg(feature = "NSMenuItem")]
#[method_id(@__retain_semantics Other standardShareMenuItem)]
pub unsafe fn standardShareMenuItem(&self) -> Retained<NSMenuItem>;
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[method(presentError:modalForWindow:delegate:didPresentSelector:contextInfo:)]
pub unsafe fn presentError_modalForWindow_delegate_didPresentSelector_contextInfo(
&self,
error: &NSError,
window: &NSWindow,
delegate: Option<&AnyObject>,
did_present_selector: Option<Sel>,
context_info: *mut c_void,
);
#[method(presentError:)]
pub unsafe fn presentError(&self, error: &NSError) -> bool;
#[method_id(@__retain_semantics Other willPresentError:)]
pub unsafe fn willPresentError(&self, error: &NSError) -> Retained<NSError>;
#[method(maximumRecentDocumentCount)]
pub unsafe fn maximumRecentDocumentCount(&self) -> NSUInteger;
#[method(clearRecentDocuments:)]
pub unsafe fn clearRecentDocuments(&self, sender: Option<&AnyObject>);
#[cfg(feature = "NSDocument")]
#[method(noteNewRecentDocument:)]
pub unsafe fn noteNewRecentDocument(&self, document: &NSDocument);
#[method(noteNewRecentDocumentURL:)]
pub unsafe fn noteNewRecentDocumentURL(&self, url: &NSURL);
#[method_id(@__retain_semantics Other recentDocumentURLs)]
pub unsafe fn recentDocumentURLs(&self) -> Retained<NSArray<NSURL>>;
#[method_id(@__retain_semantics Other defaultType)]
pub unsafe fn defaultType(&self) -> Option<Retained<NSString>>;
#[method_id(@__retain_semantics Other typeForContentsOfURL:error:_)]
pub unsafe fn typeForContentsOfURL_error(
&self,
url: &NSURL,
) -> Result<Retained<NSString>, Retained<NSError>>;
#[method_id(@__retain_semantics Other documentClassNames)]
pub unsafe fn documentClassNames(&self) -> Retained<NSArray<NSString>>;
#[method(documentClassForType:)]
pub unsafe fn documentClassForType(
&self,
type_name: &NSString,
) -> Option<&'static AnyClass>;
#[method_id(@__retain_semantics Other displayNameForType:)]
pub unsafe fn displayNameForType(&self, type_name: &NSString)
-> Option<Retained<NSString>>;
#[cfg(feature = "NSUserInterfaceValidation")]
#[method(validateUserInterfaceItem:)]
pub unsafe fn validateUserInterfaceItem(
&self,
item: &ProtocolObject<dyn NSValidatedUserInterfaceItem>,
) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDocumentController {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSDeprecated
unsafe impl NSDocumentController {
#[deprecated = "Use -openDocumentWithContentsOfURL:display:completionHandler: instead"]
#[method_id(@__retain_semantics Other openDocumentWithContentsOfURL:display:error:_)]
pub unsafe fn openDocumentWithContentsOfURL_display_error(
&self,
url: &NSURL,
display_document: bool,
) -> Result<Retained<AnyObject>, Retained<NSError>>;
#[deprecated = "Use -reopenDocumentForURL:withContentsOfURL:display:completionHandler: instead"]
#[method(reopenDocumentForURL:withContentsOfURL:error:_)]
pub unsafe fn reopenDocumentForURL_withContentsOfURL_error(
&self,
url: Option<&NSURL>,
contents_url: &NSURL,
) -> Result<(), Retained<NSError>>;
#[deprecated]
#[method_id(@__retain_semantics Other fileExtensionsFromType:)]
pub unsafe fn fileExtensionsFromType(
&self,
type_name: &NSString,
) -> Option<Retained<NSArray>>;
#[deprecated]
#[method_id(@__retain_semantics Other typeFromFileExtension:)]
pub unsafe fn typeFromFileExtension(
&self,
file_name_extension_or_hfs_file_type: &NSString,
) -> Option<Retained<NSString>>;
#[deprecated]
#[method_id(@__retain_semantics Other documentForFileName:)]
pub unsafe fn documentForFileName(
&self,
file_name: &NSString,
) -> Option<Retained<AnyObject>>;
#[deprecated]
#[method_id(@__retain_semantics Other fileNamesFromRunningOpenPanel)]
pub unsafe fn fileNamesFromRunningOpenPanel(&self) -> Option<Retained<NSArray>>;
#[deprecated]
#[method_id(@__retain_semantics Other makeDocumentWithContentsOfFile:ofType:)]
pub unsafe fn makeDocumentWithContentsOfFile_ofType(
&self,
file_name: &NSString,
r#type: &NSString,
) -> Option<Retained<AnyObject>>;
#[deprecated]
#[method_id(@__retain_semantics Other makeDocumentWithContentsOfURL:ofType:)]
pub unsafe fn makeDocumentWithContentsOfURL_ofType(
&self,
url: &NSURL,
r#type: Option<&NSString>,
) -> Option<Retained<AnyObject>>;
#[deprecated]
#[method_id(@__retain_semantics Other makeUntitledDocumentOfType:)]
pub unsafe fn makeUntitledDocumentOfType(
&self,
r#type: &NSString,
) -> Option<Retained<AnyObject>>;
#[deprecated]
#[method_id(@__retain_semantics Other openDocumentWithContentsOfFile:display:)]
pub unsafe fn openDocumentWithContentsOfFile_display(
&self,
file_name: &NSString,
display: bool,
) -> Option<Retained<AnyObject>>;
#[deprecated]
#[method_id(@__retain_semantics Other openDocumentWithContentsOfURL:display:)]
pub unsafe fn openDocumentWithContentsOfURL_display(
&self,
url: &NSURL,
display: bool,
) -> Option<Retained<AnyObject>>;
#[deprecated]
#[method_id(@__retain_semantics Other openUntitledDocumentOfType:display:)]
pub unsafe fn openUntitledDocumentOfType_display(
&self,
r#type: &NSString,
display: bool,
) -> Option<Retained<AnyObject>>;
#[deprecated]
#[method(setShouldCreateUI:)]
pub unsafe fn setShouldCreateUI(&self, flag: bool);
#[deprecated]
#[method(shouldCreateUI)]
pub unsafe fn shouldCreateUI(&self) -> bool;
}
);

View File

@@ -0,0 +1,39 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_methods!(
/// NSScripting
#[cfg(feature = "NSDocument")]
unsafe impl NSDocument {
#[method_id(@__retain_semantics Other lastComponentOfFileName)]
pub unsafe fn lastComponentOfFileName(&self) -> Retained<NSString>;
#[method(setLastComponentOfFileName:)]
pub unsafe fn setLastComponentOfFileName(&self, last_component_of_file_name: &NSString);
#[method_id(@__retain_semantics Other handleSaveScriptCommand:)]
pub unsafe fn handleSaveScriptCommand(
&self,
command: &NSScriptCommand,
) -> Option<Retained<AnyObject>>;
#[method_id(@__retain_semantics Other handleCloseScriptCommand:)]
pub unsafe fn handleCloseScriptCommand(
&self,
command: &NSCloseCommand,
) -> Option<Retained<AnyObject>>;
#[method_id(@__retain_semantics Other handlePrintScriptCommand:)]
pub unsafe fn handlePrintScriptCommand(
&self,
command: &NSScriptCommand,
) -> Option<Retained<AnyObject>>;
#[method_id(@__retain_semantics Other objectSpecifier)]
pub unsafe fn objectSpecifier(&self) -> Retained<NSScriptObjectSpecifier>;
}
);

View File

@@ -0,0 +1,379 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDragOperation(pub NSUInteger);
bitflags::bitflags! {
impl NSDragOperation: NSUInteger {
#[doc(alias = "NSDragOperationNone")]
const None = 0;
#[doc(alias = "NSDragOperationCopy")]
const Copy = 1;
#[doc(alias = "NSDragOperationLink")]
const Link = 2;
#[doc(alias = "NSDragOperationGeneric")]
const Generic = 4;
#[doc(alias = "NSDragOperationPrivate")]
const Private = 8;
#[doc(alias = "NSDragOperationMove")]
const Move = 16;
#[doc(alias = "NSDragOperationDelete")]
const Delete = 32;
#[doc(alias = "NSDragOperationEvery")]
const Every = NSUIntegerMax as _;
#[deprecated]
#[doc(alias = "NSDragOperationAll_Obsolete")]
const All_Obsolete = 15;
#[deprecated]
#[doc(alias = "NSDragOperationAll")]
const All = NSDragOperation::All_Obsolete.0;
}
}
unsafe impl Encode for NSDragOperation {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDragOperation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDraggingFormation(pub NSInteger);
impl NSDraggingFormation {
#[doc(alias = "NSDraggingFormationDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "NSDraggingFormationNone")]
pub const None: Self = Self(1);
#[doc(alias = "NSDraggingFormationPile")]
pub const Pile: Self = Self(2);
#[doc(alias = "NSDraggingFormationList")]
pub const List: Self = Self(3);
#[doc(alias = "NSDraggingFormationStack")]
pub const Stack: Self = Self(4);
}
unsafe impl Encode for NSDraggingFormation {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSDraggingFormation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDraggingContext(pub NSInteger);
impl NSDraggingContext {
#[doc(alias = "NSDraggingContextOutsideApplication")]
pub const OutsideApplication: Self = Self(0);
#[doc(alias = "NSDraggingContextWithinApplication")]
pub const WithinApplication: Self = Self(1);
}
unsafe impl Encode for NSDraggingContext {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSDraggingContext {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDraggingItemEnumerationOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSDraggingItemEnumerationOptions: NSUInteger {
const NSDraggingItemEnumerationConcurrent = NSEnumerationOptions::NSEnumerationConcurrent.0;
const NSDraggingItemEnumerationClearNonenumeratedImages = 1<<16;
}
}
unsafe impl Encode for NSDraggingItemEnumerationOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDraggingItemEnumerationOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSpringLoadingHighlight(pub NSInteger);
impl NSSpringLoadingHighlight {
#[doc(alias = "NSSpringLoadingHighlightNone")]
pub const None: Self = Self(0);
#[doc(alias = "NSSpringLoadingHighlightStandard")]
pub const Standard: Self = Self(1);
#[doc(alias = "NSSpringLoadingHighlightEmphasized")]
pub const Emphasized: Self = Self(2);
}
unsafe impl Encode for NSSpringLoadingHighlight {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSSpringLoadingHighlight {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait NSDraggingInfo: NSObjectProtocol + IsMainThreadOnly {
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[method_id(@__retain_semantics Other draggingDestinationWindow)]
unsafe fn draggingDestinationWindow(&self) -> Option<Retained<NSWindow>>;
#[method(draggingSourceOperationMask)]
unsafe fn draggingSourceOperationMask(&self) -> NSDragOperation;
#[method(draggingLocation)]
unsafe fn draggingLocation(&self) -> NSPoint;
#[method(draggedImageLocation)]
unsafe fn draggedImageLocation(&self) -> NSPoint;
#[cfg(feature = "NSImage")]
#[deprecated = "Use NSDraggingItem objects instead"]
#[method_id(@__retain_semantics Other draggedImage)]
unsafe fn draggedImage(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSPasteboard")]
#[method_id(@__retain_semantics Other draggingPasteboard)]
unsafe fn draggingPasteboard(&self) -> Retained<NSPasteboard>;
#[method_id(@__retain_semantics Other draggingSource)]
unsafe fn draggingSource(&self) -> Option<Retained<AnyObject>>;
#[method(draggingSequenceNumber)]
unsafe fn draggingSequenceNumber(&self) -> NSInteger;
#[method(slideDraggedImageTo:)]
unsafe fn slideDraggedImageTo(&self, screen_point: NSPoint);
#[deprecated = "Use NSFilePromiseReceiver objects instead"]
#[method_id(@__retain_semantics Other namesOfPromisedFilesDroppedAtDestination:)]
unsafe fn namesOfPromisedFilesDroppedAtDestination(
&self,
drop_destination: &NSURL,
) -> Option<Retained<NSArray<NSString>>>;
#[method(draggingFormation)]
unsafe fn draggingFormation(&self) -> NSDraggingFormation;
#[method(setDraggingFormation:)]
unsafe fn setDraggingFormation(&self, dragging_formation: NSDraggingFormation);
#[method(animatesToDestination)]
unsafe fn animatesToDestination(&self) -> bool;
#[method(setAnimatesToDestination:)]
unsafe fn setAnimatesToDestination(&self, animates_to_destination: bool);
#[method(numberOfValidItemsForDrop)]
unsafe fn numberOfValidItemsForDrop(&self) -> NSInteger;
#[method(setNumberOfValidItemsForDrop:)]
unsafe fn setNumberOfValidItemsForDrop(&self, number_of_valid_items_for_drop: NSInteger);
#[cfg(all(
feature = "NSDraggingItem",
feature = "NSPasteboard",
feature = "NSResponder",
feature = "NSView",
feature = "block2"
))]
#[method(enumerateDraggingItemsWithOptions:forView:classes:searchOptions:usingBlock:)]
unsafe fn enumerateDraggingItemsWithOptions_forView_classes_searchOptions_usingBlock(
&self,
enum_opts: NSDraggingItemEnumerationOptions,
view: Option<&NSView>,
class_array: &NSArray<TodoClass>,
search_options: &NSDictionary<NSPasteboardReadingOptionKey, AnyObject>,
block: &block2::Block<dyn Fn(NonNull<NSDraggingItem>, NSInteger, NonNull<Bool>)>,
);
#[method(springLoadingHighlight)]
unsafe fn springLoadingHighlight(&self) -> NSSpringLoadingHighlight;
#[method(resetSpringLoading)]
unsafe fn resetSpringLoading(&self);
}
unsafe impl ProtocolType for dyn NSDraggingInfo {}
);
extern_protocol!(
pub unsafe trait NSDraggingDestination: NSObjectProtocol + IsMainThreadOnly {
#[optional]
#[method(draggingEntered:)]
unsafe fn draggingEntered(
&self,
sender: &ProtocolObject<dyn NSDraggingInfo>,
) -> NSDragOperation;
#[optional]
#[method(draggingUpdated:)]
unsafe fn draggingUpdated(
&self,
sender: &ProtocolObject<dyn NSDraggingInfo>,
) -> NSDragOperation;
#[optional]
#[method(draggingExited:)]
unsafe fn draggingExited(&self, sender: Option<&ProtocolObject<dyn NSDraggingInfo>>);
#[optional]
#[method(prepareForDragOperation:)]
unsafe fn prepareForDragOperation(
&self,
sender: &ProtocolObject<dyn NSDraggingInfo>,
) -> bool;
#[optional]
#[method(performDragOperation:)]
unsafe fn performDragOperation(&self, sender: &ProtocolObject<dyn NSDraggingInfo>) -> bool;
#[optional]
#[method(concludeDragOperation:)]
unsafe fn concludeDragOperation(&self, sender: Option<&ProtocolObject<dyn NSDraggingInfo>>);
#[optional]
#[method(draggingEnded:)]
unsafe fn draggingEnded(&self, sender: &ProtocolObject<dyn NSDraggingInfo>);
#[optional]
#[method(wantsPeriodicDraggingUpdates)]
unsafe fn wantsPeriodicDraggingUpdates(&self) -> bool;
#[optional]
#[method(updateDraggingItemsForDrag:)]
unsafe fn updateDraggingItemsForDrag(
&self,
sender: Option<&ProtocolObject<dyn NSDraggingInfo>>,
);
}
unsafe impl ProtocolType for dyn NSDraggingDestination {}
);
extern_protocol!(
pub unsafe trait NSDraggingSource: NSObjectProtocol + IsMainThreadOnly {
#[cfg(feature = "NSDraggingSession")]
#[method(draggingSession:sourceOperationMaskForDraggingContext:)]
unsafe fn draggingSession_sourceOperationMaskForDraggingContext(
&self,
session: &NSDraggingSession,
context: NSDraggingContext,
) -> NSDragOperation;
#[cfg(feature = "NSDraggingSession")]
#[optional]
#[method(draggingSession:willBeginAtPoint:)]
unsafe fn draggingSession_willBeginAtPoint(
&self,
session: &NSDraggingSession,
screen_point: NSPoint,
);
#[cfg(feature = "NSDraggingSession")]
#[optional]
#[method(draggingSession:movedToPoint:)]
unsafe fn draggingSession_movedToPoint(
&self,
session: &NSDraggingSession,
screen_point: NSPoint,
);
#[cfg(feature = "NSDraggingSession")]
#[optional]
#[method(draggingSession:endedAtPoint:operation:)]
unsafe fn draggingSession_endedAtPoint_operation(
&self,
session: &NSDraggingSession,
screen_point: NSPoint,
operation: NSDragOperation,
);
#[cfg(feature = "NSDraggingSession")]
#[optional]
#[method(ignoreModifierKeysForDraggingSession:)]
unsafe fn ignoreModifierKeysForDraggingSession(&self, session: &NSDraggingSession) -> bool;
}
unsafe impl ProtocolType for dyn NSDraggingSource {}
);
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSSpringLoadingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSSpringLoadingOptions: NSUInteger {
const NSSpringLoadingDisabled = 0;
const NSSpringLoadingEnabled = 1<<0;
const NSSpringLoadingContinuousActivation = 1<<1;
const NSSpringLoadingNoHover = 1<<3;
}
}
unsafe impl Encode for NSSpringLoadingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSSpringLoadingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait NSSpringLoadingDestination:
NSObjectProtocol + IsMainThreadOnly
{
#[method(springLoadingActivated:draggingInfo:)]
unsafe fn springLoadingActivated_draggingInfo(
&self,
activated: bool,
dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
);
#[method(springLoadingHighlightChanged:)]
unsafe fn springLoadingHighlightChanged(
&self,
dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
);
#[optional]
#[method(springLoadingEntered:)]
unsafe fn springLoadingEntered(
&self,
dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
) -> NSSpringLoadingOptions;
#[optional]
#[method(springLoadingUpdated:)]
unsafe fn springLoadingUpdated(
&self,
dragging_info: &ProtocolObject<dyn NSDraggingInfo>,
) -> NSSpringLoadingOptions;
#[optional]
#[method(springLoadingExited:)]
unsafe fn springLoadingExited(&self, dragging_info: &ProtocolObject<dyn NSDraggingInfo>);
#[optional]
#[method(draggingEnded:)]
unsafe fn draggingEnded(&self, dragging_info: &ProtocolObject<dyn NSDraggingInfo>);
}
unsafe impl ProtocolType for dyn NSSpringLoadingDestination {}
);

View File

@@ -0,0 +1,138 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSDraggingImageComponentKey = NSString;
extern "C" {
pub static NSDraggingImageComponentIconKey: &'static NSDraggingImageComponentKey;
}
extern "C" {
pub static NSDraggingImageComponentLabelKey: &'static NSDraggingImageComponentKey;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDraggingImageComponent;
unsafe impl ClassType for NSDraggingImageComponent {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSDraggingImageComponent {}
extern_methods!(
unsafe impl NSDraggingImageComponent {
#[method_id(@__retain_semantics Other draggingImageComponentWithKey:)]
pub unsafe fn draggingImageComponentWithKey(
key: &NSDraggingImageComponentKey,
) -> Retained<NSDraggingImageComponent>;
#[method_id(@__retain_semantics Init initWithKey:)]
pub unsafe fn initWithKey(
this: Allocated<Self>,
key: &NSDraggingImageComponentKey,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Other key)]
pub unsafe fn key(&self) -> Retained<NSDraggingImageComponentKey>;
#[method(setKey:)]
pub unsafe fn setKey(&self, key: &NSDraggingImageComponentKey);
#[method_id(@__retain_semantics Other contents)]
pub unsafe fn contents(&self) -> Option<Retained<AnyObject>>;
#[method(setContents:)]
pub unsafe fn setContents(&self, contents: Option<&AnyObject>);
#[method(frame)]
pub unsafe fn frame(&self) -> NSRect;
#[method(setFrame:)]
pub unsafe fn setFrame(&self, frame: NSRect);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDraggingImageComponent {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDraggingItem;
unsafe impl ClassType for NSDraggingItem {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSDraggingItem {}
extern_methods!(
unsafe impl NSDraggingItem {
#[cfg(feature = "NSPasteboard")]
#[method_id(@__retain_semantics Init initWithPasteboardWriter:)]
pub unsafe fn initWithPasteboardWriter(
this: Allocated<Self>,
pasteboard_writer: &ProtocolObject<dyn NSPasteboardWriting>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Other item)]
pub unsafe fn item(&self) -> Retained<AnyObject>;
#[method(draggingFrame)]
pub unsafe fn draggingFrame(&self) -> NSRect;
#[method(setDraggingFrame:)]
pub unsafe fn setDraggingFrame(&self, dragging_frame: NSRect);
#[cfg(feature = "block2")]
#[method(imageComponentsProvider)]
pub unsafe fn imageComponentsProvider(
&self,
) -> *mut block2::Block<dyn Fn() -> NonNull<NSArray<NSDraggingImageComponent>>>;
#[cfg(feature = "block2")]
#[method(setImageComponentsProvider:)]
pub unsafe fn setImageComponentsProvider(
&self,
image_components_provider: Option<
&block2::Block<dyn Fn() -> NonNull<NSArray<NSDraggingImageComponent>>>,
>,
);
#[method(setDraggingFrame:contents:)]
pub unsafe fn setDraggingFrame_contents(&self, frame: NSRect, contents: Option<&AnyObject>);
#[method_id(@__retain_semantics Other imageComponents)]
pub unsafe fn imageComponents(&self)
-> Option<Retained<NSArray<NSDraggingImageComponent>>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDraggingItem {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,84 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSDraggingSession;
unsafe impl ClassType for NSDraggingSession {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSDraggingSession {}
extern_methods!(
unsafe impl NSDraggingSession {
#[cfg(feature = "NSDragging")]
#[method(draggingFormation)]
pub unsafe fn draggingFormation(&self) -> NSDraggingFormation;
#[cfg(feature = "NSDragging")]
#[method(setDraggingFormation:)]
pub unsafe fn setDraggingFormation(&self, dragging_formation: NSDraggingFormation);
#[method(animatesToStartingPositionsOnCancelOrFail)]
pub unsafe fn animatesToStartingPositionsOnCancelOrFail(&self) -> bool;
#[method(setAnimatesToStartingPositionsOnCancelOrFail:)]
pub unsafe fn setAnimatesToStartingPositionsOnCancelOrFail(
&self,
animates_to_starting_positions_on_cancel_or_fail: bool,
);
#[method(draggingLeaderIndex)]
pub unsafe fn draggingLeaderIndex(&self) -> NSInteger;
#[method(setDraggingLeaderIndex:)]
pub unsafe fn setDraggingLeaderIndex(&self, dragging_leader_index: NSInteger);
#[cfg(feature = "NSPasteboard")]
#[method_id(@__retain_semantics Other draggingPasteboard)]
pub unsafe fn draggingPasteboard(&self) -> Retained<NSPasteboard>;
#[method(draggingSequenceNumber)]
pub unsafe fn draggingSequenceNumber(&self) -> NSInteger;
#[method(draggingLocation)]
pub unsafe fn draggingLocation(&self) -> NSPoint;
#[cfg(all(
feature = "NSDragging",
feature = "NSDraggingItem",
feature = "NSPasteboard",
feature = "NSResponder",
feature = "NSView",
feature = "block2"
))]
#[method(enumerateDraggingItemsWithOptions:forView:classes:searchOptions:usingBlock:)]
pub unsafe fn enumerateDraggingItemsWithOptions_forView_classes_searchOptions_usingBlock(
&self,
enum_opts: NSDraggingItemEnumerationOptions,
view: Option<&NSView>,
class_array: &NSArray<TodoClass>,
search_options: &NSDictionary<NSPasteboardReadingOptionKey, AnyObject>,
block: &block2::Block<dyn Fn(NonNull<NSDraggingItem>, NSInteger, NonNull<Bool>) + '_>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSDraggingSession {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,247 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDrawerState(pub NSUInteger);
impl NSDrawerState {
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub const NSDrawerClosedState: Self = Self(0);
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub const NSDrawerOpeningState: Self = Self(1);
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub const NSDrawerOpenState: Self = Self(2);
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub const NSDrawerClosingState: Self = Self(3);
}
unsafe impl Encode for NSDrawerState {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSDrawerState {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSResponder")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
pub struct NSDrawer;
#[cfg(feature = "NSResponder")]
unsafe impl ClassType for NSDrawer {
#[inherits(NSObject)]
type Super = NSResponder;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
unsafe impl NSAccessibility for NSDrawer {}
#[cfg(all(feature = "NSAccessibilityProtocols", feature = "NSResponder"))]
unsafe impl NSAccessibilityElementProtocol for NSDrawer {}
#[cfg(feature = "NSResponder")]
unsafe impl NSCoding for NSDrawer {}
#[cfg(feature = "NSResponder")]
unsafe impl NSObjectProtocol for NSDrawer {}
extern_methods!(
#[cfg(feature = "NSResponder")]
unsafe impl NSDrawer {
#[method_id(@__retain_semantics Init initWithContentSize:preferredEdge:)]
pub unsafe fn initWithContentSize_preferredEdge(
this: Allocated<Self>,
content_size: NSSize,
edge: NSRectEdge,
) -> Retained<Self>;
#[cfg(feature = "NSWindow")]
#[method_id(@__retain_semantics Other parentWindow)]
pub unsafe fn parentWindow(&self) -> Option<Retained<NSWindow>>;
#[cfg(feature = "NSWindow")]
#[method(setParentWindow:)]
pub unsafe fn setParentWindow(&self, parent_window: Option<&NSWindow>);
#[cfg(feature = "NSView")]
#[method_id(@__retain_semantics Other contentView)]
pub unsafe fn contentView(&self) -> Option<Retained<NSView>>;
#[cfg(feature = "NSView")]
#[method(setContentView:)]
pub unsafe fn setContentView(&self, content_view: Option<&NSView>);
#[method(preferredEdge)]
pub unsafe fn preferredEdge(&self) -> NSRectEdge;
#[method(setPreferredEdge:)]
pub unsafe fn setPreferredEdge(&self, preferred_edge: NSRectEdge);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Retained<ProtocolObject<dyn NSDrawerDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(&self, delegate: Option<&ProtocolObject<dyn NSDrawerDelegate>>);
#[method(open)]
pub unsafe fn open(&self);
#[method(openOnEdge:)]
pub unsafe fn openOnEdge(&self, edge: NSRectEdge);
#[method(close)]
pub unsafe fn close(&self);
#[method(open:)]
pub unsafe fn open_(&self, sender: Option<&AnyObject>);
#[method(close:)]
pub unsafe fn close_(&self, sender: Option<&AnyObject>);
#[method(toggle:)]
pub unsafe fn toggle(&self, sender: Option<&AnyObject>);
#[method(state)]
pub unsafe fn state(&self) -> NSInteger;
#[method(edge)]
pub unsafe fn edge(&self) -> NSRectEdge;
#[method(contentSize)]
pub unsafe fn contentSize(&self) -> NSSize;
#[method(setContentSize:)]
pub unsafe fn setContentSize(&self, content_size: NSSize);
#[method(minContentSize)]
pub unsafe fn minContentSize(&self) -> NSSize;
#[method(setMinContentSize:)]
pub unsafe fn setMinContentSize(&self, min_content_size: NSSize);
#[method(maxContentSize)]
pub unsafe fn maxContentSize(&self) -> NSSize;
#[method(setMaxContentSize:)]
pub unsafe fn setMaxContentSize(&self, max_content_size: NSSize);
#[method(leadingOffset)]
pub unsafe fn leadingOffset(&self) -> CGFloat;
#[method(setLeadingOffset:)]
pub unsafe fn setLeadingOffset(&self, leading_offset: CGFloat);
#[method(trailingOffset)]
pub unsafe fn trailingOffset(&self) -> CGFloat;
#[method(setTrailingOffset:)]
pub unsafe fn setTrailingOffset(&self, trailing_offset: CGFloat);
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(feature = "NSResponder")]
unsafe impl NSDrawer {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSResponder")]
unsafe impl NSDrawer {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSDrawers
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSWindow {
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[method_id(@__retain_semantics Other drawers)]
pub unsafe fn drawers(&self) -> Option<Retained<NSArray<NSDrawer>>>;
}
);
extern_protocol!(
pub unsafe trait NSDrawerDelegate: NSObjectProtocol {
#[cfg(feature = "NSResponder")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[method(drawerShouldOpen:)]
unsafe fn drawerShouldOpen(&self, sender: &NSDrawer) -> bool;
#[cfg(feature = "NSResponder")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[method(drawerShouldClose:)]
unsafe fn drawerShouldClose(&self, sender: &NSDrawer) -> bool;
#[cfg(feature = "NSResponder")]
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[method(drawerWillResizeContents:toSize:)]
unsafe fn drawerWillResizeContents_toSize(
&self,
sender: &NSDrawer,
content_size: NSSize,
) -> NSSize;
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[method(drawerWillOpen:)]
unsafe fn drawerWillOpen(&self, notification: &NSNotification);
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[method(drawerDidOpen:)]
unsafe fn drawerDidOpen(&self, notification: &NSNotification);
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[method(drawerWillClose:)]
unsafe fn drawerWillClose(&self, notification: &NSNotification);
#[deprecated = "Drawers are deprecated; consider using NSSplitViewController"]
#[optional]
#[method(drawerDidClose:)]
unsafe fn drawerDidClose(&self, notification: &NSNotification);
}
unsafe impl ProtocolType for dyn NSDrawerDelegate {}
);
extern "C" {
pub static NSDrawerWillOpenNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSDrawerDidOpenNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSDrawerWillCloseNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSDrawerDidCloseNotification: &'static NSNotificationName;
}

View File

@@ -0,0 +1,77 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSImageRep")]
#[deprecated = "`NSEPSImageRep` instances cannot be created on macOS 14.0 and later"]
pub struct NSEPSImageRep;
#[cfg(feature = "NSImageRep")]
unsafe impl ClassType for NSEPSImageRep {
#[inherits(NSObject)]
type Super = NSImageRep;
type Mutability = InteriorMutable;
}
);
#[cfg(feature = "NSImageRep")]
unsafe impl NSCoding for NSEPSImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSCopying for NSEPSImageRep {}
#[cfg(feature = "NSImageRep")]
unsafe impl NSObjectProtocol for NSEPSImageRep {}
extern_methods!(
#[cfg(feature = "NSImageRep")]
unsafe impl NSEPSImageRep {
#[method_id(@__retain_semantics Other imageRepWithData:)]
pub unsafe fn imageRepWithData(eps_data: &NSData) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithData:)]
pub unsafe fn initWithData(
this: Allocated<Self>,
eps_data: &NSData,
) -> Option<Retained<Self>>;
#[method(boundingBox)]
pub unsafe fn boundingBox(&self) -> NSRect;
#[method_id(@__retain_semantics Other EPSRepresentation)]
pub unsafe fn EPSRepresentation(&self) -> Retained<NSData>;
#[deprecated]
#[method(prepareGState)]
pub unsafe fn prepareGState(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSImageRep`
#[cfg(feature = "NSImageRep")]
unsafe impl NSEPSImageRep {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(feature = "NSImageRep")]
unsafe impl NSEPSImageRep {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,150 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
pub static NSTextLineTooLongException: &'static NSExceptionName;
}
extern "C" {
pub static NSTextNoSelectionException: &'static NSExceptionName;
}
extern "C" {
pub static NSWordTablesWriteException: &'static NSExceptionName;
}
extern "C" {
pub static NSWordTablesReadException: &'static NSExceptionName;
}
extern "C" {
pub static NSTextReadException: &'static NSExceptionName;
}
extern "C" {
pub static NSTextWriteException: &'static NSExceptionName;
}
extern "C" {
pub static NSPasteboardCommunicationException: &'static NSExceptionName;
}
extern "C" {
pub static NSPrintingCommunicationException: &'static NSExceptionName;
}
extern "C" {
pub static NSAbortModalException: &'static NSExceptionName;
}
extern "C" {
pub static NSAbortPrintingException: &'static NSExceptionName;
}
extern "C" {
pub static NSIllegalSelectorException: &'static NSExceptionName;
}
extern "C" {
pub static NSAppKitVirtualMemoryException: &'static NSExceptionName;
}
extern "C" {
pub static NSBadRTFDirectiveException: &'static NSExceptionName;
}
extern "C" {
pub static NSBadRTFFontTableException: &'static NSExceptionName;
}
extern "C" {
pub static NSBadRTFStyleSheetException: &'static NSExceptionName;
}
extern "C" {
pub static NSTypedStreamVersionException: &'static NSExceptionName;
}
extern "C" {
pub static NSTIFFException: &'static NSExceptionName;
}
extern "C" {
pub static NSPrintPackageException: &'static NSExceptionName;
}
extern "C" {
pub static NSBadRTFColorTableException: &'static NSExceptionName;
}
extern "C" {
pub static NSDraggingException: &'static NSExceptionName;
}
extern "C" {
pub static NSColorListIOException: &'static NSExceptionName;
}
extern "C" {
pub static NSColorListNotEditableException: &'static NSExceptionName;
}
extern "C" {
pub static NSBadBitmapParametersException: &'static NSExceptionName;
}
extern "C" {
pub static NSWindowServerCommunicationException: &'static NSExceptionName;
}
extern "C" {
pub static NSFontUnavailableException: &'static NSExceptionName;
}
extern "C" {
pub static NSPPDIncludeNotFoundException: &'static NSExceptionName;
}
extern "C" {
pub static NSPPDParseException: &'static NSExceptionName;
}
extern "C" {
pub static NSPPDIncludeStackOverflowException: &'static NSExceptionName;
}
extern "C" {
pub static NSPPDIncludeStackUnderflowException: &'static NSExceptionName;
}
extern "C" {
pub static NSRTFPropertyStackOverflowException: &'static NSExceptionName;
}
extern "C" {
pub static NSAppKitIgnoredException: &'static NSExceptionName;
}
extern "C" {
pub static NSBadComparisonException: &'static NSExceptionName;
}
extern "C" {
pub static NSImageCacheException: &'static NSExceptionName;
}
extern "C" {
pub static NSNibLoadingException: &'static NSExceptionName;
}
extern "C" {
pub static NSBrowserIllegalDelegateException: &'static NSExceptionName;
}
extern "C" {
pub static NSAccessibilityException: &'static NSExceptionName;
}

View File

@@ -0,0 +1,977 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSEventType(pub NSUInteger);
impl NSEventType {
#[doc(alias = "NSEventTypeLeftMouseDown")]
pub const LeftMouseDown: Self = Self(1);
#[doc(alias = "NSEventTypeLeftMouseUp")]
pub const LeftMouseUp: Self = Self(2);
#[doc(alias = "NSEventTypeRightMouseDown")]
pub const RightMouseDown: Self = Self(3);
#[doc(alias = "NSEventTypeRightMouseUp")]
pub const RightMouseUp: Self = Self(4);
#[doc(alias = "NSEventTypeMouseMoved")]
pub const MouseMoved: Self = Self(5);
#[doc(alias = "NSEventTypeLeftMouseDragged")]
pub const LeftMouseDragged: Self = Self(6);
#[doc(alias = "NSEventTypeRightMouseDragged")]
pub const RightMouseDragged: Self = Self(7);
#[doc(alias = "NSEventTypeMouseEntered")]
pub const MouseEntered: Self = Self(8);
#[doc(alias = "NSEventTypeMouseExited")]
pub const MouseExited: Self = Self(9);
#[doc(alias = "NSEventTypeKeyDown")]
pub const KeyDown: Self = Self(10);
#[doc(alias = "NSEventTypeKeyUp")]
pub const KeyUp: Self = Self(11);
#[doc(alias = "NSEventTypeFlagsChanged")]
pub const FlagsChanged: Self = Self(12);
#[doc(alias = "NSEventTypeAppKitDefined")]
pub const AppKitDefined: Self = Self(13);
#[doc(alias = "NSEventTypeSystemDefined")]
pub const SystemDefined: Self = Self(14);
#[doc(alias = "NSEventTypeApplicationDefined")]
pub const ApplicationDefined: Self = Self(15);
#[doc(alias = "NSEventTypePeriodic")]
pub const Periodic: Self = Self(16);
#[doc(alias = "NSEventTypeCursorUpdate")]
pub const CursorUpdate: Self = Self(17);
#[doc(alias = "NSEventTypeScrollWheel")]
pub const ScrollWheel: Self = Self(22);
#[doc(alias = "NSEventTypeTabletPoint")]
pub const TabletPoint: Self = Self(23);
#[doc(alias = "NSEventTypeTabletProximity")]
pub const TabletProximity: Self = Self(24);
#[doc(alias = "NSEventTypeOtherMouseDown")]
pub const OtherMouseDown: Self = Self(25);
#[doc(alias = "NSEventTypeOtherMouseUp")]
pub const OtherMouseUp: Self = Self(26);
#[doc(alias = "NSEventTypeOtherMouseDragged")]
pub const OtherMouseDragged: Self = Self(27);
#[doc(alias = "NSEventTypeGesture")]
pub const Gesture: Self = Self(29);
#[doc(alias = "NSEventTypeMagnify")]
pub const Magnify: Self = Self(30);
#[doc(alias = "NSEventTypeSwipe")]
pub const Swipe: Self = Self(31);
#[doc(alias = "NSEventTypeRotate")]
pub const Rotate: Self = Self(18);
#[doc(alias = "NSEventTypeBeginGesture")]
pub const BeginGesture: Self = Self(19);
#[doc(alias = "NSEventTypeEndGesture")]
pub const EndGesture: Self = Self(20);
#[doc(alias = "NSEventTypeSmartMagnify")]
pub const SmartMagnify: Self = Self(32);
#[doc(alias = "NSEventTypeQuickLook")]
pub const QuickLook: Self = Self(33);
#[doc(alias = "NSEventTypePressure")]
pub const Pressure: Self = Self(34);
#[doc(alias = "NSEventTypeDirectTouch")]
pub const DirectTouch: Self = Self(37);
#[doc(alias = "NSEventTypeChangeMode")]
pub const ChangeMode: Self = Self(38);
}
unsafe impl Encode for NSEventType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSEventType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static NSLeftMouseDown: NSEventType = NSEventType(NSEventType::LeftMouseDown.0);
pub static NSLeftMouseUp: NSEventType = NSEventType(NSEventType::LeftMouseUp.0);
pub static NSRightMouseDown: NSEventType = NSEventType(NSEventType::RightMouseDown.0);
pub static NSRightMouseUp: NSEventType = NSEventType(NSEventType::RightMouseUp.0);
pub static NSMouseMoved: NSEventType = NSEventType(NSEventType::MouseMoved.0);
pub static NSLeftMouseDragged: NSEventType = NSEventType(NSEventType::LeftMouseDragged.0);
pub static NSRightMouseDragged: NSEventType = NSEventType(NSEventType::RightMouseDragged.0);
pub static NSMouseEntered: NSEventType = NSEventType(NSEventType::MouseEntered.0);
pub static NSMouseExited: NSEventType = NSEventType(NSEventType::MouseExited.0);
pub static NSKeyDown: NSEventType = NSEventType(NSEventType::KeyDown.0);
pub static NSKeyUp: NSEventType = NSEventType(NSEventType::KeyUp.0);
pub static NSFlagsChanged: NSEventType = NSEventType(NSEventType::FlagsChanged.0);
pub static NSAppKitDefined: NSEventType = NSEventType(NSEventType::AppKitDefined.0);
pub static NSSystemDefined: NSEventType = NSEventType(NSEventType::SystemDefined.0);
pub static NSApplicationDefined: NSEventType = NSEventType(NSEventType::ApplicationDefined.0);
pub static NSPeriodic: NSEventType = NSEventType(NSEventType::Periodic.0);
pub static NSCursorUpdate: NSEventType = NSEventType(NSEventType::CursorUpdate.0);
pub static NSScrollWheel: NSEventType = NSEventType(NSEventType::ScrollWheel.0);
pub static NSTabletPoint: NSEventType = NSEventType(NSEventType::TabletPoint.0);
pub static NSTabletProximity: NSEventType = NSEventType(NSEventType::TabletProximity.0);
pub static NSOtherMouseDown: NSEventType = NSEventType(NSEventType::OtherMouseDown.0);
pub static NSOtherMouseUp: NSEventType = NSEventType(NSEventType::OtherMouseUp.0);
pub static NSOtherMouseDragged: NSEventType = NSEventType(NSEventType::OtherMouseDragged.0);
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSEventMask(pub c_ulonglong);
bitflags::bitflags! {
impl NSEventMask: c_ulonglong {
#[doc(alias = "NSEventMaskLeftMouseDown")]
const LeftMouseDown = 1<<NSEventType::LeftMouseDown.0;
#[doc(alias = "NSEventMaskLeftMouseUp")]
const LeftMouseUp = 1<<NSEventType::LeftMouseUp.0;
#[doc(alias = "NSEventMaskRightMouseDown")]
const RightMouseDown = 1<<NSEventType::RightMouseDown.0;
#[doc(alias = "NSEventMaskRightMouseUp")]
const RightMouseUp = 1<<NSEventType::RightMouseUp.0;
#[doc(alias = "NSEventMaskMouseMoved")]
const MouseMoved = 1<<NSEventType::MouseMoved.0;
#[doc(alias = "NSEventMaskLeftMouseDragged")]
const LeftMouseDragged = 1<<NSEventType::LeftMouseDragged.0;
#[doc(alias = "NSEventMaskRightMouseDragged")]
const RightMouseDragged = 1<<NSEventType::RightMouseDragged.0;
#[doc(alias = "NSEventMaskMouseEntered")]
const MouseEntered = 1<<NSEventType::MouseEntered.0;
#[doc(alias = "NSEventMaskMouseExited")]
const MouseExited = 1<<NSEventType::MouseExited.0;
#[doc(alias = "NSEventMaskKeyDown")]
const KeyDown = 1<<NSEventType::KeyDown.0;
#[doc(alias = "NSEventMaskKeyUp")]
const KeyUp = 1<<NSEventType::KeyUp.0;
#[doc(alias = "NSEventMaskFlagsChanged")]
const FlagsChanged = 1<<NSEventType::FlagsChanged.0;
#[doc(alias = "NSEventMaskAppKitDefined")]
const AppKitDefined = 1<<NSEventType::AppKitDefined.0;
#[doc(alias = "NSEventMaskSystemDefined")]
const SystemDefined = 1<<NSEventType::SystemDefined.0;
#[doc(alias = "NSEventMaskApplicationDefined")]
const ApplicationDefined = 1<<NSEventType::ApplicationDefined.0;
#[doc(alias = "NSEventMaskPeriodic")]
const Periodic = 1<<NSEventType::Periodic.0;
#[doc(alias = "NSEventMaskCursorUpdate")]
const CursorUpdate = 1<<NSEventType::CursorUpdate.0;
#[doc(alias = "NSEventMaskScrollWheel")]
const ScrollWheel = 1<<NSEventType::ScrollWheel.0;
#[doc(alias = "NSEventMaskTabletPoint")]
const TabletPoint = 1<<NSEventType::TabletPoint.0;
#[doc(alias = "NSEventMaskTabletProximity")]
const TabletProximity = 1<<NSEventType::TabletProximity.0;
#[doc(alias = "NSEventMaskOtherMouseDown")]
const OtherMouseDown = 1<<NSEventType::OtherMouseDown.0;
#[doc(alias = "NSEventMaskOtherMouseUp")]
const OtherMouseUp = 1<<NSEventType::OtherMouseUp.0;
#[doc(alias = "NSEventMaskOtherMouseDragged")]
const OtherMouseDragged = 1<<NSEventType::OtherMouseDragged.0;
#[doc(alias = "NSEventMaskGesture")]
const Gesture = 1<<NSEventType::Gesture.0;
#[doc(alias = "NSEventMaskMagnify")]
const Magnify = 1<<NSEventType::Magnify.0;
#[doc(alias = "NSEventMaskSwipe")]
const Swipe = 1<<NSEventType::Swipe.0;
#[doc(alias = "NSEventMaskRotate")]
const Rotate = 1<<NSEventType::Rotate.0;
#[doc(alias = "NSEventMaskBeginGesture")]
const BeginGesture = 1<<NSEventType::BeginGesture.0;
#[doc(alias = "NSEventMaskEndGesture")]
const EndGesture = 1<<NSEventType::EndGesture.0;
#[doc(alias = "NSEventMaskSmartMagnify")]
const SmartMagnify = 1<<NSEventType::SmartMagnify.0;
#[doc(alias = "NSEventMaskPressure")]
const Pressure = 1<<NSEventType::Pressure.0;
#[doc(alias = "NSEventMaskDirectTouch")]
const DirectTouch = 1<<NSEventType::DirectTouch.0;
#[doc(alias = "NSEventMaskChangeMode")]
const ChangeMode = 1<<NSEventType::ChangeMode.0;
#[doc(alias = "NSEventMaskAny")]
const Any = NSUIntegerMax as _;
}
}
unsafe impl Encode for NSEventMask {
const ENCODING: Encoding = c_ulonglong::ENCODING;
}
unsafe impl RefEncode for NSEventMask {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static NSLeftMouseDownMask: NSEventMask = NSEventMask(NSEventMask::LeftMouseDown.0);
pub static NSLeftMouseUpMask: NSEventMask = NSEventMask(NSEventMask::LeftMouseUp.0);
pub static NSRightMouseDownMask: NSEventMask = NSEventMask(NSEventMask::RightMouseDown.0);
pub static NSRightMouseUpMask: NSEventMask = NSEventMask(NSEventMask::RightMouseUp.0);
pub static NSMouseMovedMask: NSEventMask = NSEventMask(NSEventMask::MouseMoved.0);
pub static NSLeftMouseDraggedMask: NSEventMask = NSEventMask(NSEventMask::LeftMouseDragged.0);
pub static NSRightMouseDraggedMask: NSEventMask = NSEventMask(NSEventMask::RightMouseDragged.0);
pub static NSMouseEnteredMask: NSEventMask = NSEventMask(NSEventMask::MouseEntered.0);
pub static NSMouseExitedMask: NSEventMask = NSEventMask(NSEventMask::MouseExited.0);
pub static NSKeyDownMask: NSEventMask = NSEventMask(NSEventMask::KeyDown.0);
pub static NSKeyUpMask: NSEventMask = NSEventMask(NSEventMask::KeyUp.0);
pub static NSFlagsChangedMask: NSEventMask = NSEventMask(NSEventMask::FlagsChanged.0);
pub static NSAppKitDefinedMask: NSEventMask = NSEventMask(NSEventMask::AppKitDefined.0);
pub static NSSystemDefinedMask: NSEventMask = NSEventMask(NSEventMask::SystemDefined.0);
pub static NSApplicationDefinedMask: NSEventMask = NSEventMask(NSEventMask::ApplicationDefined.0);
pub static NSPeriodicMask: NSEventMask = NSEventMask(NSEventMask::Periodic.0);
pub static NSCursorUpdateMask: NSEventMask = NSEventMask(NSEventMask::CursorUpdate.0);
pub static NSScrollWheelMask: NSEventMask = NSEventMask(NSEventMask::ScrollWheel.0);
pub static NSTabletPointMask: NSEventMask = NSEventMask(NSEventMask::TabletPoint.0);
pub static NSTabletProximityMask: NSEventMask = NSEventMask(NSEventMask::TabletProximity.0);
pub static NSOtherMouseDownMask: NSEventMask = NSEventMask(NSEventMask::OtherMouseDown.0);
pub static NSOtherMouseUpMask: NSEventMask = NSEventMask(NSEventMask::OtherMouseUp.0);
pub static NSOtherMouseDraggedMask: NSEventMask = NSEventMask(NSEventMask::OtherMouseDragged.0);
pub static NSAnyEventMask: NSEventMask = NSEventMask(NSUIntegerMax as _);
// TODO: pub fn NSEventMaskFromType(r#type: NSEventType,) -> NSEventMask;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSEventModifierFlags(pub NSUInteger);
bitflags::bitflags! {
impl NSEventModifierFlags: NSUInteger {
const NSEventModifierFlagCapsLock = 1<<16;
const NSEventModifierFlagShift = 1<<17;
const NSEventModifierFlagControl = 1<<18;
const NSEventModifierFlagOption = 1<<19;
const NSEventModifierFlagCommand = 1<<20;
const NSEventModifierFlagNumericPad = 1<<21;
const NSEventModifierFlagHelp = 1<<22;
const NSEventModifierFlagFunction = 1<<23;
const NSEventModifierFlagDeviceIndependentFlagsMask = 0xffff0000;
}
}
unsafe impl Encode for NSEventModifierFlags {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSEventModifierFlags {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static NSAlphaShiftKeyMask: NSEventModifierFlags =
NSEventModifierFlags(NSEventModifierFlags::NSEventModifierFlagCapsLock.0);
pub static NSShiftKeyMask: NSEventModifierFlags =
NSEventModifierFlags(NSEventModifierFlags::NSEventModifierFlagShift.0);
pub static NSControlKeyMask: NSEventModifierFlags =
NSEventModifierFlags(NSEventModifierFlags::NSEventModifierFlagControl.0);
pub static NSAlternateKeyMask: NSEventModifierFlags =
NSEventModifierFlags(NSEventModifierFlags::NSEventModifierFlagOption.0);
pub static NSCommandKeyMask: NSEventModifierFlags =
NSEventModifierFlags(NSEventModifierFlags::NSEventModifierFlagCommand.0);
pub static NSNumericPadKeyMask: NSEventModifierFlags =
NSEventModifierFlags(NSEventModifierFlags::NSEventModifierFlagNumericPad.0);
pub static NSHelpKeyMask: NSEventModifierFlags =
NSEventModifierFlags(NSEventModifierFlags::NSEventModifierFlagHelp.0);
pub static NSFunctionKeyMask: NSEventModifierFlags =
NSEventModifierFlags(NSEventModifierFlags::NSEventModifierFlagFunction.0);
pub static NSDeviceIndependentModifierFlagsMask: NSEventModifierFlags =
NSEventModifierFlags(NSEventModifierFlags::NSEventModifierFlagDeviceIndependentFlagsMask.0);
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPointingDeviceType(pub NSUInteger);
impl NSPointingDeviceType {
#[doc(alias = "NSPointingDeviceTypeUnknown")]
pub const Unknown: Self = Self(0);
#[doc(alias = "NSPointingDeviceTypePen")]
pub const Pen: Self = Self(1);
#[doc(alias = "NSPointingDeviceTypeCursor")]
pub const Cursor: Self = Self(2);
#[doc(alias = "NSPointingDeviceTypeEraser")]
pub const Eraser: Self = Self(3);
}
unsafe impl Encode for NSPointingDeviceType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSPointingDeviceType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static NSUnknownPointingDevice: NSPointingDeviceType =
NSPointingDeviceType(NSPointingDeviceType::Unknown.0);
pub static NSPenPointingDevice: NSPointingDeviceType =
NSPointingDeviceType(NSPointingDeviceType::Pen.0);
pub static NSCursorPointingDevice: NSPointingDeviceType =
NSPointingDeviceType(NSPointingDeviceType::Cursor.0);
pub static NSEraserPointingDevice: NSPointingDeviceType =
NSPointingDeviceType(NSPointingDeviceType::Eraser.0);
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSEventButtonMask(pub NSUInteger);
bitflags::bitflags! {
impl NSEventButtonMask: NSUInteger {
#[doc(alias = "NSEventButtonMaskPenTip")]
const PenTip = 1;
#[doc(alias = "NSEventButtonMaskPenLowerSide")]
const PenLowerSide = 2;
#[doc(alias = "NSEventButtonMaskPenUpperSide")]
const PenUpperSide = 4;
}
}
unsafe impl Encode for NSEventButtonMask {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSEventButtonMask {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static NSPenTipMask: NSEventButtonMask = NSEventButtonMask(NSEventButtonMask::PenTip.0);
pub static NSPenLowerSideMask: NSEventButtonMask =
NSEventButtonMask(NSEventButtonMask::PenLowerSide.0);
pub static NSPenUpperSideMask: NSEventButtonMask =
NSEventButtonMask(NSEventButtonMask::PenUpperSide.0);
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSEventPhase(pub NSUInteger);
bitflags::bitflags! {
impl NSEventPhase: NSUInteger {
#[doc(alias = "NSEventPhaseNone")]
const None = 0;
#[doc(alias = "NSEventPhaseBegan")]
const Began = 0x1<<0;
#[doc(alias = "NSEventPhaseStationary")]
const Stationary = 0x1<<1;
#[doc(alias = "NSEventPhaseChanged")]
const Changed = 0x1<<2;
#[doc(alias = "NSEventPhaseEnded")]
const Ended = 0x1<<3;
#[doc(alias = "NSEventPhaseCancelled")]
const Cancelled = 0x1<<4;
#[doc(alias = "NSEventPhaseMayBegin")]
const MayBegin = 0x1<<5;
}
}
unsafe impl Encode for NSEventPhase {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSEventPhase {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSEventGestureAxis(pub NSInteger);
impl NSEventGestureAxis {
#[doc(alias = "NSEventGestureAxisNone")]
pub const None: Self = Self(0);
#[doc(alias = "NSEventGestureAxisHorizontal")]
pub const Horizontal: Self = Self(1);
#[doc(alias = "NSEventGestureAxisVertical")]
pub const Vertical: Self = Self(2);
}
unsafe impl Encode for NSEventGestureAxis {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSEventGestureAxis {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSEventSwipeTrackingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSEventSwipeTrackingOptions: NSUInteger {
const NSEventSwipeTrackingLockDirection = 0x1<<0;
const NSEventSwipeTrackingClampGestureAmount = 0x1<<1;
}
}
unsafe impl Encode for NSEventSwipeTrackingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSEventSwipeTrackingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSEventSubtype(pub c_short);
impl NSEventSubtype {
#[doc(alias = "NSEventSubtypeWindowExposed")]
pub const WindowExposed: Self = Self(0);
#[doc(alias = "NSEventSubtypeApplicationActivated")]
pub const ApplicationActivated: Self = Self(1);
#[doc(alias = "NSEventSubtypeApplicationDeactivated")]
pub const ApplicationDeactivated: Self = Self(2);
#[doc(alias = "NSEventSubtypeWindowMoved")]
pub const WindowMoved: Self = Self(4);
#[doc(alias = "NSEventSubtypeScreenChanged")]
pub const ScreenChanged: Self = Self(8);
#[doc(alias = "NSEventSubtypePowerOff")]
pub const PowerOff: Self = Self(1);
#[doc(alias = "NSEventSubtypeMouseEvent")]
pub const MouseEvent: Self = Self(0);
#[doc(alias = "NSEventSubtypeTabletPoint")]
pub const TabletPoint: Self = Self(1);
#[doc(alias = "NSEventSubtypeTabletProximity")]
pub const TabletProximity: Self = Self(2);
#[doc(alias = "NSEventSubtypeTouch")]
pub const Touch: Self = Self(3);
}
unsafe impl Encode for NSEventSubtype {
const ENCODING: Encoding = c_short::ENCODING;
}
unsafe impl RefEncode for NSEventSubtype {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static NSWindowExposedEventType: NSEventSubtype =
NSEventSubtype(NSEventSubtype::WindowExposed.0);
pub static NSApplicationActivatedEventType: NSEventSubtype =
NSEventSubtype(NSEventSubtype::ApplicationActivated.0);
pub static NSApplicationDeactivatedEventType: NSEventSubtype =
NSEventSubtype(NSEventSubtype::ApplicationDeactivated.0);
pub static NSWindowMovedEventType: NSEventSubtype = NSEventSubtype(NSEventSubtype::WindowMoved.0);
pub static NSScreenChangedEventType: NSEventSubtype =
NSEventSubtype(NSEventSubtype::ScreenChanged.0);
pub static NSAWTEventType: NSEventSubtype = NSEventSubtype(16);
pub static NSPowerOffEventType: NSEventSubtype = NSEventSubtype(NSEventSubtype::PowerOff.0);
pub static NSMouseEventSubtype: NSEventSubtype = NSEventSubtype(NSEventSubtype::MouseEvent.0);
pub static NSTabletPointEventSubtype: NSEventSubtype =
NSEventSubtype(NSEventSubtype::TabletPoint.0);
pub static NSTabletProximityEventSubtype: NSEventSubtype =
NSEventSubtype(NSEventSubtype::TabletProximity.0);
pub static NSTouchEventSubtype: NSEventSubtype = NSEventSubtype(NSEventSubtype::Touch.0);
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPressureBehavior(pub NSInteger);
impl NSPressureBehavior {
#[doc(alias = "NSPressureBehaviorUnknown")]
pub const Unknown: Self = Self(-1);
#[doc(alias = "NSPressureBehaviorPrimaryDefault")]
pub const PrimaryDefault: Self = Self(0);
#[doc(alias = "NSPressureBehaviorPrimaryClick")]
pub const PrimaryClick: Self = Self(1);
#[doc(alias = "NSPressureBehaviorPrimaryGeneric")]
pub const PrimaryGeneric: Self = Self(2);
#[doc(alias = "NSPressureBehaviorPrimaryAccelerator")]
pub const PrimaryAccelerator: Self = Self(3);
#[doc(alias = "NSPressureBehaviorPrimaryDeepClick")]
pub const PrimaryDeepClick: Self = Self(5);
#[doc(alias = "NSPressureBehaviorPrimaryDeepDrag")]
pub const PrimaryDeepDrag: Self = Self(6);
}
unsafe impl Encode for NSPressureBehavior {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSPressureBehavior {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSEvent;
unsafe impl ClassType for NSEvent {
type Super = NSObject;
type Mutability = Immutable;
}
);
unsafe impl NSCoding for NSEvent {}
unsafe impl NSCopying for NSEvent {}
unsafe impl NSObjectProtocol for NSEvent {}
extern_methods!(
unsafe impl NSEvent {
#[method(type)]
pub unsafe fn r#type(&self) -> NSEventType;
#[method(modifierFlags)]
pub unsafe fn modifierFlags(&self) -> NSEventModifierFlags;
#[method(timestamp)]
pub unsafe fn timestamp(&self) -> NSTimeInterval;
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[method_id(@__retain_semantics Other window)]
pub unsafe fn window(&self, mtm: MainThreadMarker) -> Option<Retained<NSWindow>>;
#[method(windowNumber)]
pub unsafe fn windowNumber(&self) -> NSInteger;
#[cfg(feature = "NSGraphicsContext")]
#[deprecated = "This method always returns nil. If you need access to the current drawing context, use [NSGraphicsContext currentContext] inside of a draw operation."]
#[method_id(@__retain_semantics Other context)]
pub unsafe fn context(&self) -> Option<Retained<NSGraphicsContext>>;
#[method(clickCount)]
pub unsafe fn clickCount(&self) -> NSInteger;
#[method(buttonNumber)]
pub unsafe fn buttonNumber(&self) -> NSInteger;
#[method(eventNumber)]
pub unsafe fn eventNumber(&self) -> NSInteger;
#[method(pressure)]
pub unsafe fn pressure(&self) -> c_float;
#[method(locationInWindow)]
pub unsafe fn locationInWindow(&self) -> NSPoint;
#[method(deltaX)]
pub unsafe fn deltaX(&self) -> CGFloat;
#[method(deltaY)]
pub unsafe fn deltaY(&self) -> CGFloat;
#[method(deltaZ)]
pub unsafe fn deltaZ(&self) -> CGFloat;
#[method(hasPreciseScrollingDeltas)]
pub unsafe fn hasPreciseScrollingDeltas(&self) -> bool;
#[method(scrollingDeltaX)]
pub unsafe fn scrollingDeltaX(&self) -> CGFloat;
#[method(scrollingDeltaY)]
pub unsafe fn scrollingDeltaY(&self) -> CGFloat;
#[method(momentumPhase)]
pub unsafe fn momentumPhase(&self) -> NSEventPhase;
#[method(isDirectionInvertedFromDevice)]
pub unsafe fn isDirectionInvertedFromDevice(&self) -> bool;
#[method_id(@__retain_semantics Other characters)]
pub unsafe fn characters(&self) -> Option<Retained<NSString>>;
#[method_id(@__retain_semantics Other charactersIgnoringModifiers)]
pub unsafe fn charactersIgnoringModifiers(&self) -> Option<Retained<NSString>>;
#[method_id(@__retain_semantics Other charactersByApplyingModifiers:)]
pub unsafe fn charactersByApplyingModifiers(
&self,
modifiers: NSEventModifierFlags,
) -> Option<Retained<NSString>>;
#[method(isARepeat)]
pub unsafe fn isARepeat(&self) -> bool;
#[method(keyCode)]
pub unsafe fn keyCode(&self) -> c_ushort;
#[method(trackingNumber)]
pub unsafe fn trackingNumber(&self) -> NSInteger;
#[method(userData)]
pub unsafe fn userData(&self) -> *mut c_void;
#[cfg(feature = "NSTrackingArea")]
#[method_id(@__retain_semantics Other trackingArea)]
pub unsafe fn trackingArea(&self) -> Option<Retained<NSTrackingArea>>;
#[method(subtype)]
pub unsafe fn subtype(&self) -> NSEventSubtype;
#[method(data1)]
pub unsafe fn data1(&self) -> NSInteger;
#[method(data2)]
pub unsafe fn data2(&self) -> NSInteger;
#[method(eventRef)]
pub unsafe fn eventRef(&self) -> *mut c_void;
#[method_id(@__retain_semantics Other eventWithEventRef:)]
pub unsafe fn eventWithEventRef(event_ref: NonNull<c_void>) -> Option<Retained<NSEvent>>;
#[method(isMouseCoalescingEnabled)]
pub unsafe fn isMouseCoalescingEnabled() -> bool;
#[method(setMouseCoalescingEnabled:)]
pub unsafe fn setMouseCoalescingEnabled(mouse_coalescing_enabled: bool);
#[method(magnification)]
pub unsafe fn magnification(&self) -> CGFloat;
#[method(deviceID)]
pub unsafe fn deviceID(&self) -> NSUInteger;
#[method(rotation)]
pub unsafe fn rotation(&self) -> c_float;
#[method(absoluteX)]
pub unsafe fn absoluteX(&self) -> NSInteger;
#[method(absoluteY)]
pub unsafe fn absoluteY(&self) -> NSInteger;
#[method(absoluteZ)]
pub unsafe fn absoluteZ(&self) -> NSInteger;
#[method(buttonMask)]
pub unsafe fn buttonMask(&self) -> NSEventButtonMask;
#[method(tilt)]
pub unsafe fn tilt(&self) -> NSPoint;
#[method(tangentialPressure)]
pub unsafe fn tangentialPressure(&self) -> c_float;
#[method_id(@__retain_semantics Other vendorDefined)]
pub unsafe fn vendorDefined(&self) -> Retained<AnyObject>;
#[method(vendorID)]
pub unsafe fn vendorID(&self) -> NSUInteger;
#[method(tabletID)]
pub unsafe fn tabletID(&self) -> NSUInteger;
#[method(pointingDeviceID)]
pub unsafe fn pointingDeviceID(&self) -> NSUInteger;
#[method(systemTabletID)]
pub unsafe fn systemTabletID(&self) -> NSUInteger;
#[method(vendorPointingDeviceType)]
pub unsafe fn vendorPointingDeviceType(&self) -> NSUInteger;
#[method(pointingDeviceSerialNumber)]
pub unsafe fn pointingDeviceSerialNumber(&self) -> NSUInteger;
#[method(uniqueID)]
pub unsafe fn uniqueID(&self) -> c_ulonglong;
#[method(capabilityMask)]
pub unsafe fn capabilityMask(&self) -> NSUInteger;
#[method(pointingDeviceType)]
pub unsafe fn pointingDeviceType(&self) -> NSPointingDeviceType;
#[method(isEnteringProximity)]
pub unsafe fn isEnteringProximity(&self) -> bool;
#[cfg(all(feature = "NSResponder", feature = "NSTouch", feature = "NSView"))]
#[method_id(@__retain_semantics Other touchesMatchingPhase:inView:)]
pub unsafe fn touchesMatchingPhase_inView(
&self,
phase: NSTouchPhase,
view: Option<&NSView>,
) -> Retained<NSSet<NSTouch>>;
#[cfg(feature = "NSTouch")]
#[method_id(@__retain_semantics Other allTouches)]
pub unsafe fn allTouches(&self) -> Retained<NSSet<NSTouch>>;
#[cfg(all(feature = "NSResponder", feature = "NSTouch", feature = "NSView"))]
#[method_id(@__retain_semantics Other touchesForView:)]
pub unsafe fn touchesForView(&self, view: &NSView) -> Retained<NSSet<NSTouch>>;
#[cfg(feature = "NSTouch")]
#[method_id(@__retain_semantics Other coalescedTouchesForTouch:)]
pub unsafe fn coalescedTouchesForTouch(
&self,
touch: &NSTouch,
) -> Retained<NSArray<NSTouch>>;
#[method(phase)]
pub unsafe fn phase(&self) -> NSEventPhase;
#[method(stage)]
pub unsafe fn stage(&self) -> NSInteger;
#[method(stageTransition)]
pub unsafe fn stageTransition(&self) -> CGFloat;
#[method(associatedEventsMask)]
pub unsafe fn associatedEventsMask(&self) -> NSEventMask;
#[method(pressureBehavior)]
pub unsafe fn pressureBehavior(&self) -> NSPressureBehavior;
#[method(isSwipeTrackingFromScrollEventsEnabled)]
pub unsafe fn isSwipeTrackingFromScrollEventsEnabled() -> bool;
#[cfg(feature = "block2")]
#[method(trackSwipeEventWithOptions:dampenAmountThresholdMin:max:usingHandler:)]
pub unsafe fn trackSwipeEventWithOptions_dampenAmountThresholdMin_max_usingHandler(
&self,
options: NSEventSwipeTrackingOptions,
min_dampen_threshold: CGFloat,
max_dampen_threshold: CGFloat,
tracking_handler: &block2::Block<dyn Fn(CGFloat, NSEventPhase, Bool, NonNull<Bool>)>,
);
#[method(startPeriodicEventsAfterDelay:withPeriod:)]
pub unsafe fn startPeriodicEventsAfterDelay_withPeriod(
delay: NSTimeInterval,
period: NSTimeInterval,
);
#[method(stopPeriodicEvents)]
pub unsafe fn stopPeriodicEvents();
#[cfg(feature = "NSGraphicsContext")]
#[method_id(@__retain_semantics Other mouseEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:clickCount:pressure:)]
pub unsafe fn mouseEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_clickCount_pressure(
r#type: NSEventType,
location: NSPoint,
flags: NSEventModifierFlags,
time: NSTimeInterval,
w_num: NSInteger,
unused_pass_nil: Option<&NSGraphicsContext>,
e_num: NSInteger,
c_num: NSInteger,
pressure: c_float,
) -> Option<Retained<NSEvent>>;
#[cfg(feature = "NSGraphicsContext")]
#[method_id(@__retain_semantics Other keyEventWithType:location:modifierFlags:timestamp:windowNumber:context:characters:charactersIgnoringModifiers:isARepeat:keyCode:)]
pub unsafe fn keyEventWithType_location_modifierFlags_timestamp_windowNumber_context_characters_charactersIgnoringModifiers_isARepeat_keyCode(
r#type: NSEventType,
location: NSPoint,
flags: NSEventModifierFlags,
time: NSTimeInterval,
w_num: NSInteger,
unused_pass_nil: Option<&NSGraphicsContext>,
keys: &NSString,
ukeys: &NSString,
flag: bool,
code: c_ushort,
) -> Option<Retained<NSEvent>>;
#[cfg(feature = "NSGraphicsContext")]
#[method_id(@__retain_semantics Other enterExitEventWithType:location:modifierFlags:timestamp:windowNumber:context:eventNumber:trackingNumber:userData:)]
pub unsafe fn enterExitEventWithType_location_modifierFlags_timestamp_windowNumber_context_eventNumber_trackingNumber_userData(
r#type: NSEventType,
location: NSPoint,
flags: NSEventModifierFlags,
time: NSTimeInterval,
w_num: NSInteger,
unused_pass_nil: Option<&NSGraphicsContext>,
e_num: NSInteger,
t_num: NSInteger,
data: *mut c_void,
) -> Option<Retained<NSEvent>>;
#[cfg(feature = "NSGraphicsContext")]
#[method_id(@__retain_semantics Other otherEventWithType:location:modifierFlags:timestamp:windowNumber:context:subtype:data1:data2:)]
pub unsafe fn otherEventWithType_location_modifierFlags_timestamp_windowNumber_context_subtype_data1_data2(
r#type: NSEventType,
location: NSPoint,
flags: NSEventModifierFlags,
time: NSTimeInterval,
w_num: NSInteger,
unused_pass_nil: Option<&NSGraphicsContext>,
subtype: c_short,
d1: NSInteger,
d2: NSInteger,
) -> Option<Retained<NSEvent>>;
#[method(mouseLocation)]
pub unsafe fn mouseLocation() -> NSPoint;
#[method(modifierFlags)]
pub unsafe fn modifierFlags_class() -> NSEventModifierFlags;
#[method(pressedMouseButtons)]
pub unsafe fn pressedMouseButtons() -> NSUInteger;
#[method(doubleClickInterval)]
pub unsafe fn doubleClickInterval() -> NSTimeInterval;
#[method(keyRepeatDelay)]
pub unsafe fn keyRepeatDelay() -> NSTimeInterval;
#[method(keyRepeatInterval)]
pub unsafe fn keyRepeatInterval() -> NSTimeInterval;
#[cfg(feature = "block2")]
#[method_id(@__retain_semantics Other addGlobalMonitorForEventsMatchingMask:handler:)]
pub unsafe fn addGlobalMonitorForEventsMatchingMask_handler(
mask: NSEventMask,
block: &block2::Block<dyn Fn(NonNull<NSEvent>)>,
) -> Option<Retained<AnyObject>>;
#[cfg(feature = "block2")]
#[method_id(@__retain_semantics Other addLocalMonitorForEventsMatchingMask:handler:)]
pub unsafe fn addLocalMonitorForEventsMatchingMask_handler(
mask: NSEventMask,
block: &block2::Block<dyn Fn(NonNull<NSEvent>) -> *mut NSEvent>,
) -> Option<Retained<AnyObject>>;
#[method(removeMonitor:)]
pub unsafe fn removeMonitor(event_monitor: &AnyObject);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSEvent {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
pub const NSUpArrowFunctionKey: c_uint = 0xF700;
pub const NSDownArrowFunctionKey: c_uint = 0xF701;
pub const NSLeftArrowFunctionKey: c_uint = 0xF702;
pub const NSRightArrowFunctionKey: c_uint = 0xF703;
pub const NSF1FunctionKey: c_uint = 0xF704;
pub const NSF2FunctionKey: c_uint = 0xF705;
pub const NSF3FunctionKey: c_uint = 0xF706;
pub const NSF4FunctionKey: c_uint = 0xF707;
pub const NSF5FunctionKey: c_uint = 0xF708;
pub const NSF6FunctionKey: c_uint = 0xF709;
pub const NSF7FunctionKey: c_uint = 0xF70A;
pub const NSF8FunctionKey: c_uint = 0xF70B;
pub const NSF9FunctionKey: c_uint = 0xF70C;
pub const NSF10FunctionKey: c_uint = 0xF70D;
pub const NSF11FunctionKey: c_uint = 0xF70E;
pub const NSF12FunctionKey: c_uint = 0xF70F;
pub const NSF13FunctionKey: c_uint = 0xF710;
pub const NSF14FunctionKey: c_uint = 0xF711;
pub const NSF15FunctionKey: c_uint = 0xF712;
pub const NSF16FunctionKey: c_uint = 0xF713;
pub const NSF17FunctionKey: c_uint = 0xF714;
pub const NSF18FunctionKey: c_uint = 0xF715;
pub const NSF19FunctionKey: c_uint = 0xF716;
pub const NSF20FunctionKey: c_uint = 0xF717;
pub const NSF21FunctionKey: c_uint = 0xF718;
pub const NSF22FunctionKey: c_uint = 0xF719;
pub const NSF23FunctionKey: c_uint = 0xF71A;
pub const NSF24FunctionKey: c_uint = 0xF71B;
pub const NSF25FunctionKey: c_uint = 0xF71C;
pub const NSF26FunctionKey: c_uint = 0xF71D;
pub const NSF27FunctionKey: c_uint = 0xF71E;
pub const NSF28FunctionKey: c_uint = 0xF71F;
pub const NSF29FunctionKey: c_uint = 0xF720;
pub const NSF30FunctionKey: c_uint = 0xF721;
pub const NSF31FunctionKey: c_uint = 0xF722;
pub const NSF32FunctionKey: c_uint = 0xF723;
pub const NSF33FunctionKey: c_uint = 0xF724;
pub const NSF34FunctionKey: c_uint = 0xF725;
pub const NSF35FunctionKey: c_uint = 0xF726;
pub const NSInsertFunctionKey: c_uint = 0xF727;
pub const NSDeleteFunctionKey: c_uint = 0xF728;
pub const NSHomeFunctionKey: c_uint = 0xF729;
pub const NSBeginFunctionKey: c_uint = 0xF72A;
pub const NSEndFunctionKey: c_uint = 0xF72B;
pub const NSPageUpFunctionKey: c_uint = 0xF72C;
pub const NSPageDownFunctionKey: c_uint = 0xF72D;
pub const NSPrintScreenFunctionKey: c_uint = 0xF72E;
pub const NSScrollLockFunctionKey: c_uint = 0xF72F;
pub const NSPauseFunctionKey: c_uint = 0xF730;
pub const NSSysReqFunctionKey: c_uint = 0xF731;
pub const NSBreakFunctionKey: c_uint = 0xF732;
pub const NSResetFunctionKey: c_uint = 0xF733;
pub const NSStopFunctionKey: c_uint = 0xF734;
pub const NSMenuFunctionKey: c_uint = 0xF735;
pub const NSUserFunctionKey: c_uint = 0xF736;
pub const NSSystemFunctionKey: c_uint = 0xF737;
pub const NSPrintFunctionKey: c_uint = 0xF738;
pub const NSClearLineFunctionKey: c_uint = 0xF739;
pub const NSClearDisplayFunctionKey: c_uint = 0xF73A;
pub const NSInsertLineFunctionKey: c_uint = 0xF73B;
pub const NSDeleteLineFunctionKey: c_uint = 0xF73C;
pub const NSInsertCharFunctionKey: c_uint = 0xF73D;
pub const NSDeleteCharFunctionKey: c_uint = 0xF73E;
pub const NSPrevFunctionKey: c_uint = 0xF73F;
pub const NSNextFunctionKey: c_uint = 0xF740;
pub const NSSelectFunctionKey: c_uint = 0xF741;
pub const NSExecuteFunctionKey: c_uint = 0xF742;
pub const NSUndoFunctionKey: c_uint = 0xF743;
pub const NSRedoFunctionKey: c_uint = 0xF744;
pub const NSFindFunctionKey: c_uint = 0xF745;
pub const NSHelpFunctionKey: c_uint = 0xF746;
pub const NSModeSwitchFunctionKey: c_uint = 0xF747;

View File

@@ -0,0 +1,97 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFilePromiseProvider;
unsafe impl ClassType for NSFilePromiseProvider {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSFilePromiseProvider {}
#[cfg(feature = "NSPasteboard")]
unsafe impl NSPasteboardWriting for NSFilePromiseProvider {}
extern_methods!(
unsafe impl NSFilePromiseProvider {
#[method_id(@__retain_semantics Other fileType)]
pub unsafe fn fileType(&self) -> Retained<NSString>;
#[method(setFileType:)]
pub unsafe fn setFileType(&self, file_type: &NSString);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSFilePromiseProviderDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSFilePromiseProviderDelegate>>,
);
#[method_id(@__retain_semantics Other userInfo)]
pub unsafe fn userInfo(&self) -> Option<Retained<AnyObject>>;
#[method(setUserInfo:)]
pub unsafe fn setUserInfo(&self, user_info: Option<&AnyObject>);
#[method_id(@__retain_semantics Init initWithFileType:delegate:)]
pub unsafe fn initWithFileType_delegate(
this: Allocated<Self>,
file_type: &NSString,
delegate: &ProtocolObject<dyn NSFilePromiseProviderDelegate>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFilePromiseProvider {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_protocol!(
pub unsafe trait NSFilePromiseProviderDelegate: NSObjectProtocol {
#[method_id(@__retain_semantics Other filePromiseProvider:fileNameForType:)]
unsafe fn filePromiseProvider_fileNameForType(
&self,
file_promise_provider: &NSFilePromiseProvider,
file_type: &NSString,
mtm: MainThreadMarker,
) -> Retained<NSString>;
#[cfg(feature = "block2")]
#[method(filePromiseProvider:writePromiseToURL:completionHandler:)]
unsafe fn filePromiseProvider_writePromiseToURL_completionHandler(
&self,
file_promise_provider: &NSFilePromiseProvider,
url: &NSURL,
completion_handler: &block2::Block<dyn Fn(*mut NSError)>,
);
#[optional]
#[method_id(@__retain_semantics Other operationQueueForFilePromiseProvider:)]
unsafe fn operationQueueForFilePromiseProvider(
&self,
file_promise_provider: &NSFilePromiseProvider,
mtm: MainThreadMarker,
) -> Retained<NSOperationQueue>;
}
unsafe impl ProtocolType for dyn NSFilePromiseProviderDelegate {}
);

View File

@@ -0,0 +1,55 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFilePromiseReceiver;
unsafe impl ClassType for NSFilePromiseReceiver {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSFilePromiseReceiver {}
#[cfg(feature = "NSPasteboard")]
unsafe impl NSPasteboardReading for NSFilePromiseReceiver {}
extern_methods!(
unsafe impl NSFilePromiseReceiver {
#[method_id(@__retain_semantics Other readableDraggedTypes)]
pub unsafe fn readableDraggedTypes() -> Retained<NSArray<NSString>>;
#[method_id(@__retain_semantics Other fileTypes)]
pub unsafe fn fileTypes(&self) -> Retained<NSArray<NSString>>;
#[method_id(@__retain_semantics Other fileNames)]
pub unsafe fn fileNames(&self) -> Retained<NSArray<NSString>>;
#[cfg(feature = "block2")]
#[method(receivePromisedFilesAtDestination:options:operationQueue:reader:)]
pub unsafe fn receivePromisedFilesAtDestination_options_operationQueue_reader(
&self,
destination_dir: &NSURL,
options: &NSDictionary,
operation_queue: &NSOperationQueue,
reader: &block2::Block<dyn Fn(NonNull<NSURL>, *mut NSError)>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFilePromiseReceiver {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,22 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_category!(
/// Category "NSExtensions" on [`NSFileWrapper`].
#[doc(alias = "NSExtensions")]
pub unsafe trait NSFileWrapperNSExtensions {
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Other icon)]
unsafe fn icon(&self) -> Option<Retained<NSImage>>;
#[cfg(feature = "NSImage")]
#[method(setIcon:)]
unsafe fn setIcon(&self, icon: Option<&NSImage>);
}
unsafe impl NSFileWrapperNSExtensions for NSFileWrapper {}
);

View File

@@ -0,0 +1,358 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern "C" {
pub static NSFontIdentityMatrix: NonNull<CGFloat>;
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFont;
unsafe impl ClassType for NSFont {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSFont {}
unsafe impl NSCopying for NSFont {}
unsafe impl NSObjectProtocol for NSFont {}
unsafe impl NSSecureCoding for NSFont {}
extern_methods!(
unsafe impl NSFont {
#[method_id(@__retain_semantics Other fontWithName:size:)]
pub unsafe fn fontWithName_size(
font_name: &NSString,
font_size: CGFloat,
) -> Option<Retained<NSFont>>;
#[method_id(@__retain_semantics Other fontWithName:matrix:)]
pub unsafe fn fontWithName_matrix(
font_name: &NSString,
font_matrix: NonNull<CGFloat>,
) -> Option<Retained<NSFont>>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other fontWithDescriptor:size:)]
pub unsafe fn fontWithDescriptor_size(
font_descriptor: &NSFontDescriptor,
font_size: CGFloat,
) -> Option<Retained<NSFont>>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other fontWithDescriptor:textTransform:)]
pub unsafe fn fontWithDescriptor_textTransform(
font_descriptor: &NSFontDescriptor,
text_transform: Option<&NSAffineTransform>,
) -> Option<Retained<NSFont>>;
#[method_id(@__retain_semantics Other userFontOfSize:)]
pub unsafe fn userFontOfSize(font_size: CGFloat) -> Option<Retained<NSFont>>;
#[method_id(@__retain_semantics Other userFixedPitchFontOfSize:)]
pub unsafe fn userFixedPitchFontOfSize(font_size: CGFloat) -> Option<Retained<NSFont>>;
#[method(setUserFont:)]
pub unsafe fn setUserFont(font: Option<&NSFont>);
#[method(setUserFixedPitchFont:)]
pub unsafe fn setUserFixedPitchFont(font: Option<&NSFont>);
#[method_id(@__retain_semantics Other systemFontOfSize:)]
pub unsafe fn systemFontOfSize(font_size: CGFloat) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other boldSystemFontOfSize:)]
pub unsafe fn boldSystemFontOfSize(font_size: CGFloat) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other labelFontOfSize:)]
pub unsafe fn labelFontOfSize(font_size: CGFloat) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other titleBarFontOfSize:)]
pub unsafe fn titleBarFontOfSize(font_size: CGFloat) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other menuFontOfSize:)]
pub unsafe fn menuFontOfSize(font_size: CGFloat) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other menuBarFontOfSize:)]
pub unsafe fn menuBarFontOfSize(font_size: CGFloat) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other messageFontOfSize:)]
pub unsafe fn messageFontOfSize(font_size: CGFloat) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other paletteFontOfSize:)]
pub unsafe fn paletteFontOfSize(font_size: CGFloat) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other toolTipsFontOfSize:)]
pub unsafe fn toolTipsFontOfSize(font_size: CGFloat) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other controlContentFontOfSize:)]
pub unsafe fn controlContentFontOfSize(font_size: CGFloat) -> Retained<NSFont>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other systemFontOfSize:weight:)]
pub unsafe fn systemFontOfSize_weight(
font_size: CGFloat,
weight: NSFontWeight,
) -> Retained<NSFont>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other monospacedDigitSystemFontOfSize:weight:)]
pub unsafe fn monospacedDigitSystemFontOfSize_weight(
font_size: CGFloat,
weight: NSFontWeight,
) -> Retained<NSFont>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other systemFontOfSize:weight:width:)]
pub unsafe fn systemFontOfSize_weight_width(
font_size: CGFloat,
weight: NSFontWeight,
width: NSFontWidth,
) -> Retained<NSFont>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other monospacedSystemFontOfSize:weight:)]
pub unsafe fn monospacedSystemFontOfSize_weight(
font_size: CGFloat,
weight: NSFontWeight,
) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other fontWithSize:)]
pub unsafe fn fontWithSize(&self, font_size: CGFloat) -> Retained<NSFont>;
#[method(systemFontSize)]
pub unsafe fn systemFontSize() -> CGFloat;
#[method(smallSystemFontSize)]
pub unsafe fn smallSystemFontSize() -> CGFloat;
#[method(labelFontSize)]
pub unsafe fn labelFontSize() -> CGFloat;
#[cfg(feature = "NSCell")]
#[method(systemFontSizeForControlSize:)]
pub unsafe fn systemFontSizeForControlSize(control_size: NSControlSize) -> CGFloat;
#[method_id(@__retain_semantics Other fontName)]
pub unsafe fn fontName(&self) -> Retained<NSString>;
#[method(pointSize)]
pub unsafe fn pointSize(&self) -> CGFloat;
#[method(matrix)]
pub unsafe fn matrix(&self) -> NonNull<CGFloat>;
#[method_id(@__retain_semantics Other familyName)]
pub unsafe fn familyName(&self) -> Option<Retained<NSString>>;
#[method_id(@__retain_semantics Other displayName)]
pub unsafe fn displayName(&self) -> Option<Retained<NSString>>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other fontDescriptor)]
pub unsafe fn fontDescriptor(&self) -> Retained<NSFontDescriptor>;
#[method_id(@__retain_semantics Other textTransform)]
pub unsafe fn textTransform(&self) -> Retained<NSAffineTransform>;
#[method(numberOfGlyphs)]
pub unsafe fn numberOfGlyphs(&self) -> NSUInteger;
#[method(mostCompatibleStringEncoding)]
pub unsafe fn mostCompatibleStringEncoding(&self) -> NSStringEncoding;
#[method_id(@__retain_semantics Other coveredCharacterSet)]
pub unsafe fn coveredCharacterSet(&self) -> Retained<NSCharacterSet>;
#[method(boundingRectForFont)]
pub unsafe fn boundingRectForFont(&self) -> NSRect;
#[method(maximumAdvancement)]
pub unsafe fn maximumAdvancement(&self) -> NSSize;
#[method(ascender)]
pub unsafe fn ascender(&self) -> CGFloat;
#[method(descender)]
pub unsafe fn descender(&self) -> CGFloat;
#[method(leading)]
pub unsafe fn leading(&self) -> CGFloat;
#[method(underlinePosition)]
pub unsafe fn underlinePosition(&self) -> CGFloat;
#[method(underlineThickness)]
pub unsafe fn underlineThickness(&self) -> CGFloat;
#[method(italicAngle)]
pub unsafe fn italicAngle(&self) -> CGFloat;
#[method(capHeight)]
pub unsafe fn capHeight(&self) -> CGFloat;
#[method(xHeight)]
pub unsafe fn xHeight(&self) -> CGFloat;
#[method(isFixedPitch)]
pub unsafe fn isFixedPitch(&self) -> bool;
#[method(set)]
pub unsafe fn set(&self);
#[cfg(feature = "NSGraphicsContext")]
#[method(setInContext:)]
pub unsafe fn setInContext(&self, graphics_context: &NSGraphicsContext);
#[method_id(@__retain_semantics Other verticalFont)]
pub unsafe fn verticalFont(&self) -> Retained<NSFont>;
#[method(isVertical)]
pub unsafe fn isVertical(&self) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFont {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern "C" {
pub static NSAntialiasThresholdChangedNotification: &'static NSNotificationName;
}
extern "C" {
pub static NSFontSetChangedNotification: &'static NSNotificationName;
}
pub type NSGlyph = c_uint;
pub const NSControlGlyph: c_uint = 0x00FFFFFF;
pub const NSNullGlyph: c_uint = 0x0;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontRenderingMode(pub NSUInteger);
impl NSFontRenderingMode {
pub const NSFontDefaultRenderingMode: Self = Self(0);
pub const NSFontAntialiasedRenderingMode: Self = Self(1);
pub const NSFontIntegerAdvancementsRenderingMode: Self = Self(2);
pub const NSFontAntialiasedIntegerAdvancementsRenderingMode: Self = Self(3);
}
unsafe impl Encode for NSFontRenderingMode {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFontRenderingMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[deprecated]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSMultibyteGlyphPacking(pub NSUInteger);
impl NSMultibyteGlyphPacking {
#[deprecated]
pub const NSNativeShortGlyphPacking: Self = Self(5);
}
unsafe impl Encode for NSMultibyteGlyphPacking {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSMultibyteGlyphPacking {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
#[deprecated]
pub fn NSConvertGlyphsToPackedGlyphs(
gl_buf: NonNull<NSGlyph>,
count: NSInteger,
packing: NSMultibyteGlyphPacking,
packed_glyphs: NonNull<c_char>,
) -> NSInteger;
}
extern_methods!(
/// NSFont_Deprecated
unsafe impl NSFont {
#[method(glyphWithName:)]
pub unsafe fn glyphWithName(&self, name: &NSString) -> NSGlyph;
#[method(boundingRectForGlyph:)]
pub unsafe fn boundingRectForGlyph(&self, glyph: NSGlyph) -> NSRect;
#[method(advancementForGlyph:)]
pub unsafe fn advancementForGlyph(&self, glyph: NSGlyph) -> NSSize;
#[method(getBoundingRects:forGlyphs:count:)]
pub unsafe fn getBoundingRects_forGlyphs_count(
&self,
bounds: NSRectArray,
glyphs: NonNull<NSGlyph>,
glyph_count: NSUInteger,
);
#[method(getAdvancements:forGlyphs:count:)]
pub unsafe fn getAdvancements_forGlyphs_count(
&self,
advancements: NSSizeArray,
glyphs: NonNull<NSGlyph>,
glyph_count: NSUInteger,
);
#[method(getAdvancements:forPackedGlyphs:length:)]
pub unsafe fn getAdvancements_forPackedGlyphs_length(
&self,
advancements: NSSizeArray,
packed_glyphs: NonNull<c_void>,
length: NSUInteger,
);
#[method_id(@__retain_semantics Other printerFont)]
pub unsafe fn printerFont(&self) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other screenFont)]
pub unsafe fn screenFont(&self) -> Retained<NSFont>;
#[method_id(@__retain_semantics Other screenFontWithRenderingMode:)]
pub unsafe fn screenFontWithRenderingMode(
&self,
rendering_mode: NSFontRenderingMode,
) -> Retained<NSFont>;
#[method(renderingMode)]
pub unsafe fn renderingMode(&self) -> NSFontRenderingMode;
}
);
extern_methods!(
/// NSFont_TextStyles
unsafe impl NSFont {
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other preferredFontForTextStyle:options:)]
pub unsafe fn preferredFontForTextStyle_options(
style: &NSFontTextStyle,
options: &NSDictionary<NSFontTextStyleOptionKey, AnyObject>,
) -> Retained<NSFont>;
}
);

View File

@@ -0,0 +1,75 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontAssetRequestOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSFontAssetRequestOptions: NSUInteger {
const NSFontAssetRequestOptionUsesStandardUI = 1<<0;
}
}
unsafe impl Encode for NSFontAssetRequestOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFontAssetRequestOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFontAssetRequest;
unsafe impl ClassType for NSFontAssetRequest {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSFontAssetRequest {}
unsafe impl NSProgressReporting for NSFontAssetRequest {}
extern_methods!(
unsafe impl NSFontAssetRequest {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Init initWithFontDescriptors:options:)]
pub unsafe fn initWithFontDescriptors_options(
this: Allocated<Self>,
font_descriptors: &NSArray<NSFontDescriptor>,
options: NSFontAssetRequestOptions,
) -> Retained<Self>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other downloadedFontDescriptors)]
pub unsafe fn downloadedFontDescriptors(&self) -> Retained<NSArray<NSFontDescriptor>>;
#[method_id(@__retain_semantics Other progress)]
pub unsafe fn progress(&self) -> Retained<NSProgress>;
#[cfg(feature = "block2")]
#[method(downloadFontAssetsWithCompletionHandler:)]
pub unsafe fn downloadFontAssetsWithCompletionHandler(
&self,
completion_handler: &block2::Block<dyn Fn(*mut NSError) -> Bool>,
);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFontAssetRequest {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,308 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontCollectionVisibility(pub NSUInteger);
bitflags::bitflags! {
impl NSFontCollectionVisibility: NSUInteger {
#[doc(alias = "NSFontCollectionVisibilityProcess")]
const Process = 1<<0;
#[doc(alias = "NSFontCollectionVisibilityUser")]
const User = 1<<1;
#[doc(alias = "NSFontCollectionVisibilityComputer")]
const Computer = 1<<2;
}
}
unsafe impl Encode for NSFontCollectionVisibility {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFontCollectionVisibility {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_TYPED_ENUM
pub type NSFontCollectionMatchingOptionKey = NSString;
extern "C" {
pub static NSFontCollectionIncludeDisabledFontsOption:
&'static NSFontCollectionMatchingOptionKey;
}
extern "C" {
pub static NSFontCollectionRemoveDuplicatesOption: &'static NSFontCollectionMatchingOptionKey;
}
extern "C" {
pub static NSFontCollectionDisallowAutoActivationOption:
&'static NSFontCollectionMatchingOptionKey;
}
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSFontCollectionName = NSString;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFontCollection;
unsafe impl ClassType for NSFontCollection {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSFontCollection {}
unsafe impl NSCopying for NSFontCollection {}
unsafe impl NSMutableCopying for NSFontCollection {}
unsafe impl NSObjectProtocol for NSFontCollection {}
extern_methods!(
unsafe impl NSFontCollection {
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other fontCollectionWithDescriptors:)]
pub unsafe fn fontCollectionWithDescriptors(
query_descriptors: &NSArray<NSFontDescriptor>,
) -> Retained<NSFontCollection>;
#[method_id(@__retain_semantics Other fontCollectionWithAllAvailableDescriptors)]
pub unsafe fn fontCollectionWithAllAvailableDescriptors() -> Retained<NSFontCollection>;
#[method_id(@__retain_semantics Other fontCollectionWithLocale:)]
pub unsafe fn fontCollectionWithLocale(
locale: &NSLocale,
) -> Option<Retained<NSFontCollection>>;
#[method(showFontCollection:withName:visibility:error:_)]
pub unsafe fn showFontCollection_withName_visibility_error(
collection: &NSFontCollection,
name: &NSFontCollectionName,
visibility: NSFontCollectionVisibility,
) -> Result<(), Retained<NSError>>;
#[method(hideFontCollectionWithName:visibility:error:_)]
pub unsafe fn hideFontCollectionWithName_visibility_error(
name: &NSFontCollectionName,
visibility: NSFontCollectionVisibility,
) -> Result<(), Retained<NSError>>;
#[method(renameFontCollectionWithName:visibility:toName:error:_)]
pub unsafe fn renameFontCollectionWithName_visibility_toName_error(
old_name: &NSFontCollectionName,
visibility: NSFontCollectionVisibility,
new_name: &NSFontCollectionName,
) -> Result<(), Retained<NSError>>;
#[method_id(@__retain_semantics Other allFontCollectionNames)]
pub unsafe fn allFontCollectionNames() -> Retained<NSArray<NSFontCollectionName>>;
#[method_id(@__retain_semantics Other fontCollectionWithName:)]
pub unsafe fn fontCollectionWithName(
name: &NSFontCollectionName,
) -> Option<Retained<NSFontCollection>>;
#[method_id(@__retain_semantics Other fontCollectionWithName:visibility:)]
pub unsafe fn fontCollectionWithName_visibility(
name: &NSFontCollectionName,
visibility: NSFontCollectionVisibility,
) -> Option<Retained<NSFontCollection>>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other queryDescriptors)]
pub unsafe fn queryDescriptors(&self) -> Option<Retained<NSArray<NSFontDescriptor>>>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other exclusionDescriptors)]
pub unsafe fn exclusionDescriptors(&self) -> Option<Retained<NSArray<NSFontDescriptor>>>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other matchingDescriptors)]
pub unsafe fn matchingDescriptors(&self) -> Option<Retained<NSArray<NSFontDescriptor>>>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other matchingDescriptorsWithOptions:)]
pub unsafe fn matchingDescriptorsWithOptions(
&self,
options: Option<&NSDictionary<NSFontCollectionMatchingOptionKey, NSNumber>>,
) -> Option<Retained<NSArray<NSFontDescriptor>>>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other matchingDescriptorsForFamily:)]
pub unsafe fn matchingDescriptorsForFamily(
&self,
family: &NSString,
) -> Option<Retained<NSArray<NSFontDescriptor>>>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other matchingDescriptorsForFamily:options:)]
pub unsafe fn matchingDescriptorsForFamily_options(
&self,
family: &NSString,
options: Option<&NSDictionary<NSFontCollectionMatchingOptionKey, NSNumber>>,
) -> Option<Retained<NSArray<NSFontDescriptor>>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFontCollection {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSMutableFontCollection;
unsafe impl ClassType for NSMutableFontCollection {
#[inherits(NSObject)]
type Super = NSFontCollection;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSMutableFontCollection {}
unsafe impl NSCopying for NSMutableFontCollection {}
unsafe impl NSMutableCopying for NSMutableFontCollection {}
unsafe impl NSObjectProtocol for NSMutableFontCollection {}
extern_methods!(
unsafe impl NSMutableFontCollection {
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other fontCollectionWithDescriptors:)]
pub unsafe fn fontCollectionWithDescriptors(
query_descriptors: &NSArray<NSFontDescriptor>,
) -> Retained<NSMutableFontCollection>;
#[method_id(@__retain_semantics Other fontCollectionWithAllAvailableDescriptors)]
pub unsafe fn fontCollectionWithAllAvailableDescriptors(
) -> Retained<NSMutableFontCollection>;
#[method_id(@__retain_semantics Other fontCollectionWithLocale:)]
pub unsafe fn fontCollectionWithLocale(
locale: &NSLocale,
) -> Retained<NSMutableFontCollection>;
#[method_id(@__retain_semantics Other fontCollectionWithName:)]
pub unsafe fn fontCollectionWithName(
name: &NSFontCollectionName,
) -> Option<Retained<NSMutableFontCollection>>;
#[method_id(@__retain_semantics Other fontCollectionWithName:visibility:)]
pub unsafe fn fontCollectionWithName_visibility(
name: &NSFontCollectionName,
visibility: NSFontCollectionVisibility,
) -> Option<Retained<NSMutableFontCollection>>;
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other queryDescriptors)]
pub unsafe fn queryDescriptors(&self) -> Option<Retained<NSArray<NSFontDescriptor>>>;
#[cfg(feature = "NSFontDescriptor")]
#[method(setQueryDescriptors:)]
pub unsafe fn setQueryDescriptors(
&self,
query_descriptors: Option<&NSArray<NSFontDescriptor>>,
);
#[cfg(feature = "NSFontDescriptor")]
#[method_id(@__retain_semantics Other exclusionDescriptors)]
pub unsafe fn exclusionDescriptors(&self) -> Option<Retained<NSArray<NSFontDescriptor>>>;
#[cfg(feature = "NSFontDescriptor")]
#[method(setExclusionDescriptors:)]
pub unsafe fn setExclusionDescriptors(
&self,
exclusion_descriptors: Option<&NSArray<NSFontDescriptor>>,
);
#[cfg(feature = "NSFontDescriptor")]
#[method(addQueryForDescriptors:)]
pub unsafe fn addQueryForDescriptors(&self, descriptors: &NSArray<NSFontDescriptor>);
#[cfg(feature = "NSFontDescriptor")]
#[method(removeQueryForDescriptors:)]
pub unsafe fn removeQueryForDescriptors(&self, descriptors: &NSArray<NSFontDescriptor>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSMutableFontCollection {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern "C" {
pub static NSFontCollectionDidChangeNotification: &'static NSNotificationName;
}
// NS_TYPED_ENUM
pub type NSFontCollectionUserInfoKey = NSString;
extern "C" {
pub static NSFontCollectionActionKey: &'static NSFontCollectionUserInfoKey;
}
extern "C" {
pub static NSFontCollectionNameKey: &'static NSFontCollectionUserInfoKey;
}
extern "C" {
pub static NSFontCollectionOldNameKey: &'static NSFontCollectionUserInfoKey;
}
extern "C" {
pub static NSFontCollectionVisibilityKey: &'static NSFontCollectionUserInfoKey;
}
// NS_TYPED_ENUM
pub type NSFontCollectionActionTypeKey = NSString;
extern "C" {
pub static NSFontCollectionWasShown: &'static NSFontCollectionActionTypeKey;
}
extern "C" {
pub static NSFontCollectionWasHidden: &'static NSFontCollectionActionTypeKey;
}
extern "C" {
pub static NSFontCollectionWasRenamed: &'static NSFontCollectionActionTypeKey;
}
extern "C" {
pub static NSFontCollectionAllFonts: &'static NSFontCollectionName;
}
extern "C" {
pub static NSFontCollectionUser: &'static NSFontCollectionName;
}
extern "C" {
pub static NSFontCollectionFavorites: &'static NSFontCollectionName;
}
extern "C" {
pub static NSFontCollectionRecentlyUsed: &'static NSFontCollectionName;
}

View File

@@ -0,0 +1,453 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub type NSFontSymbolicTraits = u32;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontDescriptorSymbolicTraits(pub u32);
bitflags::bitflags! {
impl NSFontDescriptorSymbolicTraits: u32 {
const NSFontDescriptorTraitItalic = 1<<0;
const NSFontDescriptorTraitBold = 1<<1;
const NSFontDescriptorTraitExpanded = 1<<5;
const NSFontDescriptorTraitCondensed = 1<<6;
const NSFontDescriptorTraitMonoSpace = 1<<10;
const NSFontDescriptorTraitVertical = 1<<11;
const NSFontDescriptorTraitUIOptimized = 1<<12;
const NSFontDescriptorTraitTightLeading = 1<<15;
const NSFontDescriptorTraitLooseLeading = 1<<16;
const NSFontDescriptorTraitEmphasized = NSFontDescriptorSymbolicTraits::NSFontDescriptorTraitBold.0;
const NSFontDescriptorClassMask = 0xF0000000;
const NSFontDescriptorClassUnknown = 0<<28;
const NSFontDescriptorClassOldStyleSerifs = 1<<28;
const NSFontDescriptorClassTransitionalSerifs = 2<<28;
const NSFontDescriptorClassModernSerifs = 3<<28;
const NSFontDescriptorClassClarendonSerifs = 4<<28;
const NSFontDescriptorClassSlabSerifs = 5<<28;
const NSFontDescriptorClassFreeformSerifs = 7<<28;
const NSFontDescriptorClassSansSerif = 8<<28;
const NSFontDescriptorClassOrnamentals = 9<<28;
const NSFontDescriptorClassScripts = 10<<28;
const NSFontDescriptorClassSymbolic = 12<<28;
}
}
unsafe impl Encode for NSFontDescriptorSymbolicTraits {
const ENCODING: Encoding = u32::ENCODING;
}
unsafe impl RefEncode for NSFontDescriptorSymbolicTraits {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSFontDescriptorAttributeName = NSString;
// NS_TYPED_ENUM
pub type NSFontDescriptorTraitKey = NSString;
// NS_TYPED_ENUM
pub type NSFontDescriptorVariationKey = NSString;
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSFontDescriptorFeatureKey = NSString;
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSFontWeight = CGFloat;
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSFontWidth = CGFloat;
// NS_TYPED_ENUM
pub type NSFontDescriptorSystemDesign = NSString;
// NS_TYPED_ENUM
pub type NSFontTextStyle = NSString;
// NS_TYPED_ENUM
pub type NSFontTextStyleOptionKey = NSString;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFontDescriptor;
unsafe impl ClassType for NSFontDescriptor {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSFontDescriptor {}
unsafe impl NSCopying for NSFontDescriptor {}
unsafe impl NSObjectProtocol for NSFontDescriptor {}
unsafe impl NSSecureCoding for NSFontDescriptor {}
extern_methods!(
unsafe impl NSFontDescriptor {
#[method_id(@__retain_semantics Other postscriptName)]
pub unsafe fn postscriptName(&self) -> Option<Retained<NSString>>;
#[method(pointSize)]
pub unsafe fn pointSize(&self) -> CGFloat;
#[method_id(@__retain_semantics Other matrix)]
pub unsafe fn matrix(&self) -> Option<Retained<NSAffineTransform>>;
#[method(symbolicTraits)]
pub unsafe fn symbolicTraits(&self) -> NSFontDescriptorSymbolicTraits;
#[method(requiresFontAssetRequest)]
pub unsafe fn requiresFontAssetRequest(&self) -> bool;
#[method_id(@__retain_semantics Other objectForKey:)]
pub unsafe fn objectForKey(
&self,
attribute: &NSFontDescriptorAttributeName,
) -> Option<Retained<AnyObject>>;
#[method_id(@__retain_semantics Other fontAttributes)]
pub unsafe fn fontAttributes(
&self,
) -> Retained<NSDictionary<NSFontDescriptorAttributeName, AnyObject>>;
#[method_id(@__retain_semantics Other fontDescriptorWithFontAttributes:)]
pub unsafe fn fontDescriptorWithFontAttributes(
attributes: Option<&NSDictionary<NSFontDescriptorAttributeName, AnyObject>>,
) -> Retained<NSFontDescriptor>;
#[method_id(@__retain_semantics Other fontDescriptorWithName:size:)]
pub unsafe fn fontDescriptorWithName_size(
font_name: &NSString,
size: CGFloat,
) -> Retained<NSFontDescriptor>;
#[method_id(@__retain_semantics Other fontDescriptorWithName:matrix:)]
pub unsafe fn fontDescriptorWithName_matrix(
font_name: &NSString,
matrix: &NSAffineTransform,
) -> Retained<NSFontDescriptor>;
#[method_id(@__retain_semantics Init initWithFontAttributes:)]
pub unsafe fn initWithFontAttributes(
this: Allocated<Self>,
attributes: Option<&NSDictionary<NSFontDescriptorAttributeName, AnyObject>>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Other matchingFontDescriptorsWithMandatoryKeys:)]
pub unsafe fn matchingFontDescriptorsWithMandatoryKeys(
&self,
mandatory_keys: Option<&NSSet<NSFontDescriptorAttributeName>>,
) -> Retained<NSArray<NSFontDescriptor>>;
#[method_id(@__retain_semantics Other matchingFontDescriptorWithMandatoryKeys:)]
pub unsafe fn matchingFontDescriptorWithMandatoryKeys(
&self,
mandatory_keys: Option<&NSSet<NSFontDescriptorAttributeName>>,
) -> Option<Retained<NSFontDescriptor>>;
#[method_id(@__retain_semantics Other fontDescriptorByAddingAttributes:)]
pub unsafe fn fontDescriptorByAddingAttributes(
&self,
attributes: &NSDictionary<NSFontDescriptorAttributeName, AnyObject>,
) -> Retained<NSFontDescriptor>;
#[method_id(@__retain_semantics Other fontDescriptorWithSymbolicTraits:)]
pub unsafe fn fontDescriptorWithSymbolicTraits(
&self,
symbolic_traits: NSFontDescriptorSymbolicTraits,
) -> Retained<NSFontDescriptor>;
#[method_id(@__retain_semantics Other fontDescriptorWithSize:)]
pub unsafe fn fontDescriptorWithSize(
&self,
new_point_size: CGFloat,
) -> Retained<NSFontDescriptor>;
#[method_id(@__retain_semantics Other fontDescriptorWithMatrix:)]
pub unsafe fn fontDescriptorWithMatrix(
&self,
matrix: &NSAffineTransform,
) -> Retained<NSFontDescriptor>;
#[method_id(@__retain_semantics Other fontDescriptorWithFace:)]
pub unsafe fn fontDescriptorWithFace(
&self,
new_face: &NSString,
) -> Retained<NSFontDescriptor>;
#[method_id(@__retain_semantics Other fontDescriptorWithFamily:)]
pub unsafe fn fontDescriptorWithFamily(
&self,
new_family: &NSString,
) -> Retained<NSFontDescriptor>;
#[method_id(@__retain_semantics Other fontDescriptorWithDesign:)]
pub unsafe fn fontDescriptorWithDesign(
&self,
design: &NSFontDescriptorSystemDesign,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFontDescriptor {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern "C" {
pub static NSFontFamilyAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontNameAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontFaceAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontSizeAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontVisibleNameAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontMatrixAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontVariationAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontCharacterSetAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontCascadeListAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontTraitsAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontFixedAdvanceAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontFeatureSettingsAttribute: &'static NSFontDescriptorAttributeName;
}
extern "C" {
pub static NSFontSymbolicTrait: &'static NSFontDescriptorTraitKey;
}
extern "C" {
pub static NSFontWeightTrait: &'static NSFontDescriptorTraitKey;
}
extern "C" {
pub static NSFontWidthTrait: &'static NSFontDescriptorTraitKey;
}
extern "C" {
pub static NSFontSlantTrait: &'static NSFontDescriptorTraitKey;
}
extern "C" {
pub static NSFontVariationAxisIdentifierKey: &'static NSFontDescriptorVariationKey;
}
extern "C" {
pub static NSFontVariationAxisMinimumValueKey: &'static NSFontDescriptorVariationKey;
}
extern "C" {
pub static NSFontVariationAxisMaximumValueKey: &'static NSFontDescriptorVariationKey;
}
extern "C" {
pub static NSFontVariationAxisDefaultValueKey: &'static NSFontDescriptorVariationKey;
}
extern "C" {
pub static NSFontVariationAxisNameKey: &'static NSFontDescriptorVariationKey;
}
extern "C" {
pub static NSFontFeatureTypeIdentifierKey: &'static NSFontDescriptorFeatureKey;
}
extern "C" {
pub static NSFontFeatureSelectorIdentifierKey: &'static NSFontDescriptorFeatureKey;
}
extern "C" {
pub static NSFontWeightUltraLight: NSFontWeight;
}
extern "C" {
pub static NSFontWeightThin: NSFontWeight;
}
extern "C" {
pub static NSFontWeightLight: NSFontWeight;
}
extern "C" {
pub static NSFontWeightRegular: NSFontWeight;
}
extern "C" {
pub static NSFontWeightMedium: NSFontWeight;
}
extern "C" {
pub static NSFontWeightSemibold: NSFontWeight;
}
extern "C" {
pub static NSFontWeightBold: NSFontWeight;
}
extern "C" {
pub static NSFontWeightHeavy: NSFontWeight;
}
extern "C" {
pub static NSFontWeightBlack: NSFontWeight;
}
extern "C" {
pub static NSFontWidthCompressed: NSFontWidth;
}
extern "C" {
pub static NSFontWidthCondensed: NSFontWidth;
}
extern "C" {
pub static NSFontWidthStandard: NSFontWidth;
}
extern "C" {
pub static NSFontWidthExpanded: NSFontWidth;
}
extern "C" {
pub static NSFontDescriptorSystemDesignDefault: &'static NSFontDescriptorSystemDesign;
}
extern "C" {
pub static NSFontDescriptorSystemDesignSerif: &'static NSFontDescriptorSystemDesign;
}
extern "C" {
pub static NSFontDescriptorSystemDesignMonospaced: &'static NSFontDescriptorSystemDesign;
}
extern "C" {
pub static NSFontDescriptorSystemDesignRounded: &'static NSFontDescriptorSystemDesign;
}
extern "C" {
pub static NSFontTextStyleLargeTitle: &'static NSFontTextStyle;
}
extern "C" {
pub static NSFontTextStyleTitle1: &'static NSFontTextStyle;
}
extern "C" {
pub static NSFontTextStyleTitle2: &'static NSFontTextStyle;
}
extern "C" {
pub static NSFontTextStyleTitle3: &'static NSFontTextStyle;
}
extern "C" {
pub static NSFontTextStyleHeadline: &'static NSFontTextStyle;
}
extern "C" {
pub static NSFontTextStyleSubheadline: &'static NSFontTextStyle;
}
extern "C" {
pub static NSFontTextStyleBody: &'static NSFontTextStyle;
}
extern "C" {
pub static NSFontTextStyleCallout: &'static NSFontTextStyle;
}
extern "C" {
pub static NSFontTextStyleFootnote: &'static NSFontTextStyle;
}
extern "C" {
pub static NSFontTextStyleCaption1: &'static NSFontTextStyle;
}
extern "C" {
pub static NSFontTextStyleCaption2: &'static NSFontTextStyle;
}
pub type NSFontFamilyClass = u32;
pub const NSFontUnknownClass: c_int = 0 << 28;
pub const NSFontOldStyleSerifsClass: c_int = 1 << 28;
pub const NSFontTransitionalSerifsClass: c_int = 2 << 28;
pub const NSFontModernSerifsClass: c_int = 3 << 28;
pub const NSFontClarendonSerifsClass: c_int = 4 << 28;
pub const NSFontSlabSerifsClass: c_int = 5 << 28;
pub const NSFontFreeformSerifsClass: c_int = 7 << 28;
pub const NSFontSansSerifClass: c_int = 8 << 28;
pub const NSFontOrnamentalsClass: c_int = 9 << 28;
pub const NSFontScriptsClass: c_int = 10 << 28;
pub const NSFontSymbolicClass: c_int = 12 << 28;
pub const NSFontFamilyClassMask: c_uint = 0xF0000000;
pub const NSFontItalicTrait: c_uint = 1 << 0;
pub const NSFontBoldTrait: c_uint = 1 << 1;
pub const NSFontExpandedTrait: c_uint = 1 << 5;
pub const NSFontCondensedTrait: c_uint = 1 << 6;
pub const NSFontMonoSpaceTrait: c_uint = 1 << 10;
pub const NSFontVerticalTrait: c_uint = 1 << 11;
pub const NSFontUIOptimizedTrait: c_uint = 1 << 12;
extern "C" {
pub static NSFontColorAttribute: &'static NSString;
}
extern_methods!(
/// NSFontDescriptor_TextStyles
unsafe impl NSFontDescriptor {
#[method_id(@__retain_semantics Other preferredFontDescriptorForTextStyle:options:)]
pub unsafe fn preferredFontDescriptorForTextStyle_options(
style: &NSFontTextStyle,
options: &NSDictionary<NSFontTextStyleOptionKey, AnyObject>,
) -> Retained<NSFontDescriptor>;
}
);

View File

@@ -0,0 +1,364 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontTraitMask(pub NSUInteger);
bitflags::bitflags! {
impl NSFontTraitMask: NSUInteger {
const NSItalicFontMask = 0x00000001;
const NSBoldFontMask = 0x00000002;
const NSUnboldFontMask = 0x00000004;
const NSNonStandardCharacterSetFontMask = 0x00000008;
const NSNarrowFontMask = 0x00000010;
const NSExpandedFontMask = 0x00000020;
const NSCondensedFontMask = 0x00000040;
const NSSmallCapsFontMask = 0x00000080;
const NSPosterFontMask = 0x00000100;
const NSCompressedFontMask = 0x00000200;
const NSFixedPitchFontMask = 0x00000400;
const NSUnitalicFontMask = 0x01000000;
}
}
unsafe impl Encode for NSFontTraitMask {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFontTraitMask {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontCollectionOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSFontCollectionOptions: NSUInteger {
const NSFontCollectionApplicationOnlyMask = 1<<0;
}
}
unsafe impl Encode for NSFontCollectionOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFontCollectionOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontAction(pub NSUInteger);
impl NSFontAction {
pub const NSNoFontChangeAction: Self = Self(0);
pub const NSViaPanelFontAction: Self = Self(1);
pub const NSAddTraitFontAction: Self = Self(2);
pub const NSSizeUpFontAction: Self = Self(3);
pub const NSSizeDownFontAction: Self = Self(4);
pub const NSHeavierFontAction: Self = Self(5);
pub const NSLighterFontAction: Self = Self(6);
pub const NSRemoveTraitFontAction: Self = Self(7);
}
unsafe impl Encode for NSFontAction {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFontAction {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSFontManager;
unsafe impl ClassType for NSFontManager {
type Super = NSObject;
type Mutability = MainThreadOnly;
}
);
#[cfg(feature = "NSMenu")]
unsafe impl NSMenuItemValidation for NSFontManager {}
unsafe impl NSObjectProtocol for NSFontManager {}
extern_methods!(
unsafe impl NSFontManager {
#[method(setFontPanelFactory:)]
pub unsafe fn setFontPanelFactory(factory_id: Option<&AnyClass>, mtm: MainThreadMarker);
#[method(setFontManagerFactory:)]
pub unsafe fn setFontManagerFactory(factory_id: Option<&AnyClass>, mtm: MainThreadMarker);
#[method_id(@__retain_semantics Other sharedFontManager)]
pub unsafe fn sharedFontManager(mtm: MainThreadMarker) -> Retained<NSFontManager>;
#[method(isMultiple)]
pub unsafe fn isMultiple(&self) -> bool;
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other selectedFont)]
pub unsafe fn selectedFont(&self) -> Option<Retained<NSFont>>;
#[cfg(feature = "NSFont")]
#[method(setSelectedFont:isMultiple:)]
pub unsafe fn setSelectedFont_isMultiple(&self, font_obj: &NSFont, flag: bool);
#[cfg(feature = "NSMenu")]
#[method(setFontMenu:)]
pub unsafe fn setFontMenu(&self, new_menu: &NSMenu);
#[cfg(feature = "NSMenu")]
#[method_id(@__retain_semantics Other fontMenu:)]
pub unsafe fn fontMenu(&self, create: bool) -> Option<Retained<NSMenu>>;
#[cfg(all(
feature = "NSFontPanel",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
#[method_id(@__retain_semantics Other fontPanel:)]
pub unsafe fn fontPanel(&self, create: bool) -> Option<Retained<NSFontPanel>>;
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other fontWithFamily:traits:weight:size:)]
pub unsafe fn fontWithFamily_traits_weight_size(
&self,
family: &NSString,
traits: NSFontTraitMask,
weight: NSInteger,
size: CGFloat,
) -> Option<Retained<NSFont>>;
#[cfg(feature = "NSFont")]
#[method(traitsOfFont:)]
pub unsafe fn traitsOfFont(&self, font_obj: &NSFont) -> NSFontTraitMask;
#[cfg(feature = "NSFont")]
#[method(weightOfFont:)]
pub unsafe fn weightOfFont(&self, font_obj: &NSFont) -> NSInteger;
#[method_id(@__retain_semantics Other availableFonts)]
pub unsafe fn availableFonts(&self) -> Retained<NSArray<NSString>>;
#[method_id(@__retain_semantics Other availableFontFamilies)]
pub unsafe fn availableFontFamilies(&self) -> Retained<NSArray<NSString>>;
#[method_id(@__retain_semantics Other availableMembersOfFontFamily:)]
pub unsafe fn availableMembersOfFontFamily(
&self,
fam: &NSString,
) -> Option<Retained<NSArray<NSArray>>>;
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other convertFont:)]
pub unsafe fn convertFont(&self, font_obj: &NSFont) -> Retained<NSFont>;
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other convertFont:toSize:)]
pub unsafe fn convertFont_toSize(
&self,
font_obj: &NSFont,
size: CGFloat,
) -> Retained<NSFont>;
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other convertFont:toFace:)]
pub unsafe fn convertFont_toFace(
&self,
font_obj: &NSFont,
typeface: &NSString,
) -> Option<Retained<NSFont>>;
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other convertFont:toFamily:)]
pub unsafe fn convertFont_toFamily(
&self,
font_obj: &NSFont,
family: &NSString,
) -> Retained<NSFont>;
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other convertFont:toHaveTrait:)]
pub unsafe fn convertFont_toHaveTrait(
&self,
font_obj: &NSFont,
r#trait: NSFontTraitMask,
) -> Retained<NSFont>;
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other convertFont:toNotHaveTrait:)]
pub unsafe fn convertFont_toNotHaveTrait(
&self,
font_obj: &NSFont,
r#trait: NSFontTraitMask,
) -> Retained<NSFont>;
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other convertWeight:ofFont:)]
pub unsafe fn convertWeight_ofFont(
&self,
up_flag: bool,
font_obj: &NSFont,
) -> Retained<NSFont>;
#[method(isEnabled)]
pub unsafe fn isEnabled(&self) -> bool;
#[method(setEnabled:)]
pub unsafe fn setEnabled(&self, enabled: bool);
#[method(action)]
pub unsafe fn action(&self) -> Sel;
#[method(setAction:)]
pub unsafe fn setAction(&self, action: Sel);
#[deprecated = "NSFontManager doesn't have any delegate method. This property should not be used."]
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(&self) -> Option<Retained<AnyObject>>;
#[deprecated = "NSFontManager doesn't have any delegate method. This property should not be used."]
#[method(setDelegate:)]
pub unsafe fn setDelegate(&self, delegate: Option<&AnyObject>);
#[method(sendAction)]
pub unsafe fn sendAction(&self) -> bool;
#[method_id(@__retain_semantics Other localizedNameForFamily:face:)]
pub unsafe fn localizedNameForFamily_face(
&self,
family: &NSString,
face_key: Option<&NSString>,
) -> Retained<NSString>;
#[method(setSelectedAttributes:isMultiple:)]
pub unsafe fn setSelectedAttributes_isMultiple(
&self,
attributes: &NSDictionary<NSString, AnyObject>,
flag: bool,
);
#[method_id(@__retain_semantics Other convertAttributes:)]
pub unsafe fn convertAttributes(
&self,
attributes: &NSDictionary<NSString, AnyObject>,
) -> Retained<NSDictionary<NSString, AnyObject>>;
#[cfg(feature = "NSFontDescriptor")]
#[deprecated = "Use -[NSFontDescriptor matchingFontDescriptorsWithMandatoryKeys:] instead"]
#[method_id(@__retain_semantics Other availableFontNamesMatchingFontDescriptor:)]
pub unsafe fn availableFontNamesMatchingFontDescriptor(
&self,
descriptor: &NSFontDescriptor,
) -> Option<Retained<NSArray>>;
#[deprecated = "Use +[NSFontCollection allFontCollectionNames] instead"]
#[method_id(@__retain_semantics Other collectionNames)]
pub unsafe fn collectionNames(&self) -> Retained<NSArray>;
#[deprecated = "Use -[NSFontCollection matchingDescriptors] instead"]
#[method_id(@__retain_semantics Other fontDescriptorsInCollection:)]
pub unsafe fn fontDescriptorsInCollection(
&self,
collection_names: &NSString,
) -> Option<Retained<NSArray>>;
#[deprecated = "Use +[NSFontCollection showFontCollection:withName:visibility:name:] instead"]
#[method(addCollection:options:)]
pub unsafe fn addCollection_options(
&self,
collection_name: &NSString,
collection_options: NSFontCollectionOptions,
) -> bool;
#[deprecated = "Use +[NSFontCollection hideFontCollectionWithName:visibility:error:] instead"]
#[method(removeCollection:)]
pub unsafe fn removeCollection(&self, collection_name: &NSString) -> bool;
#[deprecated = "Use -[NSMutableFontCollection addQueryForDescriptors:] instead"]
#[method(addFontDescriptors:toCollection:)]
pub unsafe fn addFontDescriptors_toCollection(
&self,
descriptors: &NSArray,
collection_name: &NSString,
);
#[cfg(feature = "NSFontDescriptor")]
#[deprecated = "Use -[NSMutableFontCollection removeQueryForDescriptors:] instead"]
#[method(removeFontDescriptor:fromCollection:)]
pub unsafe fn removeFontDescriptor_fromCollection(
&self,
descriptor: &NSFontDescriptor,
collection: &NSString,
);
#[method(currentFontAction)]
pub unsafe fn currentFontAction(&self) -> NSFontAction;
#[method(convertFontTraits:)]
pub unsafe fn convertFontTraits(&self, traits: NSFontTraitMask) -> NSFontTraitMask;
#[method_id(@__retain_semantics Other target)]
pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSFontManager {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSFontManagerMenuActionMethods
unsafe impl NSFontManager {
#[method(fontNamed:hasTraits:)]
pub unsafe fn fontNamed_hasTraits(
&self,
f_name: &NSString,
some_traits: NSFontTraitMask,
) -> bool;
#[method_id(@__retain_semantics Other availableFontNamesWithTraits:)]
pub unsafe fn availableFontNamesWithTraits(
&self,
some_traits: NSFontTraitMask,
) -> Option<Retained<NSArray<NSString>>>;
#[method(addFontTrait:)]
pub unsafe fn addFontTrait(&self, sender: Option<&AnyObject>);
#[method(removeFontTrait:)]
pub unsafe fn removeFontTrait(&self, sender: Option<&AnyObject>);
#[method(modifyFontViaPanel:)]
pub unsafe fn modifyFontViaPanel(&self, sender: Option<&AnyObject>);
#[method(modifyFont:)]
pub unsafe fn modifyFont(&self, sender: Option<&AnyObject>);
#[method(orderFrontFontPanel:)]
pub unsafe fn orderFrontFontPanel(&self, sender: Option<&AnyObject>);
#[method(orderFrontStylesPanel:)]
pub unsafe fn orderFrontStylesPanel(&self, sender: Option<&AnyObject>);
}
);

View File

@@ -0,0 +1,250 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFontPanelModeMask(pub NSUInteger);
bitflags::bitflags! {
impl NSFontPanelModeMask: NSUInteger {
#[doc(alias = "NSFontPanelModeMaskFace")]
const Face = 1<<0;
#[doc(alias = "NSFontPanelModeMaskSize")]
const Size = 1<<1;
#[doc(alias = "NSFontPanelModeMaskCollection")]
const Collection = 1<<2;
#[doc(alias = "NSFontPanelModeMaskUnderlineEffect")]
const UnderlineEffect = 1<<8;
#[doc(alias = "NSFontPanelModeMaskStrikethroughEffect")]
const StrikethroughEffect = 1<<9;
#[doc(alias = "NSFontPanelModeMaskTextColorEffect")]
const TextColorEffect = 1<<10;
#[doc(alias = "NSFontPanelModeMaskDocumentColorEffect")]
const DocumentColorEffect = 1<<11;
#[doc(alias = "NSFontPanelModeMaskShadowEffect")]
const ShadowEffect = 1<<12;
#[doc(alias = "NSFontPanelModeMaskAllEffects")]
const AllEffects = 0xFFF00;
const NSFontPanelModesMaskStandardModes = 0xFFFF;
const NSFontPanelModesMaskAllModes = 0xFFFFFFFF;
}
}
unsafe impl Encode for NSFontPanelModeMask {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFontPanelModeMask {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_protocol!(
pub unsafe trait NSFontChanging: NSObjectProtocol + IsMainThreadOnly {
#[cfg(feature = "NSFontManager")]
#[optional]
#[method(changeFont:)]
unsafe fn changeFont(&self, sender: Option<&NSFontManager>);
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
#[optional]
#[method(validModesForFontPanel:)]
unsafe fn validModesForFontPanel(&self, font_panel: &NSFontPanel) -> NSFontPanelModeMask;
}
unsafe impl ProtocolType for dyn NSFontChanging {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
pub struct NSFontPanel;
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl ClassType for NSFontPanel {
#[inherits(NSWindow, NSResponder, NSObject)]
type Super = NSPanel;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAccessibility for NSFontPanel {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAccessibilityElementProtocol for NSFontPanel {}
#[cfg(all(
feature = "NSAnimation",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAnimatablePropertyContainer for NSFontPanel {}
#[cfg(all(
feature = "NSAppearance",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSAppearanceCustomization for NSFontPanel {}
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSCoding for NSFontPanel {}
#[cfg(all(
feature = "NSMenu",
feature = "NSPanel",
feature = "NSResponder",
feature = "NSWindow"
))]
unsafe impl NSMenuItemValidation for NSFontPanel {}
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSObjectProtocol for NSFontPanel {}
#[cfg(all(
feature = "NSPanel",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSWindow"
))]
unsafe impl NSUserInterfaceItemIdentification for NSFontPanel {}
#[cfg(all(
feature = "NSPanel",
feature = "NSResponder",
feature = "NSUserInterfaceValidation",
feature = "NSWindow"
))]
unsafe impl NSUserInterfaceValidations for NSFontPanel {}
extern_methods!(
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSFontPanel {
#[method_id(@__retain_semantics Other sharedFontPanel)]
pub unsafe fn sharedFontPanel(mtm: MainThreadMarker) -> Retained<NSFontPanel>;
#[method(sharedFontPanelExists)]
pub unsafe fn sharedFontPanelExists(mtm: MainThreadMarker) -> bool;
#[cfg(feature = "NSView")]
#[method_id(@__retain_semantics Other accessoryView)]
pub unsafe fn accessoryView(&self) -> Option<Retained<NSView>>;
#[cfg(feature = "NSView")]
#[method(setAccessoryView:)]
pub unsafe fn setAccessoryView(&self, accessory_view: Option<&NSView>);
#[cfg(feature = "NSFont")]
#[method(setPanelFont:isMultiple:)]
pub unsafe fn setPanelFont_isMultiple(&self, font_obj: &NSFont, flag: bool);
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other panelConvertFont:)]
pub unsafe fn panelConvertFont(&self, font_obj: &NSFont) -> Retained<NSFont>;
#[method(worksWhenModal)]
pub unsafe fn worksWhenModal(&self) -> bool;
#[method(setWorksWhenModal:)]
pub unsafe fn setWorksWhenModal(&self, works_when_modal: bool);
#[method(isEnabled)]
pub unsafe fn isEnabled(&self) -> bool;
#[method(setEnabled:)]
pub unsafe fn setEnabled(&self, enabled: bool);
#[method(reloadDefaultFontFamilies)]
pub unsafe fn reloadDefaultFontFamilies(&self);
}
);
extern_methods!(
/// Methods declared on superclass `NSWindow`
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSFontPanel {
#[cfg(feature = "NSGraphics")]
#[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:)]
pub unsafe fn initWithContentRect_styleMask_backing_defer(
this: Allocated<Self>,
content_rect: NSRect,
style: NSWindowStyleMask,
backing_store_type: NSBackingStoreType,
flag: bool,
) -> Retained<Self>;
#[cfg(all(feature = "NSGraphics", feature = "NSScreen"))]
#[method_id(@__retain_semantics Init initWithContentRect:styleMask:backing:defer:screen:)]
pub unsafe fn initWithContentRect_styleMask_backing_defer_screen(
this: Allocated<Self>,
content_rect: NSRect,
style: NSWindowStyleMask,
backing_store_type: NSBackingStoreType,
flag: bool,
screen: Option<&NSScreen>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[cfg(feature = "NSViewController")]
#[method_id(@__retain_semantics Other windowWithContentViewController:)]
pub unsafe fn windowWithContentViewController(
content_view_controller: &NSViewController,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSFontPanel {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSPanel", feature = "NSResponder", feature = "NSWindow"))]
unsafe impl NSFontPanel {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
pub const NSFontPanelFaceModeMask: c_uint = 1 << 0;
pub const NSFontPanelSizeModeMask: c_uint = 1 << 1;
pub const NSFontPanelCollectionModeMask: c_uint = 1 << 2;
pub const NSFontPanelUnderlineEffectModeMask: c_uint = 1 << 8;
pub const NSFontPanelStrikethroughEffectModeMask: c_uint = 1 << 9;
pub const NSFontPanelTextColorEffectModeMask: c_uint = 1 << 10;
pub const NSFontPanelDocumentColorEffectModeMask: c_uint = 1 << 11;
pub const NSFontPanelShadowEffectModeMask: c_uint = 1 << 12;
pub const NSFontPanelAllEffectsModeMask: c_uint = 0xFFF00;
pub const NSFontPanelStandardModesMask: c_uint = 0xFFFF;
pub const NSFontPanelAllModesMask: c_uint = 0xFFFFFFFF;
pub const NSFPPreviewButton: c_uint = 131;
pub const NSFPRevertButton: c_uint = 130;
pub const NSFPSetButton: c_uint = 132;
pub const NSFPPreviewField: c_uint = 128;
pub const NSFPSizeField: c_uint = 129;
pub const NSFPSizeTitle: c_uint = 133;
pub const NSFPCurrentField: c_uint = 134;

View File

@@ -0,0 +1,282 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
#[deprecated = "Use NSTextField directly instead, and consider NSStackView for layout assistance"]
pub struct NSForm;
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl ClassType for NSForm {
#[inherits(NSControl, NSView, NSResponder, NSObject)]
type Super = NSMatrix;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibility for NSForm {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAccessibilityElementProtocol for NSForm {}
#[cfg(all(
feature = "NSAnimation",
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAnimatablePropertyContainer for NSForm {}
#[cfg(all(
feature = "NSAppearance",
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSAppearanceCustomization for NSForm {}
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSCoding for NSForm {}
#[cfg(all(
feature = "NSControl",
feature = "NSDragging",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSDraggingDestination for NSForm {}
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSObjectProtocol for NSForm {}
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSUserInterfaceItemIdentification",
feature = "NSView"
))]
unsafe impl NSUserInterfaceItemIdentification for NSForm {}
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSUserInterfaceValidation",
feature = "NSView"
))]
unsafe impl NSUserInterfaceValidations for NSForm {}
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSViewToolTipOwner for NSForm {}
extern_methods!(
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSForm {
#[method(indexOfSelectedItem)]
pub unsafe fn indexOfSelectedItem(&self) -> NSInteger;
#[method(setEntryWidth:)]
pub unsafe fn setEntryWidth(&self, width: CGFloat);
#[method(setInterlineSpacing:)]
pub unsafe fn setInterlineSpacing(&self, spacing: CGFloat);
#[method(setBordered:)]
pub unsafe fn setBordered(&self, flag: bool);
#[method(setBezeled:)]
pub unsafe fn setBezeled(&self, flag: bool);
#[cfg(feature = "NSText")]
#[method(setTitleAlignment:)]
pub unsafe fn setTitleAlignment(&self, mode: NSTextAlignment);
#[cfg(feature = "NSText")]
#[method(setTextAlignment:)]
pub unsafe fn setTextAlignment(&self, mode: NSTextAlignment);
#[cfg(feature = "NSFont")]
#[method(setTitleFont:)]
pub unsafe fn setTitleFont(&self, font_obj: &NSFont);
#[cfg(feature = "NSFont")]
#[method(setTextFont:)]
pub unsafe fn setTextFont(&self, font_obj: &NSFont);
#[method_id(@__retain_semantics Other cellAtIndex:)]
pub unsafe fn cellAtIndex(&self, index: NSInteger) -> Option<Retained<AnyObject>>;
#[method(drawCellAtIndex:)]
pub unsafe fn drawCellAtIndex(&self, index: NSInteger);
#[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSFormCell"))]
#[method_id(@__retain_semantics Other addEntry:)]
pub unsafe fn addEntry(&self, title: &NSString) -> Retained<NSFormCell>;
#[cfg(all(feature = "NSActionCell", feature = "NSCell", feature = "NSFormCell"))]
#[method_id(@__retain_semantics Other insertEntry:atIndex:)]
pub unsafe fn insertEntry_atIndex(
&self,
title: &NSString,
index: NSInteger,
) -> Option<Retained<NSFormCell>>;
#[method(removeEntryAtIndex:)]
pub unsafe fn removeEntryAtIndex(&self, index: NSInteger);
#[method(indexOfCellWithTag:)]
pub unsafe fn indexOfCellWithTag(&self, tag: NSInteger) -> NSInteger;
#[method(selectTextAtIndex:)]
pub unsafe fn selectTextAtIndex(&self, index: NSInteger);
#[method(setFrameSize:)]
pub unsafe fn setFrameSize(&self, new_size: NSSize);
#[cfg(feature = "NSText")]
#[method(setTitleBaseWritingDirection:)]
pub unsafe fn setTitleBaseWritingDirection(&self, writing_direction: NSWritingDirection);
#[cfg(feature = "NSText")]
#[method(setTextBaseWritingDirection:)]
pub unsafe fn setTextBaseWritingDirection(&self, writing_direction: NSWritingDirection);
#[method(setPreferredTextFieldWidth:)]
pub unsafe fn setPreferredTextFieldWidth(&self, preferred_width: CGFloat);
#[method(preferredTextFieldWidth)]
pub unsafe fn preferredTextFieldWidth(&self) -> CGFloat;
}
);
extern_methods!(
/// Methods declared on superclass `NSMatrix`
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSForm {
#[method_id(@__retain_semantics Init initWithFrame:)]
pub unsafe fn initWithFrame(this: Allocated<Self>, frame_rect: NSRect) -> Retained<Self>;
#[cfg(feature = "NSCell")]
#[method_id(@__retain_semantics Init initWithFrame:mode:prototype:numberOfRows:numberOfColumns:)]
pub unsafe fn initWithFrame_mode_prototype_numberOfRows_numberOfColumns(
this: Allocated<Self>,
frame_rect: NSRect,
mode: NSMatrixMode,
cell: &NSCell,
rows_high: NSInteger,
cols_wide: NSInteger,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithFrame:mode:cellClass:numberOfRows:numberOfColumns:)]
pub unsafe fn initWithFrame_mode_cellClass_numberOfRows_numberOfColumns(
this: Allocated<Self>,
frame_rect: NSRect,
mode: NSMatrixMode,
factory_id: Option<&AnyClass>,
rows_high: NSInteger,
cols_wide: NSInteger,
) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSControl`
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSForm {
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
}
);
extern_methods!(
/// Methods declared on superclass `NSResponder`
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSForm {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(
feature = "NSControl",
feature = "NSMatrix",
feature = "NSResponder",
feature = "NSView"
))]
unsafe impl NSForm {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);

View File

@@ -0,0 +1,176 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
pub struct NSFormCell;
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl ClassType for NSFormCell {
#[inherits(NSCell, NSObject)]
type Super = NSActionCell;
type Mutability = MainThreadOnly;
}
);
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
unsafe impl NSAccessibility for NSFormCell {}
#[cfg(all(
feature = "NSAccessibilityProtocols",
feature = "NSActionCell",
feature = "NSCell"
))]
unsafe impl NSAccessibilityElementProtocol for NSFormCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSCoding for NSFormCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSCopying for NSFormCell {}
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSObjectProtocol for NSFormCell {}
#[cfg(all(
feature = "NSActionCell",
feature = "NSCell",
feature = "NSUserInterfaceItemIdentification"
))]
unsafe impl NSUserInterfaceItemIdentification for NSFormCell {}
extern_methods!(
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSFormCell {
#[method_id(@__retain_semantics Init initTextCell:)]
pub unsafe fn initTextCell(
this: Allocated<Self>,
string: Option<&NSString>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
#[cfg(feature = "NSImage")]
#[method_id(@__retain_semantics Init initImageCell:)]
pub unsafe fn initImageCell(
this: Allocated<Self>,
image: Option<&NSImage>,
) -> Retained<Self>;
#[method(titleWidth:)]
pub unsafe fn titleWidth_(&self, size: NSSize) -> CGFloat;
#[method(titleWidth)]
pub unsafe fn titleWidth(&self) -> CGFloat;
#[method(setTitleWidth:)]
pub unsafe fn setTitleWidth(&self, title_width: CGFloat);
#[method_id(@__retain_semantics Other title)]
pub unsafe fn title(&self) -> Retained<NSString>;
#[method(setTitle:)]
pub unsafe fn setTitle(&self, title: &NSString);
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other titleFont)]
pub unsafe fn titleFont(&self) -> Retained<NSFont>;
#[cfg(feature = "NSFont")]
#[method(setTitleFont:)]
pub unsafe fn setTitleFont(&self, title_font: &NSFont);
#[method(isOpaque)]
pub unsafe fn isOpaque(&self) -> bool;
#[method_id(@__retain_semantics Other placeholderString)]
pub unsafe fn placeholderString(&self) -> Option<Retained<NSString>>;
#[method(setPlaceholderString:)]
pub unsafe fn setPlaceholderString(&self, placeholder_string: Option<&NSString>);
#[method_id(@__retain_semantics Other placeholderAttributedString)]
pub unsafe fn placeholderAttributedString(&self) -> Option<Retained<NSAttributedString>>;
#[method(setPlaceholderAttributedString:)]
pub unsafe fn setPlaceholderAttributedString(
&self,
placeholder_attributed_string: Option<&NSAttributedString>,
);
#[cfg(feature = "NSText")]
#[method(titleAlignment)]
pub unsafe fn titleAlignment(&self) -> NSTextAlignment;
#[cfg(feature = "NSText")]
#[method(setTitleAlignment:)]
pub unsafe fn setTitleAlignment(&self, title_alignment: NSTextAlignment);
#[cfg(feature = "NSText")]
#[method(titleBaseWritingDirection)]
pub unsafe fn titleBaseWritingDirection(&self) -> NSWritingDirection;
#[cfg(feature = "NSText")]
#[method(setTitleBaseWritingDirection:)]
pub unsafe fn setTitleBaseWritingDirection(
&self,
title_base_writing_direction: NSWritingDirection,
);
#[method(preferredTextFieldWidth)]
pub unsafe fn preferredTextFieldWidth(&self) -> CGFloat;
#[method(setPreferredTextFieldWidth:)]
pub unsafe fn setPreferredTextFieldWidth(&self, preferred_text_field_width: CGFloat);
}
);
extern_methods!(
/// Methods declared on superclass `NSCell`
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSFormCell {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSFormCell {
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSKeyboardUI
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSFormCell {
#[deprecated]
#[method(setTitleWithMnemonic:)]
pub unsafe fn setTitleWithMnemonic(&self, string_with_ampersand: Option<&NSString>);
}
);
extern_methods!(
/// NSFormCellAttributedStringMethods
#[cfg(all(feature = "NSActionCell", feature = "NSCell"))]
unsafe impl NSFormCell {
#[method_id(@__retain_semantics Other attributedTitle)]
pub unsafe fn attributedTitle(&self) -> Retained<NSAttributedString>;
#[method(setAttributedTitle:)]
pub unsafe fn setAttributedTitle(&self, attributed_title: &NSAttributedString);
}
);

View File

@@ -0,0 +1,355 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGestureRecognizerState(pub NSInteger);
impl NSGestureRecognizerState {
#[doc(alias = "NSGestureRecognizerStatePossible")]
pub const Possible: Self = Self(0);
#[doc(alias = "NSGestureRecognizerStateBegan")]
pub const Began: Self = Self(1);
#[doc(alias = "NSGestureRecognizerStateChanged")]
pub const Changed: Self = Self(2);
#[doc(alias = "NSGestureRecognizerStateEnded")]
pub const Ended: Self = Self(3);
#[doc(alias = "NSGestureRecognizerStateCancelled")]
pub const Cancelled: Self = Self(4);
#[doc(alias = "NSGestureRecognizerStateFailed")]
pub const Failed: Self = Self(5);
#[doc(alias = "NSGestureRecognizerStateRecognized")]
pub const Recognized: Self = Self(NSGestureRecognizerState::Ended.0);
}
unsafe impl Encode for NSGestureRecognizerState {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSGestureRecognizerState {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSGestureRecognizer;
unsafe impl ClassType for NSGestureRecognizer {
type Super = NSObject;
type Mutability = MainThreadOnly;
}
);
unsafe impl NSCoding for NSGestureRecognizer {}
unsafe impl NSObjectProtocol for NSGestureRecognizer {}
extern_methods!(
unsafe impl NSGestureRecognizer {
#[method_id(@__retain_semantics Init initWithTarget:action:)]
pub unsafe fn initWithTarget_action(
this: Allocated<Self>,
target: Option<&AnyObject>,
action: Option<Sel>,
) -> Retained<Self>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Other target)]
pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
#[method(setTarget:)]
pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
#[method(action)]
pub unsafe fn action(&self) -> Option<Sel>;
#[method(setAction:)]
pub unsafe fn setAction(&self, action: Option<Sel>);
#[method_id(@__retain_semantics Other delegate)]
pub unsafe fn delegate(
&self,
) -> Option<Retained<ProtocolObject<dyn NSGestureRecognizerDelegate>>>;
#[method(setDelegate:)]
pub unsafe fn setDelegate(
&self,
delegate: Option<&ProtocolObject<dyn NSGestureRecognizerDelegate>>,
);
#[method(isEnabled)]
pub unsafe fn isEnabled(&self) -> bool;
#[method(setEnabled:)]
pub unsafe fn setEnabled(&self, enabled: bool);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method_id(@__retain_semantics Other view)]
pub unsafe fn view(&self) -> Option<Retained<NSView>>;
#[cfg(feature = "NSPressureConfiguration")]
#[method_id(@__retain_semantics Other pressureConfiguration)]
pub unsafe fn pressureConfiguration(&self) -> Retained<NSPressureConfiguration>;
#[cfg(feature = "NSPressureConfiguration")]
#[method(setPressureConfiguration:)]
pub unsafe fn setPressureConfiguration(
&self,
pressure_configuration: &NSPressureConfiguration,
);
#[method(delaysPrimaryMouseButtonEvents)]
pub unsafe fn delaysPrimaryMouseButtonEvents(&self) -> bool;
#[method(setDelaysPrimaryMouseButtonEvents:)]
pub unsafe fn setDelaysPrimaryMouseButtonEvents(
&self,
delays_primary_mouse_button_events: bool,
);
#[method(delaysSecondaryMouseButtonEvents)]
pub unsafe fn delaysSecondaryMouseButtonEvents(&self) -> bool;
#[method(setDelaysSecondaryMouseButtonEvents:)]
pub unsafe fn setDelaysSecondaryMouseButtonEvents(
&self,
delays_secondary_mouse_button_events: bool,
);
#[method(delaysOtherMouseButtonEvents)]
pub unsafe fn delaysOtherMouseButtonEvents(&self) -> bool;
#[method(setDelaysOtherMouseButtonEvents:)]
pub unsafe fn setDelaysOtherMouseButtonEvents(
&self,
delays_other_mouse_button_events: bool,
);
#[method(delaysKeyEvents)]
pub unsafe fn delaysKeyEvents(&self) -> bool;
#[method(setDelaysKeyEvents:)]
pub unsafe fn setDelaysKeyEvents(&self, delays_key_events: bool);
#[method(delaysMagnificationEvents)]
pub unsafe fn delaysMagnificationEvents(&self) -> bool;
#[method(setDelaysMagnificationEvents:)]
pub unsafe fn setDelaysMagnificationEvents(&self, delays_magnification_events: bool);
#[method(delaysRotationEvents)]
pub unsafe fn delaysRotationEvents(&self) -> bool;
#[method(setDelaysRotationEvents:)]
pub unsafe fn setDelaysRotationEvents(&self, delays_rotation_events: bool);
#[cfg(all(feature = "NSResponder", feature = "NSView"))]
#[method(locationInView:)]
pub unsafe fn locationInView(&self, view: Option<&NSView>) -> NSPoint;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSGestureRecognizer {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new(mtm: MainThreadMarker) -> Retained<Self>;
}
);
extern_methods!(
/// NSTouchBar
unsafe impl NSGestureRecognizer {
#[cfg(feature = "NSTouch")]
#[method(allowedTouchTypes)]
pub unsafe fn allowedTouchTypes(&self) -> NSTouchTypeMask;
#[cfg(feature = "NSTouch")]
#[method(setAllowedTouchTypes:)]
pub unsafe fn setAllowedTouchTypes(&self, allowed_touch_types: NSTouchTypeMask);
}
);
extern_protocol!(
pub unsafe trait NSGestureRecognizerDelegate:
NSObjectProtocol + IsMainThreadOnly
{
#[cfg(feature = "NSEvent")]
#[optional]
#[method(gestureRecognizer:shouldAttemptToRecognizeWithEvent:)]
unsafe fn gestureRecognizer_shouldAttemptToRecognizeWithEvent(
&self,
gesture_recognizer: &NSGestureRecognizer,
event: &NSEvent,
) -> bool;
#[optional]
#[method(gestureRecognizerShouldBegin:)]
unsafe fn gestureRecognizerShouldBegin(
&self,
gesture_recognizer: &NSGestureRecognizer,
) -> bool;
#[optional]
#[method(gestureRecognizer:shouldRecognizeSimultaneouslyWithGestureRecognizer:)]
unsafe fn gestureRecognizer_shouldRecognizeSimultaneouslyWithGestureRecognizer(
&self,
gesture_recognizer: &NSGestureRecognizer,
other_gesture_recognizer: &NSGestureRecognizer,
) -> bool;
#[optional]
#[method(gestureRecognizer:shouldRequireFailureOfGestureRecognizer:)]
unsafe fn gestureRecognizer_shouldRequireFailureOfGestureRecognizer(
&self,
gesture_recognizer: &NSGestureRecognizer,
other_gesture_recognizer: &NSGestureRecognizer,
) -> bool;
#[optional]
#[method(gestureRecognizer:shouldBeRequiredToFailByGestureRecognizer:)]
unsafe fn gestureRecognizer_shouldBeRequiredToFailByGestureRecognizer(
&self,
gesture_recognizer: &NSGestureRecognizer,
other_gesture_recognizer: &NSGestureRecognizer,
) -> bool;
#[cfg(feature = "NSTouch")]
#[optional]
#[method(gestureRecognizer:shouldReceiveTouch:)]
unsafe fn gestureRecognizer_shouldReceiveTouch(
&self,
gesture_recognizer: &NSGestureRecognizer,
touch: &NSTouch,
) -> bool;
}
unsafe impl ProtocolType for dyn NSGestureRecognizerDelegate {}
);
extern_methods!(
/// NSSubclassUse
unsafe impl NSGestureRecognizer {
#[method(setState:)]
pub unsafe fn setState(&self, state: NSGestureRecognizerState);
#[method(reset)]
pub unsafe fn reset(&self);
#[method(canPreventGestureRecognizer:)]
pub unsafe fn canPreventGestureRecognizer(
&self,
prevented_gesture_recognizer: &NSGestureRecognizer,
) -> bool;
#[method(canBePreventedByGestureRecognizer:)]
pub unsafe fn canBePreventedByGestureRecognizer(
&self,
preventing_gesture_recognizer: &NSGestureRecognizer,
) -> bool;
#[method(shouldRequireFailureOfGestureRecognizer:)]
pub unsafe fn shouldRequireFailureOfGestureRecognizer(
&self,
other_gesture_recognizer: &NSGestureRecognizer,
) -> bool;
#[method(shouldBeRequiredToFailByGestureRecognizer:)]
pub unsafe fn shouldBeRequiredToFailByGestureRecognizer(
&self,
other_gesture_recognizer: &NSGestureRecognizer,
) -> bool;
#[cfg(feature = "NSEvent")]
#[method(mouseDown:)]
pub unsafe fn mouseDown(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(rightMouseDown:)]
pub unsafe fn rightMouseDown(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(otherMouseDown:)]
pub unsafe fn otherMouseDown(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(mouseUp:)]
pub unsafe fn mouseUp(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(rightMouseUp:)]
pub unsafe fn rightMouseUp(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(otherMouseUp:)]
pub unsafe fn otherMouseUp(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(mouseDragged:)]
pub unsafe fn mouseDragged(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(rightMouseDragged:)]
pub unsafe fn rightMouseDragged(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(otherMouseDragged:)]
pub unsafe fn otherMouseDragged(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(keyDown:)]
pub unsafe fn keyDown(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(keyUp:)]
pub unsafe fn keyUp(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(flagsChanged:)]
pub unsafe fn flagsChanged(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(tabletPoint:)]
pub unsafe fn tabletPoint(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(magnifyWithEvent:)]
pub unsafe fn magnifyWithEvent(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(rotateWithEvent:)]
pub unsafe fn rotateWithEvent(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(pressureChangeWithEvent:)]
pub unsafe fn pressureChangeWithEvent(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(touchesBeganWithEvent:)]
pub unsafe fn touchesBeganWithEvent(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(touchesMovedWithEvent:)]
pub unsafe fn touchesMovedWithEvent(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(touchesEndedWithEvent:)]
pub unsafe fn touchesEndedWithEvent(&self, event: &NSEvent);
#[cfg(feature = "NSEvent")]
#[method(touchesCancelledWithEvent:)]
pub unsafe fn touchesCancelledWithEvent(&self, event: &NSEvent);
}
);

View File

@@ -0,0 +1,79 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
pub const NSShowControlGlyphs: c_uint = 1 << 0;
pub const NSShowInvisibleGlyphs: c_uint = 1 << 1;
pub const NSWantsBidiLevels: c_uint = 1 << 2;
extern_protocol!(
pub unsafe trait NSGlyphStorage {
#[cfg(feature = "NSFont")]
#[method(insertGlyphs:length:forStartingGlyphAtIndex:characterIndex:)]
unsafe fn insertGlyphs_length_forStartingGlyphAtIndex_characterIndex(
&self,
glyphs: NonNull<NSGlyph>,
length: NSUInteger,
glyph_index: NSUInteger,
char_index: NSUInteger,
);
#[method(setIntAttribute:value:forGlyphAtIndex:)]
unsafe fn setIntAttribute_value_forGlyphAtIndex(
&self,
attribute_tag: NSInteger,
val: NSInteger,
glyph_index: NSUInteger,
);
#[method_id(@__retain_semantics Other attributedString)]
unsafe fn attributedString(&self) -> Retained<NSAttributedString>;
#[method(layoutOptions)]
unsafe fn layoutOptions(&self) -> NSUInteger;
}
unsafe impl ProtocolType for dyn NSGlyphStorage {}
);
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSGlyphGenerator;
unsafe impl ClassType for NSGlyphGenerator {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSGlyphGenerator {}
extern_methods!(
unsafe impl NSGlyphGenerator {
#[method(generateGlyphsForGlyphStorage:desiredNumberOfCharacters:glyphIndex:characterIndex:)]
pub unsafe fn generateGlyphsForGlyphStorage_desiredNumberOfCharacters_glyphIndex_characterIndex(
&self,
glyph_storage: &ProtocolObject<dyn NSGlyphStorage>,
n_chars: NSUInteger,
glyph_index: *mut NSUInteger,
char_index: *mut NSUInteger,
);
#[method_id(@__retain_semantics Other sharedGlyphGenerator)]
pub unsafe fn sharedGlyphGenerator() -> Retained<NSGlyphGenerator>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSGlyphGenerator {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,100 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSGlyphInfo;
unsafe impl ClassType for NSGlyphInfo {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSCoding for NSGlyphInfo {}
unsafe impl NSCopying for NSGlyphInfo {}
unsafe impl NSObjectProtocol for NSGlyphInfo {}
unsafe impl NSSecureCoding for NSGlyphInfo {}
extern_methods!(
unsafe impl NSGlyphInfo {
#[method_id(@__retain_semantics Other baseString)]
pub unsafe fn baseString(&self) -> Retained<NSString>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSGlyphInfo {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCharacterCollection(pub NSUInteger);
impl NSCharacterCollection {
pub const NSIdentityMappingCharacterCollection: Self = Self(0);
pub const NSAdobeCNS1CharacterCollection: Self = Self(1);
pub const NSAdobeGB1CharacterCollection: Self = Self(2);
pub const NSAdobeJapan1CharacterCollection: Self = Self(3);
pub const NSAdobeJapan2CharacterCollection: Self = Self(4);
pub const NSAdobeKorea1CharacterCollection: Self = Self(5);
}
unsafe impl Encode for NSCharacterCollection {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCharacterCollection {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_methods!(
/// NSGlyphInfo_Deprecated
unsafe impl NSGlyphInfo {
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other glyphInfoWithGlyphName:forFont:baseString:)]
pub unsafe fn glyphInfoWithGlyphName_forFont_baseString(
glyph_name: &NSString,
font: &NSFont,
string: &NSString,
) -> Option<Retained<NSGlyphInfo>>;
#[cfg(feature = "NSFont")]
#[method_id(@__retain_semantics Other glyphInfoWithGlyph:forFont:baseString:)]
pub unsafe fn glyphInfoWithGlyph_forFont_baseString(
glyph: NSGlyph,
font: &NSFont,
string: &NSString,
) -> Option<Retained<NSGlyphInfo>>;
#[method_id(@__retain_semantics Other glyphInfoWithCharacterIdentifier:collection:baseString:)]
pub unsafe fn glyphInfoWithCharacterIdentifier_collection_baseString(
cid: NSUInteger,
character_collection: NSCharacterCollection,
string: &NSString,
) -> Option<Retained<NSGlyphInfo>>;
#[method_id(@__retain_semantics Other glyphName)]
pub unsafe fn glyphName(&self) -> Option<Retained<NSString>>;
#[method(characterIdentifier)]
pub unsafe fn characterIdentifier(&self) -> NSUInteger;
#[method(characterCollection)]
pub unsafe fn characterCollection(&self) -> NSCharacterCollection;
}
);

View File

@@ -0,0 +1,152 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_OPTIONS
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSGradientDrawingOptions(pub NSUInteger);
bitflags::bitflags! {
impl NSGradientDrawingOptions: NSUInteger {
const NSGradientDrawsBeforeStartingLocation = 1<<0;
const NSGradientDrawsAfterEndingLocation = 1<<1;
}
}
unsafe impl Encode for NSGradientDrawingOptions {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSGradientDrawingOptions {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSGradient;
unsafe impl ClassType for NSGradient {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl Send for NSGradient {}
unsafe impl Sync for NSGradient {}
unsafe impl NSCoding for NSGradient {}
unsafe impl NSCopying for NSGradient {}
unsafe impl NSObjectProtocol for NSGradient {}
unsafe impl NSSecureCoding for NSGradient {}
extern_methods!(
unsafe impl NSGradient {
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Init initWithStartingColor:endingColor:)]
pub unsafe fn initWithStartingColor_endingColor(
this: Allocated<Self>,
starting_color: &NSColor,
ending_color: &NSColor,
) -> Option<Retained<Self>>;
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Init initWithColors:)]
pub unsafe fn initWithColors(
this: Allocated<Self>,
color_array: &NSArray<NSColor>,
) -> Option<Retained<Self>>;
#[cfg(all(feature = "NSColor", feature = "NSColorSpace"))]
#[method_id(@__retain_semantics Init initWithColors:atLocations:colorSpace:)]
pub unsafe fn initWithColors_atLocations_colorSpace(
this: Allocated<Self>,
color_array: &NSArray<NSColor>,
locations: *mut CGFloat,
color_space: &NSColorSpace,
) -> Option<Retained<Self>>;
#[method_id(@__retain_semantics Init initWithCoder:)]
pub unsafe fn initWithCoder(
this: Allocated<Self>,
coder: &NSCoder,
) -> Option<Retained<Self>>;
#[method(drawFromPoint:toPoint:options:)]
pub unsafe fn drawFromPoint_toPoint_options(
&self,
starting_point: NSPoint,
ending_point: NSPoint,
options: NSGradientDrawingOptions,
);
#[method(drawInRect:angle:)]
pub unsafe fn drawInRect_angle(&self, rect: NSRect, angle: CGFloat);
#[cfg(feature = "NSBezierPath")]
#[method(drawInBezierPath:angle:)]
pub unsafe fn drawInBezierPath_angle(&self, path: &NSBezierPath, angle: CGFloat);
#[method(drawFromCenter:radius:toCenter:radius:options:)]
pub unsafe fn drawFromCenter_radius_toCenter_radius_options(
&self,
start_center: NSPoint,
start_radius: CGFloat,
end_center: NSPoint,
end_radius: CGFloat,
options: NSGradientDrawingOptions,
);
#[method(drawInRect:relativeCenterPosition:)]
pub unsafe fn drawInRect_relativeCenterPosition(
&self,
rect: NSRect,
relative_center_position: NSPoint,
);
#[cfg(feature = "NSBezierPath")]
#[method(drawInBezierPath:relativeCenterPosition:)]
pub unsafe fn drawInBezierPath_relativeCenterPosition(
&self,
path: &NSBezierPath,
relative_center_position: NSPoint,
);
#[cfg(feature = "NSColorSpace")]
#[method_id(@__retain_semantics Other colorSpace)]
pub unsafe fn colorSpace(&self) -> Retained<NSColorSpace>;
#[method(numberOfColorStops)]
pub unsafe fn numberOfColorStops(&self) -> NSInteger;
#[cfg(feature = "NSColor")]
#[method(getColor:location:atIndex:)]
pub unsafe fn getColor_location_atIndex(
&self,
color: Option<&mut Retained<NSColor>>,
location: *mut CGFloat,
index: NSInteger,
);
#[cfg(feature = "NSColor")]
#[method_id(@__retain_semantics Other interpolatedColorAtLocation:)]
pub unsafe fn interpolatedColorAtLocation(&self, location: CGFloat) -> Retained<NSColor>;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSGradient {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);

View File

@@ -0,0 +1,649 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
use objc2_foundation::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCompositingOperation(pub NSUInteger);
impl NSCompositingOperation {
#[doc(alias = "NSCompositingOperationClear")]
pub const Clear: Self = Self(0);
#[doc(alias = "NSCompositingOperationCopy")]
pub const Copy: Self = Self(1);
#[doc(alias = "NSCompositingOperationSourceOver")]
pub const SourceOver: Self = Self(2);
#[doc(alias = "NSCompositingOperationSourceIn")]
pub const SourceIn: Self = Self(3);
#[doc(alias = "NSCompositingOperationSourceOut")]
pub const SourceOut: Self = Self(4);
#[doc(alias = "NSCompositingOperationSourceAtop")]
pub const SourceAtop: Self = Self(5);
#[doc(alias = "NSCompositingOperationDestinationOver")]
pub const DestinationOver: Self = Self(6);
#[doc(alias = "NSCompositingOperationDestinationIn")]
pub const DestinationIn: Self = Self(7);
#[doc(alias = "NSCompositingOperationDestinationOut")]
pub const DestinationOut: Self = Self(8);
#[doc(alias = "NSCompositingOperationDestinationAtop")]
pub const DestinationAtop: Self = Self(9);
#[doc(alias = "NSCompositingOperationXOR")]
pub const XOR: Self = Self(10);
#[doc(alias = "NSCompositingOperationPlusDarker")]
pub const PlusDarker: Self = Self(11);
#[deprecated = "Use NSCompositingOperationSourceOver instead"]
#[doc(alias = "NSCompositingOperationHighlight")]
pub const Highlight: Self = Self(12);
#[doc(alias = "NSCompositingOperationPlusLighter")]
pub const PlusLighter: Self = Self(13);
#[doc(alias = "NSCompositingOperationMultiply")]
pub const Multiply: Self = Self(14);
#[doc(alias = "NSCompositingOperationScreen")]
pub const Screen: Self = Self(15);
#[doc(alias = "NSCompositingOperationOverlay")]
pub const Overlay: Self = Self(16);
#[doc(alias = "NSCompositingOperationDarken")]
pub const Darken: Self = Self(17);
#[doc(alias = "NSCompositingOperationLighten")]
pub const Lighten: Self = Self(18);
#[doc(alias = "NSCompositingOperationColorDodge")]
pub const ColorDodge: Self = Self(19);
#[doc(alias = "NSCompositingOperationColorBurn")]
pub const ColorBurn: Self = Self(20);
#[doc(alias = "NSCompositingOperationSoftLight")]
pub const SoftLight: Self = Self(21);
#[doc(alias = "NSCompositingOperationHardLight")]
pub const HardLight: Self = Self(22);
#[doc(alias = "NSCompositingOperationDifference")]
pub const Difference: Self = Self(23);
#[doc(alias = "NSCompositingOperationExclusion")]
pub const Exclusion: Self = Self(24);
#[doc(alias = "NSCompositingOperationHue")]
pub const Hue: Self = Self(25);
#[doc(alias = "NSCompositingOperationSaturation")]
pub const Saturation: Self = Self(26);
#[doc(alias = "NSCompositingOperationColor")]
pub const Color: Self = Self(27);
#[doc(alias = "NSCompositingOperationLuminosity")]
pub const Luminosity: Self = Self(28);
}
unsafe impl Encode for NSCompositingOperation {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSCompositingOperation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
pub static NSCompositeClear: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Clear.0);
pub static NSCompositeCopy: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Copy.0);
pub static NSCompositeSourceOver: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::SourceOver.0);
pub static NSCompositeSourceIn: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::SourceIn.0);
pub static NSCompositeSourceOut: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::SourceOut.0);
pub static NSCompositeSourceAtop: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::SourceAtop.0);
pub static NSCompositeDestinationOver: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::DestinationOver.0);
pub static NSCompositeDestinationIn: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::DestinationIn.0);
pub static NSCompositeDestinationOut: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::DestinationOut.0);
pub static NSCompositeDestinationAtop: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::DestinationAtop.0);
pub static NSCompositeXOR: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::XOR.0);
pub static NSCompositePlusDarker: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::PlusDarker.0);
pub static NSCompositeHighlight: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Highlight.0);
pub static NSCompositePlusLighter: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::PlusLighter.0);
pub static NSCompositeMultiply: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Multiply.0);
pub static NSCompositeScreen: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Screen.0);
pub static NSCompositeOverlay: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Overlay.0);
pub static NSCompositeDarken: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Darken.0);
pub static NSCompositeLighten: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Lighten.0);
pub static NSCompositeColorDodge: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::ColorDodge.0);
pub static NSCompositeColorBurn: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::ColorBurn.0);
pub static NSCompositeSoftLight: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::SoftLight.0);
pub static NSCompositeHardLight: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::HardLight.0);
pub static NSCompositeDifference: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Difference.0);
pub static NSCompositeExclusion: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Exclusion.0);
pub static NSCompositeHue: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Hue.0);
pub static NSCompositeSaturation: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Saturation.0);
pub static NSCompositeColor: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Color.0);
pub static NSCompositeLuminosity: NSCompositingOperation =
NSCompositingOperation(NSCompositingOperation::Luminosity.0);
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSBackingStoreType(pub NSUInteger);
impl NSBackingStoreType {
#[deprecated]
pub const NSBackingStoreRetained: Self = Self(0);
#[deprecated]
pub const NSBackingStoreNonretained: Self = Self(1);
pub const NSBackingStoreBuffered: Self = Self(2);
}
unsafe impl Encode for NSBackingStoreType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSBackingStoreType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWindowOrderingMode(pub NSInteger);
impl NSWindowOrderingMode {
pub const NSWindowAbove: Self = Self(1);
pub const NSWindowBelow: Self = Self(-1);
pub const NSWindowOut: Self = Self(0);
}
unsafe impl Encode for NSWindowOrderingMode {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSWindowOrderingMode {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFocusRingPlacement(pub NSUInteger);
impl NSFocusRingPlacement {
pub const NSFocusRingOnly: Self = Self(0);
pub const NSFocusRingBelow: Self = Self(1);
pub const NSFocusRingAbove: Self = Self(2);
}
unsafe impl Encode for NSFocusRingPlacement {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFocusRingPlacement {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSFocusRingType(pub NSUInteger);
impl NSFocusRingType {
#[doc(alias = "NSFocusRingTypeDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "NSFocusRingTypeNone")]
pub const None: Self = Self(1);
#[doc(alias = "NSFocusRingTypeExterior")]
pub const Exterior: Self = Self(2);
}
unsafe impl Encode for NSFocusRingType {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSFocusRingType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSColorRenderingIntent(pub NSInteger);
impl NSColorRenderingIntent {
#[doc(alias = "NSColorRenderingIntentDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "NSColorRenderingIntentAbsoluteColorimetric")]
pub const AbsoluteColorimetric: Self = Self(1);
#[doc(alias = "NSColorRenderingIntentRelativeColorimetric")]
pub const RelativeColorimetric: Self = Self(2);
#[doc(alias = "NSColorRenderingIntentPerceptual")]
pub const Perceptual: Self = Self(3);
#[doc(alias = "NSColorRenderingIntentSaturation")]
pub const Saturation: Self = Self(4);
}
unsafe impl Encode for NSColorRenderingIntent {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSColorRenderingIntent {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_TYPED_ENUM
pub type NSColorSpaceName = NSString;
extern "C" {
pub static NSCalibratedWhiteColorSpace: &'static NSColorSpaceName;
}
extern "C" {
pub static NSCalibratedRGBColorSpace: &'static NSColorSpaceName;
}
extern "C" {
pub static NSDeviceWhiteColorSpace: &'static NSColorSpaceName;
}
extern "C" {
pub static NSDeviceRGBColorSpace: &'static NSColorSpaceName;
}
extern "C" {
pub static NSDeviceCMYKColorSpace: &'static NSColorSpaceName;
}
extern "C" {
pub static NSNamedColorSpace: &'static NSColorSpaceName;
}
extern "C" {
pub static NSPatternColorSpace: &'static NSColorSpaceName;
}
extern "C" {
pub static NSCustomColorSpace: &'static NSColorSpaceName;
}
extern "C" {
pub static NSCalibratedBlackColorSpace: &'static NSColorSpaceName;
}
extern "C" {
pub static NSDeviceBlackColorSpace: &'static NSColorSpaceName;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSWindowDepth(pub i32);
impl NSWindowDepth {
#[doc(alias = "NSWindowDepthTwentyfourBitRGB")]
pub const TwentyfourBitRGB: Self = Self(0x208);
#[doc(alias = "NSWindowDepthSixtyfourBitRGB")]
pub const SixtyfourBitRGB: Self = Self(0x210);
#[doc(alias = "NSWindowDepthOnehundredtwentyeightBitRGB")]
pub const OnehundredtwentyeightBitRGB: Self = Self(0x220);
}
unsafe impl Encode for NSWindowDepth {
const ENCODING: Encoding = i32::ENCODING;
}
unsafe impl RefEncode for NSWindowDepth {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
pub fn NSBestDepth(
color_space: &NSColorSpaceName,
bps: NSInteger,
bpp: NSInteger,
planar: Bool,
exact_match: *mut Bool,
) -> NSWindowDepth;
}
extern "C" {
pub fn NSPlanarFromDepth(depth: NSWindowDepth) -> Bool;
}
extern "C" {
pub fn NSColorSpaceFromDepth(depth: NSWindowDepth) -> *mut NSColorSpaceName;
}
extern "C" {
pub fn NSBitsPerSampleFromDepth(depth: NSWindowDepth) -> NSInteger;
}
extern "C" {
pub fn NSBitsPerPixelFromDepth(depth: NSWindowDepth) -> NSInteger;
}
extern "C" {
pub fn NSNumberOfColorComponents(color_space_name: &NSColorSpaceName) -> NSInteger;
}
extern "C" {
pub fn NSAvailableWindowDepths() -> NonNull<NSWindowDepth>;
}
extern "C" {
pub static NSWhite: CGFloat;
}
extern "C" {
pub static NSLightGray: CGFloat;
}
extern "C" {
pub static NSDarkGray: CGFloat;
}
extern "C" {
pub static NSBlack: CGFloat;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSDisplayGamut(pub NSInteger);
impl NSDisplayGamut {
#[doc(alias = "NSDisplayGamutSRGB")]
pub const SRGB: Self = Self(1);
#[doc(alias = "NSDisplayGamutP3")]
pub const P3: Self = Self(2);
}
unsafe impl Encode for NSDisplayGamut {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSDisplayGamut {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
// NS_TYPED_EXTENSIBLE_ENUM
pub type NSDeviceDescriptionKey = NSString;
extern "C" {
pub static NSDeviceResolution: &'static NSDeviceDescriptionKey;
}
extern "C" {
pub static NSDeviceColorSpaceName: &'static NSDeviceDescriptionKey;
}
extern "C" {
pub static NSDeviceBitsPerSample: &'static NSDeviceDescriptionKey;
}
extern "C" {
pub static NSDeviceIsScreen: &'static NSDeviceDescriptionKey;
}
extern "C" {
pub static NSDeviceIsPrinter: &'static NSDeviceDescriptionKey;
}
extern "C" {
pub static NSDeviceSize: &'static NSDeviceDescriptionKey;
}
extern "C" {
pub fn NSRectFill(rect: NSRect);
}
extern "C" {
pub fn NSRectFillList(rects: NonNull<NSRect>, count: NSInteger);
}
extern "C" {
pub fn NSRectFillListWithGrays(rects: NonNull<NSRect>, grays: NonNull<CGFloat>, num: NSInteger);
}
extern "C" {
#[cfg(feature = "NSColor")]
pub fn NSRectFillListWithColors(
rects: NonNull<NSRect>,
colors: NonNull<NonNull<NSColor>>,
num: NSInteger,
);
}
extern "C" {
pub fn NSRectFillUsingOperation(rect: NSRect, op: NSCompositingOperation);
}
extern "C" {
pub fn NSRectFillListUsingOperation(
rects: NonNull<NSRect>,
count: NSInteger,
op: NSCompositingOperation,
);
}
extern "C" {
#[cfg(feature = "NSColor")]
pub fn NSRectFillListWithColorsUsingOperation(
rects: NonNull<NSRect>,
colors: NonNull<NonNull<NSColor>>,
num: NSInteger,
op: NSCompositingOperation,
);
}
extern "C" {
pub fn NSFrameRect(rect: NSRect);
}
extern "C" {
pub fn NSFrameRectWithWidth(rect: NSRect, frame_width: CGFloat);
}
extern "C" {
pub fn NSFrameRectWithWidthUsingOperation(
rect: NSRect,
frame_width: CGFloat,
op: NSCompositingOperation,
);
}
extern "C" {
pub fn NSRectClip(rect: NSRect);
}
extern "C" {
pub fn NSRectClipList(rects: NonNull<NSRect>, count: NSInteger);
}
extern "C" {
pub fn NSDrawTiledRects(
bounds_rect: NSRect,
clip_rect: NSRect,
sides: NonNull<NSRectEdge>,
grays: NonNull<CGFloat>,
count: NSInteger,
) -> NSRect;
}
extern "C" {
pub fn NSDrawGrayBezel(rect: NSRect, clip_rect: NSRect);
}
extern "C" {
pub fn NSDrawGroove(rect: NSRect, clip_rect: NSRect);
}
extern "C" {
pub fn NSDrawWhiteBezel(rect: NSRect, clip_rect: NSRect);
}
extern "C" {
pub fn NSDrawButton(rect: NSRect, clip_rect: NSRect);
}
extern "C" {
pub fn NSEraseRect(rect: NSRect);
}
extern "C" {
#[cfg(feature = "NSColor")]
#[deprecated = "Use -[NSBitmapImageRep colorAtX:y:] to interrogate pixel values. If necessary, use -[NSView cacheDisplayInRect:toBitmapImageRep:] to snapshot a view hierarchy into an NSBitmapImageRep."]
pub fn NSReadPixel(passed_point: NSPoint) -> *mut NSColor;
}
extern "C" {
#[deprecated]
pub fn NSHighlightRect(rect: NSRect);
}
extern "C" {
pub fn NSBeep();
}
extern "C" {
#[deprecated = "Doesn't return anything useful since 10.0"]
pub fn NSGetWindowServerMemory(
context: NSInteger,
virtual_memory: NonNull<NSInteger>,
window_backing_memory: NonNull<NSInteger>,
window_dump_string: NonNull<NonNull<NSString>>,
) -> NSInteger;
}
extern "C" {
#[cfg(feature = "NSColor")]
pub fn NSDrawColorTiledRects(
bounds_rect: NSRect,
clip_rect: NSRect,
sides: NonNull<NSRectEdge>,
colors: NonNull<NonNull<NSColor>>,
count: NSInteger,
) -> NSRect;
}
extern "C" {
pub fn NSDrawDarkBezel(rect: NSRect, clip_rect: NSRect);
}
extern "C" {
pub fn NSDrawLightBezel(rect: NSRect, clip_rect: NSRect);
}
extern "C" {
pub fn NSDottedFrameRect(rect: NSRect);
}
extern "C" {
pub fn NSDrawWindowBackground(rect: NSRect);
}
extern "C" {
pub fn NSSetFocusRingStyle(placement: NSFocusRingPlacement);
}
extern "C" {
#[deprecated = "As of 10.11 it is not generally necessary to take explicit action to achieve visual atomicity. +[NSAnimationContext runAnimationGroup:] and other similar methods can be used when a stronger than normal need for visual atomicity is required. The NSAnimationContext methods do not suffer from the same performance problems as NSDisableScreenUpdates."]
pub fn NSDisableScreenUpdates();
}
extern "C" {
#[deprecated = "As of 10.11 it is not generally necessary to take explicit action to achieve visual atomicity. +[NSAnimationContext runAnimationGroup:] and other similar methods can be used when a stronger than normal need for visual atomicity is required. The NSAnimationContext methods do not suffer from the same performance problems as NSEnableScreenUpdates."]
pub fn NSEnableScreenUpdates();
}
// NS_ENUM
#[deprecated = "Use +[NSCursor disappearingItemCursor] instead"]
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSAnimationEffect(pub NSUInteger);
impl NSAnimationEffect {
#[doc(alias = "NSAnimationEffectDisappearingItemDefault")]
pub const DisappearingItemDefault: Self = Self(0);
#[doc(alias = "NSAnimationEffectPoof")]
pub const Poof: Self = Self(10);
}
unsafe impl Encode for NSAnimationEffect {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSAnimationEffect {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern "C" {
#[deprecated = "Use +[NSCursor disappearingItemCursor] instead"]
pub fn NSShowAnimationEffect(
animation_effect: NSAnimationEffect,
center_location: NSPoint,
size: NSSize,
animation_delegate: Option<&AnyObject>,
did_end_selector: Option<Sel>,
context_info: *mut c_void,
);
}
extern "C" {
#[deprecated = "Use +[NSWindow windowNumbersWithOptions:] instead"]
pub fn NSCountWindows(count: NonNull<NSInteger>);
}
extern "C" {
#[deprecated = "Use +[NSWindow windowNumbersWithOptions:] instead"]
pub fn NSWindowList(size: NSInteger, list: NonNull<NSInteger>);
}
extern "C" {
#[deprecated = "Use +[NSWindow windowNumbersWithOptions:] instead"]
pub fn NSCountWindowsForContext(context: NSInteger, count: NonNull<NSInteger>);
}
extern "C" {
#[deprecated = "Use +[NSWindow windowNumbersWithOptions:] instead"]
pub fn NSWindowListForContext(context: NSInteger, size: NSInteger, list: NonNull<NSInteger>);
}
extern "C" {
#[deprecated]
pub fn NSCopyBits(src_g_state: NSInteger, src_rect: NSRect, dest_point: NSPoint);
}

View File

@@ -0,0 +1,214 @@
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
use objc2_core_image::*;
use objc2_foundation::*;
use crate::*;
// NS_TYPED_ENUM
pub type NSGraphicsContextAttributeKey = NSString;
extern "C" {
pub static NSGraphicsContextDestinationAttributeName: &'static NSGraphicsContextAttributeKey;
}
extern "C" {
pub static NSGraphicsContextRepresentationFormatAttributeName:
&'static NSGraphicsContextAttributeKey;
}
// NS_TYPED_ENUM
pub type NSGraphicsContextRepresentationFormatName = NSString;
extern "C" {
pub static NSGraphicsContextPSFormat: &'static NSGraphicsContextRepresentationFormatName;
}
extern "C" {
pub static NSGraphicsContextPDFFormat: &'static NSGraphicsContextRepresentationFormatName;
}
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSImageInterpolation(pub NSUInteger);
impl NSImageInterpolation {
#[doc(alias = "NSImageInterpolationDefault")]
pub const Default: Self = Self(0);
#[doc(alias = "NSImageInterpolationNone")]
pub const None: Self = Self(1);
#[doc(alias = "NSImageInterpolationLow")]
pub const Low: Self = Self(2);
#[doc(alias = "NSImageInterpolationMedium")]
pub const Medium: Self = Self(4);
#[doc(alias = "NSImageInterpolationHigh")]
pub const High: Self = Self(3);
}
unsafe impl Encode for NSImageInterpolation {
const ENCODING: Encoding = NSUInteger::ENCODING;
}
unsafe impl RefEncode for NSImageInterpolation {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSGraphicsContext;
unsafe impl ClassType for NSGraphicsContext {
type Super = NSObject;
type Mutability = InteriorMutable;
}
);
unsafe impl NSObjectProtocol for NSGraphicsContext {}
extern_methods!(
unsafe impl NSGraphicsContext {
#[method_id(@__retain_semantics Other graphicsContextWithAttributes:)]
pub unsafe fn graphicsContextWithAttributes(
attributes: &NSDictionary<NSGraphicsContextAttributeKey, AnyObject>,
) -> Option<Retained<NSGraphicsContext>>;
#[cfg(all(feature = "NSResponder", feature = "NSWindow"))]
#[method_id(@__retain_semantics Other graphicsContextWithWindow:)]
pub unsafe fn graphicsContextWithWindow(window: &NSWindow) -> Retained<NSGraphicsContext>;
#[cfg(all(feature = "NSBitmapImageRep", feature = "NSImageRep"))]
#[method_id(@__retain_semantics Other graphicsContextWithBitmapImageRep:)]
pub unsafe fn graphicsContextWithBitmapImageRep(
bitmap_rep: &NSBitmapImageRep,
) -> Option<Retained<NSGraphicsContext>>;
#[method_id(@__retain_semantics Other currentContext)]
pub unsafe fn currentContext() -> Option<Retained<NSGraphicsContext>>;
#[method(setCurrentContext:)]
pub unsafe fn setCurrentContext(current_context: Option<&NSGraphicsContext>);
#[method(currentContextDrawingToScreen)]
pub unsafe fn currentContextDrawingToScreen() -> bool;
#[method(saveGraphicsState)]
pub unsafe fn saveGraphicsState_class();
#[method(restoreGraphicsState)]
pub unsafe fn restoreGraphicsState_class();
#[method_id(@__retain_semantics Other attributes)]
pub unsafe fn attributes(
&self,
) -> Option<Retained<NSDictionary<NSGraphicsContextAttributeKey, AnyObject>>>;
#[method(isDrawingToScreen)]
pub unsafe fn isDrawingToScreen(&self) -> bool;
#[method(saveGraphicsState)]
pub unsafe fn saveGraphicsState(&self);
#[method(restoreGraphicsState)]
pub unsafe fn restoreGraphicsState(&self);
#[method(flushGraphics)]
pub unsafe fn flushGraphics(&self);
#[method(isFlipped)]
pub unsafe fn isFlipped(&self) -> bool;
}
);
extern_methods!(
/// Methods declared on superclass `NSObject`
unsafe impl NSGraphicsContext {
#[method_id(@__retain_semantics Init init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[method_id(@__retain_semantics New new)]
pub unsafe fn new() -> Retained<Self>;
}
);
extern_methods!(
/// NSGraphicsContext_RenderingOptions
unsafe impl NSGraphicsContext {
#[method(shouldAntialias)]
pub unsafe fn shouldAntialias(&self) -> bool;
#[method(setShouldAntialias:)]
pub unsafe fn setShouldAntialias(&self, should_antialias: bool);
#[method(imageInterpolation)]
pub unsafe fn imageInterpolation(&self) -> NSImageInterpolation;
#[method(setImageInterpolation:)]
pub unsafe fn setImageInterpolation(&self, image_interpolation: NSImageInterpolation);
#[method(patternPhase)]
pub unsafe fn patternPhase(&self) -> NSPoint;
#[method(setPatternPhase:)]
pub unsafe fn setPatternPhase(&self, pattern_phase: NSPoint);
#[cfg(feature = "NSGraphics")]
#[method(compositingOperation)]
pub unsafe fn compositingOperation(&self) -> NSCompositingOperation;
#[cfg(feature = "NSGraphics")]
#[method(setCompositingOperation:)]
pub unsafe fn setCompositingOperation(&self, compositing_operation: NSCompositingOperation);
#[cfg(feature = "NSGraphics")]
#[method(colorRenderingIntent)]
pub unsafe fn colorRenderingIntent(&self) -> NSColorRenderingIntent;
#[cfg(feature = "NSGraphics")]
#[method(setColorRenderingIntent:)]
pub unsafe fn setColorRenderingIntent(
&self,
color_rendering_intent: NSColorRenderingIntent,
);
}
);
extern_methods!(
/// NSQuartzCoreAdditions
unsafe impl NSGraphicsContext {
#[cfg(feature = "objc2-core-image")]
#[cfg(target_vendor = "apple")]
#[method_id(@__retain_semantics Other CIContext)]
pub unsafe fn CIContext(&self) -> Option<Retained<CIContext>>;
}
);
extern_methods!(
/// NSGraphicsContextDeprecated
unsafe impl NSGraphicsContext {
#[deprecated = "This method has no effect"]
#[method(setGraphicsState:)]
pub unsafe fn setGraphicsState(g_state: NSInteger);
#[deprecated]
#[method_id(@__retain_semantics Other focusStack)]
pub unsafe fn focusStack(&self) -> Option<Retained<AnyObject>>;
#[deprecated]
#[method(setFocusStack:)]
pub unsafe fn setFocusStack(&self, stack: Option<&AnyObject>);
#[deprecated]
#[method_id(@__retain_semantics Other graphicsContextWithGraphicsPort:flipped:)]
pub unsafe fn graphicsContextWithGraphicsPort_flipped(
graphics_port: NonNull<c_void>,
initial_flipped_state: bool,
) -> Retained<NSGraphicsContext>;
#[deprecated]
#[method(graphicsPort)]
pub unsafe fn graphicsPort(&self) -> NonNull<c_void>;
}
);

Some files were not shown because too many files have changed in this diff Show More