objc2_app_kit/generated/
NSMediaLibraryBrowserController.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// This type is used to configure a media browser for individual media types.
11///
12/// Warning: Though this type is declared as a set of mixable options -- and was originally intended to become that eventually -- you should treat it as an enum.
13///
14/// Warning: In other words, this type should be declared with NS_ENUM rather than NS_OPTIONS, but the latter has historical inertia not worth struggling against.
15///
16/// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmedialibrary?language=objc)
17// NS_OPTIONS
18#[repr(transparent)]
19#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
20pub struct NSMediaLibrary(pub NSUInteger);
21bitflags::bitflags! {
22    impl NSMediaLibrary: NSUInteger {
23        #[doc(alias = "NSMediaLibraryAudio")]
24        const Audio = 1<<0;
25        #[doc(alias = "NSMediaLibraryImage")]
26        const Image = 1<<1;
27        #[doc(alias = "NSMediaLibraryMovie")]
28        const Movie = 1<<2;
29    }
30}
31
32unsafe impl Encode for NSMediaLibrary {
33    const ENCODING: Encoding = NSUInteger::ENCODING;
34}
35
36unsafe impl RefEncode for NSMediaLibrary {
37    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
38}
39
40extern_class!(
41    /// This class configures and displays a media browser panel.
42    ///
43    /// This class provides no direct access to the panel, and its meaningful contents aren't in the calling process.
44    ///
45    /// See also [Apple's documentation](https://developer.apple.com/documentation/appkit/nsmedialibrarybrowsercontroller?language=objc)
46    #[unsafe(super(NSObject))]
47    #[derive(Debug, PartialEq, Eq, Hash)]
48    pub struct NSMediaLibraryBrowserController;
49);
50
51extern_conformance!(
52    unsafe impl NSObjectProtocol for NSMediaLibraryBrowserController {}
53);
54
55impl NSMediaLibraryBrowserController {
56    extern_methods!(
57        #[unsafe(method(sharedMediaLibraryBrowserController))]
58        #[unsafe(method_family = none)]
59        pub fn sharedMediaLibraryBrowserController() -> Retained<NSMediaLibraryBrowserController>;
60
61        #[unsafe(method(isVisible))]
62        #[unsafe(method_family = none)]
63        pub fn isVisible(&self) -> bool;
64
65        /// Setter for [`isVisible`][Self::isVisible].
66        #[unsafe(method(setVisible:))]
67        #[unsafe(method_family = none)]
68        pub fn setVisible(&self, visible: bool);
69
70        #[unsafe(method(frame))]
71        #[unsafe(method_family = none)]
72        pub fn frame(&self) -> NSRect;
73
74        /// Setter for [`frame`][Self::frame].
75        #[unsafe(method(setFrame:))]
76        #[unsafe(method_family = none)]
77        pub fn setFrame(&self, frame: NSRect);
78
79        #[unsafe(method(mediaLibraries))]
80        #[unsafe(method_family = none)]
81        pub fn mediaLibraries(&self) -> NSMediaLibrary;
82
83        /// Setter for [`mediaLibraries`][Self::mediaLibraries].
84        #[unsafe(method(setMediaLibraries:))]
85        #[unsafe(method_family = none)]
86        pub fn setMediaLibraries(&self, media_libraries: NSMediaLibrary);
87
88        /// # Safety
89        ///
90        /// `sender` should be of the correct type.
91        #[unsafe(method(togglePanel:))]
92        #[unsafe(method_family = none)]
93        pub unsafe fn togglePanel(&self, sender: Option<&AnyObject>);
94    );
95}
96
97/// Methods declared on superclass `NSObject`.
98impl NSMediaLibraryBrowserController {
99    extern_methods!(
100        #[unsafe(method(init))]
101        #[unsafe(method_family = init)]
102        pub fn init(this: Allocated<Self>) -> Retained<Self>;
103
104        #[unsafe(method(new))]
105        #[unsafe(method_family = new)]
106        pub fn new() -> Retained<Self>;
107    );
108}
109
110impl DefaultRetained for NSMediaLibraryBrowserController {
111    #[inline]
112    fn default_retained() -> Retained<Self> {
113        Self::new()
114    }
115}