+ wxMenuItemBase::Enable(bEnable);
+} // end of wxMenuItem::Enable
+
+void wxMenuItem::Check(
+ bool bCheck
+)
+{
+ bool bOk;
+
+ wxCHECK_RET( IsCheckable(), wxT("only checkable items may be checked") );
+ if (m_isChecked == bCheck)
+ return;
+
+ HMENU hMenu = GetHmenuOf(m_parentMenu);
+
+ if (GetKind() == wxITEM_RADIO)
+ {
+ //
+ // It doesn't make sense to uncheck a radio item - what would this do?
+ //
+ if (!bCheck)
+ return;
+
+ //
+ // Get the index of this item in the menu
+ //
+ const wxMenuItemList& rItems = m_parentMenu->GetMenuItems();
+ int nPos = rItems.IndexOf(this);
+
+ wxCHECK_RET( nPos != wxNOT_FOUND
+ ,_T("menuitem not found in the menu items list?")
+ );
+
+ //
+ // Get the radio group range
+ //
+ int nStart;
+ int nEnd;
+
+ if (m_bIsRadioGroupStart)
+ {
+ //
+ // We already have all information we need
+ //
+ nStart = nPos;
+ nEnd = m_vRadioGroup.m_nEnd;
+ }
+ else // next radio group item
+ {
+ //
+ // Get the radio group end from the start item
+ //
+ nStart = m_vRadioGroup.m_nStart;
+ nEnd = rItems.Item(nStart)->GetData()->m_vRadioGroup.m_nEnd;
+ }
+
+ //
+ // Also uncheck all the other items in this radio group
+ //
+ wxMenuItemList::compatibility_iterator node = rItems.Item(nStart);
+
+ for (int n = nStart; n <= nEnd && node; n++)
+ {
+ if (n == nPos)
+ {
+ ::WinSendMsg( hMenu
+ ,MM_SETITEMATTR
+ ,MPFROM2SHORT(n, TRUE)
+ ,MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED)
+ );
+ }
+ if (n != nPos)
+ {
+ node->GetData()->m_isChecked = FALSE;
+ ::WinSendMsg( hMenu
+ ,MM_SETITEMATTR
+ ,MPFROM2SHORT(n, TRUE)
+ ,MPFROM2SHORT(MIA_CHECKED, FALSE)
+ );
+ }
+ node = node->GetNext();
+ }
+ }
+ else // check item
+ {
+ if (bCheck)
+ bOk = (bool)::WinSendMsg( hMenu
+ ,MM_SETITEMATTR
+ ,MPFROM2SHORT(GetRealId(), TRUE)
+ ,MPFROM2SHORT(MIA_CHECKED, MIA_CHECKED)
+ );
+ else
+ bOk = (bool)::WinSendMsg( hMenu
+ ,MM_SETITEMATTR
+ ,MPFROM2SHORT(GetRealId(), TRUE)
+ ,MPFROM2SHORT(MIA_CHECKED, FALSE)
+ );
+ }
+ if (!bOk)
+ {
+ wxLogLastError(wxT("CheckMenuItem"));
+ }
+ wxMenuItemBase::Check(bCheck);
+} // end of wxMenuItem::Check
+
+void wxMenuItem::SetText( const wxString& rText )
+{
+ //
+ // Don't do anything if label didn't change
+ //
+
+ wxString sText = wxPMTextToLabel(rText);
+ if (m_text == sText)
+ return;
+
+ wxMenuItemBase::SetText(sText);
+ OWNER_DRAWN_ONLY(wxOwnerDrawn::SetName(sText));
+#if wxUSE_OWNER_DRAWN
+ SetAccelString(rText.AfterFirst(_T('\t')));
+#endif // wxUSE_OWNER_DRAWN
+
+ HWND hMenu = GetHmenuOf(m_parentMenu);
+
+ wxCHECK_RET(hMenu, wxT("menuitem without menu"));
+
+#if wxUSE_ACCEL
+ m_parentMenu->UpdateAccel(this);
+#endif // wxUSE_ACCEL
+
+ USHORT uId = (USHORT)GetRealId();
+ MENUITEM vItem;
+ USHORT uFlagsOld;
+
+ if (!::WinSendMsg( hMenu
+ ,MM_QUERYITEM
+ ,MPFROM2SHORT(uId, TRUE)
+ ,(MPARAM)&vItem
+ ))