Re: make a window fullscreen and back?
Re: make a window fullscreen and back?
- Subject: Re: make a window fullscreen and back?
- From: "Shawn Erickson" <email@hidden>
- Date: Mon, 19 Jun 2006 10:35:57 -0700
On 6/19/06, Sebi <email@hidden> wrote:
but i can't get rid of the windows title bar. what to do?
Make a borderless window (NSBorderlessWindowMask) and swap the content
view from your normal window into the full screen window (or some
aspect of the view hierarchy).
Quick example from a NSWindow subclass of mine (you don't have to do
it in a subclass)...
- (id) initForScreen:(NSScreen*)screen
{
NSRect screenFrame = [screen frame];
NSRect contentRect;
contentRect.origin = NSZeroPoint;
contentRect.size = [screen frame].size;
self = [super initWithContentRect:contentRect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:YES
screen:screen];
if (self != nil) {
[self setReleasedWhenClosed:NO];
[self setTargetScreen:screen];
}
return self;
}
//======================================================================================================================
// -canBecomeKeyWindow:
//
// By default NSBorderlessWindowMask styled windows report that they
cannot become the key (target of key board input)
// this override allows our full screen window to become the key window.
//======================================================================================================================
- (BOOL) canBecomeKeyWindow
{
return YES;
}
//======================================================================================================================
// -canBecomeMainWindow:
//
// By default NSBorderlessWindowMask styled windows report that they
cannot become the main window this override
// allows our full screen window to become the main window.
//======================================================================================================================
- (BOOL) canBecomeMainWindow
{
return YES;
}
-Shawn
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden