Remove the now unnecessary calls to SetupBitmaps()

After the changes of the previous commit, calling SetupBitmaps()
preemptively is not necessary any more, as it's called in any case just
before showing the menu, so remove the calls to it to simplify the code
and even make it slightly faster (at the cost of slowing it down before
opening the menu, but this needs to be done in any case to avoid
reintroducing the problem fixed by the parent commit).
This commit is contained in:
Vadim Zeitlin 2022-06-15 01:50:00 +01:00
parent 37950c1421
commit f0ec9974a5
2 changed files with 0 additions and 47 deletions

View file

@ -69,10 +69,6 @@ public:
// containing this position.
bool MSWGetRadioGroupRange(int pos, int *start, int *end) const;
#if wxUSE_MENUBAR
virtual void Attach(wxMenuBarBase *menubar) wxOVERRIDE;
#endif
void SetupBitmaps();
#if wxUSE_ACCEL
@ -226,16 +222,6 @@ protected:
// common part of all ctors
void Init();
void SetupBitmaps();
void OnDPIChanged(wxDPIChangedEvent& event)
{
// need to reset bitmaps
SetupBitmaps();
event.Skip();
}
WXHMENU m_hMenu;
// Return the MSW position for a wxMenu which is sometimes different from

View file

@ -305,19 +305,6 @@ bool wxMenu::MSWGetRadioGroupRange(int pos, int *start, int *end) const
return m_radioData && m_radioData->GetGroupRange(pos, start, end);
}
#if wxUSE_MENUBAR
void wxMenu::Attach(wxMenuBarBase* menubar)
{
wxMenuBase::Attach(menubar);
if (menubar->IsAttached())
{
// menubar is already attached, we need to call SetupBitmaps
SetupBitmaps();
}
}
#endif
void wxMenu::SetupBitmaps()
{
for ( wxMenuItemList::compatibility_iterator node = m_items.GetFirst();
@ -611,14 +598,6 @@ bool wxMenu::DoInsertOrAppend(wxMenuItem *pItem, size_t pos)
// if we're already attached to the menubar, we must update it
if ( IsAttached() && GetMenuBar()->IsAttached() )
{
if ( pItem->IsSubMenu() )
{
pItem->GetSubMenu()->SetupBitmaps();
}
if ( !pItem->IsSeparator() )
{
pItem->SetupBitmaps();
}
GetMenuBar()->Refresh();
}
@ -1259,14 +1238,6 @@ void wxMenuBar::RebuildAccelTable()
#endif // wxUSE_ACCEL
void wxMenuBar::SetupBitmaps()
{
for ( wxMenuList::const_iterator it = m_menus.begin(); it != m_menus.end(); ++it )
{
(*it)->SetupBitmaps();
}
}
void wxMenuBar::Attach(wxFrame *frame)
{
wxMenuBarBase::Attach(frame);
@ -1274,10 +1245,6 @@ void wxMenuBar::Attach(wxFrame *frame)
#if wxUSE_ACCEL
RebuildAccelTable();
#endif // wxUSE_ACCEL
SetupBitmaps();
frame->Bind(wxEVT_DPI_CHANGED, &wxMenuBar::OnDPIChanged, this);
}
void wxMenuBar::Detach()