// // SplashWindow.m // Bruce Banner // // Created by Andrew Pennebaker on 8/15/09. // Copyright 2009 YelloSoft. All rights reserved. // #import "SplashWindow.h" // From http://www.artlogic.com/resources/mac-os-x-splash-screens/ @implementation SplashWindow - (id) initWithContentRect: (NSRect) contentRect styleMask: (unsigned int) style backing: (NSBackingStoreType) bufferingType defer: (BOOL) flag { // Determine the center of the main screen and set the origin of the content rect // so that the window will be centered in the main screen. NSScreen *mainScreen=[NSScreen mainScreen]; NSRect screen=[mainScreen frame]; NSPoint center=NSMakePoint(screen.size.width/2, screen.size.height/2); contentRect.origin.x=center.x-(contentRect.size.width/2); //contentRect.origin.y=center.y-(contentRect.size.height/2); contentRect.origin.y=screen.size.height-contentRect.size.height-[[NSStatusBar systemStatusBar] thickness]; // Call the inherited init function, but pass NSBorderlessWindowMask instead of // the normal style. This will give us a window with no title bar or edge. id window=[super initWithContentRect:contentRect styleMask:NSBorderlessWindowMask backing:bufferingType defer:flag]; if (window) { [window setOpaque:NO]; // Set the window's background color to a clear color (without this step, the // normal OS X background with the alternating gray bars will still draw). [window setBackgroundColor:[NSColor colorWithDeviceWhite:1.0 alpha:0.0]]; [window setHasShadow:NO]; [window setLevel:NSFloatingWindowLevel]; [window setIgnoresMouseEvents: YES]; } return window; } @end