objc2-virtualization 0.3.2

Bindings to the Virtualization framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ffi::*;
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
#[cfg(feature = "objc2-app-kit")]
use objc2_app_kit::*;
use objc2_foundation::*;

use crate::*;

extern_class!(
    /// Configuration for a display attached to a Mac graphics device.
    ///
    /// This display can be shown in a VZVirtualMachineView.
    ///
    /// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzmacgraphicsdisplayconfiguration?language=objc)
    #[unsafe(super(VZGraphicsDisplayConfiguration, NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    #[cfg(feature = "VZGraphicsDisplayConfiguration")]
    pub struct VZMacGraphicsDisplayConfiguration;
);

#[cfg(feature = "VZGraphicsDisplayConfiguration")]
extern_conformance!(
    unsafe impl NSCopying for VZMacGraphicsDisplayConfiguration {}
);

#[cfg(feature = "VZGraphicsDisplayConfiguration")]
unsafe impl CopyingHelper for VZMacGraphicsDisplayConfiguration {
    type Result = Self;
}

#[cfg(feature = "VZGraphicsDisplayConfiguration")]
extern_conformance!(
    unsafe impl NSObjectProtocol for VZMacGraphicsDisplayConfiguration {}
);

#[cfg(feature = "VZGraphicsDisplayConfiguration")]
impl VZMacGraphicsDisplayConfiguration {
    extern_methods!(
        /// Create a display configuration with the specified pixel dimensions and pixel density.
        ///
        /// Parameter `widthInPixels`: The width of the display, in pixels.
        ///
        /// Parameter `heightInPixels`: The height of the display, in pixels.
        ///
        /// Parameter `pixelsPerInch`: The pixel density as a number of pixels per inch.
        #[unsafe(method(initWithWidthInPixels:heightInPixels:pixelsPerInch:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithWidthInPixels_heightInPixels_pixelsPerInch(
            this: Allocated<Self>,
            width_in_pixels: NSInteger,
            height_in_pixels: NSInteger,
            pixels_per_inch: NSInteger,
        ) -> Retained<Self>;

        #[cfg(feature = "objc2-app-kit")]
        /// Create a display configuration suitable for showing on the specified screen.
        ///
        /// Parameter `screen`: The screen on which you intend to present the VZVirtualMachineView for the display.
        ///
        /// Parameter `sizeInPoints`: The intended logical size of the display.
        ///
        /// The pixel dimensions and pixel density will be initialized based on the specified screen and
        /// size. Note: an instance of macOS running in the virtual machine may not necessarily provide
        /// a display mode with a backing scale factor matching the specified screen.
        #[unsafe(method(initForScreen:sizeInPoints:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initForScreen_sizeInPoints(
            this: Allocated<Self>,
            screen: &NSScreen,
            size_in_points: NSSize,
        ) -> Retained<Self>;

        /// The width of the display, in pixels.
        #[unsafe(method(widthInPixels))]
        #[unsafe(method_family = none)]
        pub unsafe fn widthInPixels(&self) -> NSInteger;

        /// Setter for [`widthInPixels`][Self::widthInPixels].
        #[unsafe(method(setWidthInPixels:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setWidthInPixels(&self, width_in_pixels: NSInteger);

        /// The height of the display, in pixels.
        #[unsafe(method(heightInPixels))]
        #[unsafe(method_family = none)]
        pub unsafe fn heightInPixels(&self) -> NSInteger;

        /// Setter for [`heightInPixels`][Self::heightInPixels].
        #[unsafe(method(setHeightInPixels:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setHeightInPixels(&self, height_in_pixels: NSInteger);

        /// The pixel density as a number of pixels per inch.
        #[unsafe(method(pixelsPerInch))]
        #[unsafe(method_family = none)]
        pub unsafe fn pixelsPerInch(&self) -> NSInteger;

        /// Setter for [`pixelsPerInch`][Self::pixelsPerInch].
        #[unsafe(method(setPixelsPerInch:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setPixelsPerInch(&self, pixels_per_inch: NSInteger);
    );
}

/// Methods declared on superclass `VZGraphicsDisplayConfiguration`.
#[cfg(feature = "VZGraphicsDisplayConfiguration")]
impl VZMacGraphicsDisplayConfiguration {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
    );
}