• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Fullscreen Window
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Fullscreen Window


  • Subject: Re: Fullscreen Window
  • From: Fabio Mancinelli <email@hidden>
  • Date: Thu, 29 Mar 2007 11:48:08 +0200


On Mar 29, 2007, at 11:19 AM, Andrew James wrote:


So how does one create such a fullscreen window?

I've done this before so I might help...

First you create a borderless window that will be used to cover the whole screen real estate.

NSRect screenRect = [[NSScreen mainScreen] frame];
NSWindow *window = [[NSWindow alloc] initWithContentRect:screenRect
styleMask:NSBorderlessWindowMask
backing:NSBackingStoreBuffered
defer:NO
screen: [NSScreen mainScreen]];


Then you have to capture the display using:

if(CGDisplayCapture(kCGDirectMainDisplay) != kCGErrorSuccess) {
	/* Handle errors here */
}

You recover the window level of the shielding window that is the topmost layer, and set it to be your fullscreen window level:

int windowLevel = CGShieldingWindowLevel();
[window setLevel:windowLevel];

Then you simply show the window:

[window makeKeyAndOrderFront:nil];

And that's it. Of course you might add to the window content a view that you have designed and stored in your Nib. Just use setContentView. For example your panel with the password field could be exactly that view!

Once you are finished with your fullscreen window, you have to release the display by using:

if (CGDisplayRelease(kCGDirectMainDisplay) != kCGErrorSuccess) {
        /* Handle errors here */
}

and hide your window:

[window orderOut:nil];

I have found that releasing the display and then hiding the window produces a better "effect" than doing the opposite (which may sound more logical).

That's it.

See you,
Fabio

_______________________________________________

Cocoa-dev mailing list (email@hidden)

Do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Fullscreen Window
      • From: Ricky Sharp <email@hidden>
    • Re: Fullscreen Window
      • From: Michael Watson <email@hidden>
References: 
 >Fullscreen Window (From: Andrew James <email@hidden>)

  • Prev by Date: Design Pattern
  • Next by Date: Re: Fullscreen Window
  • Previous by thread: Fullscreen Window
  • Next by thread: Re: Fullscreen Window
  • Index(es):
    • Date
    • Thread