]> git.saurik.com Git - wxWidgets.git/blobdiff - src/osx/cocoa/utils.mm
Applied #10639 (Not all previewed fonts are displayed with the correct nameface)
[wxWidgets.git] / src / osx / cocoa / utils.mm
index b8aa14190b2bc054b6fd3430bdcdf90b60c1d8cb..4b22268b3ff215ba75faa8d8548b48e7d0e6a0cf 100644 (file)
@@ -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;