Check for menu title being non-empty when appending it to the menu bar.

It doesn't make sense to add a menu with empty title to the menu bar so assert
that the title is not empty and fail to add the menu if it is.

See r64033 in wxQT branch.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@64058 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin 2010-04-20 11:59:46 +00:00
parent f994a8ac8d
commit b871bb951a
2 changed files with 4 additions and 3 deletions

View File

@ -73,7 +73,7 @@ public:
@param menu
The menu to add. Do not deallocate this menu after calling Append().
@param title
The title of the menu.
The title of the menu, must be non-empty.
@return @true on success, @false if an error occurred.
@ -497,7 +497,7 @@ public:
this string in the status line.
@param kind
May be @c wxITEM_SEPARATOR, @c wxITEM_NORMAL, @c wxITEM_CHECK or @c wxITEM_RADIO.
Example:
@code
m_pFileMenu->Append(ID_NEW_FILE, "&New file\tCTRL+N", "Creates a new XYZ document");

View File

@ -616,9 +616,10 @@ wxMenu *wxMenuBarBase::GetMenu(size_t pos) const
return node->GetData();
}
bool wxMenuBarBase::Append(wxMenu *menu, const wxString& WXUNUSED(title))
bool wxMenuBarBase::Append(wxMenu *menu, const wxString& title)
{
wxCHECK_MSG( menu, false, wxT("can't append NULL menu") );
wxCHECK_MSG( !title.empty(), false, wxT("can't append menu with empty title") );
m_menus.Append(menu);
menu->Attach(this);