// Author: Stefan Csomor
// Modified by:
// Created: 1998-01-01
-// RCS-ID: $Id: menuitem.cpp 54129 2008-06-11 19:30:52Z SC $
+// RCS-ID: $Id$
// Copyright: (c) Stefan Csomor
// Licence: wxWindows licence
///////////////////////////////////////////////////////////////////////////////
{
}
-IMPLEMENT_DYNAMIC_CLASS(wxMenuItem, wxObject)
-
wxMenuItem::wxMenuItem(wxMenu *pParentMenu,
int id,
const wxString& t,
m_radioGroup.start = -1;
m_isRadioGroupStart = false;
-
+
wxString text = wxStripMenuCodes(m_text);
if (text.IsEmpty() && !IsSeparator())
{
wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC);
}
-
+
wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ;
// use accessors for ID and Kind because they might have been changed in the base constructor
m_peer = wxMenuItemImpl::Create( this, pParentMenu, GetId(), text, entry, strHelp, GetKind(), pSubMenu );
// eg. BeginAppModalStateForWindow() will disable menus and ignore this change
// which in turn causes m_isEnabled to become out of sync with real menuitem state
#if wxOSX_USE_CARBON
- && !(m_parentMenu && !IsMenuItemEnabled(MAC_WXHMENU(m_parentMenu->GetHMenu()), 0))
+ && !(m_parentMenu && !IsMenuItemEnabled(MAC_WXHMENU(m_parentMenu->GetHMenu()), 0))
#endif
)
// always update builtin menuitems
{
if ( !m_parentMenu )
return;
-
+
if ( m_bitmap.Ok() )
{
- m_peer->SetBitmap( m_bitmap );
+ GetPeer()->SetBitmap( m_bitmap );
}
}
if ( IsSeparator() )
return ;
-
+
if ( IsCheckable() && IsChecked() )
- m_peer->Check( true );
+ GetPeer()->Check( true );
else
- m_peer->Check( false );
-
- m_peer->Enable( IsEnabled() );
+ GetPeer()->Check( false );
+
+ GetPeer()->Enable( IsEnabled() );
}
void wxMenuItem::UpdateItemText()
wxASSERT_MSG(wxIsStockID(GetId()), wxT("A non-stock menu item with an empty label?"));
text = wxGetStockLabel(GetId(), wxSTOCK_WITH_ACCELERATOR|wxSTOCK_WITH_MNEMONIC);
}
-
+
wxAcceleratorEntry *entry = wxAcceleratorEntry::Create( m_text ) ;
- m_peer->SetLabel( text, entry );
+ GetPeer()->SetLabel( text, entry );
delete entry ;
}