X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/90527a50d74bed6ed6b4d163e8170ae8c3f5d869..9d5507f7a2701395e1d5c121bd877bb9066ee6ea:/src/mac/carbon/menuitem.cpp?ds=inline diff --git a/src/mac/carbon/menuitem.cpp b/src/mac/carbon/menuitem.cpp index 7d6dc48db1..172c5b0ab1 100644 --- a/src/mac/carbon/menuitem.cpp +++ b/src/mac/carbon/menuitem.cpp @@ -63,6 +63,13 @@ void wxMenuItem::UpdateItemBitmap() MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ; MenuItemIndex index = m_parentMenu->MacGetIndexFromItem( this ) ; + DoUpdateItemBitmap( mhandle, index ); +} + +void wxMenuItem::DoUpdateItemBitmap( WXHMENU menu, wxUint16 index) +{ + MenuHandle mhandle = (MenuHandle) menu; + if ( mhandle == NULL || index == 0) return ; @@ -76,6 +83,9 @@ void wxMenuItem::UpdateItemBitmap() if ( info.contentType == kControlContentIconRef ) SetMenuItemIconHandle( mhandle , index , kMenuIconRefType , (Handle) info.u.iconRef ) ; + else if ( info.contentType == kControlContentCGImageRef ) + SetMenuItemIconHandle( mhandle , index , + kMenuCGImageRefType , (Handle) info.u.imageRef ) ; } wxMacReleaseBitmapButton( &info ) ; #endif @@ -90,8 +100,7 @@ void wxMenuItem::UpdateItemStatus() if ( IsSeparator() ) return ; -#if TARGET_CARBON - if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macPreferencesMenuItemId) + if ( GetId() == wxApp::s_macPreferencesMenuItemId) { if ( !IsEnabled() ) DisableMenuCommand( NULL , kHICommandPreferences ) ; @@ -99,14 +108,13 @@ void wxMenuItem::UpdateItemStatus() EnableMenuCommand( NULL , kHICommandPreferences ) ; } - if ( UMAGetSystemVersion() >= 0x1000 && GetId() == wxApp::s_macExitMenuItemId) + if ( GetId() == wxApp::s_macExitMenuItemId) { if ( !IsEnabled() ) DisableMenuCommand( NULL , kHICommandQuit ) ; else EnableMenuCommand( NULL , kHICommandQuit ) ; } -#endif { MenuHandle mhandle = MAC_WXHMENU(m_parentMenu->GetHMenu()) ; @@ -153,7 +161,6 @@ void wxMenuItem::UpdateItemText() void wxMenuItem::Enable(bool bDoEnable) { if (( m_isEnabled != bDoEnable -#if TARGET_CARBON // avoid changing menuitem state when menu is disabled // eg. BeginAppModalStateForWindow() will disable menus and ignore this change // which in turn causes m_isEnabled to become out of sync with real menuitem state @@ -162,7 +169,6 @@ void wxMenuItem::Enable(bool bDoEnable) || ( GetId() == wxApp::s_macPreferencesMenuItemId || GetId() == wxApp::s_macExitMenuItemId || GetId() == wxApp::s_macAboutMenuItemId -#endif )) { wxMenuItemBase::Enable( bDoEnable ) ; @@ -233,13 +239,13 @@ void wxMenuItem::Check(bool bDoCheck) } } -void wxMenuItem::SetText(const wxString& text) +void wxMenuItem::SetItemLabel(const wxString& text) { // don't do anything if label didn't change if ( m_text == text ) return; - wxMenuItemBase::SetText(text); + wxMenuItemBase::SetItemLabel(text); UpdateItemText() ; } @@ -273,7 +279,7 @@ void wxMenuItem::SetRadioGroupEnd(int end) // ---------------------------------------------------------------------------- /* static */ -wxString wxMenuItemBase::GetLabelFromText(const wxString& text) +wxString wxMenuItemBase::GetLabelText(const wxString& text) { return wxStripMenuCodes(text); }