+ wxMenuItem *item = NULL;
+ int pos;
+ wxNode *node;
+ for (pos = 0, node = m_menuItems.First(); node; node = node->Next(), pos++)
+ {
+ item = (wxMenuItem *)node->Data();
+ if ( item->GetId() == id )
+ break;
+ }
+
+ wxCHECK_RET( node, _T("wxMenu::Delete(): item doesn't exist") );
+
+ HMENU menu = GetHMENU();
+
+ wxMenu *pSubMenu = item->GetSubMenu();
+ if ( pSubMenu != NULL ) {
+ RemoveMenu(menu, (UINT)pos, MF_BYPOSITION);
+ pSubMenu->m_hMenu = pSubMenu->m_savehMenu;
+ pSubMenu->m_savehMenu = 0;
+ pSubMenu->m_parent = NULL;
+ // RemoveChild(item->subMenu);
+ pSubMenu->m_topLevelMenu = NULL;
+ // TODO: Why isn't subMenu deleted here???
+ // Will put this in for now. Assuming this is supposed
+ // to delete the menu, not just remove it.
+ item->DeleteSubMenu();
+ }
+ else {
+ DeleteMenu(menu, (UINT)pos, MF_BYPOSITION);
+ }
+
+ m_menuItems.DeleteNode(node);
+ delete item;
+}
+
+#if wxUSE_ACCEL
+
+// ---------------------------------------------------------------------------
+// accelerator helpers
+// ---------------------------------------------------------------------------
+
+// create the wxAcceleratorEntries for our accels and put them into provided
+// array - return the number of accels we have
+size_t wxMenu::CopyAccels(wxAcceleratorEntry *accels) const
+{
+ size_t count = GetAccelCount();
+ for ( size_t n = 0; n < count; n++ )
+ {
+ (*accels++).Set(m_accelFlags[n], m_accelKeyCodes[n], m_accelIds[n]);
+ }
+
+ return count;
+}
+
+#endif // wxUSE_ACCEL
+
+// ---------------------------------------------------------------------------
+// wxMenu functions implemented in wxMenuItem
+// ---------------------------------------------------------------------------
+
+void wxMenu::Enable(int id, bool Flag)
+{
+ wxMenuItem *item = FindItemForId(id);
+ wxCHECK_RET( item != NULL, _T("can't enable non-existing menu item") );