Implement wxMenuBar::EnableTop() for wxMSW and wxGTK.

This method was only available in wxUniv before and just always returned true
in the other ports. Implement it for wxMSW and wxGTK too now and document it.
Also add a unit test.

Closes #795.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@70350 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2012-01-15 13:41:17 +00:00
parent 2db3b9a6a4
commit e4a23857ec
9 changed files with 59 additions and 0 deletions

View File

@@ -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 );