]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/taskbar.cpp
drawing circles with a transparent pen was filling of course...
[wxWidgets.git] / src / mac / carbon / taskbar.cpp
index e94ae77d65587c3063b216561178e76193e5dad0..7cce1813fd9b29394af799d3536ff23937a7adf2 100644 (file)
@@ -176,39 +176,45 @@ wxMenu* wxTaskBarIcon::DoCreatePopupMenu()
 // Operations:
 bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
 {
 // Operations:
 bool wxTaskBarIcon::SetIcon(const wxIcon& icon, const wxString& tooltip)
 {
-    wxMask* mask = icon.GetMask();
+    wxBitmap bmp( icon ) ;
+    OSStatus err = noErr ;
+
+    CGImageRef pImage;
+    
+#if wxMAC_USE_CORE_GRAPHICS        
+    pImage = (CGImageRef) bmp.CGImageCreate() ;
+#else
+    wxMask* mask = bmp.GetMask();
     if (!mask)
     {
         // Make a mask with no transparent pixels
     if (!mask)
     {
         // Make a mask with no transparent pixels
-        wxBitmap   bmp(icon.GetWidth(), icon.GetHeight());
+        wxBitmap   mbmp(icon.GetWidth(), icon.GetHeight());
         wxMemoryDC dc;
         wxMemoryDC dc;
-        dc.SelectObject(bmp);
+        dc.SelectObject(mbmp);
         dc.SetBackground(*wxBLACK_BRUSH);
         dc.Clear();
         dc.SelectObject(wxNullBitmap);
         dc.SetBackground(*wxBLACK_BRUSH);
         dc.Clear();
         dc.SelectObject(wxNullBitmap);
-        mask = new wxMask(bmp, *wxWHITE);
+        bmp.SetMask( new wxMask(mbmp, *wxWHITE) ) ;
     } 
     } 
-        
-    CGImageRef pImage;
     
     //create the icon from the bitmap and mask bitmap contained within
     
     //create the icon from the bitmap and mask bitmap contained within
-    OSStatus err = CreateCGImageFromPixMaps(
-        GetGWorldPixMap(MAC_WXHBITMAP(icon.GetHBITMAP())),
-        GetGWorldPixMap(MAC_WXHBITMAP(mask->GetMaskBitmap())),
-        &pImage
-        );
-        
+    WXHBITMAP iconport ;
+    WXHBITMAP maskport ;
+    iconport = bmp.GetHBITMAP( &maskport ) ;
+    err = CreateCGImageFromPixMaps(
+                                            GetGWorldPixMap(MAC_WXHBITMAP(iconport)),
+                                            GetGWorldPixMap(MAC_WXHBITMAP(maskport)),
+                                            &pImage
+                                            );    
     wxASSERT(err == 0);
     wxASSERT(err == 0);
-    
+#endif
+    wxASSERT(pImage != NULL );
     err = SetApplicationDockTileImage(pImage);
     err = SetApplicationDockTileImage(pImage);
-        
+    
     wxASSERT(err == 0);
     
     if (pImage != NULL)
         CGImageRelease(pImage);
     wxASSERT(err == 0);
     
     if (pImage != NULL)
         CGImageRelease(pImage);
-
-    if (!icon.GetMask())
-        delete mask;
     
     return m_iconAdded = err == noErr;
 }
     
     return m_iconAdded = err == noErr;
 }