X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/0f29501b663574dc6f5f43dfb8a7f16fb5a8e4ea..41fec01fa9e009d84fe353aa494725328d850af1:/src/gtk/menu.cpp diff --git a/src/gtk/menu.cpp b/src/gtk/menu.cpp index ae2d4df832..83bece8ee6 100644 --- a/src/gtk/menu.cpp +++ b/src/gtk/menu.cpp @@ -416,6 +416,15 @@ void wxMenuBar::EnableTop( size_t pos, bool flag ) gtk_widget_set_sensitive( menu->m_owner, flag ); } +bool wxMenuBar::IsEnabledTop(size_t pos) const +{ + wxMenuList::compatibility_iterator node = m_menus.Item( pos ); + wxCHECK_MSG( node, false, wxS("invalid index in IsEnabledTop") ); + wxMenu* const menu = node->GetData(); + wxCHECK_MSG( menu->m_owner, true, wxS("no menu owner?") ); + return gtk_widget_get_sensitive( menu->m_owner ); +} + wxString wxMenuBar::GetMenuLabel( size_t pos ) const { wxMenuList::compatibility_iterator node = m_menus.Item( pos ); @@ -878,7 +887,21 @@ wxMenuItem *wxMenu::DoRemove(wxMenuItem *item) return NULL; GtkWidget * const mitem = item->GetMenuItem(); - gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL); + if (!gtk_check_version(2,12,0)) + { + // gtk_menu_item_remove_submenu() is deprecated since 2.12, but + // gtk_menu_item_set_submenu() can now be used with NULL submenu now so + // just do use it. + gtk_menu_item_set_submenu(GTK_MENU_ITEM(mitem), NULL); + } + else // GTK+ < 2.12 + { + // In 2.10 calling gtk_menu_item_set_submenu() with NULL submenu + // results in critical GTK+ error messages so use the old function + // instead. + gtk_menu_item_remove_submenu(GTK_MENU_ITEM(mitem)); + } + gtk_widget_destroy(mitem); item->SetMenuItem(NULL);