void wxMenu::Init()
{
m_bDoBreak = FALSE;
+ m_nStartRadioGroup = -1;
//
// Create the menu (to be used as a submenu or a popup)
//
// Delete accels
//
-#if (!(defined(__VISAGECPP__) && (__IBMCPP__ < 400 || __IBMC__ < 400 )))
WX_CLEAR_ARRAY(m_vAccels);
-#endif
#endif // wxUSE_ACCEL
} // end of wxMenu::~wxMenu
m_bDoBreak = TRUE;
} // end of wxMenu::Break
-#if wxUSE_ACCEL
-
-void wxMenu::EndRadioGroup()
+void wxMenu::Attach(
+ wxMenuBarBase* pMenubar
+)
{
- //
- // We're not inside a radio group any longer
- //
- m_nStartRadioGroup = -1;
-} // end of wxMenu::EndRadioGroup
+ wxMenuBase::Attach(pMenubar);
+ EndRadioGroup();
+} // end of wxMenu::Break;
+
+#if wxUSE_ACCEL
int wxMenu::FindAccel(
int nId
size_t nCount = m_vAccels.GetCount();
for (n = 0; n < nCount; n++)
- {
if (m_vAccels[n]->m_command == nId)
return n;
- }
return wxNOT_FOUND;
} // end of wxMenu::FindAccel
// 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());
+ size_t n = FindAccel(pItem->GetId());
if (n == wxNOT_FOUND)
{
if (pAccel)
m_vAccels.Add(pAccel);
else
- return; // skipping RebuildAccelTable() below
+ return;
}
else
{
//
// Replace old with new or just remove the old one if no new
//
- delete m_vAccels[n];
-
+ delete m_vAccels[n];
if (pAccel)
m_vAccels[n] = pAccel;
else
, size_t nPos
)
{
+ wxMenu* pSubmenu = pItem->GetSubMenu();
+ MENUITEM& rItem = (pSubmenu != NULL)?pSubmenu->m_vMenuData:
+ pItem->m_vMenuData;
+
ERRORID vError;
wxString sError;
char zMsg[128];
// MENUITEM for submenus as required by ::MM_INSERTITEM message API
//
- wxMenu* pSubmenu = pItem->GetSubMenu();
- MENUITEM& rItem = (pSubmenu != NULL)?pSubmenu->m_vMenuData:
- pItem->m_vMenuData;
if(pSubmenu != NULL)
{
wxASSERT_MSG(pSubmenu->GetHMenu(), wxT("invalid submenu"));
return FALSE;
} // end of wxMenu::DoInsertOrAppend
+void wxMenu::EndRadioGroup()
+{
+ //
+ // We're not inside a radio group any longer
+ //
+ m_nStartRadioGroup = -1;
+} // end of wxMenu::EndRadioGroup
+
bool wxMenu::DoAppend(
wxMenuItem* pItem
)
// We need to update its end item
//
pItem->SetRadioGroupStart(m_nStartRadioGroup);
+
wxMenuItemList::Node* pNode = GetMenuItems().Item(m_nStartRadioGroup);
if (pNode)
{
EndRadioGroup();
}
+
if (!wxMenuBase::DoAppend(pItem) || !DoInsertOrAppend(pItem))
{
return FALSE;
}
if (bCheck)
{
+ //
+ // Check the item initially
+ //
pItem->Check(TRUE);
}
return TRUE;
-} // end of wxMenu::DoInsert
+} // end of wxMenu::DoAppend
bool wxMenu::DoInsert(
size_t nPos
,pItem) &&
DoInsertOrAppend( pItem
,nPos
- ));
+ )
+ );
} // end of wxMenu::DoInsert
wxMenuItem* wxMenu::DoRemove(
wxFrame* pFrame
)
{
- wxASSERT_MSG( !IsAttached(), wxT("menubar already attached!") );
+ wxMenuBarBase::Attach(pFrame);
#if wxUSE_ACCEL
RebuildAccelTable();
// Ensure the accelerator table is set to the frame (not the client!)
//
if (!::WinSetAccelTable( vHabmain
- ,(HWND)pFrame->GetHWND()
,m_vAccelTable.GetHACCEL()
+ ,(HWND)pFrame->GetFrame()
))
wxLogLastError("WinSetAccelTable");
#endif // wxUSE_ACCEL