Aug 06, '03 09:50:00AM • Contributed by: kitzkikz
Add the following two files to your project:
Fullscreen.h:
#import #import @interface NSApplication (ASKAFullScreen) - (NSWindow *)beginFullScreen; - (void)endFullScreen; @endFullscreen.mm:
#import "FullScreen.h"
NSWindow *fsWindow;
@implementation NSApplication (ASKAFullScreen)
- (NSWindow *)beginFullScreen
{ fsWindow = [
[NSWindow alloc]
initWithContentRect:[[NSScreen mainScreen] frame]
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO];
NSView *fsView=[[NSView alloc] initWithFrame:[fsWindow frame]];
[fsWindow setContentView:fsView];
NSImageView *fsImage = [[NSImageView alloc] initWithFrame:[fsView frame]];
[fsView addSubview:fsImage];
[fsWindow setBackgroundColor:[NSColor blackColor]];
[NSMenu setMenuBarVisible:0];
[fsWindow makeKeyAndOrderFront:fsWindow];
return fsWindow;
}
- (void)endFullScreen
{ [NSMenu setMenuBarVisible:1];
[fsWindow close];
}
@end
Then you can use applescript to open and close the fullscreen window:
set theWindow to (call method "beginFullScreen") call method "endFullScreen"I hope someone else gets some use out of this example.
