- if ( m_bEnabled != bDoEnable ) {
- if ( m_pSubMenu == NULL ) { // normal menu item
- EnableMenuItem((HMENU)m_pParentMenu->GetHMenu(), m_idItem,
- MF_BYCOMMAND | (bDoEnable ? MF_ENABLED: MF_GRAYED));
+ if ( m_isEnabled == enable )
+ return;
+
+ long rc = EnableMenuItem(GetHMenuOf(m_parentMenu),
+ GetRealId(),
+ MF_BYCOMMAND |
+ (enable ? MF_ENABLED : MF_GRAYED));
+
+ if ( rc == -1 ) {
+ wxLogLastError(wxT("EnableMenuItem"));
+ }
+
+ wxMenuItemBase::Enable(enable);
+}
+
+void wxMenuItem::Check(bool check)
+{
+ wxCHECK_RET( m_isCheckable, wxT("only checkable items may be checked") );
+
+ if ( m_isChecked == check )
+ return;
+
+ long rc = CheckMenuItem(GetHMenuOf(m_parentMenu),
+ GetRealId(),
+ MF_BYCOMMAND |
+ (check ? MF_CHECKED : MF_UNCHECKED));
+
+ if ( rc == -1 ) {
+ wxLogLastError(wxT("CheckMenuItem"));