]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/bitmap.cpp
fixed the wrong custom build messages
[wxWidgets.git] / src / mac / carbon / bitmap.cpp
index ec5d91854ef4687790ced68949bdbe0d40c3310b..c8b6ea5a430d013936791d64ca93c8f565db1594 100644 (file)
@@ -59,9 +59,9 @@ void wxMacDestroyColorTable( CTabHandle colors )
 void wxMacSetColorTableEntry( CTabHandle newColors , int index , int red , int green ,  int blue )
 {
     (**newColors).ctTable[index].value = index;
-    (**newColors).ctTable[index].rgb.red = 0 ;// someRedValue;
-    (**newColors).ctTable[index].rgb.green = 0 ; // someGreenValue;
-    (**newColors).ctTable[index].rgb.blue = 0 ; // someBlueValue;
+    (**newColors).ctTable[index].rgb.red = red ;// someRedValue;
+    (**newColors).ctTable[index].rgb.green = green ; // someGreenValue;
+    (**newColors).ctTable[index].rgb.blue = blue ; // someBlueValue;
 }
 
 GWorldPtr wxMacCreateGWorld( int width , int height , int depth )
@@ -289,6 +289,57 @@ PicHandle wxMacCreatePict(GWorldPtr wp, GWorldPtr mask)
   return pict;                  
 }
 
+void wxMacCreateBitmapButton( ControlButtonContentInfo*info , const wxBitmap& bitmap ) 
+{
+    memset( info , 0 , sizeof(ControlButtonContentInfo) ) ;
+    if ( bitmap.Ok() )
+    {
+        wxBitmapRefData * bmap = (wxBitmapRefData*) ( bitmap.GetRefData()) ;
+        if ( bmap == NULL )
+            return ;
+            
+        if ( bmap->m_bitmapType == kMacBitmapTypePict )
+        {
+            info->contentType = kControlContentPictHandle ;
+            info->u.picture = MAC_WXHMETAFILE(bmap->m_hPict) ;
+        }
+        else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
+        {
+            if ( (bmap->m_width == bmap->m_height) && (bmap->m_width & 0x3 == 0) )
+            {
+                info->contentType = kControlContentCIconHandle ;
+                if ( bitmap.GetMask() )
+                {
+                    info->u.cIconHandle = wxMacCreateCIcon( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap()) ,
+                                                           8 , bmap->m_width ) ;
+                }
+                else
+                {
+                    info->u.cIconHandle = wxMacCreateCIcon( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ,
+                                                           8 , bmap->m_width ) ;
+                }
+            }
+            else
+            {
+                info->contentType = kControlContentPictHandle ;
+                if ( bitmap.GetMask() )
+                {
+                                   info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(bitmap.GetMask()->GetMaskBitmap() ) ) ;
+               }
+                else
+                {
+                                   info->u.picture = wxMacCreatePict( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ) ;
+                }
+            }
+        }
+               else if ( bmap->m_bitmapType == kMacBitmapTypeIcon )
+               {
+               info->contentType = kControlContentCIconHandle ;
+               info->u.cIconHandle = MAC_WXHICON(bmap->m_hIcon) ;
+               }
+    }
+}
+
 wxBitmapRefData::wxBitmapRefData()
 {
     m_ok = FALSE;