osx - How to show a NSWindow (not fullscreen) and turn all the rest of the screen darker Xcode5 cocoa -
I am developing an app for Xcode5 for MacOSX which runs in the fullscreen app
I show some NSWindowControllers required times for which will help to focus on not
and I need to deepen their background so that the user critical information in fullscreen as other NSWindowControllers Could I, the NSWWO Contro Looking for a way to modify the shadow of R but I could not find anything, I'm not sure how to get it:
Current window:
desired effect
This is the code used to open my NSWindowController:
< pre> - (IBAction) showMyNSWindowController: (id) sender {if (! _myNSWindowController) {_myNSWindowController = [[MyNSWindowController alloc] initWi ThWindowNibName: @ "MyNSWindowController"]; [_myNSWindowController.window setback color: NSColor.whiteColor]; } [_myNSWindowController Delegate Set: self]; [_myNSWindowController initializeData]; [_myNSWindowController showWindow: self]; }
Edit: I can work by doing this
AppDelegate.m
< Code> Typingfifed * CGSConnection; External OSSATATUS CGSSetWindowBackgroundBlurRadius (CG connection connection, NSInteger windowNumber, int radius); Additional CG CGSDefaultConnectionForThread (); - (zero) enabled full window: (NSWindow *) window {{window set OPEC: no]; Window.backgroundColor = [NSColor colorWithCalibratedWhite: 0.0 alpha: 0.5]; CGSConnection Connection = CGSDefaultConnectionForThread (); CGSSetWindowBackgroundBlurRadius (connection, [window window], 20); } - (IBAction) showMyNSWindowController: (id) sender {if (! _myNSWindowController) {_myNSWindowController = [[MyNSWindowController alloc] initWithWindowNibName: @ "MyNSWindowController"]; [_myNSWindowController.window setFrame: [[NSScreen main screen] frame] Display: Yes]; [_myNSWindowController.window setOpaque: NO]; [_myNSWindowController.window setBackgroundColor: [NSColor colorWithCalibratedHue: 0.0 Saturation: 0.0 brightness: 0.2 alpha: 0.5]]; [_myNSWindowController.window setmable: FALSE]; [Self-enabled forwardwondo: _myNSWindowController.window]; } [_myNSWindowController Delegate Set: self]; [_myNSWindowController initializeData]; [_myNSWindowController showWindow: self]; }
I modified my NSWindowController by adding an NSView and by putting everything in it like this:
this is code for inicialization:
MyNSWindowController.m
< Code> - (zero) initialize {CALayer * viewLayer = [Cayayer layer]; [Set Sitterserius: 5]; [View set background color: CGColorCreateGenericRGB (255.0, 255.0, 255.0, 1)]; // RGB Plus Alpha Channel [_ ContainerViewSatvent: Yes]; // Backing of the scene is using Store Core Animation Layer [_containerViewSetline: ViewLayer]; [_containerView setFrameOrigin: NSMakePoint ((NSWidth ([_parentView limit]) - NSWidth ([_ container visual frame]) / 2, (Ansaciit ([_ parent visual range]) - Ansacit ([_ container visual frame]) / 2) ]; [_containerView Setatorijingmask: NSViewMinXMargin | NSViewMaxXMargin | NSViewMinYMargin | NSViewMaxYMargin];}
The end result:
This too much There is a "modal" window. You can try to use one of the NSApplication
It can not be what you want because it blocks the main event loop, so that you can avoid interacting with things outside the modal window.
Do you just have your window in that semi-transparent Preventing the size of the screen with the background and if it is more desirable, then adding nothing to the current window content in the form of centered SubViews does not stop.
One of the same behaviors Chchha examples that you may find useful CALayer
and Siaifiltr
uses and to obtain more detailed impact that an in-depth (and & lt; 100 line code).
BTW NSWindowController
is not a "shadow" that is a UI element (hence the "controller" portion of its name); If you are thinking of NSWindow
this difference can help you in further search.
Comments
Post a Comment