title: NSWindow with round corners and shadow
body: <p>I'm trying to crate a <code>NSWindow</code> without <em>title bar</em> (<code>NSBorderlessWindowMask</code>) with round corners and a shadow, similar to the below "Welcome to Xcode" window.</p>
  
  <p><img src="https://i.stack.imgur.com/XJc9r.png" alt="Welcome to Xcode"></p>
  
  <p>I make a subclass of <code>NSWindow</code>:</p>
  
  <pre><code>@implementation FlatWindow
  
  - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
  {
      self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag];
  
      if ( self )
      {
          [self setOpaque:NO];
          [self setBackgroundColor:[NSColor clearColor]];
          [self setMovableByWindowBackground:TRUE];
          [self setStyleMask:NSBorderlessWindowMask];
          [self setHasShadow:YES];
      }
  
      return self;
  }
  
  - (void) setContentView:(NSView *)aView
  {
      aView.wantsLayer            = YES;
      aView.layer.frame           = aView.frame;
      aView.layer.cornerRadius    = 10.0;
      aView.layer.masksToBounds   = YES;
  
      [super setContentView:aView];
  }
  
  @end
  </code></pre>
  
  <p>And a subclass of <code>NSView</code>:</p>
  
  <pre><code>@implementation ColoredView
  
  - (void)drawRect:(NSRect)dirtyRect {
      [super drawRect:dirtyRect];
  
      [[NSColor windowBackgroundColor] set];
      NSRectFill(dirtyRect);
  }
  
  @end
  </code></pre>
  
  <p>This gives me a window without <em>title bar</em> with round corners, but the default shadow on <code>NSWindow</code> is gone. How can I add the default shadow to this window?</p>
  
  <p><img src="https://i.stack.imgur.com/Opd9S.png" alt="Flat window"></p>
  
  <p><strong>EDIT1:</strong></p>
  
  <p>NSWindow with <code>NSShadow</code>. This shadow is not shown.</p>
  
  <pre><code>@implementation FlatWindow
  
  - (id)initWithContentRect:(NSRect)contentRect styleMask:(NSUInteger)aStyle backing:(NSBackingStoreType)bufferingType defer:(BOOL)flag
  {
      self = [super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag];
  
      if ( self )
      {
          [self setOpaque:NO];
          [self setBackgroundColor:[NSColor clearColor]];
          [self setMovableByWindowBackground:TRUE];
          [self setStyleMask:NSBorderlessWindowMask];
          [self setHasShadow:YES];
      }
  
      return self;
  }
  
  - (void) setContentView:(NSView *)aView
  {
      aView.wantsLayer            = YES;
      aView.layer.frame           = aView.frame;
      aView.layer.cornerRadius    = 10.0;
      aView.layer.masksToBounds   = YES;
  
      NSShadow *dropShadow = [[NSShadow alloc] init];
      [dropShadow setShadowColor:[NSColor blackColor]];
      [dropShadow setShadowBlurRadius:10.0];
      [aView setShadow: dropShadow];
  
      [super setContentView:aView];
  }
  
  @end
  </code></pre>