// ----------------------------------------------------------------------------
// the (popup) menu title has this special id
-static const int idMenuTitle = -2;
+static const int idMenuTitle = -3;
// ----------------------------------------------------------------------------
// private functions
m_startRadioGroup = -1;
}
-bool wxMenu::DoAppend(wxMenuItem *item)
+wxMenuItem* wxMenu::DoAppend(wxMenuItem *item)
{
- wxCHECK_MSG( item, FALSE, _T("NULL item in wxMenu::DoAppend") );
+ wxCHECK_MSG( item, NULL, _T("NULL item in wxMenu::DoAppend") );
bool check = FALSE;
if ( !wxMenuBase::DoAppend(item) || !DoInsertOrAppend(item) )
{
- return FALSE;
+ return NULL;
}
if ( check )
item->Check(TRUE);
}
- return TRUE;
+ return item;
}
-bool wxMenu::DoInsert(size_t pos, wxMenuItem *item)
+wxMenuItem* wxMenu::DoInsert(size_t pos, wxMenuItem *item)
{
- return wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos);
+ if (wxMenuBase::DoInsert(pos, item) && DoInsertOrAppend(item, pos))
+ return item;
+ else
+ return NULL;
}
wxMenuItem *wxMenu::DoRemove(wxMenuItem *item)
wxASSERT(menu);
wxASSERT(menu->GetHMenu());
wxASSERT(m_hMenu);
+
+#if defined(__WXWINCE__)
+ int totalMSWItems = GetMenuCount();
+#else
int totalMSWItems = GetMenuItemCount((HMENU)m_hMenu);
+#endif
+
int i; // For old C++ compatibility
for(i=wxpos; i<totalMSWItems; i++)
{
{
// Find out which MSW item before which we'll be inserting before
// wxMenuBarBase::Insert is called and GetMenu(pos) is the new menu.
- int mswpos = (pos == m_menus.GetCount())
+ // If IsAttached() is false this won't be used anyway
+ int mswpos = (!IsAttached() || (pos == m_menus.GetCount()))
? -1 // append the menu
: MSWPositionForWxMenu(GetMenu(pos),pos);