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
51unsafe impl NSObjectProtocol for NSMediaLibraryBrowserController {}
52
53impl NSMediaLibraryBrowserController {
54    extern_methods!(
55        #[unsafe(method(sharedMediaLibraryBrowserController))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn sharedMediaLibraryBrowserController(
58        ) -> Retained<NSMediaLibraryBrowserController>;
59
60        #[unsafe(method(isVisible))]
61        #[unsafe(method_family = none)]
62        pub unsafe fn isVisible(&self) -> bool;
63
64        /// Setter for [`isVisible`][Self::isVisible].
65        #[unsafe(method(setVisible:))]
66        #[unsafe(method_family = none)]
67        pub unsafe fn setVisible(&self, visible: bool);
68
69        #[unsafe(method(frame))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn frame(&self) -> NSRect;
72
73        /// Setter for [`frame`][Self::frame].
74        #[unsafe(method(setFrame:))]
75        #[unsafe(method_family = none)]
76        pub unsafe fn setFrame(&self, frame: NSRect);
77
78        #[unsafe(method(mediaLibraries))]
79        #[unsafe(method_family = none)]
80        pub unsafe fn mediaLibraries(&self) -> NSMediaLibrary;
81
82        /// Setter for [`mediaLibraries`][Self::mediaLibraries].
83        #[unsafe(method(setMediaLibraries:))]
84        #[unsafe(method_family = none)]
85        pub unsafe fn setMediaLibraries(&self, media_libraries: NSMediaLibrary);
86
87        #[unsafe(method(togglePanel:))]
88        #[unsafe(method_family = none)]
89        pub unsafe fn togglePanel(&self, sender: Option<&AnyObject>);
90    );
91}
92
93/// Methods declared on superclass `NSObject`.
94impl NSMediaLibraryBrowserController {
95    extern_methods!(
96        #[unsafe(method(init))]
97        #[unsafe(method_family = init)]
98        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
99
100        #[unsafe(method(new))]
101        #[unsafe(method_family = new)]
102        pub unsafe fn new() -> Retained<Self>;
103    );
104}