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