Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion Groups
General
GeneralPortable MacsHardwareNetworking
Applications
Mac ApplicationsEudoraFirefox / MozillaInternet ExplorerOutlook ExpressMS OfficeEntourageExcelPowerPointWordVirtual PCMedia PlayerOther MS Products
Programming
Mac ProgrammingCodeWarriorPerl
Country Specific
Australian Mac GroupUK Mac Group

Mac Forum / Programming / Mac Programming / January 2006



Tip: Looking for answers? Try searching our database.

Full screen cocoa

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
pf - 03 Jan 2006 00:18 GMT
Hi,

Is there any sample code to make a full screen app? No menu bar and no
dock. The only code I found is 3 years old and doesn't seem to work
under Tiger.

Thanks,

Paul
Michael Ash - 03 Jan 2006 11:37 GMT
> Hi,
>
> Is there any sample code to make a full screen app? No menu bar and no
> dock. The only code I found is 3 years old and doesn't seem to work
> under Tiger.

There really isn't that much to it. To hide the menu bar and the dock, you
can call SetSystemUIMode(kUIModeAllHidden, 0), then set the frame of a
borderless window to fill the screen. To get back out,
SetSystemUIMode(kUIModeNormal, 0) and close the window.

Here's some code from QTAmateur's fullscreen method. Here, 'movieView' is
the movie view in the regular document window with a title bar, and
fullscreenWindow is a subclassed borderless window which accepts first
responder (so I can still pause the movie with the space bar and things
like that).

- (void)beginFullscreen
{
    if(inFullscreen) return;
   
    NSWindow *window = [movieView window];
    NSScreen *screen = [window screen];
   
    [window orderOut:self];
    [movieView setMovie:nil];
   
    [fullscreenWindow setFrame:[screen frame] display:YES];
    [fullscreenMovieView setMovie:movie];
    [fullscreenWindow makeKeyAndOrderFront:self];
   
    if([screen isEqual:[NSScreen mainScreen]])
        SetSystemUIMode(kUIModeAllHidden, 0);
   
    [fullscreenMovieView play:self];
   
    [self disableSleep];
   
    inFullscreen = YES;
}

And for completeness, the endFullscreen method:

- (void)endFullscreen
{
    if(!inFullscreen) return;
   
    SetSystemUIMode(kUIModeNormal, 0);
    [fullscreenMovieView pause:self];
    [fullscreenWindow orderOut:self];
    [fullscreenMovieView setMovie:nil];
   
    [movieView setMovie:movie];
    [movieView setControllerVisible:YES];
    [[movieView window] makeKeyAndOrderFront:self];
   
    [self enableSleep];
   
    inFullscreen = NO;
}

Signature

Michael Ash
Rogue Amoeba Software

pf - 04 Jan 2006 01:09 GMT
Thanks, I'll give it a go.

Paul

>> Hi,
>>
[quoted text clipped - 56 lines]
>     inFullscreen = NO;
>}
pf - 04 Jan 2006 05:43 GMT
Hi Michael,

Where did you find "SetSystemUIMode"? It works but I can't find it in
the API reference, and it seems to need Carbon.h.

Thanks,

Paul
Michael Ash - 04 Jan 2006 12:15 GMT
> Hi Michael,
>
> Where did you find "SetSystemUIMode"? It works but I can't find it in
> the API reference, and it seems to need Carbon.h.

Yes, it's a Carbon function. A friend recommended it to me for this use. I
can't find it in the docs either, but there is a technote about it here:

http://developer.apple.com/technotes/tn2002/tn2062.html

This technote is basically some very thorough documentation about this
function, it's just kind of in the wrong place.

Signature

Michael Ash
Rogue Amoeba Software

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.