+int wxMenuBar::FindMenu(const wxString& title)
+{
+ wxString menuTitle = wxStripMenuCodes(title);
+ for ( int i = 0; i < m_menuCount; i++ )
+ {
+ wxString title = wxStripMenuCodes(m_titles[i]);
+ if ( menuTitle == title )
+ return i;
+ }
+
+ return wxNOT_FOUND;
+
+}
+
+
+void wxMenuBar::ReplaceMenu(int pos, wxMenu * new_menu, const wxString& title)
+{
+ if (m_menuBarFrame) return;
+
+ if ( pos >= 0 && pos < m_menuCount )
+ {
+ wxMenu *old_menu = m_menus[pos];
+ m_menus[pos] = new_menu;
+ delete old_menu;
+ }
+
+}
+
+
+void wxMenuBar::Insert(int pos, wxMenu * menu, const wxString& title)
+{
+ if (m_menuBarFrame) return;
+ if ( pos < 0 && pos >= m_menuCount ) return;
+
+ m_menuCount ++;
+ wxMenu **new_menus = new wxMenu *[m_menuCount];
+ wxString *new_titles = new wxString[m_menuCount];
+ int i;
+
+ for (i = 0; i < pos; i++)
+ {
+ new_menus[i] = m_menus[i];
+ m_menus[i] = NULL;
+ new_titles[i] = m_titles[i];
+ m_titles[i] = wxT("");
+ }
+
+ new_menus[pos] = (wxMenu *)menu;
+ new_titles[i] = title;
+
+ for (i = pos+1; i < m_menuCount; i++)
+ {
+ new_menus[i] = m_menus[i-1];
+ m_menus[i-1] = NULL;
+ new_titles[i] = m_titles[i-1];
+ m_titles[i-1] = wxT("");
+ }
+ if (m_menus)
+ {
+ delete[]m_menus;
+ delete[]m_titles;
+ }
+ m_menus = new_menus;
+ m_titles = new_titles;
+
+ menu->SetParent(this);
+
+}
+