+int wxMenuBarBase::FindMenu(const wxString& title) const
+{
+ wxString label = wxMenuItem::GetLabelText(title);
+
+ size_t count = GetMenuCount();
+ for ( size_t i = 0; i < count; i++ )
+ {
+ wxString title2 = GetMenuLabel(i);
+ if ( (title2 == title) ||
+ (wxMenuItem::GetLabelText(title2) == label) )
+ {
+ // found
+ return (int)i;
+ }
+ }
+
+ return wxNOT_FOUND;
+
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuBar attaching/detaching to/from the frame
+// ----------------------------------------------------------------------------
+
+void wxMenuBarBase::Attach(wxFrame *frame)
+{
+ wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
+
+ m_menuBarFrame = frame;
+}
+
+void wxMenuBarBase::Detach()
+{
+ wxASSERT_MSG( IsAttached(), wxT("detaching unattached menubar") );
+
+ m_menuBarFrame = NULL;
+}
+
+// ----------------------------------------------------------------------------
+// wxMenuBar searching for items
+// ----------------------------------------------------------------------------
+
+wxMenuItem *wxMenuBarBase::FindItem(int id, wxMenu **menu) const
+{
+ if ( menu )
+ *menu = NULL;
+
+ wxMenuItem *item = NULL;
+ size_t count = GetMenuCount(), i;
+ wxMenuList::const_iterator it;
+ for ( i = 0, it = m_menus.begin(); !item && (i < count); i++, it++ )
+ {
+ item = (*it)->FindItem(id, menu);
+ }
+
+ return item;
+}
+
+int wxMenuBarBase::FindMenuItem(const wxString& menu, const wxString& item) const
+{
+ wxString label = wxMenuItem::GetLabelText(menu);
+
+ int i = 0;
+ wxMenuList::compatibility_iterator node;
+ for ( node = m_menus.GetFirst(); node; node = node->GetNext(), i++ )
+ {
+ if ( label == wxMenuItem::GetLabelText(GetMenuLabel(i)) )
+ return node->GetData()->FindItem(item);
+ }
+
+ return wxNOT_FOUND;
+}
+