X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/e6c3d3e655c4637764f60eb28a3d7e7ed3d9732b..ba98e032a7d195fc94d3856bcd8f4cf4b4b01b4c:/src/mac/carbon/uma.cpp diff --git a/src/mac/carbon/uma.cpp b/src/mac/carbon/uma.cpp index 161708406b..0857a2411d 100644 --- a/src/mac/carbon/uma.cpp +++ b/src/mac/carbon/uma.cpp @@ -645,14 +645,29 @@ static OSStatus helpMenuStatus = noErr ; static MenuItemIndex firstCustomItemIndex = 0 ; #endif -OSStatus UMAGetHelpMenu( +static OSStatus UMAGetHelpMenu( MenuRef * outHelpMenu, - MenuItemIndex * outFirstCustomItemIndex) + MenuItemIndex * outFirstCustomItemIndex, + bool allowHelpMenuCreation); + +static OSStatus UMAGetHelpMenu( + MenuRef * outHelpMenu, + MenuItemIndex * outFirstCustomItemIndex, + bool allowHelpMenuCreation) { #if TARGET_CARBON - return HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ; + static bool s_createdHelpMenu = false ; + if ( !s_createdHelpMenu && !allowHelpMenuCreation ) + { + return paramErr ; + } + + OSStatus status = HMGetHelpMenu( outHelpMenu , outFirstCustomItemIndex ) ; + s_createdHelpMenu = ( status == noErr ) ; + return status ; #else + wxUnusedVar( allowHelpMenuCreation ) ; MenuRef helpMenuHandle ; helpMenuStatus = HMGetHelpMenuHandle( &helpMenuHandle ) ; @@ -668,6 +683,20 @@ OSStatus UMAGetHelpMenu( #endif } +OSStatus UMAGetHelpMenu( + MenuRef * outHelpMenu, + MenuItemIndex * outFirstCustomItemIndex) +{ + return UMAGetHelpMenu( outHelpMenu , outFirstCustomItemIndex , true ); +} + +OSStatus UMAGetHelpMenuDontCreate( + MenuRef * outHelpMenu, + MenuItemIndex * outFirstCustomItemIndex) +{ + return UMAGetHelpMenu( outHelpMenu , outFirstCustomItemIndex , false ); +} + #ifndef __LP64__ wxMacPortStateHelper::wxMacPortStateHelper( GrafPtr newport )