+}
+
+// Find a wxMenuItem using its id. Recurses down into sub-menus
+static wxMenuItem* FindMenuItemByIdRecursive(const wxMenu* menu, int id)
+{
+ wxMenuItem* result = menu->FindItem(id);
+
+ wxNode *node = menu->m_items.First();
+ while ( node && result == NULL ) {
+ wxMenuItem *item = (wxMenuItem*)node->Data();
+ if ( item->IsSubMenu() )
+ result = FindMenuItemByIdRecursive( item->GetSubMenu(), id );
+ node = node->Next();
+ }
+
+ return result;
+}
+
+wxMenuItem* wxMenuBar::FindMenuItemById( int id ) const
+{
+ wxMenuItem* result = 0;
+ wxNode *node = m_menus.First();
+ while (node && result == 0)
+ {
+ wxMenu *menu = (wxMenu*)node->Data();
+ result = FindMenuItemByIdRecursive( menu, id );
+ node = node->Next();
+ }
+ return result;
+}
+
+void wxMenuBar::Check( int id, bool check )
+{
+ wxMenuItem* item = FindMenuItemById( id );
+ if (item) item->Check(check);
+}
+
+bool wxMenuBar::Checked( int id ) const
+{
+ wxMenuItem* item = FindMenuItemById( id );
+ if (item) return item->IsChecked();
+ return FALSE;
+}
+
+void wxMenuBar::Enable( int id, bool enable )
+{
+ wxMenuItem* item = FindMenuItemById( id );
+ if (item) item->Enable(enable);
+}
+
+bool wxMenuBar::Enabled( int id ) const
+{
+ wxMenuItem* item = FindMenuItemById( id );
+ if (item) return item->IsEnabled();
+ return FALSE;
+}