From e3a77bfee43dbfb5a03cd88d7cde50ca0fd3202e Mon Sep 17 00:00:00 2001 From: Alexander Polakov Date: Sun, 26 Feb 2023 14:52:50 +0400 Subject: [PATCH] cocoa: add NSAppearance --- cocoa/src/appkit.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/cocoa/src/appkit.rs b/cocoa/src/appkit.rs index 7770263..bac30c1 100644 --- a/cocoa/src/appkit.rs +++ b/cocoa/src/appkit.rs @@ -1275,6 +1275,7 @@ pub trait NSWindow: Sized { unsafe fn setMiniwindowImage_(self, miniwindowImage: id); unsafe fn miniwindowTitle(self) -> id; unsafe fn setMiniwindowTitle_(self, miniwindowTitle: id); + unsafe fn setAppearance(self, appearance: id); // TODO: Getting the Dock Tile // TODO: Printing Windows @@ -1955,6 +1956,10 @@ impl NSWindow for id { msg_send![self, setMiniwindowTitle:miniwindowTitle] } + unsafe fn setAppearance(self, appearance: id) { + msg_send![self, setAppearance: appearance] + } + // TODO: Getting the Dock Tile // TODO: Printing Windows // TODO: Providing Services @@ -2119,6 +2124,7 @@ pub trait NSView: Sized { unsafe fn layerContentsPlacement(self) -> NSViewLayerContentsPlacement; unsafe fn setLayerContentsPlacement(self, placement: NSViewLayerContentsPlacement); + unsafe fn setAppearance(self, appearance: id); } impl NSView for id { @@ -2209,6 +2215,10 @@ impl NSView for id { unsafe fn setLayerContentsPlacement(self, placement: NSViewLayerContentsPlacement) { msg_send![self, setLayerContentsPlacement: placement] } + + unsafe fn setAppearance(self, appearance: id) { + msg_send![self, setAppearance: appearance] + } } pub type NSAutoresizingMaskOptions = u64; @@ -4648,6 +4658,10 @@ impl NSDockTile for id { } } +pub unsafe fn NSAppearance(named: id /* NSAppearanceName */) -> id { + objc::msg_send![class!(NSAppearance), appearanceNamed: named] +} + #[cfg(test)] mod test { use super::*;