Show
Ignore:
Timestamp:
12/10/07 21:36:34 (7 years ago)
Author:
robert
Message:

From Eric Wing, "For osgviewerCocoa, a very simple change to allow toggling between
fullscreen mode and back between views. (To activate, double click on
the view to toggle.) It demonstrates/uses the new one-liner fullscreen
method introduced in Leopard. Code will still compile and run in
pre-Leopard (thanks to Obj-C dynamic/late binding), but code path is
treated as a no-op in those cases."

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • OpenSceneGraph/trunk/examples/osgviewerCocoa/ViewerCocoa.mm

    r6941 r7655  
    675675        { 
    676676                theViewer->getEventQueue()->mouseDoubleButtonPress(converted_point.x, converted_point.y, 1); 
     677                 
     678                 
     679                // Let's toggle fullscreen for show 
     680                [self toggleFullScreen:nil]; 
     681 
    677682        } 
    678683        [self setNeedsDisplay:YES]; 
     
    13891394} 
    13901395 
     1396- (IBAction) toggleFullScreen:(id)the_sender 
     1397{ 
     1398        // I'm lazy and rather use the new 10.5 Cocoa Fullscreen API. 
     1399        // For now, no legacy support for fullscreen. 
     1400        // One of the cool things about Obj-C is dynamic/late binding. 
     1401        // We can compile and run this code on versions prior to 10.5. 
     1402        // At run-time, we check to see if these methods actually exist 
     1403        // and if they do, we message them. If not, we avoid them. 
     1404        if([self respondsToSelector:@selector(isInFullScreenMode)]) 
     1405        { 
     1406                if([self isInFullScreenMode]) 
     1407                { 
     1408                        [self exitFullScreenModeWithOptions:nil]; 
     1409                } 
     1410                else 
     1411                { 
     1412                        [self enterFullScreenMode:[NSScreen mainScreen] withOptions:nil]; 
     1413                } 
     1414        } 
     1415} 
     1416 
    13911417//////////////////////////////////////////////////////////////////////// 
    13921418/////////////////////////// End IBAction examples  /////////////////////