#if wxUSE_ACCEL
+void wxMenu::EndRadioGroup()
+{
+ //
+ // We're not inside a radio group any longer
+ //
+ m_nStartRadioGroup = -1;
+} // end of wxMenu::EndRadioGroup
+
int wxMenu::FindAccel(
int nId
) const
wxMenuItem* pItem
)
{
- //
- // Find the (new) accel for this item
- //
- wxAcceleratorEntry* pAccel = wxGetAccelFromString(pItem->GetText());
-
- if (pAccel)
- pAccel->m_command = pItem->GetId();
-
- //
- // Find the old one
- //
- int n = FindAccel(pItem->GetId());
+ if (pItem->IsSubMenu())
+ {
+ wxMenu* pSubmenu = pItem->GetSubMenu();
+ wxMenuItemList::Node* pNode = pSubmenu->GetMenuItems().GetFirst();
- if (n == wxNOT_FOUND)
+ while (pNode)
+ {
+ UpdateAccel(pNode->GetData());
+ pNode = pNode->GetNext();
+ }
+ }
+ else if (!pItem->IsSeparator())
{
//
- // No old, add new if any
+ // Find the (new) accel for this item
//
+ wxAcceleratorEntry* pAccel = wxGetAccelFromString(pItem->GetText());
if (pAccel)
- m_vAccels.Add(pAccel);
- else
- return; // skipping RebuildAccelTable() below
- }
- else
- {
+ pAccel->m_command = pItem->GetId();
+
//
- // Replace old with new or just remove the old one if no new
+ // Find the old one
//
- delete m_vAccels[n];
+ int n = FindAccel(pItem->GetId());
- if (pAccel)
- m_vAccels[n] = pAccel;
+ if (n == wxNOT_FOUND)
+ {
+ //
+ // No old, add new if any
+ //
+ if (pAccel)
+ m_vAccels.Add(pAccel);
+ else
+ return; // skipping RebuildAccelTable() below
+ }
else
- m_vAccels.RemoveAt(n);
- }
+ {
+ //
+ // Replace old with new or just remove the old one if no new
+ //
+ delete m_vAccels[n];
- if (IsAttached())
- {
- m_menuBar->RebuildAccelTable();
+ if (pAccel)
+ m_vAccels[n] = pAccel;
+ else
+ m_vAccels.RemoveAt(n);
+ }
+
+ if (IsAttached())
+ {
+ m_menuBar->RebuildAccelTable();
+ }
}
} // wxMenu::UpdateAccel
{
int nCount = GetMenuItemCount();
- if (m_lStartRadioGroup == -1)
+ if (m_nStartRadioGroup == -1)
{
//
// Start a new radio group
//
- m_lStartRadioGroup = lCount;
+ m_nStartRadioGroup = nCount;
//
// For now it has just one element
//
pItem->SetAsRadioGroupStart();
- pItem->SetRadioGroupEnd(m_startRadioGroup);
+ pItem->SetRadioGroupEnd(m_nStartRadioGroup);
//
// Ensure that we have a checked item in the radio group
//
// We need to update its end item
//
- pItem->SetRadioGroupStart(m_lStartRadioGroup);
- wxMenuItemList::Node *node = GetMenuItems().Item(m_startRadioGroup);
+ pItem->SetRadioGroupStart(m_nStartRadioGroup);
+ wxMenuItemList::Node* pNode = GetMenuItems().Item(m_nStartRadioGroup);
- if (node)
+ if (pNode)
{
- node->GetData()->SetRadioGroupEnd(count);
+ pNode->GetData()->SetRadioGroupEnd(nCount);
}
else
{