X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/76a5e5d21ee1a6230d777ce0209b2df4c6075f0f..cd5e9298159e58f57e05f3b76c9d4a45e1eefe12:/src/mac/toolbar.cpp?ds=sidebyside diff --git a/src/mac/toolbar.cpp b/src/mac/toolbar.cpp index 66bed14b79..152e1aaddf 100644 --- a/src/mac/toolbar.cpp +++ b/src/mac/toolbar.cpp @@ -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() ) {