Ensure that submenus are also added to the system when their parent
menu is used in a wxMenuBar::Repalce call. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@20262 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -738,6 +738,25 @@ int wxMenuBar::FindMenu(const wxString& title)
|
|||||||
// wxMenuBar construction
|
// wxMenuBar construction
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// This allows Replace to work with menus that have submenus. Is it needed
|
||||||
|
// anywhere else? (Like in Insert and Append?)
|
||||||
|
static wxMenuBarInsertSubmenus(wxMenu* menu)
|
||||||
|
{
|
||||||
|
int pos ;
|
||||||
|
wxMenuItemList::Node *node;
|
||||||
|
wxMenuItem *item;
|
||||||
|
for (pos = 0, node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
|
||||||
|
{
|
||||||
|
item = (wxMenuItem *)node->GetData();
|
||||||
|
wxMenu* subMenu = item->GetSubMenu() ;
|
||||||
|
if (subMenu)
|
||||||
|
{
|
||||||
|
::InsertMenu(MAC_WXHMENU( subMenu->GetHMenu()), -1);
|
||||||
|
wxMenuBarInsertSubmenus(subMenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
|
wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
|
||||||
{
|
{
|
||||||
wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title);
|
wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title);
|
||||||
@@ -762,6 +781,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
|
|||||||
{
|
{
|
||||||
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
|
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
|
||||||
}
|
}
|
||||||
|
wxMenuBarInsertSubmenus(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -738,6 +738,25 @@ int wxMenuBar::FindMenu(const wxString& title)
|
|||||||
// wxMenuBar construction
|
// wxMenuBar construction
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// This allows Replace to work with menus that have submenus. Is it needed
|
||||||
|
// anywhere else? (Like in Insert and Append?)
|
||||||
|
static wxMenuBarInsertSubmenus(wxMenu* menu)
|
||||||
|
{
|
||||||
|
int pos ;
|
||||||
|
wxMenuItemList::Node *node;
|
||||||
|
wxMenuItem *item;
|
||||||
|
for (pos = 0, node = menu->GetMenuItems().GetFirst(); node; node = node->GetNext(), pos++)
|
||||||
|
{
|
||||||
|
item = (wxMenuItem *)node->GetData();
|
||||||
|
wxMenu* subMenu = item->GetSubMenu() ;
|
||||||
|
if (subMenu)
|
||||||
|
{
|
||||||
|
::InsertMenu(MAC_WXHMENU( subMenu->GetHMenu()), -1);
|
||||||
|
wxMenuBarInsertSubmenus(subMenu);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
|
wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
|
||||||
{
|
{
|
||||||
wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title);
|
wxMenu *menuOld = wxMenuBarBase::Replace(pos, menu, title);
|
||||||
@@ -762,6 +781,7 @@ wxMenu *wxMenuBar::Replace(size_t pos, wxMenu *menu, const wxString& title)
|
|||||||
{
|
{
|
||||||
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
|
::InsertMenu( MAC_WXHMENU(menu->GetHMenu()) , m_menus[pos+1]->MacGetMenuId() ) ;
|
||||||
}
|
}
|
||||||
|
wxMenuBarInsertSubmenus(menu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user