]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/toolbar.cpp
Fix wxListCtrl background colour bug Part I
[wxWidgets.git] / src / mac / toolbar.cpp
index 66bed14b79934a31ab9f9422a198bb7f96c48240..152e1aaddfce3fdc39a4c8a49ec8554538c67a2f 100644 (file)
@@ -41,14 +41,15 @@ class wxToolBarTool : public wxToolBarToolBase
 public:
     wxToolBarTool(wxToolBar *tbar,
                   int id,
-                  const wxBitmap& bitmap1,
-                  const wxBitmap& bitmap2,
-                  bool toggle,
+                  const wxString& label,
+                  const wxBitmap& bmpNormal,
+                  const wxBitmap& bmpDisabled,
+                  wxItemKind kind,
                   wxObject *clientData,
-                  const wxString& shortHelpString,
-                  const wxString& longHelpString)
-        : wxToolBarToolBase(tbar, id, bitmap1, bitmap2, toggle,
-                            clientData, shortHelpString, longHelpString)
+                  const wxString& shortHelp,
+                  const wxString& longHelp)
+        : wxToolBarToolBase(tbar, id, label, bmpNormal, bmpDisabled, kind,
+                            clientData, shortHelp, longHelp)
     {
         m_nSepCount = 0;
         m_index = -1 ;
@@ -87,15 +88,16 @@ const short kwxMacToolBarLeftMargin = 2 ;
 
 
 wxToolBarToolBase *wxToolBar::CreateTool(int id,
-                                         const wxBitmap& bitmap1,
-                                         const wxBitmap& bitmap2,
-                                         bool toggle,
+                                         const wxString& label,
+                                         const wxBitmap& bmpNormal,
+                                         const wxBitmap& bmpDisabled,
+                                         wxItemKind kind,
                                          wxObject *clientData,
-                                         const wxString& shortHelpString,
-                                         const wxString& longHelpString)
+                                         const wxString& shortHelp,
+                                         const wxString& longHelp)
 {
-    return new wxToolBarTool(this, id, bitmap1, bitmap2, toggle,
-                             clientData, shortHelpString, longHelpString);
+    return new wxToolBarTool(this, id, label, bmpNormal, bmpDisabled, kind,
+                             clientData, shortHelp, longHelp);
 }
 
 wxToolBarToolBase *wxToolBar::CreateTool(wxControl *control)
@@ -200,7 +202,7 @@ bool wxToolBar::Realize()
     while (node)
     {
         wxToolBarTool *tool = (wxToolBarTool *)node->Data();
-        wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->GetBitmap1().GetRefData()) ;
+        wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->GetNormalBitmap().GetRefData()) ;
         
         if(  !tool->IsSeparator()  )
         {
@@ -210,37 +212,14 @@ bool wxToolBar::Realize()
             toolrect.bottom = toolrect.top + toolSize.y ;
             
             ControlButtonContentInfo info ;
-            if ( bmap )
-            {
-                if ( bmap->m_bitmapType == kMacBitmapTypePict )
-                {
-                    info.contentType = kControlContentPictHandle ;
-                    info.u.picture = MAC_WXHMETAFILE(bmap->m_hPict) ;
-                }
-                else if ( bmap->m_bitmapType == kMacBitmapTypeGrafWorld )
-                {
-                    if ( tool->GetBitmap1().GetMask() )
-                    {
-                        info.contentType = kControlContentCIconHandle ;
-                        info.u.cIconHandle = wxMacCreateCIcon( MAC_WXHBITMAP(bmap->m_hBitmap) , MAC_WXHBITMAP(tool->GetBitmap1().GetMask()->GetMaskBitmap()) ,
-                                                               8 , 16 ) ;
-                    }
-                    else
-                    {
-                        info.contentType = kControlContentCIconHandle ;
-                        info.u.cIconHandle = wxMacCreateCIcon( MAC_WXHBITMAP(bmap->m_hBitmap) , NULL ,
-                                                               8 , 16 ) ;
-                    }
-                }
-            }
-            
+            wxMacCreateBitmapButton( &info , tool->GetNormalBitmap() ) ;
             ControlHandle m_macToolHandle ;
             
             SInt16 behaviour = kControlBehaviorOffsetContents ;
             if ( tool->CanBeToggled() )
                 behaviour += kControlBehaviorToggles ;
             
-            if ( info.u.cIconHandle ) // since it is a handle we can use one of them
+            if ( info.contentType != kControlNoContent ) 
             {
                 m_macToolHandle = ::NewControl( window , &toolrect , "\p" , false , 0 , 
                                                 behaviour + info.contentType , 0 , kControlBevelButtonNormalBevelProc , (long) this ) ;
@@ -414,7 +393,7 @@ void wxToolBar::MacSuperChangedPosition()
        while (node)
        {
                wxToolBarTool *tool = (wxToolBarTool *)node->Data();
-               wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->GetBitmap1().GetRefData()) ;
+               wxBitmapRefData * bmap = (wxBitmapRefData*) ( tool->GetNormalBitmap().GetRefData()) ;
                
                if(  !tool->IsSeparator()  )
                {