X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/d8207702d1cf580a7200114abd52f186b4b9a4f3..d2c5fe6e6e1ab3b4532b4ca0e2eeba4f9c190562:/src/osx/cocoa/utils.mm diff --git a/src/osx/cocoa/utils.mm b/src/osx/cocoa/utils.mm index b8aa14190b..4b22268b3f 100644 --- a/src/osx/cocoa/utils.mm +++ b/src/osx/cocoa/utils.mm @@ -52,7 +52,9 @@ void wxBell() void wxMacWakeUp() { - // TODO + NSEvent* wakeupEvent = [NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint + modifierFlags:NSAnyEventMask timestamp:0 windowNumber:0 context:nil subtype:0 data1:0 data2:0]; + [NSApp postEvent:wakeupEvent atStart:NO]; } #endif // wxUSE_BASE @@ -146,9 +148,9 @@ void wxMacWakeUp() } @end -/* +/* allows ShowModal to work when using sheets. - see include/wx/osx/cocoa/private.h for more info + see include/wx/osx/cocoa/private.h for more info */ @implementation ModalDialogDelegate - (id)init @@ -159,7 +161,7 @@ void wxMacWakeUp() return self; } -- (BOOL)finished +- (BOOL)finished { return sheetFinished; } @@ -299,14 +301,21 @@ wxBitmap wxWindowDCImpl::DoGetAsBitmap(const wxRect *subrect) const NSBitmapImageRep *rep = [[[NSBitmapImageRep alloc] initWithFocusedViewRect: [view bounds]] retain]; [view unlockFocus]; - CGImageRef cgImageRef = (CGImageRef)[rep CGImage]; + wxBitmap bitmap(width, height); + if ( [rep respondsToSelector:@selector(CGImage)] ) + { + CGImageRef cgImageRef = (CGImageRef)[rep CGImage]; - wxBitmap bitmap(CGImageGetWidth(cgImageRef) , CGImageGetHeight(cgImageRef) ); - CGRect r = CGRectMake( 0 , 0 , CGImageGetWidth(cgImageRef) , CGImageGetHeight(cgImageRef) ); - // since our context is upside down we dont use CGContextDrawImage - wxMacDrawCGImage( (CGContextRef) bitmap.GetHBITMAP() , &r, cgImageRef ) ; - CGImageRelease(cgImageRef); - cgImageRef = NULL; + CGRect r = CGRectMake( 0 , 0 , CGImageGetWidth(cgImageRef) , CGImageGetHeight(cgImageRef) ); + // since our context is upside down we dont use CGContextDrawImage + wxMacDrawCGImage( (CGContextRef) bitmap.GetHBITMAP() , &r, cgImageRef ) ; + CGImageRelease(cgImageRef); + cgImageRef = NULL; + } + else + { + // TODO for 10.4 in case we can support this for osx_cocoa + } [rep release]; return bitmap;