]> git.saurik.com Git - wxWidgets.git/blobdiff - src/mac/carbon/uma.cpp
implemented wxMBConv::IsUTF8() helper for more classes so that all uses of UTF-8...
[wxWidgets.git] / src / mac / carbon / uma.cpp
index 161708406b5628f33a84abd36051524c723605b9..0857a2411dfeaa09457bde69999a6d7f00c237ad 100644 (file)
@@ -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 )