NSVisualEffectView

Trait NSVisualEffectView 

Source
pub trait NSVisualEffectView: Sized {
Show 14 methods // Required methods unsafe fn init(self) -> id; unsafe fn initWithFrame_(self, frameRect: NSRect) -> id; unsafe fn bounds(self) -> NSRect; unsafe fn frame(self) -> NSRect; unsafe fn setFrameSize(self, frameSize: NSSize); unsafe fn setFrameOrigin(self, frameOrigin: NSPoint); unsafe fn superview(self) -> id; unsafe fn removeFromSuperview(self); unsafe fn isEmphasized(self) -> BOOL; unsafe fn setEmphasized_(self, emphasized: BOOL); unsafe fn setMaterial_(self, material: NSVisualEffectMaterial); unsafe fn setState_(self, state: NSVisualEffectState); unsafe fn setBlendingMode_(self, mode: NSVisualEffectBlendingMode); // Provided method unsafe fn alloc(_: Self) -> id { ... }
}
๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead

Required Methodsยง

Source

unsafe fn init(self) -> id

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn initWithFrame_(self, frameRect: NSRect) -> id

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn bounds(self) -> NSRect

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn frame(self) -> NSRect

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn setFrameSize(self, frameSize: NSSize)

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn setFrameOrigin(self, frameOrigin: NSPoint)

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn superview(self) -> id

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn removeFromSuperview(self)

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn isEmphasized(self) -> BOOL

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn setEmphasized_(self, emphasized: BOOL)

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn setMaterial_(self, material: NSVisualEffectMaterial)

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn setState_(self, state: NSVisualEffectState)

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Source

unsafe fn setBlendingMode_(self, mode: NSVisualEffectBlendingMode)

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead

Provided Methodsยง

Source

unsafe fn alloc(_: Self) -> id

๐Ÿ‘ŽDeprecated: use the objc2-app-kit crate instead
Examples found in repository?
examples/nsvisualeffectview_blur.rs (line 66)
13fn main() {
14    unsafe {
15        // Create the app.
16        let _pool = NSAutoreleasePool::new(nil);
17
18        let app = NSApp();
19        app.setActivationPolicy_(NSApplicationActivationPolicyRegular);
20
21        // create Menu Bar
22        let menubar = NSMenu::new(nil).autorelease();
23        let app_menu_item = NSMenuItem::new(nil).autorelease();
24        menubar.addItem_(app_menu_item);
25        app.setMainMenu_(menubar);
26
27        // create Application menu
28        let app_menu = NSMenu::new(nil).autorelease();
29        let quit_prefix = NSString::alloc(nil).init_str("Quit ");
30        let quit_title =
31            quit_prefix.stringByAppendingString_(NSProcessInfo::processInfo(nil).processName());
32        let quit_action = selector("terminate:");
33        let quit_key = NSString::alloc(nil).init_str("q");
34        let quit_item = NSMenuItem::alloc(nil)
35            .initWithTitle_action_keyEquivalent_(quit_title, quit_action, quit_key)
36            .autorelease();
37        app_menu.addItem_(quit_item);
38        app_menu_item.setSubmenu_(app_menu);
39
40        // Create some colors
41        let clear = NSColor::clearColor(nil);
42
43        // Create windows with different color types.
44        let window = NSWindow::alloc(nil)
45            .initWithContentRect_styleMask_backing_defer_(
46                NSRect::new(NSPoint::new(0., 0.), NSSize::new(200., 200.)),
47                NSWindowStyleMask::NSTitledWindowMask
48                    | NSWindowStyleMask::NSClosableWindowMask
49                    | NSWindowStyleMask::NSResizableWindowMask
50                    | NSWindowStyleMask::NSMiniaturizableWindowMask
51                    | NSWindowStyleMask::NSUnifiedTitleAndToolbarWindowMask,
52                NSBackingStoreType::NSBackingStoreBuffered,
53                NO,
54            )
55            .autorelease();
56
57        window.cascadeTopLeftFromPoint_(NSPoint::new(20., 20.));
58        window.setTitle_(NSString::alloc(nil).init_str("NSVisualEffectView_blur"));
59        window.setBackgroundColor_(clear);
60        window.makeKeyAndOrderFront_(nil);
61
62        //NSVisualEffectView blur
63        let ns_view = window.contentView();
64        let bounds = NSView::bounds(ns_view);
65        let blurred_view =
66            NSVisualEffectView::initWithFrame_(NSVisualEffectView::alloc(nil), bounds);
67        blurred_view.autorelease();
68
69        blurred_view.setMaterial_(NSVisualEffectMaterial::HudWindow);
70        blurred_view.setBlendingMode_(NSVisualEffectBlendingMode::BehindWindow);
71        blurred_view.setState_(NSVisualEffectState::FollowsWindowActiveState);
72        blurred_view.setAutoresizingMask_(NSViewWidthSizable | NSViewHeightSizable);
73
74        let _: () = msg_send![ns_view, addSubview: blurred_view positioned: NSWindowOrderingMode::NSWindowBelow relativeTo: 0];
75
76        app.run();
77    }
78}

Dyn Compatibilityยง

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementorsยง