+
+// Find an item given the Macintosh Menu Reference
+
+WX_DECLARE_HASH_MAP(MenuRef, wxMenu*, wxPointerHash, wxPointerEqual, MacMenuMap);
+
+static MacMenuMap wxWinMacMenuList;
+
+wxMenu *wxFindMenuFromMacMenu(MenuRef inMenuRef)
+{
+ MacMenuMap::iterator node = wxWinMacMenuList.find(inMenuRef);
+
+ return (node == wxWinMacMenuList.end()) ? NULL : node->second;
+}
+
+void wxAssociateMenuWithMacMenu(MenuRef inMenuRef, wxMenu *menu) ;
+void wxAssociateMenuWithMacMenu(MenuRef inMenuRef, wxMenu *menu)
+{
+ // adding NULL MenuRef is (first) surely a result of an error and
+ // (secondly) breaks menu command processing
+ wxCHECK_RET( inMenuRef != (MenuRef) NULL, wxT("attempt to add a NULL MenuRef to menu list") );
+
+ wxWinMacMenuList[inMenuRef] = menu;
+}
+
+void wxRemoveMacMenuAssociation(wxMenu *menu) ;
+void wxRemoveMacMenuAssociation(wxMenu *menu)
+{
+ // iterate over all the elements in the class
+ MacMenuMap::iterator it;
+ for ( it = wxWinMacMenuList.begin(); it != wxWinMacMenuList.end(); ++it )
+ {
+ if ( it->second == menu )
+ {
+ wxWinMacMenuList.erase(it);
+ break;
+ }
+ }
+}
+