1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
//! 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-core-foundation")]
use objc2_core_foundation::*;
use objc2_foundation::*;
use crate::*;
extern_class!(
/// Class representing a graphics display in a virtual machine.
///
/// VZGraphicsDisplay should not be instantiated directly.
///
/// Graphics displays are first configured on a VZGraphicsDeviceConfiguration subclass.
/// When a VZVirtualMachine is created from the configuration, the displays
/// are available through the VZGraphicsDevice's `displays` property.
///
///
/// See: VZMacGraphicsDisplayConfiguration
///
/// See: VZVirtioGraphicsScanoutConfiguration
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzgraphicsdisplay?language=objc)
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct VZGraphicsDisplay;
);
extern_conformance!(
unsafe impl NSObjectProtocol for VZGraphicsDisplay {}
);
impl VZGraphicsDisplay {
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>;
#[cfg(feature = "objc2-core-foundation")]
/// The size of the display, in pixels.
#[unsafe(method(sizeInPixels))]
#[unsafe(method_family = none)]
pub unsafe fn sizeInPixels(&self) -> CGSize;
#[cfg(feature = "objc2-core-foundation")]
/// Resize this display.
///
/// Parameter `sizeInPixels`: New display width and height in pixels.
///
/// Parameter `error`: If not nil, assigned with an error describing why the new size is not valid.
///
/// Returns: YES if the resize is successful, NO otherwise.
///
/// If successful, the new size will be passed to the guest but the guest may or may
/// not respond to the new size. The guest not using the size does not return an error.
///
/// Reconfiguration triggers a display state change which can be tracked by VZGraphicsDisplayObservers.
#[unsafe(method(reconfigureWithSizeInPixels:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn reconfigureWithSizeInPixels_error(
&self,
size_in_pixels: CGSize,
) -> Result<(), Retained<NSError>>;
#[cfg(feature = "VZGraphicsDisplayConfiguration")]
/// Reconfigure this display.
///
/// Parameter `configuration`: New display configuration.
///
/// Parameter `error`: If not nil, assigned with an error describing why the new configuration is not valid.
///
/// Returns: YES if the reconfiguration is successful, NO otherwise.
///
/// The type of the configuration must match the corresponding type that caused this display to be created.
///
/// If successful, the new configuration will be passed to the guest but the guest may or may
/// not respond to parts of the configuration. The guest not using the new configuration does not
/// return an error.
///
/// Reconfiguration triggers a display state change which can be tracked by VZGraphicsDisplayObservers.
#[unsafe(method(reconfigureWithConfiguration:error:_))]
#[unsafe(method_family = none)]
pub unsafe fn reconfigureWithConfiguration_error(
&self,
configuration: &VZGraphicsDisplayConfiguration,
) -> Result<(), Retained<NSError>>;
/// Add an observer.
///
/// Parameter `observer`: The new observer to be notified of display state changes.
#[unsafe(method(addObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn addObserver(&self, observer: &ProtocolObject<dyn VZGraphicsDisplayObserver>);
/// Remove an observer.
///
/// Parameter `observer`: The observer to be removed.
#[unsafe(method(removeObserver:))]
#[unsafe(method_family = none)]
pub unsafe fn removeObserver(
&self,
observer: &ProtocolObject<dyn VZGraphicsDisplayObserver>,
);
);
}
extern_protocol!(
/// VZGraphicsDisplayObserver observes a VZGraphicsDisplay for state changes.
///
/// See also [Apple's documentation](https://developer.apple.com/documentation/virtualization/vzgraphicsdisplayobserver?language=objc)
pub unsafe trait VZGraphicsDisplayObserver: NSObjectProtocol {
/// A reconfiguration operation has begun.
///
/// A configuration change, such as a resize, has been issued and new frames are expected with a new size or configuration.
/// This method will be invoked on the virtual machine's queue.
///
/// Parameter `display`: The display whose state is changing.
#[optional]
#[unsafe(method(displayDidBeginReconfiguration:))]
#[unsafe(method_family = none)]
unsafe fn displayDidBeginReconfiguration(&self, display: &VZGraphicsDisplay);
/// A reconfiguration operation has ended.
///
/// Frame updates have arrived at the most recently requested display size and configuration.
/// This method will be invoked on the virtual machine's queue.
///
/// Parameter `display`: The display whose state is changing.
#[optional]
#[unsafe(method(displayDidEndReconfiguration:))]
#[unsafe(method_family = none)]
unsafe fn displayDidEndReconfiguration(&self, display: &VZGraphicsDisplay);
}
);